8 |
Function Prototypes
Visual Basic | Declare Function standardpalette Lib "VIC32.DLL" (resimg As imgdes) As Long |
C/C++ | int standardpalette(imgdes *resimg); |
Java | int vic.vic32jni.standardpalette(imgdes resimg); |
Function Arguments
resimg | Image which is to receive the new palette |
Description
The standardpalette function creates a 256-color palette consisting of the 256-color standard Window's palette. This palette is stored in the palette location defined in the image descriptor element palette. The function enters 256 into the image descriptor element colors. Standardpalette is for use with 8-bit images.
Return value
Returns number of colors placed in the palette, 0 or 256. A return value of 0 indicates the palette was not installed because the image bits per pixel was not 8, or the palette address was NULL.
See also
defaultpalette
8 | 24 |
Function Prototypes
Visual Basic | Declare Function subimage Lib "VIC32.DLL" (srcimg As imgdes, oprimg As imgdes, resimg As imgdes) As Long |
C/C++ | int subimage(imgdes *srcimg, imgdes *oprimg, imgdes *resimg); |
Java | int vic.vic32jni.subimage(imgdes srcimg, imgdes oprimg, imgdes resimg); |
Function Arguments
srcimg | Source image |
oprimg | Operator image |
resimg | Result image |
Description
The subimage function subtracts the brightness level of each pixel in the operator image area from the brightness level of the corresponding pixel in the source image area and places the difference in the result image area. Result brightness values less than 0 are set to 0.
The image areas are defined by the corresponding image descriptors.
Return value
NO_ERROR | Function successful |
BAD_RANGE | Range error, see Appendix A |
BAD_IBUF | Invalid image buffer address |
BAD_MEM | Insufficient local memory |
BAD_BPP | Images are not all 8- or 24-bit |
BAD_DIB | Image is a compressed DIB |
Function Prototypes
Visual Basic | Declare Function tgainfo Lib "VIC32.DLL" (ByVal filename As String, tinfo As TgaData) As Long |
C/C++ | int tgainfo(LPCSTR filename, TgaData *tinfo); |
Java | int vic.vic32jni.tgainfo(String filename, TgaData tinfo); |
Function Arguments
filename | Filename to load |
tinfo | TgaData structure to be filled in |
Description
The tgainfo function reads the header of a TGA file and places the image information in the tinfo structure.
The TgaData structure elements are defined as follows:
IDfieldchars | Number of characters in ID field |
width | Image width in pixels |
length | Image length in pixels |
ColorMapType | 0 = no color map, 1 = color map |
ImageType | Image type |
ColorMapEntryBits | Number of bits in color map entry |
Xorigin | X-coordinate of origin |
Yorigin | Y-coordinate of origin |
BPerPix | Bits per pixel |
ABPerPix | Alpha channel bits |
ScreenOrigin | 0 = lower left corner, 2 = upper left |
Interleave | Data storage interleave: 0 = none |
vbitcount | Victor bits per pixel (used to allocate an imagebuffer with allocimage). |
The tgainfo function is used to identify the type and size of the image in the file to permit allocating enough memory to load the file.
The Targa file specification is available from Truevision, (317) 841-0332.
Return value
NO_ERROR | Function successful |
BAD_OPN | Filename not found |
BAD_TGA | Unreadable Targa file format |
See also
loadtga, savetga
See loadtga
8 | 24 |
Function Prototypes
Visual Basic | Declare Function threshold Lib "VIC32.DLL" (ByVal threshold As Long, srcimg As imgdes, resimg As imgdes) As Long |
C/C++ | int threshold(const int threshold, imgdes *srcimg, imgdes *resimg); |
Java | int vic.vic32jni.threshold(int threshold, imgdes srcimg, imgdes resimg); |
Function Arguments
threshold | Maximum level to set (0-255) |
srcimg | Source image |
resimg | Result image |
Description
The threshold function sets any brightness levels within an image area that are less than or equal to the threshold to zero.
For an RGB image the source red, green, and blue components all must be less than or equal to threshold for the result pixel to be set to 0.
The image areas are defined by the corresponding image descriptors.
Return value
NO_ERROR | Function successful |
BAD_RANGE | Range error, see Appendix A |
BAD_IBUF | Invalid image buffer address |
BAD_MEM | Insufficient local memory |
BAD_BPP | Source and result are not both 8- or 24-bit |
BAD_DIB | Source or result is a compressed DIB |
BAD_FAC | Threshold is outside the range 0 to 255 |
Function Prototypes
Visual Basic | Declare Function tiffgeterror Lib "VIC32.DLL" () As Long |
C/C++ | int tiffgeterror(void); |
Java | int vic.vic32jni.tiffgeterror(); |
Description
The tiffgeterror function reports extended error information after a TIFF
function returns BAD_TIFF.
Return value
0 | No extended error information |
-100 | Invalid data found in TIF file |
-101 | Error reading data from the file |
-102 | Unexpected end of file |
-103 | Trans point arrays not large enough |
Function Prototypes
Visual Basic | Declare Function tiffgetpageinfo Lib "VIC32.DLL" (ByVal filename As String, ByRef totalpages As Long, ByRef pageArray As Long, ByVal arrayelems As Long) As Long |
C/C++ | int tiffgetpageinfo(LPCSTR filename, int *totalPages, int *pageArray, int arrayElems); |
Java | int vic.vic32jni.tiffgetpageinfo(String filename, refvar totalPages, int[] pageArray, int arrayElems); |
Function Arguments
filename | Filename to load |
totalPages | Variable to receive number of total pages in the file |
pageArray | Array to receive page numbers |
arrayElems | Number of elements in pageArray |
Description
The tiffgetpageinfo function obtains page information from a TIFF file. The page information includes the total number of pages (images) in the file and the specific page numbers.
Page numbers are copied into pageArray. Up to arrayElems page numbers are copied into pageArray. If a multipage TIFF file does not contain explicit page number tags, pageArray will be filled with consecutive numbers starting with zero.
To determine the total number of pages in a TIFF file, call tiffgetpageinfo with pageArray equal NULL. TotalPages will be filled in which can then be used to allocate a page array large enough to hold the list of all the page numbers.
Return value
NO_ERROR | Function successful |
BAD_OPN | Filename not found |
BAD_TIFF | File is not a readable TIFF format |
BAD_MEM | Insufficient local memory |
See also
loadtifpage, tiffinfopage
Function Prototypes
Visual Basic | Declare Function tiffgetpageinfofrombuffer Lib "VIC32.DLL" (ByVal buffer As Long, ByRef totalpages As Long, ByRef pageArray As Long, ByVal arrayelems As Long) As Long |
C/C++ | int tiffgetpageinfofrombuffer(UCHAR *buffer, int *totalPages, int *pageArray, int arrayElems); |
Java | int vic.vic32jni.tiffgetpageinfofrombuffer(int buffer, refvar totalPages, int[] pageArray, int arrayElems); |
Function Arguments
buffer | Buffer address |
totalPages | Variable to receive number of total pages in the file |
pageArray | Array to receive page numbers |
arrayElems | Number of elements in pageArray |
Description
The tiffgetpageinfofrombuffer function obtains page information from a TIFF file. The page information includes the total number of pages (images) in the file and the specific page numbers.
Page numbers are copied into pageArray. Up to arrayElems page numbers are copied into pageArray. If a multipage TIFF file does not contain explicit page number tags, pageArray will be filled with consecutive numbers starting with zero.
To determine the total number of pages in a TIFF file, call tiffgetpageinfofrombuffer with pageArray equal NULL. TotalPages will be filled in which can then be used to allocate a page array large enough to hold the list of all the page numbers.
Return value
NO_ERROR | Function successful |
BAD_OPN | Memory handle not available |
BAD_TIFF | File is not a readable TIFF format |
BAD_MEM | Insufficient local memory |
See also
loadtifpage, tiffinfopage
Function Prototypes
Visual Basic | Declare Function tiffgetSOIofspagebyindex Lib "VIC32.DLL" (ByVal filename As String, soiOfs As Long, ByVal pageIndex As Long) As Long |
C/C++ | int tiffgetSOIofspagebyindex(LPCSTR filename, unsigned long *soiOfs, int pageIndex); |
Java | int vic.vic32jni.tiffgetSOIofspagebyindex(String filename, refvar soiOfs, int pageIndex); |
Function Arguments
filename | Filename to load |
soiOfs | Variable to receive offset value |
pageIndex | Index of target page to read (0 based) |
Description
The tiffgetSOIofspagebyindex function returns the value for the offset from the beginning of a tiff file to the point where a JPEG-compressed image begins.
If the image is not JPEG-compressed (compression must equal six) or tiff tag for JPEG offset is not present then the soiOfs value is set to zero,
Return value
NO_ERROR | Function successful |
BAD_OPN | Filename not found |
BAD_TIFF | Invalid TIFF file |
BAD_MEM | Insufficient local memory |
See also
tiffinfo
Function Prototypes
Visual Basic | Declare Function tiffgetSOIofspagebyindexfrombuffer Lib "VIC32.DLL" (ByVal buffer As Long, soiOfs As Long, ByVal pageIndex As Long) As Long |
C/C++ | int tiffgetSOIofspagebyindexfrombuffer(UCHAR *buffer, unsigned long *soiOfs, int pageIndex); |
Java | int vic.vic32jni.tiffgetSOIofspagebyindexfrombuffer(int buffer, refvar soiOfs, int pageIndex); |
Function Arguments
buffer | Buffer address |
soiOfs | Variable to receive offset value |
pageIndex | Index of target page to read (0 based) |
Description
The tiffgetSOIofspagebyindexfrombuffer function returns the value for the offset from the beginning of a tiff file to the point where a JPEG-compressed image begins.
If the image is not JPEG-compressed (compression must equal six) or tiff tag for JPEG offset is not present then the soiOfs value is set to zero,
Return value
NO_ERROR | Function successful |
BAD_OPN | Filename not found |
BAD_TIFF | Invalid TIFF file |
BAD_MEM | Insufficient local memory |
See also
tiffinfo
Function Prototypes
Visual Basic | Declare Function tiffgetxyresolution Lib "VIC32.DLL" (ByVal filename As String, xres As Long, yres As Long, resunit As Long) As Long |
C/C++ | int tiffgetxyresolution(LPCSTR filename, unsigned *xres, unsigned *yres, unsigned *resunit); |
Java | int vic.vic32jni.tiffgetxyresolution(String filename, refvar xres, refvar yres, refvar resunit); |
Function Arguments
filename | Filename to load |
xres | Variable to receive horizontal resolution in pixels |
yres | Variable to receive vertical resolution in pixels |
resunit | Variable to receive resolution units |
Description
The tiffgetxyresolution function returns the values for image resolution from a TIFF image file. The resolution values are stored in the variables xres and yres. The type of resolution unit is stored in the resunit variable. The value returned is one of the following:
1 | No unit of measurement |
2 | Inch |
3 | Centimeter |
Return value
NO_ERROR | Function successful |
BAD_OPN | Filename not found |
BAD_TIFF | Invalid TIFF file |
BAD_MEM | Insufficient local memory |
See also
tiffinfo, tiffsetxyresolution, tiffgetxyresolutionpagebyindex
Function Prototypes
Visual Basic | Declare Function tiffgetxyresolutionpagebyindex Lib "VIC32.DLL" (ByVal filename As String, xres As Long, yres As Long, resunit As Long, ByVal targetpage As Long) As Long |
C/C++ | int tiffgetxyresolutionpagebyindex(LPCSTR filename, unsigned *xres, unsigned *yres, unsigned *resunit, int targetpage); |
Java | int vic.vic32jni.tiffgetxyresolutionpagebyindex(String filename, refvar xres, refvar yres, refvar resUnit, int targetpage); |
Function Arguments
filename | Filename to load |
xres | Variable to receive horizontal resolution in pixels |
yres | Variable to receive vertical resolution in pixels |
resunit | Variable to receive resolution units |
targetpage | Index number of the target page (0 based) |
Description
The tiffgetxyresolutionpagebyindex function returns the values for image resolution from a multipage TIFF image file. The resolution values are stored in the variables xres and yres. The type of resolution unit is stored in the resunit variable. The value returned is one of the following:
1 | No unit of measurement |
2 | Inch |
3 | Centimeter |
Return value
NO_ERROR | Function successful |
BAD_OPN | Filename not found |
BAD_TIFF | Invalid TIFF file |
BAD_MEM | Insufficient local memory |
See also
tiffinfo, tiffsetxyresolution
Function Prototypes
Visual Basic | Declare Function tiffinfo Lib "VIC32.DLL" (ByVal filename As String, tinfo As TiffData) As Long |
C/C++ | int tiffinfo(LPCSTR filename, TiffData *tinfo); |
Java | int vic.vic32jni.tiffinfo(String filename, TiffData tinfo); |
Function Arguments
filename | Filename to load |
tinfo | TiffData structure to be filled in |
Description
The tiffinfo function reads the header of a TIFF file and places the image information in the tinfo structure.
The TiffData structure elements are defined as follows:
ByteOrder | Intel or Motorola ("II" or "MM") |
width | Image width in pixels |
length | Image length in pixels |
BitsPSample | Bits per sample |
Comp | Compression scheme |
SamplesPPixel | Samples per pixel |
PhotoInt | Photometric interpretation |
PlanarCfg | Planar configuration |
vbitcount | Victor bits per pixel (used to allocate an imagebuffer with allocimage). |
The purpose of the tiffinfo function is to identify the type and size of the image in the file to permit allocating enough memory to load the file. Table 18 lists the common TIFF image types.
Table 18. TIFF Image Types | |||
Image type | SamplesPPixel | BitsPSample | PhotoInt |
Bilevel | 1 | 1 | 0 or 1 |
Grayscale | 1 | 4-8 | 0 or 1 |
Palette color | 1 | 1-8 | 3 |
RGB 24-bit | 3 | 8 | 2 |
The TIFF file specification is available from the Adobe Developers Association http://partners.adobe.com/asn/developer/PDFS/TN/TIFF6.pdf or http://www.adobe.com/supportservice/devrelations/technotes.html.
Return value
NO_ERROR | Function successful |
BAD_OPN | Filename not found |
BAD_TIFF | Invalid TIFF file |
BAD_MEM | Insufficient local memory |
See also
loadtif, savetif, tiffgetxyresolution
Function Prototypes
Visual Basic | Declare Function tiffinfofrombuffer Lib "VIC32.DLL" (ByVal buffer As Long, tinfo As TiffData) As Long |
C/C++ | int tiffinfofrombuffer(UCHAR *buffer, TiffData *tinfo); |
Java | int vic.vic32jni.tiffinfofrombuffer(int buffer, TiffData tinfo); |
Function Arguments
buffer | Buffer address |
tinfo | TiffData structure to be filled in |
Description
The tiffinfofrombuffer function reads the header information from memory
holding TIFF file data and places the image information in the tinfo structure.
The TiffData structure elements are defined as follows:
ByteOrder | Intel or Motorola ("II" or "MM") |
width | Image width in pixels |
length | Image length in pixels |
BitsPSample | Bits per sample |
Comp | Compression scheme |
SamplesPPixel | Samples per pixel |
PhotoInt | Photometric interpretation |
PlanarCfg | Planar configuration |
vbitcount | Victor bits per pixel (used to allocate an imagebuffer with allocimage). |
The purpose of the tiffinfofrombuffer function is to identify the type and size of the image and permit allocating enough memory to load the file.
Return value
NO_ERROR | Function successful |
BAD_OPN | Memory handle not available |
BAD_TIFF | File is not a valid TIFF file |
BAD_PTR | Buff does not point to readable memory |
See also tiffinfo
See loadtiffrombuffer
Function Prototypes
Visual Basic | Declare Function Declare Function tiffinfopage Lib "VIC32.DLL" (ByVal filename As String, tinfo As TiffData, ByVal page As Long) As Long |
C/C++ | int tiffinfopage(LPCSTR filename, TiffData *tinfo, int page); |
Java | int vic.vic32jni.tiffinfopage(String filename, TiffData tinfo, int page);; |
Function Arguments
filename | Filename to load |
tinfo | TiffData structure to be filled in |
page | page number of page to load |
Description
The tiffinfopage function reads the header of a page in a multipage TIFF file and places the image information in the tinfo structure.
The TiffData structure elements are defined as follows:
ByteOrder | Intel or Motorola ("II" or "MM") |
width | Image width in pixels |
length | Image length in pixels |
BitsPSample | Bits per sample |
Comp | Compression scheme |
SamplesPPixel | Samples per pixel |
PhotoInt | Photometric interpretation |
PlanarCfg | Planar configuration |
vbitcount | Victor bits per pixel (used to allocate an imagebuffer with allocimage). |
The purpose of the tiffinfopage function is to identify the type and size of a page in a multipage TIFF file to permit allocating enough memory to load the page.
The value of the variable page is compared to the label for each page in the file. If the specific page label is not found in the file then the function returns TIFF_NOPAGE.
Except for obtaining information about a specific page (image) in a multipage TIFF file, tiffinfopage is identical to the tiffinfo function. To determine the pages present in a multipage TIFF file, use the tiffgetpageinfo function. If tiffPage is set to -1, calling tiffinfopage obtains information on the first image in a TIFF file whether or not the file contains multiple pages.
Return value
NO_ERROR | Function successful |
BAD_OPN | Filename not found |
BAD_TIFF | File is not a readable TIFF format |
BAD_MEM | Insufficient local memory |
TIFF_NOPAGE | TIFF page not found and tiffPage is not -1 |
See also
tiffinfo, loadtifpage, tiffgetpageinfo
See loadtifpage
Function Prototypes
Visual Basic | Declare Function tiffinfopagebyindex Lib "VIC32.DLL" (ByVal filename As String, tinfo As TiffData, ByVal pageIndex As Long) As Long |
C/C++ | int tiffinfopagebyindex(LPCSTR filename, TiffData *tinfo, int pageIndex); |
Java | int vic.vic32jni.tiffinfopagebyindex(String filename, TiffData tinfo, int pageIndex); |
Function Arguments
filename | Filename to load |
tinfo | TiffData structure to be filled in |
pageIndex | Index of target page to load (0 based) |
Description
The tiffinfopagebyindex function reads the header of a page in a multipage TIFF
file and places the image information in the tinfo structure.
The TiffData structure elements are defined as follows:
ByteOrder | Intel or Motorola ("II" or "MM") |
width | Image width in pixels |
length | Image length in pixels |
BitsPSample | Bits per sample |
Comp | Compression scheme |
SamplesPPixel | Samples per pixel |
PhotoInt | Photometric interpretation |
PlanarCfg | Planar configuration |
vbitcount | Victor bits per pixel (used to allocate an imagebuffer with allocimage). |
The purpose of the tiffinfopagebyindex function is to identify the type and size of a page in a multipage TIFF file to permit allocating enough memory to load the page.
Use tiffinfopagebyindex to get information about an image based on its position in the file.
Except for obtaining information about a specific page (image) in a multipage TIFF file, tiffinfopagebyindex is identical to the tiffinfo function. To determine the pages present in a multipage TIFF file, use the tiffgetpageinfo function. If pageIndex is set to -1, calling tiffinfopagebyindex obtains information on the first image in a TIFF file whether or not the file contains multiple pages.
Return value
NO_ERROR | Function successful |
BAD_OPN | Filename not found |
BAD_TIFF | File is not a valid TIFF file |
BAD_MEM | Insufficient memory |
TIFF_NOPAGE | TIFF page not found and tiffPageIndex is not -1 |
See also
tiffinfo, tiffinfopageex
Example C/C++
See loadtifpagebyindex
Function Prototypes
Visual Basic | Declare Function tiffinfopagebyindexex Lib "VIC32.DLL" (ByVal filename As String, tinfo As TiffDataEx, ByVal pageIndex As Long) As Long |
C/C++ | int tiffinfopagebyindexex(LPCSTR filename, TiffDataEx *tinfo, int pageIndex); |
Java | int vic.vic32jni.tiffinfopagebyindexex(String filename, TiffDataEx tinfo, int pageIndex); |
Function Arguments
filename | Filename to load |
tinfo | TiffDataEx structure to be filled in |
pageIndex | Index of target page to load (0 based) |
Description
The tiffinfopagebyindexex function reads the header of a page in a multipage TIFF
file and places the image information in the tinfo structure.
The TiffDataEx structure elements are defined as follows:
ByteOrder | Intel or Motorola ("II" or "MM") |
width | Image width in pixels |
length | Image length in pixels |
BitsPSample | Bits per sample |
Comp | Compression scheme |
SamplesPPixel | Samples per pixel |
PhotoInt | Photometric interpretation |
PlanarCfg | Planar configuration |
vbitcount | Victor bits per pixel (used to allocate an imagebuffer with allocimage) |
xres | Horizontal resolution |
yres | Vertical resolution |
resunit | Resolution units |
fillorder | Fill order |
rowsperstrip | Rows per strip |
orientation | Orientation |
IFDofs | Offset from file beginning to IFD |
page | Page label |
The purpose of the tiffinfopagebyindexex function is to identify the type and size of a page in a multipage TIFF file to permit allocating enough memory to load the page.
Use tiffinfopagebyindexex to get information about an image based on its position in the file.
To determine the pages present in a multipage TIFF file, use the tiffgetpageinfo function.
Return value
NO_ERROR | Function successful |
BAD_OPN | Filename not found |
BAD_TIFF | File is not a valid TIFF file |
BAD_MEM | Insufficient memory |
TIFF_NOPAGE | TIFF page not found and tiffPageIndex is not -1 |
See also
tiffinfo, tiffinfopagebyindex
Example C/C++
See loadtifpagebyindex
Function Prototypes
Visual Basic | Declare Function tiffinfopagebyindexfrombuffer Lib "VIC32.DLL" (ByVal buffer As Long, tinfo As TiffData, ByVal pageIndex As Long) As Long |
C/C++ | int tiffinfopagebyindexfrombuffer(UCHAR *buffer, TiffData *tinfo, int pageIndex); |
Java | int vic.vic32jni.tiffinfopagebyindexfrombuffer(int buffer, TiffData tinfo, int pageIndex); |
Function Arguments
buffer | Buffer address |
tinfo | TiffData structure to be filled in |
pageIndex | Index of target page to load (0 based) |
Description
The tiffinfopagebyindexfrombuffer function reads the header of a page in a multipage TIFF
file and places the image information in the tinfo structure.
The TiffData structure elements are defined as follows:
ByteOrder | Intel or Motorola ("II" or "MM") |
width | Image width in pixels |
length | Image length in pixels |
BitsPSample | Bits per sample |
Comp | Compression scheme |
SamplesPPixel | Samples per pixel |
PhotoInt | Photometric interpretation |
PlanarCfg | Planar configuration |
vbitcount | Victor bits per pixel (used to allocate an imagebuffer with allocimage). |
The purpose of the tiffinfopagebyindexfrombuffer function is to identify the type and size of a page in a multipage TIFF file to permit allocating enough memory to load the page.
Use tiffinfopagebyindexfrombuffer to get information about an image based on its position in the file. Use tiffinfopage to get information about an image based on its page number tag.
Except for obtaining information about a specific page (image) in a multipage TIFF file, tiffinfopagebyindexfrombuffer is identical to the tiffinfo function. To determine the pages present in a multipage TIFF file, use the tiffgetpageinfo function. If pageIndex is set to -1, calling tiffinfopagebyindexfrombuffer obtains information on the first image in a TIFF file whether or not the file contains multiple pages.
Return value
NO_ERROR | Function successful |
BAD_OPN | Memory handle not available |
BAD_TIFF | File is not a valid TIFF file |
BAD_MEM | Insufficient memory |
TIFF_NOPAGE | TIFF page not found and tiffPageIndex is not -1 |
See also
tiffinfo, tiffinfopage, loadtifpage, tiffgetpageinfo
Example C/C++
See loadtifpagebyindex
Function Prototypes
Visual Basic | Declare Function tiffinfopagebyindexfrombufferex Lib "VIC32.DLL" (ByVal buffer As Long, tinfo As TiffDataEx, ByVal pageIndex As Long) As Long |
C/C++ | int tiffinfopagebyindexfrombufferex(UCHAR *buffer, TiffDataEx *tinfo, int pageIndex); |
Java | int vic.vic32jni.tiffinfopagebyindexfrombufferex(int buffer, TiffDataEx tinfo, int pageIndex); |
Function Arguments
buffer | Buffer address |
tinfo | TiffDataEx structure to be filled in |
pageIndex | Index of target page to load (0 based) |
Description
The tiffinfopagebyindexfrombufferex function reads the header of a page in a multipage TIFF
file and places the image information in the tinfo structure.
The TiffDataEx structure elements are defined as follows:
ByteOrder | Intel or Motorola ("II" or "MM") |
width | Image width in pixels |
length | Image length in pixels |
BitsPSample | Bits per sample |
Comp | Compression scheme |
SamplesPPixel | Samples per pixel |
PhotoInt | Photometric interpretation |
PlanarCfg | Planar configuration |
vbitcount | Victor bits per pixel (used to allocate an imagebuffer with allocimage) |
xres | Horizontal resolution |
yres | Vertical resolution |
resunit | Resolution units |
fillorder | Fill order |
rowsperstrip | Rows per strip |
orientation | Orientation |
IFDofs | Offset from file beginning to IFD |
page | Page label |
The purpose of the tiffinfopagebyindexfrombufferex function is to identify the type and size of a page in a multipage TIFF file to permit allocating enough memory to load the page.
Use tiffinfopagebyindexfrombufferex to get information about an image based on its position in the file.
To determine the pages present in a multipage TIFF file, use the tiffgetpageinfofrombuffer function.
Return value
NO_ERROR | Function successful |
BAD_OPN | Memory handle not available |
BAD_TIFF | File is not a valid TIFF file |
BAD_MEM | Insufficient memory |
TIFF_NOPAGE | TIFF page not found and tiffPageIndex is not -1 |
See also
tiffinfo, tiffinfopagebyindexex
Example C/C++
See loadtifpagebyindex
Function Prototypes
Visual Basic | Declare Sub tiffsetxyresolution Lib "VIC32.DLL" (ByVal xres As Long, ByVal yres As Long, ByVal resunit As Long) |
C/C++ | void tiffsetxyresolution(unsigned xres, unsigned yres, unsigned resunit); |
Java | void vic.vic32jni.tiffsetxyresolution(int xres, int yres, int resunit); |
Function Arguments
xres | Horizontal resolution in pixels (0 - 32767) |
yres | Vertical resolution in pixels (0 - 32767) |
resunit | Resolution unit (1-3) |
Description
The tiffsetxyresolution function sets the horizontal and vertical resolution and resolution unit for a TIFF file. The next file saved with a savetif function will use the values set by tiffsetxyresolution.
The default values are xres = 300, yres = 300, resunit = 2 (inch); that is, the default resolution is 300 pixels per inch.
To save files with nondefault values for resolution, this function must be called before each call to savetif, savetifpage, or savetiftobuffer.
Return value
There is no return value.
See also
tiffgetxyresolution, tiffgetxyresolutionpagebyindex
Function Prototypes
Visual Basic | Declare Sub TWclose Lib "VICTW32.DLL" () |
C/C++ | void TWclose(void); |
Java | void vic.victw32jni.TWclose(); |
The TWclose function closes the TWAIN data source and the TWAIN source manager (TWAIN.DLL or TWAIN_32.DLL).
This function should only be used in combination with TWopen.
Function Prototypes
Visual Basic | Declare Function TWdetecttwain Lib "VICTW32.DLL" (ByVal hWnd As Long) As Long |
C/C++ | int TWdetecttwain(HWND hWnd); |
Java | int vic.victw32jni.TWdetecttwain(int hWnd); |
Function Arguments
hWnd | Window handle |
Description
The TWdetecttwain function verifies the presence of the TWAIN
source manager (TWAIN.DLL or TWAIN_32.DLL). This function does not determine if
a TWAIN data source is present.
The TWdetecttwain function may appear to execute slowly because the function determines the presence of the TWAIN source manager by opening it. When opened, the source manager searches for all available data sources. This may take some time depending on operating system and number of TWAIN drivers installed.
Return value
NO_ERROR | Function successful |
TWAIN_NODSM | Could not open TWAIN Source Manager |
TWAIN_BUSY | TWAIN module is busy |
BAD_MEM | Insufficient memory |
Function Prototypes
Visual Basic | Declare Function TWgetbrightness Lib "VICTW32.DLL" (ByVal hWnd As Long, ByRef brightdata As TWAIN_CAP_DATA) As Long |
C/C++ | int TWgetbrightness(HWND hWnd, TWAIN_CAP_DATA *brightdata); |
Java | int vic.victw32jni.TWgetbrightness(int hWnd, TWAIN_CAP_DATA brightdata); |
Function Arguments
hWnd | Window handle |
brightdata | Variable of type TWAIN_CAP_DATA to receive the data |
Description
The TWgetbrightness function gets the valid range of brightness levels that can
be used to set the brightness in a call to TWsetbrightness. The data is
returned in the brightdata structure, usually in a TWAIN_RANGE container.
Typical brightness values are in the range -1000 to +1000.
The TWAIN_CAP_DATA structure elements are defined as follows:
conType | Receives the value of container type
5 = TWON_ONEVALUE 4 = TWON_ENUMERATION 6 = TWON_RANGE | ||||||||||
oneVal | Container of type TWAIN_ONEVALUE
| ||||||||||
enum | Container of type TWAIN_ENUMTYPE
| ||||||||||
range | Container of type TWAIN_RANGE
|
TWgetbrightness may not be able to verify a parameter change made by a TWsetbrightness call. This is because the new value to set is not sent to the device until a scan image function is called.
Return value
NO_ERROR | Function successful |
TWAIN_NODSM | Could not open TWAIN Source Manager |
TWAIN_NODS | Could not open TWAIN Data Source |
TWAIN_BUSY | TWAIN module is busy |
TWAIN_ERR | Function failed, call TWgeterror for more info |
Example C/C++
See TWsetbrightness
Function Prototypes
Visual Basic | Declare Function TWgetcontrast Lib "VICTW32.DLL" (ByVal hWnd As Long, ByRef contrastdata As TWAIN_CAP_DATA) As Long |
C/C++ | int TWgetcontrast(HWND hWnd, TWAIN_CAP_DATA *contrastdata); |
Java | int vic.victw32jni.TWgetcontrast(int hWnd, TWAIN_CAP_DATA contrastdata); |
Function Arguments
hWnd | Window handle |
contrastdata | Variable of type TWAIN_CAP_DATA to receive the data |
Description
The TWgetcontrast function gets the valid range of contrast values that can be
used to set the contrast in a call to TWsetcontrast. The data is returned in
the contrastdata structure, usually in a TWAIN_RANGE container.
Typical contrast values are in the range -1000 to +1000.
The TWAIN_CAP_DATA structure elements are defined as follows:
conType | Receives the value of container type
5 = TWON_ONEVALUE 4 = TWON_ENUMERATION 6 = TWON_RANGE | ||||||||||
oneVal | Container of type TWAIN_ONEVALUE
| ||||||||||
enum | Container of type TWAIN_ENUMTYPE
| ||||||||||
range | Container of type TWAIN_RANGE
|
Return value
NO_ERROR | Function successful |
TWAIN_NODSM | Could not open TWAIN Source Manager |
TWAIN_NODS | Could not open TWAIN Data Source |
TWAIN_BUSY | TWAIN module is busy |
TWAIN_ERR | Function failed, call TWgeterror for more info |
Example C/C++
See TWsetcontrast
Function Prototypes
Visual Basic | Declare Function TWgeterror Lib "VICTW32.DLL" () As Long |
C/C++ | int TWgeterror(void); |
Java | int vic.victw32jni.TWgeterror(); |
Description
The TWgeterror function reports extended error information. When the return
code from a Victor TWAIN function is not NO_ERROR or TWAIN_SCAN_CANCEL, calling
TWgeterror usually provides additional information about why the function
failed.
Return value
0 TWCC_SUCCESS | Operation successful |
1 TWCC_BUMMER | Failure due to unknown causes |
2 TWCC_LOWMEMORY | Not enough memory to perform operation |
3 TWCC_NODS | No Data Source |
4 TWCC_MAXCONNECTIONS | Source already in use |
5 TWCC_OPERATIONERROR | Source or Source Manager error already reported to user |
6 TWCC_BADCAP | Unknown capability requested |
9 TWCC_BADPROTOCOL | Unrecognized DataGroup / Data ArgType / Msg combination |
10 TWCC_BADVALUE | Parameter out of range |
11 TWCC_SEQERROR | Message received out of sequence |
12 TWCC_BADDEST | Unknown destination App/Src in DSM_Entry |
-55 TWAIN_NOWND | Could not create parent window |
-54 TWAIN_NODSM | TWAIN Source Manager not found |
Example C/C++
See TWscanimage
Function Prototypes
Visual Basic | Declare Function TWgetfeeder Lib "VICTW32.DLL" (ByVal hWnd As Long, ByRef feederIsEnabled as Long, ByRef feederHasPaper as Long) As Long |
C/C++ | int TWgetfeeder(HWND hWnd, BOOL *feederIsEnabled, BOOL *feederHasPaper); |
Java | int vic.victw32jni.TWgetfeeder(int hWnd, refvar feederIsEnabled, refvar feederHasPaper); |
Function Arguments
hWnd | Window handle |
feederEnabled | Variable to receive state of feeder Nonzero if ADF is enabled |
feederLoaded | Variable to receive state of paper in feeder Nonzero if ADF has paper |
Description
The TWgetfeeder function indicates whether the Automatic Document Feeder (ADF)
is enabled and has paper loaded. The value returned in feederLoaded is valid
only if feederEnabled is TRUE.
Return value
NO_ERROR | Function successful |
TWAIN_NODSM | Could not open TWAIN Source Manager |
TWAIN_NODS | Could not open TWAIN Data Source |
TWAIN_BUSY | TWAIN module is busy |
TWAIN_ERR | Function failed, call TWgeterror for more info |
See Also
See TWsetfeeder
Example C/C++ | Example VB See TWscancountimages
Function Prototypes
Visual Basic | Declare Function TWgetmeasureunit Lib "VICTW32.DLL" (ByVal hWnd As Long, ByRef typeUnit As TWAIN_CAP_DATA) As Long |
C/C++ | int TWgetmeasureunit(HWND hWnd, TWAIN_CAP_DATA *typeUnit); |
Java | int vic.victw32jni.TWgetmeasureunit(int hWnd, TWAIN_CAP_DATA typeUnit); |
Function Arguments
hWnd | Window handle |
typeUnit | Variable of type TWAIN_CAP_DATA to receive the data |
Description
The TWgetmeasureunit function gets the valid range of values that can be used
to set the measurement units in a call to TWsetmeasureunit. The data is
returned in the typeUnit structure, usually in a TWAIN_ENUMTYPE container.
The unit type constants are defined as follows:
Value | Defined Constant | Description |
0 | TWUN_INCHES | Inches |
1 | TWUN_CENTIMETERS | Centimeters |
2 | TWUN_PICAS | Picas (1/6 inch) |
3 | TWUN_POINTS | Points (1/72 inch) |
4 | TWUN_TWIPS | Twips |
5 | TWUN_PIXELS | Pixels |
The TWAIN_CAP_DATA structure elements are defined as follows:
conType | Receives the value of container type
5 = TWON_ONEVALUE 4 = TWON_ENUMERATION 6 = TWON_RANGE | ||||||||||
oneVal | Container of type TWAIN_ONEVALUE
| ||||||||||
enum | Container of type TWAIN_ENUMTYPE
| ||||||||||
range | Container of type TWAIN_RANGE
|
Return value
NO_ERROR | Function successful |
TWAIN_NODSM | Could not open TWAIN Source Manager |
TWAIN_NODS | Could not open TWAIN Data Source |
TWAIN_BUSY | TWAIN module is busy |
TWAIN_ERR | Function failed, call TWgeterror for more info |
Example C/C++
See TWsetpixeltype
Function Prototypes
Visual Basic | Declare Function TWgetphysicalsize Lib "VICTW32.DLL" (ByVal hWnd As Long, ByRef width as Long, ByRef height as Long) As Long |
C/C++ | int TWgetphysicalsize(HWND hWnd, int *width, int *height); |
Java | int vic.victw32jni.TWgetphysicalsize(int hWnd, refvar width, refvar height); |
Function Arguments
hWnd | Window handle |
width | Variable to receive the width |
height | Variable to receive the height |
Description
The TWgetphysicalsize function gets the maximum width and height of an image
the TWAIN device can acquire measured in increments of 1/1000 unit of measure,
usually inches.
Return value
NO_ERROR | Function successful |
TWAIN_NODSM | Could not open TWAIN Source Manager |
TWAIN_NODS | Could not open TWAIN Data Source |
TWAIN_BUSY | TWAIN module is busy |
TWAIN_ERR | Function failed, call TWgeterror for more info |
See Also
See TWgetmeasureunit, TWsetmeasureunit
Function Prototypes
Visual Basic | Declare Function TWgetpixeltype Lib "VICTW32.DLL" (ByVal hWnd As Long, ByRef pixelType As TWAIN_CAP_DATA) As Long |
C/C++ | int TWgetpixeltype(HWND hWnd, TWAIN_CAP_DATA *pixelType); |
Java | int vic.victw32jni.TWgetpixeltype(int hWnd, TWAIN_CAP_DATA pixelType); |
Function Arguments
hWnd | Window handle |
pixelType | Variable of type TWAIN_CAP_DATA to receive the data |
Description
The TWgetpixeltype function gets the valid range of values that can be used to
set the pixel type in a call to TWsetpixeltype. The data is returned in the
pixelType structure, usually in a TWAIN_ENUMTYPE container. TWAIN_ONEVALUE,
The pixel type constants are defined as follows:
Value | Defined Constant | Description |
0 | TWPT_BW | Black and white |
1 | TWPT_GRAY | Grayscale |
2 | TWPT_RGB | RGB |
3 | TWPT_PALETTE | Palette color |
4 | TWPT_CMY | CMY |
5 | TWPT_CMYK | CMYK |
6 | TWPT_YUV | YUV |
7 | TWPT_YUVK | YUVK |
8 | TWPT_CIEXYZ | CIEXYZ |
The TWAIN_CAP_DATA structure elements are defined as follows:
conType | Receives the value of container type
5 = TWON_ONEVALUE 4 = TWON_ENUMERATION 6 = TWON_RANGE | ||||||||||
oneVal | Container of type TWAIN_ONEVALUE
| ||||||||||
enum | Container of type TWAIN_ENUMTYPE
| ||||||||||
range | Container of type TWAIN_RANGE
|
Return value
NO_ERROR | Function successful |
TWAIN_NODSM | Could not open TWAIN Source Manager |
TWAIN_NODS | Could not open TWAIN Data Source |
TWAIN_BUSY | TWAIN module is busy |
TWAIN_ERR | Function failed, call TWgeterror for more info |
Example C/C++
See TWsetpixeltype
Function Prototypes
Visual Basic | Declare Function TWgetsourcenames Lib "VICTW32.DLL" (ByVal hWnd As Long, ByRef namelist As TW_STR32, ByRef nameCount As Long) As Long |
C/C++ | int TWgetsourcenames(HWND hWnd, TW_STR32 *nameList, int *nameCount); |
Java | int vic.victw32jni.TWgetsourcenames(int hWnd, char[] nameList, refvar nameCount); |
Function Arguments
hWnd | Window handle |
nameList | List of Twain sources |
nameCount | Variable to receive number of sources in nameList |
Description
The TWgetsourcenames function gets a list of available Twain data sources from
the source manager. Each data source name is inserted into a 34-character array
of type TW_STR32. If nameList is NULL, TWgetsourcenames just enters the
number of available data sources into nameCount. This allows the calling
program to allocate adequate space for nameList, that is, an array of
nameCount elements of type TW_STR32.
If nameList represents a valid array, the list of available data source names is copied into nameList and nameCount is not altered. Up to nameCount names will be copied. TW_STR32 is defined as a 34-element character array.
See also
TWselectsourcebyname
Return value
NO_ERROR | Function successful |
TWAIN_NODSM | Could not open TWAIN Source Manager |
TWAIN_BUSY | TWAIN module is busy |
TWAIN_ERR | Function failed, call TWgeterror for more info |
BAD_MEM | Insufficient memory |
Function Prototypes
Visual Basic | Declare Function TWgetxresolution Lib "VICTW32.DLL" (ByVal hWnd As Long, ByRef resdata As TWAIN_CAP_DATA) As Long |
C/C++ | int TWgetxresolution(HWND hWnd, TWAIN_CAP_DATA *resdata); |
Java | int vic.victw32jni.TWgetxresolution(int hWnd, TWAIN_CAP_DATA resdata); |
Function Arguments
hWnd | Window handle |
resdata | Variable of type TWAIN_CAP_DATA to receive the data |
Description
The TWgetxresolution function gets the valid range of resolutions that can be
used to set the resolution in a call to TWsetxresolution. The data is returned
in the resdata structure, usually in a TWAIN_RANGE container.
The TWAIN_CAP_DATA structure elements are defined as follows:
conType | Receives the value of container type
5 = TWON_ONEVALUE 4 = TWON_ENUMERATION 6 = TWON_RANGE | ||||||||||
oneVal | Container of type TWAIN_ONEVALUE
| ||||||||||
enum | Container of type TWAIN_ENUMTYPE
| ||||||||||
range | Container of type TWAIN_RANGE
|
TWgetxresolution may not be able to verify a parameter change made by a TWsetxresolution call. This is because the new value to set is not sent to the device until a scan image function is called.
Return value
NO_ERROR | Function successful |
TWAIN_NODSM | Could not open TWAIN Source Manager |
TWAIN_NODS | Could not open TWAIN Data Source |
TWAIN_BUSY | TWAIN module is busy |
TWAIN_ERR | Function failed, call TWgeterror for more info |
Example C/C++
See TWscanimageex
Function Prototypes
Visual Basic | Declare Function TWgetyresolution Lib "VICTW32.DLL" (ByVal hWnd As Long, ByRef resdata As TWAIN_CAP_DATA) As Long |
C/C++ | int TWgetyresolution(HWND hWnd, TWAIN_CAP_DATA *resdata); |
Java | int vic.victw32jni.TWgetyresolution(int hWnd, TWAIN_CAP_DATA resdata); |
Function Arguments
hWnd | Window handle |
resdata | Variable of type TWAIN_CAP_DATA to receive the data |
Description
The TWgetyresolution function gets the valid range of resolution values that
can be used to set the resolution in a subsequent call to TWsetyresolution. The
data is returned in the resdata structure, usually in a TWAIN_RANGE container.
The TWAIN_CAP_DATA structure elements are defined as follows:
conType | Receives the value of container type
5 = TWON_ONEVALUE 4 = TWON_ENUMERATION 6 = TWON_RANGE | ||||||||||
oneVal | Container of type TWAIN_ONEVALUE
| ||||||||||
enum | Container of type TWAIN_ENUMTYPE
| ||||||||||
range | Container of type TWAIN_RANGE
|
TWgetyresolution may not be able to verify a parameter change made by a TWsetyresolution call. This is because the new value to set is not sent to the device until a scan image function is called.
Return value
NO_ERROR | Function successful |
TWAIN_NODSM | Could not open TWAIN Source Manager |
TWAIN_NODS | Could not open TWAIN Data Source |
TWAIN_BUSY | TWAIN module is busy |
TWAIN_ERR | Function failed, call TWgeterror for more info |
Example C/C++
See TWscanimageex
Function Prototypes
Visual Basic | Declare Function TWopen Lib "VICTW32.DLL" (ByVal hWnd As Long) As Long |
C/C++ | int TWopen(HWND hWnd); |
Java | int vic.victw32jni.TWopen(int hWnd); |
Function Arguments
hWnd | Window handle |
The TWopen function opens the TWAIN data source and source manager. It is to be called once before capturing any images. This will increase the speed of each scanning operation. Balance any call to TWopen with a corresponding call to TWclose after capturing images.
It is not necessary to use the TWopen/TWclose functions because the TWscanimage functions will open and close the TWAIN files as needed for each scan. These functions are provided as an optional speed-up device.
Return value
NO_ERROR | Function successful |
TWAIN_NODSM | Could not open TWAIN Source Manager |
TWAIN_NODS | Could not open TWAIN Data Source |
TWAIN_BUSY | TWAIN module is busy |
TWAIN_ERR | Function failed, call TWgeterror for more info |
1 | 8 | 24 |
Function Prototypes
Visual Basic | Declare Function TWscancountimages Lib "VICTW32.DLL" (ByVal hWnd As Long, ByRef resimg As imgdes, ByRef scanrect As RECT, ByVal showIU As Long, ByVal maxPages As Long, ByVal saveScan As Long) As Long |
C/C++ | int TWscancountimages(HWND hWnd, imgdes *resimg, RECT *scanrect, BOOL showIU, int maxPages, int (WINAPI *saveScan)(imgdes *thisimg)); |
Java | int vic.victw32jni.TWscancountimages(int hWnd, imgdes resimg, RECT scanrect, int showIU, int maxPages, SCNFCT saveScan); |
Function Arguments
hWnd | Window handle |
resimg | Result image |
scanrect | Area on scan bed to be scanned (usually in mils, 1/1000 inch) |
showUI | Flag to display the Acquire dialog box
zero = do not display built-in Twain user interface nonzero = display built-in Twain user interface |
maxPages | Max number of images to acquire |
saveScan | Function that saves or prints each page as it is scanned |
Description
The TWscancountimages function acquires up to maxPages images from the default
TWAIN source. This is the preferred function to use for scanning multiple images.
The resimg argument is the address of an empty image descriptor that the function fills in with the description of the last image acquired.
The scan bed area to be scanned is specified by scanrect.
The RECT structure elements are defined as follows:
left | X-coordinate of the rectangle's upper-left corner |
top | Y-coordinate of the rectangle's upper-left corner |
right | X-coordinate of the rectangle's lower-right corner |
bottom | Y-coordinate of the rectangle's lower-right corner |
The display of the device-supplied TWAIN user interface is specified by showUI, the number of pages to scan is maxPages, and the callback function for handling each image as it is acquired is specified by saveScan.
SaveScan is a function you provide in your application. SaveScan is called from within TWscacountimages each time an image is acquired from the source. An image descriptor describing the captured image is sent to the saveScan function. Your saveScan function can use this information to save, display, or print each image, as required.
The saveScan function must return NO_ERROR to continue acquiring images. Any other return code causes TWscancountimages to instruct the source to stop acquiring images. The return code from saveScan is passed to and returned by TWscanmultipleimages unless saveScan returns the special code TWAIN_STOP_SCAN (-67)
Return value
NO_ERROR | Function successful |
TWAIN_SCAN_CANCEL | User canceled image transfer |
TWAIN_NO_PAPER | Autofeeder is empty |
TWAIN_NODSM | Could not open TWAIN Source Manager |
TWAIN_NODS | Could not open TWAIN Data Source |
TWAIN_BUSY | TWAIN module is busy |
TWAIN_ERR | Function failed, call TWgeterror for more info |
BAD_MEM | Insufficient memory |
BAD_CMP | TWAIN image has unreadable compression scheme |
BAD_BPP | Bits per pixel of TWAIN image is not 1, 4, 8, or 24 |
See also
TWscanimage,
TWscanimageex
1 | 8 | 24 |
Function Prototypes
Visual Basic | Declare Function TWscanimage Lib "VICTW32.DLL" (ByVal hWnd As Long, ByRef resimg As imgdes) As Long |
C/C++ | int TWscanimage(HWND hWnd, imgdes *resimg); |
Java | int vic.victw32jni.TWscanimage(int hWnd, imgdes resimg); |
Function Arguments
hWnd | Window handle |
resimg | Result image |
Description
The TWscanimage function acquires an image from a TWAIN data source and creates
a Victor-compatible image.
The resimg argument is the address of an empty image descriptor that the function fills in with the description of the image acquired.
This function allocates memory to hold the image and enters the correct data into all elements of the image descriptor resimg. The image in memory must be released with freeimage when no longer needed.
Calling this function causes the data source to display a dialog box that the user can fill in to acquire an image. This dialog box allows specifying image characteristics such as dimensions and pixel depth. When the user selects "FINAL" the image is transferred from the data source to resimg. If the user cancels the dialog box, TWAIN_SCAN_CANCEL is returned.
The data source used by TWscanimage can be selected by TWselectsource or TWselectsourcebyname. If a data source is not selected the default data source will be used. If no data source is available it will not be possible to acquire an image. See the section about Scanning Images in the Victor User's Guide for more information about acquiring images with TWAIN.
See also
TWscanimageex,
TWscancountimages
Return value
NO_ERROR | Function successful |
TWAIN_SCAN_CANCEL | User canceled image transfer |
TWAIN_NODSM | Could not open TWAIN Source Manager |
TWAIN_NODS | Could not open TWAIN Data Source |
TWAIN_BUSY | TWAIN module is busy |
TWAIN_ERR | Function failed, call TWgeterror for more info |
BAD_MEM | Insufficient memory |
BAD_CMP | TWAIN image has unreadable compression scheme |
BAD_BPP | Bits per pixel of TWAIN image is not 1, 4, 8, or 24 |
Example C/C++ | Example VB 1 | Example VB 2
1 | 8 | 24 |
Function Prototypes
Visual Basic | Declare Function TWscanimageex Lib "VICTW32.DLL" (ByVal hWnd As Long, ByRef resimg As imgdes, scanrect As RECT, ByVal showIU As Long) As Long |
C/C++ | int TWscanimageex(HWND hWnd, imgdes *resimg, RECT *scanrRect, BOOL showIU); |
Java | int vic.victw32jni.TWscanimageex(int hWnd, imgdes resimg, RECT scanrect, int showIU); |
Function Arguments
hWnd | Window handle |
resimg | Result image |
scanrect | Area on scan bed to be scanned (usually in mils, 1/1000 inch) |
showUI | Flag to display the Acquire dialog box
zero = do not display built-in Twain user interface nonzero = display built-in Twain user interface |
Description
The TWscanimageex function acquires an image from a TWAIN data source and
creates a Victor-compatible image.
The resimg argument is the address of an empty image descriptor that the function fills in with the description of the image acquired.
This function allocates memory to hold the image and enters the correct data into all elements of the image descriptor resimg. The image in memory must be released with freeimage when no longer needed.
TWscanimageex allows specifying the scan window and if the acquire dialog box should be displayed. The scan window is the rectangular section of the scan bed that is scanned. This window is defined by the srect structure in increments of 1/1000 unit of measure, usually inches.
The RECT structure elements are defined as follows:
left | X-coordinate of the rectangle's upper-left corner |
top | Y-coordinate of the rectangle's upper-left corner |
right | X-coordinate of the rectangle's lower-right corner |
bottom | Y-coordinate of the rectangle's lower-right corner |
The variable showUI controls whether the acquire dialog box will be displayed. If showUI is TRUE the data source displays a dialog box that the user can fill in to acquire an image. Setting showUI to FALSE instructs the data source to acquire an image without displaying the dialog box. Note that some data sources may not allow bypassing the acquire dialog box.
The acquire dialog box allows specifying image characteristics such as dimensions and pixel type. When the user selects "FINAL" the image is transferred from the data source to resimg. If the user cancels the dialog box, TWAIN_SCAN_CANCEL is returned.
The data source used by TWscanimageex can be selected by TWselectsource or TWselectsourcebyname. If a data source is not selected the default data source will be used. If no data source is available it will not be possible to acquire an image. See the section about Scanning Images in the Victor User's Guide for more information about acquiring images with TWAIN.
Image acquisition properties can be controlled by using TWsetbrightness, TWsetcontrast, TWsetpixeltype, TWsetmeasureunit, TWsetxresolution, and TWsetyresolution,
See also
TWscanimage,
TWscancountimages
Return value
NO_ERROR | Function successful |
TWAIN_SCAN_CANCEL | User canceled image transfer |
TWAIN_NODSM | Could not open TWAIN Source Manager |
TWAIN_NODS | Could not open TWAIN Data Source |
TWAIN_BUSY | TWAIN module is busy |
TWAIN_ERR | Function failed, call TWgeterror for more info |
BAD_MEM | Insufficient memory |
BAD_CMP | TWAIN image has unreadable compression scheme |
BAD_BPP | Bits per pixel of TWAIN image not 1, 4, 8, or 24 |
1 | 8 | 24 |
Function Prototypes
Visual Basic | Declare Function TWscanmultipleimages Lib "VICTW32.DLL" (ByVal hWnd As Long, ByRef resimg As imgdes, ByVal saveScan As Long) As Long |
C/C++ | int TWscanmultipleimages(HWND hWnd, imgdes *resimg, int (WINAPI *saveScan)()); |
Java | int vic.victw32jni.TWscanmultipleimages(int hWnd, imgdes resimg,SCNFCT saveScan); |
Function Arguments
hWnd | Window handle |
resimg | Result image |
saveScan | Function that saves or prints each page as it is scanned |
Description
The TWscanmultipleimages function acquires one or more images from the default
TWAIN source.
Calling this function causes the data source to display a dialog box that the user can fill in to acquire images. When the "FINAL" (or "FINISH") button is pressed, transfer of the images from the data source to the application begins.
Resimg is the address of an empty image descriptor that is filled in by the function with the description of the last image acquired. The image in memory must be released with freeimage when no longer needed.
SaveScan is a pointer to a function you provide in your application. SaveScan is called from within TWscanmultipleimages each time an image is acquired from the source. An image descriptor describing the captured image is sent to the saveScan function. SaveScan can use this information to save, display, or print each image, as required. The saveScan function definition must be exported from your application and be of type WINAPI. (Either use the "_export" keyword in the function definition or list the function name under EXPORTS in a .DEF file.)
The saveScan function must return NO_ERROR to continue acquiring images. Any other return code causes TWscanmultipleimages to instruct the source to stop acquiring images. The return code from saveScan is passed to and returned by TWscanmultipleimages unless saveScan returns the special code TWAIN_STOP_SCAN (-67)
If you elect to have saveScan cancel image acquisition by returning a value other than NO_ERROR, verify that the data source doesn't cause the application to "hang." If this cannot be verified then within the saveScan function display a message box instructing the user to select "CANCEL" in the user interface.
The data source used by TWscanmultipleimages can be selected by TWselectsource or TWselectsourcebyname. If a data source is not selected the default data source will be used. If no data source is available it will not be possible to acquire an image. See the section about Scanning Images in the Victor User's Guide for more information about acquiring images with TWAIN.
For each image acquired TWscanmultipleimages allocates memory to hold the image. This memory must be released with freeimage when no longer needed.
See also
TWscanimage,
TWscanimageex,
TWscancountimages (preferred)
Return value
NO_ERROR | Function successful |
TWAIN_SCAN_CANCEL | User canceled image transfer |
TWAIN_NODSM | Could not open TWAIN Source Manager |
TWAIN_NODS | Could not open TWAIN Data Source |
TWAIN_BUSY | TWAIN module is busy |
TWAIN_ERR | Function failed, call TWgeterror for more info |
BAD_MEM | Insufficient memory |
BAD_CMP | TWAIN image has unreadable compression scheme |
BAD_BPP | Bits per pixel of TWAIN image is not 1, 4, 8, or 24 |
1 | 8 | 24 |
Function Prototypes
Visual Basic | Declare Function TWscanmultipleimagesex Lib "VICTW32.DLL" (ByVal hWnd As Long, ByRef resimg As imgdes, ByRef scanrect As RECT, ByVal showIU As Long, ByVal saveScan As Long) As Long |
C/C++ | int TWscanmultipleimagesex(HWND hWnd, imgdes *resimg, RECT *scanrect, BOOL showIU, int (WINAPI *saveScan)(imgdes *thisimg)); |
Java | int vic.victw32jni.TWscanmultipleimagesex(int hWnd, imgdes resimg, RECT scanrect, int showIU,SCNFCT saveScan); |
Function Arguments
hWnd | Window handle |
resimg | Result image |
scanrect | Area on scan bed to be scanned (usually in mils, 1/1000 inch) |
showUI | Flag to display the Acquire dialog box
zero = do not display built-in Twain user interface nonzero = display built-in Twain user interface |
saveScan | Function that saves or prints each page as it is scanned |
Description
The TWscanmultipleimagesex function acquires one or more images from the
default TWAIN source.
The resimg argument is the address of an empty image descriptor that the function fills in with the description of the last image acquired.
The scan bed area to be scanned is specified by scanrect.
The RECT structure elements are defined as follows:
left | X-coordinate of the rectangle's upper-left corner |
top | Y-coordinate of the rectangle's upper-left corner |
right | X-coordinate of the rectangle's lower-right corner |
bottom | Y-coordinate of the rectangle's lower-right corner |
The display of the device-supplied TWAIN user interface is specified by showUI, and the callback function for handling each image as it is acquired is specified by saveScan. Refer to the other TWscanmultipleimage functions for additional information.
See also
TWscanimage,
TWscanimageex,
TWscancountimages (preferred)
Return value
NO_ERROR | Function successful |
TWAIN_SCAN_CANCEL | User canceled image transfer |
TWAIN_NODSM | Could not open TWAIN Source Manager |
TWAIN_NODS | Could not open TWAIN Data Source |
TWAIN_BUSY | TWAIN module is busy |
TWAIN_ERR | Function failed, call TWgeterror for more info |
BAD_MEM | Insufficient memory |
BAD_CMP | TWAIN image has unreadable compression scheme |
BAD_BPP | Bits per pixel of TWAIN image is not 1, 4, 8, or 24 |
Example C/C++
See TWscanmultipleimages
Function Prototypes
Visual Basic | Declare Function TWselectsource Lib "VICTW32.DLL" (ByVal hWnd As Long) As Long |
C/C++ | int TWselectsource(HWND hWnd); |
Java | int vic.victw32jni.TWselectsource(int hWnd); |
Function Arguments
hWnd | Window handle |
Description
The TWselectsource function allows the user to select a new default TWAIN data
source. The data source controls the imaging device.
Calling this function causes the source manager (TWAIN.DLL or TWAIN_32.DLL) to display a Select Data Source dialog box containing a list of TWAIN data sources. From this list the user can select a data source to become the default data source. This source will be used for subsequent calls to the Victor TWscan image functions. If no TWAIN data source is available the list will be empty and it will not be possible to acquire an image.
See the section about Scanning Images in the Victor User's Guide for more information about acquiring images with TWAIN.
See also
TWselectsourcebyname
Return value
NO_ERROR | Function successful |
TWAIN_NODSM | Could not open TWAIN Source Manager |
TWAIN_BUSY | TWAIN module is busy |
TWAIN_ERR | Function failed, call TWgeterror for more info |
BAD_MEM | Insufficient memory |
Function Prototypes
Visual Basic | Declare Function TWselectsourcebyname Lib "VICTW32.DLL" (ByVal hWnd As Long, ByVal dsname As String) As Long |
C/C++ | int TWselectsourcebyname(HWND hWnd, LPCSTR dsname); |
Java | int vic.victw32jni.TWselectsourcebyname(int hWnd, String dsname); |
Function Arguments
hWnd | Window handle |
dsname | TWAIN data source name |
Description
The TWselectsourcebyname function allows selecting a TWAIN data source without
displaying the Select Data Source dialog box. In this way a data source can be
selected without user intervention.
The data source controls the imaging device.
For a data source to be selected, dsname must match a name as it would be displayed in the Select Source dialog box, though case is not important in this comparison. The parameter dsname is a null-terminated string such as "Deskscan II 2.3".
This source will be used for subsequent calls to the Victor TWscan image functions. If the source manager cannot find the data source associated with dsname, the default data source will be used. If no TWAIN data source is available it will not be possible to acquire an image.
See the section about Scanning Images in the Victor User's Guide for more information about acquiring images with TWAIN.
See also
TWselectsource
Return value
NO_ERROR | Function successful |
TWAIN_NODS | Could not find specified TWAIN data source |
TWAIN_NODSM | Could not open TWAIN Source Manager |
TWAIN_BUSY | TWAIN module is busy |
TWAIN_ERR | Function failed, call TWgeterror for more info |
BAD_MEM | Insufficient memory |
Example C/C++ 1 | Example C/C++ 2 | Example VB
Function Prototypes
Visual Basic | Declare Function TWsetbrightness Lib "VICTW32.DLL" (ByVal hWnd As Long, ByRef brightdata As TWAIN_CAP_DATA) As Long |
C/C++ | int TWsetbrightness(HWND hWnd, TWAIN_CAP_DATA *brightdata); |
Java | int vic.victw32jni.TWsetbrightness(int hWnd, TWAIN_CAP_DATA brightdata); |
Function Arguments
hWnd | Window handle |
brightdata | Variable of type TWAIN_CAP_DATA |
Description
The TWsetbrightness function sets the brightness level to be used for future
image acquisition. To set the brightness place the new brightness in oneVal.val
and set conType to TWON_ONEVALUE. To determine the valid brightness range call
TWgetbrightness.
The TWAIN_CAP_DATA structure elements are defined as follows:
conType | Receives the value of container type
5 = TWON_ONEVALUE 4 = TWON_ENUMERATION 6 = TWON_RANGE | ||||||||||
oneVal | Container of type TWAIN_ONEVALUE
| ||||||||||
enum | Container of type TWAIN_ENUMTYPE
| ||||||||||
range | Container of type TWAIN_RANGE
|
The new brightness value is not put into effect until an image is acquired with a scan image function call and may not be verifiable by calling TWgetbrightness.
Return value
NO_ERROR | Function successful |
TWAIN_NODSM | Could not open TWAIN Source Manager |
TWAIN_NODS | Could not open TWAIN Data Source |
TWAIN_BUSY | TWAIN module is busy |
TWAIN_ERR | Function failed, call TWgeterror for more info |
Function Prototypes
Visual Basic | Declare Function TWsetcontrast Lib "VICTW32.DLL" (ByVal hWnd As Long, ByRef contrastdataAs TWAIN_CAP_DATA) As Long |
C/C++ | int TWsetcontrast(HWND hWnd, TWAIN_CAP_DATA *contrastdata); |
Java | int vic.victw32jni.TWsetcontrast(int hWnd, TWAIN_CAP_DATA contrastdata); |
Function Arguments
hWnd | Window handle |
contrastdata | Variable of type TWAIN_CAP_DATA |
Description
The TWsetcontrast function sets the contrast adjustment to be used for future
image acquisition. To set the contrast place the new value in oneVal.val and
set conType to TWON_ONEVALUE. To determine the valid contrast range call
TWgetcontrast.
The TWAIN_CAP_DATA structure elements are defined as follows:
conType | Receives the value of container type
5 = TWON_ONEVALUE 4 = TWON_ENUMERATION 6 = TWON_RANGE | ||||||||||
oneVal | Container of type TWAIN_ONEVALUE
| ||||||||||
enum | Container of type TWAIN_ENUMTYPE
| ||||||||||
range | Container of type TWAIN_RANGE
|
The new contrast value is not put into effect until an image is retrieved with a scan image function call and may not be verifiable by calling TWgetcontrast.
Return value
NO_ERROR | Function successful |
TWAIN_NODSM | Could not open TWAIN Source Manager |
TWAIN_NODS | Could not open TWAIN Data Source |
TWAIN_BUSY | TWAIN module is busy |
TWAIN_ERR | Function failed, call TWgeterror for more info |
Example C/C++ | Example VB
See TWsetbrightness
Function Prototypes
Visual Basic | Declare Function TWsetduplex Lib "VICTW32.DLL" (ByVal hWnd As Long, ByVal enableDuplex as long) As long |
C/C++ | int TWsetduplex(HWND hWnd, BOOL enableDuplex); |
Java | int vic.victw32jni.TWsetduplex(int hWnd, int enableDuplex); |
Function Arguments
hWnd | Window handle |
enableDuplex | Nonzero = enable duplex
zero = disable duplex |
Description
The TWsetduplex function enables or disables duplex operation (automatic scanning of two sides of a sheet of paper) for future image
acquisition. To enable duplex operation set enableDuplex to TRUE.
To enable duplex, the scanner must support duplex operation and the data source for the device must support enabling duplex by software. A return value of NO_ERROR does not mean duplex is enabled, it only means that the function successfully communicated with the data source.
Return value
NO_ERROR | Function successful |
TWAIN_NODSM | Could not open TWAIN Source Manager |
TWAIN_NODS | Could not open TWAIN Data Source |
TWAIN_BUSY | TWAIN module is busy |
TWAIN_ERR | Function failed, call TWgeterror for more info |
Example C/C++ | Example VB See TWgetphysicalsize
Function Prototypes
Visual Basic | Declare Function TWsetfeeder Lib "VICTW32.DLL" (ByVal hWnd As Long, ByVal enableFeeder as long) As long |
C/C++ | int TWsetfeeder(HWND hWnd, BOOL enableFeeder); |
Java | int vic.victw32jni.TWsetfeeder(int hWnd, int enableFeeder); |
Function Arguments
hWnd | Window handle |
enableFeeder | Nonzero = enable doc feeder
zero = disable doc feeder |
Description
The TWsetfeeder function enables or disables the Automatic Document Feeder
(ADF) for image acquisition. For a scanner this function determines whether the
ADF or the scanbed is used to acquire images. Not all scanners can be
controlled by this function. For example, the HP C6270 fitted with an ADF
always acquires images from a loaded ADF and ignores the value of enableFeeder.
A return value of NO_ERROR does not mean the ADF is enabled or disabled, it means only that the function successfully communicated with the data source.
Return value
NO_ERROR | Function successful |
TWAIN_NODSM | Could not open TWAIN Source Manager |
TWAIN_NODS | Could not open TWAIN Data Source |
TWAIN_BUSY | TWAIN module is busy |
TWAIN_ERR | Function failed, call TWgeterror for more info |
See also
TWgetfeeder
Function Prototypes
Visual Basic | Declare Function TWsetmeasureunit Lib "VICTW32.DLL" (ByVal hWnd As Long, ByRef typeUnit As TWAIN_CAP_DATA) As Long |
C/C++ | int _export WINAPI TWsetmeasureunit(HWND hWnd, TWAIN_CAP_DATA *typeUnit); |
Java | int vic.victw32jni.TWsetmeasureunit(int hWnd, TWAIN_CAP_DATA typeUnit); |
Function Arguments
hWnd | Window handle |
typeUnit | Variable of type TWAIN_CAP_DATA |
Description
The TWsetmeasureunit function sets the measurement unit to be used for future
image acquisition. To set the measurement unit place the proper defined
constant in oneVal.val and set conType to TWON_ONEVALUE.
The unit type constants are defined as follows:
Value | Defined Constant | Description |
0 | TWUN_INCHES | Inches |
1 | TWUN_CENTIMETERS | Centimeters |
2 | TWUN_PICAS | Picas (1/6 inch) |
3 | TWUN_POINTS | Points (1/72 inch) |
4 | TWUN_TWIPS | Twips |
5 | TWUN_PIXELS | Pixels |
To determine the valid measurement units call TWgetmeasureunit.
The TWAIN_CAP_DATA structure elements are defined as follows:
conType | Receives the value of container type
5 = TWON_ONEVALUE 4 = TWON_ENUMERATION 6 = TWON_RANGE | ||||||||||
oneVal | Container of type TWAIN_ONEVALUE
| ||||||||||
enum | Container of type TWAIN_ENUMTYPE
| ||||||||||
range | Container of type TWAIN_RANGE
|
The new measurement unit is not put into effect until an image is acquired with a scan image function call and may not be verifiable by calling TWgetmeasureunit.
Return value
NO_ERROR | Function successful |
TWAIN_NODSM | Could not open TWAIN Source Manager |
TWAIN_NODS | Could not open TWAIN Data Source |
TWAIN_BUSY | TWAIN module is busy |
TWAIN_ERR | Function failed, call TWgeterror for more info |
Example C/C++ | Example VB
See TWsetpixeltype
Function Prototypes
Visual Basic | Declare Function TWsetpagesize Lib "VICTW32.DLL" (ByVal hWnd As Long, ByVal pageConst as long) As long |
C/C++ | int TWsetpagesize(HWND hWnd, unsigned pageConst); |
Java | int vic.victw32jni.TWsetpagesize(int hWnd, int pageConst); |
Function Arguments
hWnd | Window handle |
pageConst | Defined constant for page size |
Description
The TWsetpagesize function specifies the page size the device should use to
acquire image data. Some of the common page size constants are:
Value | Defined Constant |
0 | TWSS_NONE |
1 | TWSS_A4LETTER |
2 | TWSS_B5LETTER |
3 | TWSS_USLETTER |
4 | TWSS_USLEGAL |
For devices that support physical dimensions use TWSS_NONE to specify the maximum image size supported by the device.
Return value
NO_ERROR | Function successful |
TWAIN_NODSM | Could not open TWAIN Source Manager |
TWAIN_NODS | Could not open TWAIN Data Source |
TWAIN_BUSY | TWAIN module is busy |
TWAIN_ERR | Function failed, call TWgeterror for more info |
See also
TWgetphysicalsize
Example C/C++ | Example VB See TWgetphysicalsize
Function Prototypes
Visual Basic | Declare Function TWsetpixeltype Lib "VICTW32.DLL" (ByVal hWnd As Long, ByRef pixelType As TWAIN_CAP_DATA) As Long |
C/C++ | int TWsetpixeltype(HWND hWnd, TWAIN_CAP_DATA *pixelType); |
Java | int vic.victw32jni.TWsetpixeltype(int hWnd, TWAIN_CAP_DATA pixelType); |
Function Arguments
hWnd | Window handle |
pixelType | Variable of type TWAIN_CAP_DATA |
Description
The TWsetpixeltype function sets the pixel type to be used for future image
acquisition. To set the pixel type place the proper defined constant in
oneVal.val and set conType to TWON_ONEVALUE.
The pixel type constants are defined as follows:
Value | Defined Constant | Description |
0 | TWPT_BW | Black and white |
1 | TWPT_GRAY | Grayscale |
2 | TWPT_RGB | RGB |
3 | TWPT_PALETTE | Palette color |
4 | TWPT_CMY | CMY |
5 | TWPT_CMYK | CMYK |
6 | TWPT_YUV | YUV |
7 | TWPT_YUVK | YUVK |
8 | TWPT_CIEXYZ | CIEXYZ |
To determine the valid pixel types call TWwgetpixeltype.
The new pixel type is not put into effect until an image is retrieved with a scan image function call and may not be verifiable by calling TWgetpixeltype.
The TWAIN_CAP_DATA structure elements are defined as follows:
conType | Receives the value of container type
5 = TWON_ONEVALUE 4 = TWON_ENUMERATION 6 = TWON_RANGE | ||||||||||
oneVal | Container of type TWAIN_ONEVALUE
| ||||||||||
enum | Container of type TWAIN_ENUMTYPE
| ||||||||||
range | Container of type TWAIN_RANGE
|
The Victor TWscan image functions can accept black and white, grayscale, RGB, and palette color images.
Return value
NO_ERROR | Function successful |
TWAIN_NODSM | Could not open TWAIN Source Manager |
TWAIN_NODS | Could not open TWAIN Data Source |
TWAIN_BUSY | TWAIN module is busy |
TWAIN_ERR | Function failed, call TWgeterror for more info |
Function Prototypes
Visual Basic | Declare Sub TWsetproductname Lib "VICTW32.DLL" (ByVal prodName As String) |
C/C++ | void TWsetproductname(LPCSTR prodName); |
Java | void vic.victw32jni.TWsetproductname(String prodName); |
Function Arguments
prodName | Name of the calling application |
Description
The TWsetproductname function tells the TWAIN data source the name of the
calling application. This name may be displayed by the data source during image
acquisition. The variable appname may contain up to 32 characters. To be
effective this function must be called before calling TWopen.
Return value
There is no return code.
Example C/C++ | Example VB
See TWopen
Function Prototypes
Visual Basic | Declare Function TWsetxresolution Lib "VICTW32.DLL" (ByVal hWnd As Long, resdata As TWAIN_CAP_DATA) As Long |
C/C++ | int TWsetxresolution(HWND hWnd, TWAIN_CAP_DATA *resdata); |
Java | int vic.victw32jni.TWsetxresolution(int hWnd, TWAIN_CAP_DATA resdata); |
Function Arguments
hWnd | Window handle |
resdata | Variable of type TWAIN_CAP_DATA |
Description
The TWsetxresolution function sets the horizontal resolution to be used for
future image acquisition. To set the resolution place the new value in
oneVal.val and set conType to TWON_ONEVALUE. To determine the valid horizontal
resolution range call TWgetxresolution.
The TWAIN_CAP_DATA structure elements are defined as follows:
conType | Receives the value of container type
5 = TWON_ONEVALUE 4 = TWON_ENUMERATION 6 = TWON_RANGE | ||||||||||
oneVal | Container of type TWAIN_ONEVALUE
| ||||||||||
enum | Container of type TWAIN_ENUMTYPE
| ||||||||||
range | Container of type TWAIN_RANGE
|
The new resolution is not put into effect until an image is retrieved with a scan image function call and may not be verifiable by calling TWgetxresolution.
Return value
NO_ERROR | Function successful |
TWAIN_NODSM | Could not open TWAIN Source Manager |
TWAIN_NODS | Could not open TWAIN Data Source |
TWAIN_BUSY | TWAIN module is busy |
TWAIN_ERR | Function failed, call TWgeterror for more info |
Example C/C++ | Example VB
See TWscanimageex
Function Prototypes
Visual Basic | Declare Function TWsetyresolution Lib "VICTW32.DLL" (ByVal hWnd As Long, resdata As TWAIN_CAP_DATA) As Long |
C/C++ | int TWsetyresolution(HWND hWnd, TWAIN_CAP_DATA *resdata); |
Java | int vic.victw32jni.TWsetyresolution(int hWnd, TWAIN_CAP_DATA resdata); |
Function Arguments
hWnd | Window handle |
resdata | Variable of type TWAIN_CAP_DATA |
Description
The TWsetyresolution function sets the vertical resolution to be used for
future image acquisition. To set the resolution place the new value in
oneVal.val and set conType to TWON_ONEVALUE. To determine the valid vertical
resolution range call TWgetyresolution.
The TWAIN_CAP_DATA structure elements are defined as follows:
conType | Receives the value of container type
5 = TWON_ONEVALUE 4 = TWON_ENUMERATION 6 = TWON_RANGE | ||||||||||
oneVal | Container of type TWAIN_ONEVALUE
| ||||||||||
enum | Container of type TWAIN_ENUMTYPE
| ||||||||||
range | Container of type TWAIN_RANGE
|
The new resolution is not put into effect until an image is retrieved with a scan image function call and may not be verifiable by calling TWgetyresolution.
Return value
NO_ERROR | Function successful |
TWAIN_NODSM | Could not open TWAIN Source Manager |
TWAIN_NODS | Could not open TWAIN Data Source |
TWAIN_BUSY | TWAIN module is busy |
TWAIN_ERR | Function failed, call TWgeterror for more info |
Example C/C++ | Example VB
See TWscanimageex
Function Prototypes
C/C++ | void TWStaticLibStart(HINSTANCE hinst); |
Function Arguments
hinst | Window instance |
Description
The TWStaticLibStart function initializes the static Victor Library functions
and structures. This function must be called before any other Victor functions.
It is usually called in the instance initialization function.
Function Prototypes
C/C++ | void TWStaticLibTerm(void); |
Description
The TWStaticLibTerm function frees resources used by the static library Victor
Twain support module before an application ends. This function should be called
after all other TWAIN functions. It is usually called when the main window is
being destroyed, before the Windows PostQuitMessage.
Function Prototypes
Visual Basic | Declare Function TWvicversion Lib "VICTW32.DLL" () As Integer |
C/C++ | WORD TWvicversion(void); |
Java | short vic.victw32jni.TWvicversion(); |
Description
The TWvicversion function returns the version of the Victor Library TWAIN
support module.
Return value
The version number is returned as a two-byte WORD. The high-order byte contains
the major version number. The low-order byte contains the minor version number
as a two-digit decimal number.
Function Prototypes
Visual Basic | Declare Sub unlockLZW Lib "VIC32.DLL"(ByVal key as long) |
C/C++ | void unlockLZW(DWORD key); |
Java | void vic.vic32jni.unlockLZW(int key); |
Function Arguments
key | Required key |
Description
The unlockLZW function enables LZW compression and decompression in the Victor Library. The required key will be supplied to you when you provide to Catenary Systems proof of a valid LZW license agreement with Unisys. This proof can be a fax of a fully executed software license agreement.
Unisys holds the patent rights to the LZW compression technology used in GIF and TIFF-LZW image files. The LZW license agreement is necessary if you wish to use this technology. This is true regardless of how you develop the LZW support, what library you use, or even if you write all the code yourself.
The license generally requires modest royalty payments for any commercial application. To establish an agreement with Unisys contact: Unisys Corporation, Welch Licensing Dept - C1SW19, Township Line & Union Meeting Roads, PO Box 500, Blue Bell PA 19424, fax: 215 986 5721, url: www.unisys.com
If the LZW functionality is not unlocked then the following functions will
return LZW_DISABLED
if compression or decompression of an LZW-compressed image is attemped:
savegif, savegifex, loadgif, savetif, savetifpage, loadtif, and loadtifpage.
Return value
There is no return value.
Function Prototypes
Function Arguments
Description
Updatebitmapcolortable is available only in the Victor Library for 32-bit
Windows and has utility only in Windows 95 and Windows NT version 3.51 or
later.
When a device independent bitmap (DIB) is created with allocimage, a default
palette is set up that is used to initialize the bitmap's color table. If the
palette data subsequently changes, through loading a file, for example, the
DIB's color table may need to be updated to accurately represent the DIB. This
can be done using the updatebitmapcolortable function. This function
does not need to be called if the viewimage or
viewimageex function is used to display the DIB. Both view functions
automatically update a DIB's color table to make sure the DIB is displayed
properly. Also, updatebitmapcolortable only affects the color table associated
with the DIB (resimg.hBitmap) and not the DIB's palette at
resimg.palette.
Return value
This example updates the color table associated with the DIB handle.
Function Prototypes
Function Arguments
Description
The usetable function assigns every pixel within the source image area to a new
value in the result image area using a lookup table. The source and result
image areas are defined by the corresponding image descriptors.
The result pixel is computed using the source pixel's current value as an index
into the lookup table. For an 8-bit image, only redtable is used.
For a 24-bit image, redtable, grntable, and blutable are used.
Return value
This example computes a gamma correction table and applies it to an image.
Function Prototypes
Description
Function Prototypes
Function Prototypes
Description
The Victorversion function returns the version of the Victor Image Processing
Library.
Return value
The version number is returned as a two-byte WORD
. The high-order byte contains the major version number. The low-order byte
contains the minor version number as a two-digit decimal number.
Function Prototypes
Description
The Victorversiondate function returns version and the date of the Victor Image Processing
Library. The date is placed into the string, desStr. The bufchars parameter specifies the
maximum number of characters the desStr buffer can hold.
Return value
The version number is returned as a two-byte WORD
. The high-order byte contains the major version number. The low-order byte
contains the minor version number as a two-digit decimal number.
Function Prototypes
Function Arguments
Description
The VIC_VERSION_INFO structure elements are defined as follows:
The library version number is placed in the version element as a two-byte WORD.
The high-order byte contains the major version number and the low-order byte
contains the minor version number as a two-digit decimal number.
The exver element receives extended version information. The bits in exver are
defined in Table 19.
As an example exver = 7 indicates a release version, multithread- safe Victor
Library that uses the C static run-time library.
Return value
The version number is returned as a two-byte WORD.
Function Prototypes
Function Arguments
Description
The victowinpal function creates a logical palette from an image palette. If
successful, the handle to the logical palette is placed in hPal. This handle
can be used to select and realize a logical palette for image display.
A logical palette created with this function must be released with the Windows
DeleteObject function when no longer needed.
Return value
Function Prototypes
Function Arguments
Description
The viewimage function displays an image on a device context.
The source image is defined by the image descriptor.
C/C++ programming: for positioning the image anywhere in the window
and automatic color reduction use the viewimageex function.
VB programming: instead of calling viewimage,
place the image into a VB Picture Box by calling the image_to_picturebox function
defined in the Victor Library VB6 application loadpic.
This function creates a logical palette from an image palette. If successful,
the handle to the logical palette is placed in hPal. This handle can be used to
select and realize the logical palette in response to Windows
WM_QUERYNEWPALETTE and WM_PALETTECHANGED messages.
The logical palette created with this function must be released with the
Windows DeleteObject function when no longer needed (see example).
The xpos and ypos variables represent the coordinates of the first visible
pixel at the upper left corner in the window. If images are to be scrolled use
the Windows SetScrollRange or SetScrollInfo function to
display the scroll bars. Scroll ranges should be set to:
If the scroll ranges are set in this manner, the Windows GetScrollPos function
can be used to determine xpos and ypos (see example).
Viewimage displays as much of the image as will fit in the window beginning at
(xpos, ypos). This function ignores the image area defined by stx, sty, endx,
and endy. To display only a portion of an image, use copyimage to copy the
image area into a new buffer, sized to fit the area exactly, then call
viewimage to display the new buffer. The source code for viewimage is included
with the library in the module VICCORE.C.
Return value
See also
viewimageex
Function Prototypes
Function Arguments
Description
The viewimageex function displays an image on a device context.
The source image is defined by the image descriptor.
VB programming: instead of calling viewimageex, place the image into a
VB Picture Box by calling the image_to_picturebox function
defined in the Victor Library VB6 application loadpic.
This function creates a logical palette from an image palette. If successful,
the handle to the logical palette is placed in hPal. This handle can be used to
select and realize the logical palette in response to Windows messages
WM_QUERYNEWPALETTE and WM_PALETTECHANGED.
The logical palette created with this function must be released with the
Windows DeletePalette function when no longer needed (see example).
Scrnx and scrny represent the window coordinates where the image is to be
displayed. If Scrnx and scrny are zero, the image will be displayed in the
upper left corner of the window.
Xpos and ypos are pixel coordinates within the image and represent the upper
left corner of the section of the image to be displayed. In other words, image
display starts at xpos, ypos. If the image is to be scrolled, use the Windows
SetScrollRange or SetScrollInfo function to display the scroll bars.
Scroll ranges should be set to:
If the scroll ranges are set in this manner, the Windows GetScrollPos function
can be used to set xpos and ypos (see example).
Viewimageex displays as much of the image as will fit in the window. This
function ignores the image area defined by stx, sty, endx, and endy. This
allows viewing an entire image regardless of what image area is set. To display
only a portion of an image, use copyimage to copy the image area into a new
buffer, sized to fit the area exactly, then call viewimageex to display the new
buffer.
Viewimageex automatically uses color reduction to display an image that
contains more colors than the video mode can display. For example, if a 24-bit
image is displayed in a 256-color display mode. The variable colRedMode
determines which color reduction method is used (see Table 20 below).
ColRedMode is ignored if an image contains fewer colors than the video mode can
display. ColRedMode is ignored if the video mode can display as many colors as
the image contains.
For additional information on the color reduction methods, see the function
descriptions.
The source code for viewimageex is included with the library in the module
VICCORE.C.
Return value
See also
viewimage
Function Prototypes
Function Arguments
Description
If the function is successful the image descriptor resimg is filled in.
Windowtoimage allocates memory to hold the image, so freeimage must be called
when this memory is no longer needed.
Return value
See also
Function Prototypes
Function Arguments
Description
The wintovicpal function creates an image palette from a logical palette. The
function places the palette data into the buffer defined by the image
descriptor member palette, enters the size of the palette into the image
descriptor member colors.
Return value
Function Prototypes
Function Arguments
Description
The wtaverage function combines the brightness level of each pixel in the source
area image with the brightness level of the corresponding pixel in the operator
image area and places the weighted average in the result image area. The
variable weight may range from 0 to 100.
The image areas are defined by the corresponding image descriptors.
Return value
Function Prototypes
Function Arguments
Description
The xorimage function XORs the value of each pixel in the source image area with
the value of the corresponding pixel in the operator image area and places the
result in the result image area.
The image areas are defined by the corresponding image descriptors.
Return value
See also
andimage, orimage
Function Prototypes
Function Arguments
Description
The zeroimage function sets all brightness levels within an image area to the
new value. The image area is defined by the image descriptor.
Return value
Function Prototypes
Function Arguments
Description
The zeroimgdes function zeros all elements in an image descriptor. Note that
this function does not zero any image data, it only modifies structure member
data. Zeroimgdes is equivalent to:
Return value
There is no return value.
updatebitmapcolortable
1
8
Visual Basic
Declare Function updatebitmapcolortable Lib "VIC32.DLL" (resimg As imgdes) As Long
C/C++
int updatebitmapcolortable(imgdes *resimg);
Java
int vic.vic32jni.updatebitmapcolortable(imgdes resimg);
resimg
Result image
NO_ERROR Function successful BAD_MEM Insufficient memory
usetable
8
24
Visual Basic
Declare Function usetable Lib "VIC32.DLL" (redtab As Byte, grntab As Byte, blutab As Byte, srcimg As imgdes, resimg As imgdes) As Long
C/C++
int usetable(UCHAR *redtab, UCHAR *grntab, UCHAR *blutab, imgdes *srcimg, imgdes *resimg);
Java
int vic.vic32jni.usetable(byte[] redtab, byte[] grntab, byte[] blutab, imgdes srcimg, imgdes resimg);
redtab
Table of red values to use
grntab
Table of green values to use
blutab
Table of blue values to use
srcimg
Source image
resimg
Result image
Result = redtable[Source]
NO_ERROR Function successful BAD_RANGE Range error, see Appendix A BAD_IBUF Invalid image buffer address BAD_MEM Insufficient local memory BAD_BPP Source and result are not both 8- or 24-bit BAD_DIB Source or result is a compressed DIB
VicLibStart
C/C++
void VicLibStart(void);
The VicLibStart function initializes the static Victor Library functions and
structures.This function must be called before any other Victor functions when
using the static linkable Victor Library. It is usually called in the instance
initialization function.
VicLibTerm
C/C++
void VicLibTerm(void);
Description
The VicLibTerm function frees resources used by the static Victor Library
before an application ends. This function should be called after all other
Victor functions. It is usually called when the main window is being destroyed,
before the Windows PostQuitMessage.
Victorversion
Visual Basic
Declare Function Victorversion Lib "VIC32.DLL" () As Integer
C/C++
WORD Victorversion(void);
Java
short vic.vic32jni.Victorversion();
Victorversiondate
Visual Basic
Declare Function Victorversiondate Lib "VIC32.DLL" (desStr, int bufchars) As Integer
C/C++
WORD Victorversiondate(LPSTR desStr, int bufchars);
Java
short vic.vic32jni.Victorversiondate(String desStr, int bufchars);
Victorversionex
Visual Basic
Declare Function Victorversionex Lib "VIC32.DLL" (vicVerInfo As VIC_VERSION_INFO) As Integer
C/C++
WORD Victorversionex(VIC_VERSION_INFO *vicVerInfo);
Java
short vic.vic32jni.Victorversionex(VIC_VERSION_INFO vicVerInfo);
vicVerInfo
Variable of type VIC_VERSION_INFO to receive the data
The Victorversionex function places version information about the Victor Image
Processing Library in vicVerinfo.
version
Version number
exver
Extended version information
Table 19. Extended Victor Version Information
Bit
Bit value
Meaning
0
0
Uses C dynamic run-time library, i.e., MSVCRTxx.DLL
1
Uses C static run-time library
1
0
Not multithread-safe
1
Multithread-safe
2
0
Beta prerelease version
1
Release version
3
0
Nonevaluation (retail) version
1
Evaluation version, time limited
victowinpal
Visual Basic
Declare Function victowinpal Lib "VIC32.DLL" (srcimg As imgdes, hPal As Long) As Long
C/C++
int victowinpal(imgdes *srcimg, HPALETTE *hPal);
Java
int vic.vic32jni.victowinpal(imgdes srcimg, refvar hPal);
srcimg
Source image
hPal
Variable to receive the logical palette handle
NO_ERROR Function successful BAD_MEM Insufficient local memory
viewimage
1
8
24
Visual Basic
Declare Function viewimage Lib "VIC32.DLL" (ByVal hWnd As Long, ByVal hdc As Long, hPal As Long, ByVal xpos As Long, ByVal ypos As Long, srcimg As imgdes) As Long
C/C++
int _export WINAPI viewimage(HWND hWnd, HDC hdc, HPALETTE *hPal,
int xpos, int ypos, imgdes *srcimg);
Java
int vic.vic32jni.viewimage(int hWnd, int hdc, refvar hPal, int xpos, int ypos, imgdes srcimg);
hWnd
Window handle
hdc
Device context handle
hPal
Variable to receive the logical palette handle
xpos
Horizontal scroll position
ypos
Vertical scroll position
srcimg
Source image
NO_ERROR Function successful BAD_MEM Insufficient local memory
viewimageex
1
8
24
Visual Basic
Declare Function viewimageex Lib "VIC32.DLL" (ByVal hWnd As Long, ByVal hdc As Long,
hPal As Long, ByVal xpos As Long, ByVal ypos As Long, srcimg As imgdes,
ByVal scrnx As Long, ByVal scrny As Long, ByVal colRedMode As Long) As Long
C/C++
int viewimageex(HWND hWnd, HDC hdc, HPALETTE *hPal,
int xpos, int ypos, imgdes *srcimg, int scrnx, int scrny, int colRedMode);
Java
int vic.vic32jni.viewimageex(int hWnd, int hdc,
refvar hPal, int xpos, int ypos, imgdes srcimg,
int scrnx, int scrny, int colRedMode);
hWnd
Window handle
hdc
Device context handle
hPal
Variable to receive the logical palette handle
xpos
Horizontal scroll position
ypos
Vertical scroll position
srcimg
Source image
scrnx
Horizontal position in window to display image
scrny
Vertical position in window to display image
colRedMode
Color reduction mode
0 = optimized palette
1 = color dither
2 = color scatter
Table 20. Color Reduction Methods Used
by viewimageex
colRedMode
Color reduction method
Function used
VIEWOPTPAL (0)
Optimized palette
convertrgbtopal
VIEWDITHER (1)
Color dither with rainbow palette
colordither
VIEWSCATTER (2)
Color scatter with rainbow palette
colorscatter
NO_ERROR Function successful BAD_RANGE Range error, see Appendix A BAD_IBUF Invalid image buffer address BAD_MEM Insufficient local or global memory BAD_BPP Image is not 1-, 8-, or 24-bit BAD_DIB Image is a compressed DIB
windowtoimage
1
8
24
Visual Basic
Declare Function windowtoimage Lib "VIC32.DLL" (ByVal hWnd As Long, resimg As imgdes) As Long
C/C++
int windowtoimage(HWND hWnd, imgdes *resimg);
Java
int vic.vic32jni.windowtoimage(int hWnd, imgdes resimg);
hWnd
Window handle
resimg
Result image
The windowtoimage function creates a Victor-compatible image from a window.
This function provides an easy way to capture a window displayed on the screen.
The result image will have the same bits per pixel as the current display mode.
NO_ERROR Function successful BAD_MEM Insufficient memory BAD_BPP Bits per pixel not 1, 4, 8, 16, or 24
clienttoimage
wintovicpal
Visual Basic
Declare Function wintovicpal Lib "VIC32.DLL" (ByVal hpal As Long, resimg As imgdes) As Long
C/C++
int wintovicpal(HPALETTE hPal, imgdes *resimg);
Java
int vic.vic32jni.wintovicpal(int hPal, imgdes resimg);
hPal
Logical palette handle
resimg
Result image
NO_ERROR Function successful BAD_MEM Insufficient local memory
wtaverage
8
24
Visual Basic
Declare Function wtaverage Lib "VIC32.DLL" (ByVal weight As Long, srcimg As imgdes, oprimg As imgdes, resimg As imgdes) As Long
C/C++
int wtaverage(int weight, imgdes *srcimg,
imgdes *oprimg, imgdes *resimg);
Java
int vic.vic32jni.wtaverage(int weight, imgdes srcimg, imgdes oprimg, imgdes resimg);
weight
Weight factor for the source image (0-100)
srcimg
Source image
oprimg
Operator image
resimg
Result image
Result = (weight * Source + (100 - weight) * Operator) / 100
NO_ERROR Function successful BAD_RANGE Range error, see Appendix A BAD_IBUF Invalid image buffer address BAD_MEM Insufficient local memory BAD_BPP Images are not all 8- or 24-bit BAD_DIB Image is a compressed DIB BAD_FAC Weight value is outside the range 0 - 100
xorimage
1
8
24
Visual Basic
Declare Function xorimage Lib "VIC32.DLL" (srcimg As imgdes, oprimg As imgdes, resimg As imgdes) As Long
C/C++
int xorimage(imgdes *srcimg, imgdes *oprimg, imgdes *resimg);
Java
int vic.vic32jni.xorimage(imgdes srcimg, imgdes oprimg, imgdes resimg);
srcimg
Source image
oprimg
Operator image
resimg
Result image
Result = Source ^ Operator
NO_ERROR Function successful BAD_RANGE Range error, see Appendix A BAD_IBUF Invalid image buffer address BAD_MEM Insufficient local memory BAD_BPP Images are not all 1-, 8-, or 24-bit BAD_DIB Image is a compressed DIB
zeroimage
1
8
24
Visual Basic
Declare Function zeroimage Lib "VIC32.DLL" (ByVal newval As Long, resimg As imgdes) As Long
C/C++
int zeroimage(int newval, imgdes *resimg);
Java
int vic.vic32jni.zeroimage(int newval, imgdes resimg);
newval
New pixel value to set (0-255)
resimg
Result image
NO_ERROR Function successful BAD_RANGE Range error, see Appendix A BAD_IBUF Invalid image buffer address BAD_MEM Insufficient local memory BAD_BPP Image is not 1-, 8-, or 24-bit BAD_DIB Image is a compressed DIB BAD_FAC Newval is outside the r ange 0 to 255
zeroimgdes
Visual Basic
Declare Sub zeroimgdes Lib "VIC32.DLL" (resimg As imgdes)
C/C++
void zeroimgdes(resimg *image);
Java
void vic.vic32jni.zeroimgdes(resimg image);
resimg
Result image
resimg.ibuff = 0
resimg.stx = 0
resimg.sty = 0
resimg.endx = 0
resimg.endy = 0
resimg.buffwidth = 0
resimg.palette = 0
resimg.colors = 0
resimg.imgtype = 0
resimg.bmh = 0
resimg.hBitmap = 0
or
memset(resimg, 0, sizeof(imgdes));