![]() |
![]() |
|
![]() |
TWAIN Support in ObjectPAL® TWAIN Support Overview Part 3 © 2001 Paul Cronk Acquiring Images With the Twain type, developers can acquire images into three different formats. For each format, the user-interface can be shown or not shown. Paradox does not support multiple image handling. Certain cameras can buffer images in the camera memory, and send them in succession. Paradox does not support the ADF (automatic document feeders), such as scanners. The reason is quite simple. It makes little sense to scan 40 images into the same graphic field in a table. A graphic type can only hold one graphic, and a file can only have one filename. Paradox does not support 32bit images, regardless if they are scanned in, or imported from files. With other topics such as graphics handling, 24bit scanned images can be saved to disk in .gif, .jpg formats to keep the file size down. Paradox 10 SP1 does not support acquiring to a graphic type. Attempting to acquire to a graphic type will result in an error stating that an unassigned variable was referenced. In fact, upon further investigation, it appears that it is calling the 'acquire to file' TWAIN function.Paradox 10 SP2 corrects this behavior. Acquiring to a file To acquire to a file, only the filename is required. Like other ObjectPAL functions, if the filename is not preceded with an absolute path, the working directory is assumed. BtnExample::pushbutton Method pushbutton(var eventInfo Event) var twSes Twain strFileName String endvar if not twSes.open() then errorShow() return endif strFileName = "acquired.bmp" ;// acquire to the filename, acquired.bmp. ;// show the user interface. if not twSes.acquire ( strFileName, true ) then errorShow() endif twSes.close() endMethodAcquiring to a graphic object Acquiring to a graphic object is straight-forward. The first parameter of the acquire() method is the uiObject that refers to the graphic object. The graphic object can be in run or design mode. BtnExample::pushbutton Method pushbutton(var eventInfo Event) var twSes Twain uiGraphic UIObject endvar if not twSes.open() then errorShow() return endif ;// acquire to the field, fldGraphic. ;// show the user interface. uiGraphic = fldGraphic if not twSes.acquire (uiGraphic, true ) then errorShow() endif twSes.close() endMethodAcquiring to a graphic field object Acquiring to a graphic field is a little more complex than a graphic object. The form must be in edit mode. The uiObject refers to the graphic field. If these two conditions are not met, then the acquire method will log an error to the error stack. BtnExample::pushbutton Method pushbutton(var eventInfo Event) var twSes Twain uiGraphic UIObject endvar if not twSes.open() then errorShow() return endif ;// place the form in edit mode. ;// acquire to the graphic field object, fldGraphic. ;// show the user interface. fldGraphic.edit() uiGraphic = fldGraphic if not twSes.acquire (uiGraphic, true ) then errorShow() endif twSes.close() ;// end Edit mode which will post the record. fldGraphic.endEdit() endMethodAcquiring to a graphic type This example does not work in Paradox 10 SP1. Acquiring to a graphic type returns an error stating usage of an unassigned variable. This issue has been resolved in Paradox 10 SP2. However, for completeness, the example, plus an explanation is listed here. Its intended functionality is the ability to acquire an image from a data source and place the image into the graphic variable. Then the graphic variable can be written to disk, stored into a table, or displayed on screen. BtnExample::pushbutton Method pushbutton(var eventInfo Event) var twSes Twain gAcquired Graphic endvar if not twSes.open() then errorShow() return endif ;// acquire to the graphic type, gAcquired. ;// show the user interface. if not twSes.acquire (gAcquired, true ) then errorShow() endif qAcquired.writeToFile ( "c:\\temp\\acquired.bmp" ) twSes.close() endMethod Next: Function Reference Previous: TWAIN Support in ObjectPAL Part 2 Discussion of this article |
![]() Feedback | Paradox Day | Who Uses Paradox | I Use Paradox | Downloads ![]() |
|
![]() The information provided on this Web site is not in any way sponsored or endorsed by Corel Corporation. Paradox is a registered trademark of Corel Corporation. ![]() |
|
![]() Modified: 15 May 2003 Terms of Use / Legal Disclaimer ![]() |
![]() Copyright © 2001- 2003 Paradox Community. All rights reserved. Company and product names are trademarks or registered trademarks of their respective companies. Authors hold the copyrights to their own works. Please contact the author of any article for details. ![]() |
![]() |
|