sortpixelsbyval
| 8 | 24 |
Function Prototypes
| Visual Basic | Declare Function sortpixelsbyval Lib "VICSTATS.DLL" (ByRef resimg As imgdes, ByRef coordinatearray As COORD_VAL, ByVal nelem As Long) As Long |
| VB.NET | Declare Function sortpixelsbyval Lib "VICSTATS.DLL" (ByRef resimg As imgdes, ByRef coordinatearray As COORD_VAL, ByVal nelem As integer) As Integer |
| C# | int vicwin.sortpixelsbyval(ref imgdes srcimg, ref COORD_VAL coordinatearray, int nelem) |
| C/C++ | int sortpixelsbyval(imgdes *srcimg, COORD_VAL *coordinatearray, int nelem) |
| viclib64 | |
| C# | int vicwin.sortpixelsbyval(ref imgdes srcimg, COORD_VAL[] coordinatearray, int nelem) |
Function Arguments
| srcimg | Source image |
| coordinatearray | Array of COORD_VAL structures to be filled in |
| nelem | Number of COORD_VAL structures in coordinatearray |
Description
The sortpixelsbyval function sorts the pixel values of the source image area and places them in the array in descending brightness order. This is used to find the brightest (or darkest) values in an area. The image area is defined by the image descriptor.
For 24-bit RGB images the array is sorted by the sum of the red, green, and blue components of pixel values.
Allocate the coordinatearray before calling sortpixelsbyval and be sure to make it large enough to hold all the pixels.
The COORD_VAL structure elements are defined as follows:
| val | pixel value |
| x | x-coordinate |
| y | y-coordinate |
Download the analysis module vicstats.
Import library for MSVC: vicstats.lib
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 | Image is not 8-bit |
| BAD_DIB | Image is a compressed DIB |
VB and C/C++ Examples Pattern Recognition, find a mark in an image.
standardpalette
| 8 |
Function Prototypes
| Visual Basic | Declare Function standardpalette Lib "VIC32.DLL" (resimg As imgdes) As Long |
| VB.NET | Declare Function standardpalette Lib "VIC32.DLL" (ByRef resimg As imgdes) As Integer |
| C# | int vicwin.standardpalette(ref imgdes resimg); |
| 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
subimage
| 8 | 24 |
Function Prototypes
| Visual Basic | Declare Function subimage Lib "VIC32.DLL" (srcimg As imgdes, oprimg As imgdes, resimg As imgdes) As Long |
| VB.NET | Declare Function subimage Lib "VIC32.DLL" (ByRef srcimg As imgdes, ByRef oprimg As imgdes, ByRef resimg As imgdes) As Integer |
| C# | int vicwin.subimage(ref imgdes srcimg, ref imgdes oprimg, ref imgdes resimg); |
| 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.
-
Result = Source - Operator
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 |
tgainfo
Function Prototypes
| Visual Basic | Declare Function tgainfo Lib "VIC32.DLL" (ByVal filename As String, tinfo As TgaData) As Long |
| VB.NET | Declare Function tgainfo Lib "VIC32.DLL" (ByVal filename As String, ByRef tinto As TgaData) As Integer |
| C# | int vicwin.tgainfo(ref string filename, ref TgaData tinfo); |
| 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
threshold
| 8 | 24 |
Function Prototypes
| Visual Basic | Declare Function threshold Lib "VIC32.DLL" (ByVal threshold As Long, srcimg As imgdes, resimg As imgdes) As Long |
| VB.NET | Declare Function threshold Lib "VIC32.DLL" (ByVal thres As Integer, ByRef srcimg As imgdes, ByRef resimg As imgdes) As Integer |
| int vicwin.threshold(int threshold, ref imgdes srcimg, ref imgdes resimg); | |
| 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.
-
if Source > threshold
-
Result = Source
-
Result = 0
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 |
tiffgeterror
Function Prototypes
| Visual Basic | Declare Function tiffgeterror Lib "VIC32.DLL" () As Long |
| VB.NET | Declare Function tiffgeterror Lib "VIC32.DLL" () As Integer |
| C# | int vicwin.tiffgeterror(void); |
| 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 |
tiffgetpageinfo
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 |
| VB.NET | Declare Function tiffgetpageinfo Lib "VIC32.DLL" (ByVal filename As String, ByRef totalpages As Integer, ByRef pagearray As Integer, ByVal arrayelems As Integer) As Integer |
| C# | int vicwin.tiffgetpageinfo(ref string filename, ref int totalPages, ref int pageArray_firstelem, int arrayElems); |
| 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
tiffgetpageinfofrombuffer
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 |
| VB.NET | Declare Function tiffgetpageinfofrombuffer Lib "VIC32.DLL" (ByVal buffer As Integer, ByRef totalpages As Integer, ByRef pageArray As Integer, ByVal arrayelems As Integer) As Integer |
| C# | int vicwin.tiffgetpageinfofrombuffer(ref byte buffer_firstelem, ref int totalPages, ref int pageArray_firstelem, int arrayElems); |
| 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); |
| viclib64 | |
| C# | int vicwin.tiffgetpageinfofrombuffer( System.IntPtr buffer, ref int totalPages, ref int pageArray_firstelem, 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
tiffgetSOIofspagebyindex
Function Prototypes
| Visual Basic | Declare Function tiffgetSOIofspagebyindex Lib "VIC32.DLL" (ByVal filename As String, soiOfs As Long, ByVal pageIndex As Long) As Long |
| VB.NET | Declare Function tiffgetSOIofspagebyindex Lib "VIC32.DLL" (ByVal filename As String, soiOfs As Integer, ByVal pageIndex As Integer) As Integer |
| C# | int vicwin.tiffgetSOIofspagebyindex(ref string filename, ref int soiOfs, int pageIndex); |
| 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
tiffgetSOIofspagebyindexfrombuffer
Function Prototypes
| Visual Basic | Declare Function tiffgetSOIofspagebyindexfrombuffer Lib "VIC32.DLL" (ByVal buffer As Long, soiOfs As Long, ByVal pageIndex As Long) As Long |
| VB.NET | Declare Function tiffgetSOIofspagebyindexfrombuffer Lib "VIC32.DLL" (ByVal buffer As Integer, soiOfs As Integer, ByVal pageIndex As Integer) As Integer |
| C# | int vicwin.tiffgetSOIofspagebyindexfrombuffer(ref byte buffer_firstelem, ref int soiOfs, int pageIndex); |
| C/C++ | int tiffgetSOIofspagebyindexfrombuffer(UCHAR *buffer, unsigned long *soiOfs, int pageIndex); |
| Java | int vic.vic32jni.tiffgetSOIofspagebyindexfrombuffer(int buffer, refvar soiOfs, int pageIndex); |
| viclib64 | |
| C# | int vicwin.tiffgetSOIofspagebyindexfrombuffer( System.IntPtr buffer, ref uint 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
tiffgetxyresolution
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 |
| VB.NET | Declare Function tiffgetxyresolution Lib "VIC32.DLL" (ByVal filename As String, ByRef xres As Integer, ByRef yres As Integer, ByRef resunit As Integer) As Integer |
| C# | int vicwin.tiffgetxyresolution(ref string filename, ref int xres, ref int yres, ref int resunit); |
| 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
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 |
| VB.NET | Declare Function tiffgetxyresolutionpagebyindex Lib "VIC32.DLL" (ByVal filename As String, ByRef xres As Integer, ByRef yres As Integer, ByRef resunit As Integer, ByVal targetpage As Integer) As Integer |
| C# | int vicwin.tiffgetxyresolutionpagebyindex(ref string filename, ref int xres, ref int yres, ref int resunit, int targetpage); |
| 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
tiffinfo
Function Prototypes
| Visual Basic | Declare Function tiffinfo Lib "VIC32.DLL" (ByVal filename As String, tinfo As TiffData) As Long |
| VB.NET | Declare Function tiffinfo Lib "VIC32.DLL" (ByVal filename As String, ByRef tinto As TiffData) As Integer |
| C# | int vicwin.tiffinfo(ref string filename, ref TiffData tinfo); |
| 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 |
- Possible compression values (Comp) are:
- 1 No compression
- 2 CCITT Group 3
- 3 Fax compatible Group 3
- 4 Fax compatible Group 4
- 5 LZW
- 6 JPEG
- 7 JPEG
- 32773 PackBits
- 2 CCITT Group 3
- Possible photometric interpretation (PhotoInt) values are:
-
0 White is zero, bilevel or grayscale
- 1 Black is zero, bilevel or grayscale
- 2 RGB
- 3 Palette color
- 4 Transparency mask
- 5 CMYK
- 6 YCbCr
- 8 CIELab
- 1 Black is zero, bilevel or grayscale
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
tiffinfofrombuffer
Function Prototypes
| Visual Basic | Declare Function tiffinfofrombuffer Lib "VIC32.DLL" (ByVal buffer As Long, tinfo As TiffData) As Long |
| VB.NET | Declare Function tiffinfofrombuffer Lib "VIC32.DLL" (ByVal buff As Integer, ByRef tinto As TiffData) As Integer |
| C# | int vicwin.tiffinfofrombuffer(ref byte buffer_firstelem, ref TiffData tinfo); |
| C/C++ | int tiffinfofrombuffer(UCHAR *buffer, TiffData *tinfo); |
| Java | int vic.vic32jni.tiffinfofrombuffer(int buffer, TiffData tinfo); |
| viclib64 | |
| C# | int vicwin.tiffinfofrombuffer( System.IntPtr buffer, ref 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
tiffinfopage
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 |
| VB.NET | Declare Function tiffinfopage Lib "VIC32.DLL" (ByVal filename As String, ByRef tinto As TiffData, ByVal page As Integer) As Integer |
| C# | int vicwin.tiffinfopage(ref string filename, ref TiffData tinfo, int page); |
| 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
tiffinfopagebyindex
Function Prototypes
| Visual Basic | Declare Function tiffinfopagebyindex Lib "VIC32.DLL" (ByVal filename As String, tinfo As TiffData, ByVal pageIndex As Long) As Long |
| VB.NET | Declare Function tiffinfopagebyindex Lib "VIC32.DLL" (ByVal filename As String, ByRef tinto As TiffData, ByVal pageIndex As Integer) As Integer |
| C# | int vicwin.tiffinfopagebyindex(ref string filename, ref TiffData tinfo, int pageIndex); |
| 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
tiffinfopagebyindexex
Function Prototypes
| Visual Basic | Declare Function tiffinfopagebyindexex Lib "VIC32.DLL" (ByVal filename As String, tinfo As TiffDataEx, ByVal pageIndex As Long) As Long |
| VB.NET | Declare Function tiffinfopagebyindexex Lib "VIC32.DLL" (ByVal filename As String, ByRef tinfo As TiffDataEx, ByVal pageIndex As Integer) As Integer |
| C# | int vicwin.tiffinfopagebyindexex(ref string filename, ref TiffDataEx tinfo, int pageIndex); |
| 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
tiffinfopagebyindexfrombuffer
Function Prototypes
| Visual Basic | Declare Function tiffinfopagebyindexfrombuffer Lib "VIC32.DLL" (ByVal buffer As Long, tinfo As TiffData, ByVal pageIndex As Long) As Long |
| VB.NET | Declare Function tiffinfopagebyindexfrombuffer Lib "VIC32.DLL" (ByVal buffer As Integer, ByRef tinfo As TiffData, ByVal pageIndex As Integer) As Integer |
| C# | int vicwin.tiffinfopagebyindexfrombuffer(ref byte buffer_firstelem, ref TiffData tinfo, int pageIndex); |
| C/C++ | int tiffinfopagebyindexfrombuffer(UCHAR *buffer, TiffData *tinfo, int pageIndex); |
| Java | int vic.vic32jni.tiffinfopagebyindexfrombuffer(int buffer, TiffData tinfo, int pageIndex); |
| viclib64 | |
| C# | int vicwin.tiffinfopagebyindexfrombuffer( System.IntPtr buffer, ref 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
tiffinfopagebyindexfrombufferex
Function Prototypes
| Visual Basic | Declare Function tiffinfopagebyindexfrombufferex Lib "VIC32.DLL" (ByVal buffer As Long, tinfo As TiffDataEx, ByVal pageIndex As Long) As Long |
| VB.NET | Declare Function tiffinfopagebyindexfrombufferex Lib "VIC32.DLL" (ByVal buffer As Integer, ByRef tinfo As TiffDataEx, ByVal pageIndex As Integer) As Integer |
| C# | int vicwin.tiffinfopagebyindexfrombufferex(ref byte buffer_firstelem, ref TiffDataEx tinfo, int pageIndex); |
| C/C++ | int tiffinfopagebyindexfrombufferex(UCHAR *buffer, TiffDataEx *tinfo, int pageIndex); |
| Java | int vic.vic32jni.tiffinfopagebyindexfrombufferex(int buffer, TiffDataEx tinfo, int pageIndex); |
| viclib64 | |
| C# | int vicwin.tiffinfopagebyindexfrombufferex( System.IntPtr buffer, ref 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
tiffsetxyresolution
Function Prototypes
| Visual Basic | Declare Sub tiffsetxyresolution Lib "VIC32.DLL" (ByVal xres As Long, ByVal yres As Long, ByVal resunit As Long) |
| VB.NET | Declare Sub tiffsetxyresolution Lib "VIC32.DLL" (ByVal xres As Integer, ByVal yres As Integer, ByVal resunit As Integer) |
| C# | void vicwin.tiffsetxyresolution(unsigned xres, unsigned yres, unsigned resunit); |
| 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.
- The resunit value can be one of the following:
-
1 No unit of measurement
- 2 Inch
- 3 Centimeter
- 2 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
tile
| 8 | 24 |
Function Prototypes
| Visual Basic | Declare Function tile Lib "VIC32.DLL" (srcimg As imgdes, resimg As imgdes) As Long |
| VB.NET | Declare Function tile Lib "VIC32.DLL" (ByRef srcimg As imgdes, ByRef resimg As imgdes) As Integer |
| C# | int vicwin.tile(ref imgdes srcimg, ref imgdes resimg); |
| C/C++ | int tile(imgdes *srcimg, imgdes *resimg); |
| Java | int vic.vic32jni.tile(imgdes srcimg, imgdes resimg); |
Function Arguments
| srcimg | Source image |
| resimg | Result image |
Description
The tile function fills a result image with multiple copies of a smaller source image. The first copy is placed in the upper left corner of the result image area and successive copies fill the area from left to right, down the image area. The source and result 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 both 8- or 24-bit |
| BAD_DIB | Source or result is a compressed DIB |
TWclose
Function Prototypes
| Visual Basic | Declare Sub TWclose Lib "VICTW32.DLL" () |
| VB.NET | Declare Sub TWclose Lib "VICTW32.DLL" () |
| C# | void vicwin.TWclose(void); |
| 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.
TWdetecttwain
Function Prototypes
| Visual Basic | Declare Function TWdetecttwain Lib "VICTW32.DLL" (ByVal hWnd As Long) As Long |
| VB.NET | Declare Function TWdetecttwain Lib "VICTW32.DLL" (ByVal hWnd As Integer) As Integer |
| C# | int vicwin.TWdetecttwain(int hWnd); |
| C/C++ | int TWdetecttwain(HWND hWnd); |
| Java | int vic.victw32jni.TWdetecttwain(int hWnd); |
| viclib64 | |
| C# | int vicwin.TWdetecttwain(System.IntPtr 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 |
TWgetbrightness
Function Prototypes
| Visual Basic | Declare Function TWgetbrightness Lib "VICTW32.DLL" (ByVal hWnd As Long, ByRef brightdata As TWAIN_CAP_DATA) As Long |
| VB.NET | Declare Function TWgetbrightness Lib "VICTW32.DLL" (ByVal hWnd As Integer, ByRef brightdata As TWAIN_CAP_DATA) As Integer |
| C# | int vicwin.TWgetbrightness(int hWnd, ref TWAIN_CAP_DATA brightdata); |
| C/C++ | int TWgetbrightness(HWND hWnd, TWAIN_CAP_DATA *brightdata); |
| Java | int vic.victw32jni.TWgetbrightness(int hWnd, TWAIN_CAP_DATA brightdata); |
| viclib64 | |
| C# | int vicwin.TWgetbrightness( System.IntPtr hWnd, ref 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
TWgetcontrast
Function Prototypes
| Visual Basic | Declare Function TWgetcontrast Lib "VICTW32.DLL" (ByVal hWnd As Long, ByRef contrastdata As TWAIN_CAP_DATA) As Long |
| VB.NET | Declare Function TWgetcontrast Lib "VICTW32.DLL" (ByVal hWnd As Integer, ByRef contrastdata As TWAIN_CAP_DATA) As Integer |
| C# | int vicwin.TWgetcontrast(int hWnd, ref TWAIN_CAP_DATA contrastdata); |
| C/C++ | int TWgetcontrast(HWND hWnd, TWAIN_CAP_DATA *contrastdata); |
| Java | int vic.victw32jni.TWgetcontrast(int hWnd, TWAIN_CAP_DATA contrastdata); |
| viclib64 | |
| C# | int vicwin.TWgetcontrast( System.IntPtr hWnd, ref 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
TWgeterror
Function Prototypes
| Visual Basic | Declare Function TWgeterror Lib "VICTW32.DLL" () As Long |
| VB.NET | Declare Function TWgeterror Lib "VICTW32.DLL" () As Integer |
| C# | int vicwin.TWgeterror(void); |
| 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
TWgetfeeder
Function Prototypes
| Visual Basic | Declare Function TWgetfeeder Lib "VICTW32.DLL" (ByVal hWnd As Long, ByRef feederIsEnabled as Long, ByRef feederHasPaper as Long) As Long |
| VB.NET | Declare Function TWgetfeeder Lib "VICTW32.DLL" (ByVal hWnd As Integer, ByRef feederIsEnabled As Integer, ByRef feederHasPaper As Integer) As Integer |
| C# | int vicwin.TWgetfeeder(int hWnd, ref int feederIsEnabled, ref int feederHasPaper); |
| C/C++ | int TWgetfeeder(HWND hWnd, BOOL *feederIsEnabled, BOOL *feederHasPaper); |
| Java | int vic.victw32jni.TWgetfeeder(int hWnd, refvar feederIsEnabled, refvar feederHasPaper); |
| viclib64 | |
| C# | int vicwin.TWgetfeeder( System.IntPtr hWnd, ref int feederIsEnabled, ref int 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
TWgetmeasureunit
Function Prototypes
| Visual Basic | Declare Function TWgetmeasureunit Lib "VICTW32.DLL" (ByVal hWnd As Long, ByRef typeUnit As TWAIN_CAP_DATA) As Long |
| VB.NET | Declare Function TWgetmeasureunit Lib "VICTW32.DLL" (ByVal hWnd As Integer, ByRef typeUnit As TWAIN_CAP_DATA) As Integer |
| C# | int vicwin.TWgetmeasureunit(int hWnd, ref TWAIN_CAP_DATA typeUnit); |
| C/C++ | int TWgetmeasureunit(HWND hWnd, TWAIN_CAP_DATA *typeUnit); |
| Java | int vic.victw32jni.TWgetmeasureunit(int hWnd, TWAIN_CAP_DATA typeUnit); |
| viclib64 | |
| C# | int vicwin.TWgetmeasureunit( System.IntPtr hWnd, ref 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
TWgetpendingxfers
Function Prototypes
| Visual Basic | Declare Function TWgetpendingxfers Lib "VICTW32.DLL" (ByVal hWnd As Long, ByRef count as Long) As Long |
| VB.NET | Declare Function TWgetpendingxfers Lib "VICTW32.DLL" (ByVal hWnd As Integer, ByRef count As Integer) As Integer |
| C# | int vicwin.TWgetpendingxfers(int hWnd, ref int count); |
| C/C++ | int TWgetpendingxfers(HWND hWnd, int *count); |
| Java | int vic.victw32jni.TWgetpendingxfers(int hWnd, refvar count); |
| viclib64 | |
| C# | int vicwin.TWgetpendingxfers( System.IntPtr hWnd, ref int count); |
Function Arguments
| hWnd | Window handle |
| count | Variable to receive the count of images |
Description
The TWgetpendingxfers function gets number of images the source is ready to transfer to the application.
If the number of images cannot be determined and is not zero, -1 is returned. For example, source may return -1
if a scanner has an Automatic Document Feeder.
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 |
TWgetphysicalsize
Function Prototypes
| Visual Basic | Declare Function TWgetphysicalsize Lib "VICTW32.DLL" (ByVal hWnd As Long, ByRef width as Long, ByRef height as Long) As Long |
| VB.NET | Declare Function TWgetphysicalsize Lib "VICTW32.DLL" (ByVal hWnd As Integer, ByRef width As Integer, ByRef height As Integer) As Integer |
| C# | int vicwin.TWgetphysicalsize(int hWnd, ref int width, ref int height); |
| C/C++ | int TWgetphysicalsize(HWND hWnd, int *width, int *height); |
| Java | int vic.victw32jni.TWgetphysicalsize(int hWnd, refvar width, refvar height); |
| viclib64 | |
| C# | int vicwin.TWgetphysicalsize( System.IntPtr hWnd, ref int width, ref int 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
TWgetpixeltype
Function Prototypes
| Visual Basic | Declare Function TWgetpixeltype Lib "VICTW32.DLL" (ByVal hWnd As Long, ByRef pixelType As TWAIN_CAP_DATA) As Long |
| VB.NET | Declare Function TWgetpixeltype Lib "VICTW32.DLL" (ByVal hWnd As Integer, ByRef pixelType As TWAIN_CAP_DATA) As Integer |
| C# | int vicwin.TWgetpixeltype(int hWnd, ref TWAIN_CAP_DATA pixelType); |
| C/C++ | int TWgetpixeltype(HWND hWnd, TWAIN_CAP_DATA *pixelType); |
| Java | int vic.victw32jni.TWgetpixeltype(int hWnd, TWAIN_CAP_DATA pixelType); |
| viclib64 | |
| C# | int vicwin.TWgetpixeltype( System.IntPtr hWnd, ref 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
TWgetsourcenames
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 |
| VB.NET | Declare Function TWgetsourcenames Lib "VICTW32.DLL" (ByVal hWnd As Integer, ByRef namelist As TW_STR32, ByRef nameCount As Integer) As Integer |
| C# | int vicwin.TWgetsourcenames(int hWnd, ref TW_STR32 nameList, ref int nameCount); |
| C/C++ | int TWgetsourcenames(HWND hWnd, TW_STR32 *nameList, int *nameCount); |
| Java | int vic.victw32jni.TWgetsourcenames(int hWnd, char[] nameList, refvar nameCount); |
| viclib64 | |
| C# | int vicwin.TWgetsourcenames( System.IntPtr hWnd, ref TW_STR32 nameList, ref int 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 |
TWgetxresolution
Function Prototypes
| Visual Basic | Declare Function TWgetxresolution Lib "VICTW32.DLL" (ByVal hWnd As Long, ByRef resdata As TWAIN_CAP_DATA) As Long |
| VB.NET | Declare Function TWgetxresolution Lib "VICTW32.DLL" (ByVal hWnd As Integer, ByRef resdata As TWAIN_CAP_DATA) As Integer |
| C# | int vicwin.TWgetxresolution(int hWnd, ref TWAIN_CAP_DATA resdata); |
| C/C++ | int TWgetxresolution(HWND hWnd, TWAIN_CAP_DATA *resdata); |
| Java | int vic.victw32jni.TWgetxresolution(int hWnd, TWAIN_CAP_DATA resdata); |
| viclib64 | |
| C# | int vicwin.TWgetxresolution( System.IntPtr hWnd, ref 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
TWgetyresolution
Function Prototypes
| Visual Basic | Declare Function TWgetyresolution Lib "VICTW32.DLL" (ByVal hWnd As Long, ByRef resdata As TWAIN_CAP_DATA) As Long |
| VB.NET | Declare Function TWgetyresolution Lib "VICTW32.DLL" (ByVal hWnd As Integer, ByRef resdata As TWAIN_CAP_DATA) As Integer |
| C# | int vicwin.TWgetyresolution(int hWnd, ref TWAIN_CAP_DATA resdata); |
| C/C++ | int TWgetyresolution(HWND hWnd, TWAIN_CAP_DATA *resdata); |
| Java | int vic.victw32jni.TWgetyresolution(int hWnd, TWAIN_CAP_DATA resdata); |
| viclib64 | |
| C# | int vicwin.TWgetyresolution( System.IntPtr hWnd, ref 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
TWopen
Function Prototypes
| Visual Basic | Declare Function TWopen Lib "VICTW32.DLL" (ByVal hWnd As Long) As Long |
| VB.NET | Declare Function TWopen Lib "VICTW32.DLL" (ByVal hWnd As Integer) As Integer |
| C# | int vicwin.TWopen(int hWnd); |
| C/C++ | int TWopen(HWND hWnd); |
| Java | int vic.victw32jni.TWopen(int hWnd); |
| viclib64 | |
| C# | int vicwin.TWopen( System.IntPtr 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 |
TWscancountimages
| 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 |
| VB.NET | Declare Function TWscancountimages Lib "VICTW32.DLL" (ByVal hWnd As Integer, ByRef resimg As imgdes, ByRef scanrect As RECT, ByVal showIU As Integer, ByVal maxPages As Integer, ByVal saveScan As SCNFCT) As Integer |
| C# | int vicwin.TWscancountimages(int hWnd, ref imgdes resimg, ref RECT scanrect, BOOL showIU, int maxPages, SCNFCT saveScan)(ref imgdes thisimg)); |
| 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); |
| viclib64 | |
| C# | int vicwin.TWscancountimages( System.IntPtr hWnd, ref imgdes resimg, ref RECT scanrect, BOOL showIU, int maxPages, ref 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
TWscanimage
| 1 | 8 | 24 |
Function Prototypes
| Visual Basic | Declare Function TWscanimage Lib "VICTW32.DLL" (ByVal hWnd As Long, ByRef resimg As imgdes) As Long |
| VB.NET | Declare Function TWscanimage Lib "VICTW32.DLL" (ByVal hWnd As Integer, ByRef resimg As imgdes) As Integer |
| C# | int vicwin.TWscanimage(int hWnd, ref imgdes resimg); |
| C/C++ | int TWscanimage(HWND hWnd, imgdes *resimg); |
| Java | int vic.victw32jni.TWscanimage(int hWnd, imgdes resimg); |
| viclib64 | |
| C# | int vicwin.TWscanimage( System.IntPtr hWnd, ref 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
TWscanimageex
| 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 |
| VB.NET | Declare Function TWscanimageex Lib "VICTW32.DLL" (ByVal hWnd As Integer, ByRef resimg As imgdes, ByRef scanrect As RECT, ByVal showIU As Integer) As Integer |
| C# | int vicwin.TWscanimageex(int hWnd, ref imgdes resimg, ref RECT scanrRect, int showIU); |
| 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); |
| viclib64 | |
| C# | int vicwin.TWscanimageex( System.IntPtr hWnd, ref imgdes resimg, ref RECT scanrRect, 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 |
TWscanmultipleimages
| 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 |
| VB.NET | Declare Function TWscanmultipleimages Lib "VICTW32.DLL" (ByVal hWnd As Integer, ByRef resimg As imgdes, ByVal saveScan As SCNFCT) As Integer |
| C# | int vicwin.TWscanmultipleimages(int hWnd, ref imgdes resimg, SCNFCT saveScan)()); |
| C/C++ | int TWscanmultipleimages(HWND hWnd, imgdes *resimg, int (WINAPI *saveScan)()); |
| Java | int vic.victw32jni.TWscanmultipleimages(int hWnd, imgdes resimg,SCNFCT saveScan); |
| viclib64 | |
| C# | int vicwin.TWscanmultipleimages( System.IntPtr hWnd, ref imgdes resimg, ref 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 |
TWscanmultipleimagesex
| 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 |
| VB.NET | Declare Function TWscanmultipleimagesex Lib "VICTW32.DLL" (ByVal hWnd As Integer, ByRef resimg As imgdes, ByRef scanrect As RECT, ByVal showIU As Integer, ByVal saveScan As SCNFCT) As Integer |
| C# | int vicwin.TWscanmultipleimagesex(int hWnd, ref imgdes resimg, ref RECT scanrect, BOOL showIU, SCNFCT saveScan)(ref imgdes thisimg)); |
| 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); |
| viclib64 | |
| C# | int vicwin.TWscanmultipleimagesex( System.IntPtr hWnd, ref imgdes resimg, ref RECT scanrect, BOOL showIU, ref 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
TWselectsource
Function Prototypes
| Visual Basic | Declare Function TWselectsource Lib "VICTW32.DLL" (ByVal hWnd As Long) As Long |
| VB.NET | Declare Function TWselectsource Lib "VICTW32.DLL" (ByVal hWnd As Integer) As Integer |
| C# | int vicwin.TWselectsource(int hWnd); |
| C/C++ | int TWselectsource(HWND hWnd); |
| Java | int vic.victw32jni.TWselectsource(int hWnd); |
| viclib64 | |
| C# | int vicwin.TWselectsource( System.IntPtr 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 |
TWselectsourcebyname
Function Prototypes
| Visual Basic | Declare Function TWselectsourcebyname Lib "VICTW32.DLL" (ByVal hWnd As Long, ByVal dsname As String) As Long |
| VB.NET | Declare Function TWselectsourcebyname Lib "VICTW32.DLL" (ByVal hWnd As Integer, ByVal dsname As String) As Integer |
| C# | int vicwin.TWselectsourcebyname(int hWnd, ref string dsname); |
| C/C++ | int TWselectsourcebyname(HWND hWnd, LPCSTR dsname); |
| Java | int vic.victw32jni.TWselectsourcebyname(int hWnd, String dsname); |
| viclib64 | |
| C# | int vicwin.TWselectsourcebyname( System.IntPtr 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
TWsetbrightness
Function Prototypes
| Visual Basic | Declare Function TWsetbrightness Lib "VICTW32.DLL" (ByVal hWnd As Long, ByRef brightdata As TWAIN_CAP_DATA) As Long |
| VB.NET | Declare Function TWsetbrightness Lib "VICTW32.DLL" (ByVal hWnd As Integer, ByRef brightdata As TWAIN_CAP_DATA) As Integer |
| C# | int vicwin.TWsetbrightness(int hWnd, ref TWAIN_CAP_DATA brightdata); |
| C/C++ | int TWsetbrightness(HWND hWnd, TWAIN_CAP_DATA *brightdata); |
| Java | int vic.victw32jni.TWsetbrightness(int hWnd, TWAIN_CAP_DATA brightdata); |
| viclib64 | |
| C# | int vicwin.TWsetbrightness( System.IntPtr hWnd, ref 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 |
TWsetcontrast
Function Prototypes
| Visual Basic | Declare Function TWsetcontrast Lib "VICTW32.DLL" (ByVal hWnd As Long, ByRef contrastdata As TWAIN_CAP_DATA) As Long |
| VB.NET | Declare Function TWsetcontrast Lib "VICTW32.DLL" (ByVal hWnd As Integer, ByRef contrastdata As TWAIN_CAP_DATA) As Integer |
| C# | int vicwin.TWsetcontrast(int hWnd, ref TWAIN_CAP_DATA contrastdata); |
| C/C++ | int TWsetcontrast(HWND hWnd, TWAIN_CAP_DATA *contrastdata); |
| Java | int vic.victw32jni.TWsetcontrast(int hWnd, TWAIN_CAP_DATA contrastdata); |
| viclib64 | |
| C# | int vicwin.TWsetcontrast( System.IntPtr hWnd, ref 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
TWsetduplex
Function Prototypes
| Visual Basic | Declare Function TWsetduplex Lib "VICTW32.DLL" (ByVal hWnd As Long, ByVal enableDuplex as long) As long |
| VB.NET | Declare Function TWsetduplex Lib "VICTW32.DLL" (ByVal hWnd As Integer, ByVal enableDuplex As Integer) As Integer |
| C# | int vicwin.TWsetduplex(int hWnd, BOOL enableDuplex); |
| C/C++ | int TWsetduplex(HWND hWnd, BOOL enableDuplex); |
| Java | int vic.victw32jni.TWsetduplex(int hWnd, int enableDuplex); |
| viclib64 | |
| C# | int vicwin.TWsetduplex( System.IntPtr 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
TWsetfeeder
Function Prototypes
| Visual Basic | Declare Function TWsetfeeder Lib "VICTW32.DLL" (ByVal hWnd As Long, ByVal enableFeeder as long) As long |
| VB.NET | Declare Function TWsetfeeder Lib "VICTW32.DLL" (ByVal hWnd As Integer, ByVal enableFeeder As Integer) As Integer |
| C# | int vicwin.TWsetfeeder(int hWnd, BOOL enableFeeder); |
| C/C++ | int TWsetfeeder(HWND hWnd, BOOL enableFeeder); |
| Java | int vic.victw32jni.TWsetfeeder(int hWnd, int enableFeeder); |
| viclib64 | |
| C# | int vicwin.TWsetfeeder( System.IntPtr 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
TWsetmeasureunit
Function Prototypes
| Visual Basic | Declare Function TWsetmeasureunit Lib "VICTW32.DLL" (ByVal hWnd As Long, ByRef typeUnit As TWAIN_CAP_DATA) As Long |
| VB.NET | Declare Function TWsetmeasureunit Lib "VICTW32.DLL" (ByVal hWnd As Integer, ByRef typeUnit As TWAIN_CAP_DATA) As Integer |
| C# | int vicwin.TWsetmeasureunit(int hWnd, ref TWAIN_CAP_DATA typeUnit); |
| C/C++ | int TWsetmeasureunit(HWND hWnd, TWAIN_CAP_DATA *typeUnit); |
| Java | int vic.victw32jni.TWsetmeasureunit(int hWnd, TWAIN_CAP_DATA typeUnit); |
| viclib64 | |
| C# | int vicwin._export WINAPI TWsetmeasureunit( System.IntPtr hWnd, ref 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
TWsetpagesize
Function Prototypes
| Visual Basic | Declare Function TWsetpagesize Lib "VICTW32.DLL" (ByVal hWnd As Long, ByVal pageConst as long) As long |
| VB.NET | Declare Function TWsetpagesize Lib "VICTW32.DLL" (ByVal hWnd As Integer, ByVal pageConst As Integer) As Integer |
| C# | int vicwin.TWsetpagesize(int hWnd, unsigned pageConst); | /tr>
| C/C++ | int TWsetpagesize(HWND hWnd, unsigned pageConst); | /tr>
| Java | int vic.victw32jni.TWsetpagesize(int hWnd, int pageConst); |
| viclib64 | |
| C# | int vicwin.TWsetpagesize( System.IntPtr hWnd, uint pageConst); | /tr>
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 page size constants are:
| Value | Defined Constant |
| 0 | TWSS_NONE |
| 1 | TWSS_A4LETTER |
| 2 | TWSS_B5LETTER |
| 3 | TWSS_USLETTER |
| 4 | TWSS_USLEGAL |
| 5 | TWSS_A5 |
| 6 | TWSS_B4 |
| 7 | TWSS_B6 |
| 9 | TWSS_USLEDGER |
| 10 | TWSS_USEXECUTIVE |
| 11 | TWSS_A3 |
| 12 | TWSS_B3 |
| 13 | TWSS_A6 |
| 14 | TWSS_C4 |
| 15 | TWSS_C5 |
| 16 | TWSS_C6 |
| 17 | TWSS_4A0 |
| 18 | TWSS_2A0 |
| 19 | TWSS_A0 |
| 20 | TWSS_A1 |
| 21 | TWSS_A2 |
| 22 | TWSS_A7 |
| 23 | TWSS_A8 |
| 24 | TWSS_A9 |
| 25 | TWSS_A10 |
| 26 | TWSS_ISOB0 |
| 27 | TWSS_ISOB1 |
| 28 | TWSS_ISOB2 |
| 29 | TWSS_ISOB5 |
| 30 | TWSS_ISOB7 |
| 31 | TWSS_ISOB8 |
| 32 | TWSS_ISOB9 |
| 33 | TWSS_ISOB10 |
| 34 | TWSS_JISB0 |
| 35 | TWSS_JISB1 |
| 36 | TWSS_JISB2 |
| 37 | TWSS_JISB3 |
| 38 | TWSS_JISB4 |
| 39 | TWSS_JISB6 |
| 40 | TWSS_JISB7 |
| 41 | TWSS_JISB8 |
| 42 | TWSS_JISB9 |
| 43 | TWSS_JISB10 |
| 44 | TWSS_C0 |
| 45 | TWSS_C1 |
| 46 | TWSS_C2 |
| 47 | TWSS_C3 |
| 48 | TWSS_C7 |
| 49 | TWSS_C8 |
| 50 | TWSS_C9 |
| 51 | TWSS_C10 |
| 52 | TWSS_USSTATEMENT |
| 53 | TWSS_BUSINESSCARD |
Some devices that support physical dimensions accept 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
TWsetpixeltype
Function Prototypes
| Visual Basic | Declare Function TWsetpixeltype Lib "VICTW32.DLL" (ByVal hWnd As Long, ByRef pixelType As TWAIN_CAP_DATA) As Long |
| VB.NET | Declare Function TWsetpixeltype Lib "VICTW32.DLL" (ByVal hWnd As Integer, ByRef pixelType As TWAIN_CAP_DATA) As Integer |
| C# | int vicwin.TWsetpixeltype(int hWnd, ref TWAIN_CAP_DATA pixelType); |
| C/C++ | int TWsetpixeltype(HWND hWnd, TWAIN_CAP_DATA *pixelType); |
| Java | int vic.victw32jni.TWsetpixeltype(int hWnd, TWAIN_CAP_DATA pixelType); |
| viclib64 | |
| C# | int vicwin.TWsetpixeltype( System.IntPtr hWnd, ref 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 |
TWsetproductname
Function Prototypes
| Visual Basic | Declare Sub TWsetproductname Lib "VICTW32.DLL" (ByVal prodName As String) |
| VB.NET | Declare Sub TWsetproductname Lib "VICTW32.DLL" (ByVal prodName As String) |
| C# | void vicwin.TWsetproductname(ref string prodName); |
| 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
TWsetxresolution
Function Prototypes
| Visual Basic | Declare Function TWsetxresolution Lib "VICTW32.DLL" (ByVal hWnd As Long, resdata As TWAIN_CAP_DATA) As Long |
| VB.NET | Declare Function TWsetxresolution Lib "VICTW32.DLL" (ByVal hWnd As Integer, ByRef resdata As TWAIN_CAP_DATA) As Integer |
| C# | int vicwin.TWsetxresolution(int hWnd, ref TWAIN_CAP_DATA resdata); |
| C/C++ | int TWsetxresolution(HWND hWnd, TWAIN_CAP_DATA *resdata); |
| Java | int vic.victw32jni.TWsetxresolution(int hWnd, TWAIN_CAP_DATA resdata); |
| viclib64 | |
| C# | int vicwin.TWsetxresolution( System.IntPtr hWnd, ref 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
TWsetyresolution
Function Prototypes
| Visual Basic | Declare Function TWsetyresolution Lib "VICTW32.DLL" (ByVal hWnd As Long, resdata As TWAIN_CAP_DATA) As Long |
| VB.NET | Declare Function TWsetyresolution Lib "VICTW32.DLL" (ByVal hWnd As Integer, ByRef resdata As TWAIN_CAP_DATA) As Integer |
| C# | int vicwin.TWsetyresolution(int hWnd, ref TWAIN_CAP_DATA resdata); |
| C/C++ | int TWsetyresolution(HWND hWnd, TWAIN_CAP_DATA *resdata); |
| Java | int vic.victw32jni.TWsetyresolution(int hWnd, TWAIN_CAP_DATA resdata); |
| viclib64 | |
| C# | int vicwin.TWsetyresolution( System.IntPtr hWnd, ref 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
TWStaticLibStart
Function Prototypes
| C# | void vicwin.TWStaticLibStart(HINSTANCE hinst); |
| 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.
TWStaticLibTerm
Function Prototypes
| C# | void vicwin.TWStaticLibTerm(void); |
| 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.
TWvicversion
Function Prototypes
| Visual Basic | Declare Function TWvicversion Lib "VICTW32.DLL" () As Integer |
| VB.NET | Declare Function TWvicversion Lib "VICTW32.DLL" () As Short |
| C# | short vicwin.TWvicversion(void); |
| 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 short integer. The high-order byte contains
the major version number. The low-order byte contains the minor version number
as a two-digit decimal number.
unlockLZW
Function Prototypes
| Visual Basic | Declare Sub unlockLZW Lib "VIC32.DLL"(ByVal key as long) |
| VB.NET | Declare Sub unlockLZW Lib "VIC32.DLL" (ByVal key As Integer) |
| C# | void vicwin.unlockLZW(int key); |
| C/C++ | void unlockLZW(DWORD key); |
| Java | void vic.vic32jni.unlockLZW(int key); |
Function Arguments
| key | Required key |
Description
The unlockLZW function is obsolete. It enables LZW compression and decompression in the Victor Library versions earlier than v 5.60, July 8, 2004.
Return value
There is no return value.
updatebitmapcolortable
| 1 | 8 |
Function Prototypes
| Visual Basic | Declare Function updatebitmapcolortable Lib "VIC32.DLL" (resimg As imgdes) As Long |
| VB.NET | Declare Function updatebitmapcolortable Lib "VIC32.DLL" (ByRef resimg As imgdes) As Integer |
| C# | td>int vicwin.updatebitmapcolortable(ref imgdes resimg);|
| C/C++ | td>int updatebitmapcolortable(imgdes *resimg);|
| Java | int vic.vic32jni.updatebitmapcolortable(imgdes resimg); |
Function Arguments
| resimg | Result image |
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
| NO_ERROR | Function successful |
| BAD_MEM | Insufficient memory |
This example updates the color table associated with the DIB handle.
usetable
| 8 | 24 |
Function Prototypes
| 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 |
| VB.NET | Declare Function usetable Lib "VIC32.DLL" (ByRef redtab As Byte, ByRef grntab As Byte, ByRef blutab As Byte, ByRef srcimg As imgdes, ByRef resimg As imgdes) As Integer |
| C# | int vicwin.usetable(ref byte redtab_firstelem, ref byte grntab_firstelem, ref byte blutab_firstelem, ref imgdes srcimg, ref imgdes resimg); |
| 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); |
| viclib64 | |
| C# | int vicwin.usetable(byte[]redtab, byte[] grntab, byte[] blutab, ref imgdes srcimg, ref imgdes resimg); |
Function Arguments
| 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 |
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.
-
Result = redtable[Source]
For a 24-bit image, redtable, grntable, and blutable are used.
-
Result red = redtable[Source red]
- Result green= grntable[Source green]
- Result blue = blutable[Source blue]
- Result green= grntable[Source green]
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 |
This example computes a gamma correction table and applies it to an image.
VicLibStart
Function Prototypes
| C# | void vicwin.VicLibStart(void); |
| C/C++ | void VicLibStart(void); |
Description
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
Function Prototypes
| C# | void vicwin.VicLibTerm(void); |
| 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
Function Prototypes
| Visual Basic | Declare Function Victorversion Lib "VIC32.DLL" () As Integer |
| VB.NET | Declare Function Victorversion Lib "VIC32.DLL" () As Short |
| C# | short vicwin.Victorversion(void); |
| C/C++ | WORD Victorversion(void); |
| Java | short vic.vic32jni.Victorversion(); |
Description
The Victorversion function returns the version of the Victor Image Processing Library.
Return value
The version number is returned as a two-byte short integer. The high-order byte contains the major version number. The low-order byte contains the minor version number as a two-digit decimal number.
Victorversiondate
Function Prototypes
| Visual Basic | Declare Function Victorversiondate Lib "VIC32.DLL" (ByVal desStr As String, ByVal bufchars As Long) As Integer |
| VB.NET | Declare Function Victorversiondate Lib "VIC32.DLL" (ByVal desStr As String, ByVal bufchars As Integer) As Short |
| C# | short vicwin.Victorversiondate(ref string, int bufchars); |
| C/C++ | WORD Victorversiondate(LPSTR desStr, int bufchars); |
| Java | short vic.vic32jni.Victorversiondate(String desStr, int bufchars); |
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 short integer. The high-order byte contains the major version number. The low-order byte contains the minor version number as a two-digit decimal number.
Victorversionex
Function Prototypes
| Visual Basic | Declare Function Victorversionex Lib "VIC32.DLL" (vicVerInfo As VIC_VERSION_INFO) As Integer |
| VB.NET | Declare Function Victorversionex Lib "VIC32.DLL" (ByRef vicVerInfo As VIC_VERSION_INFO) As Short |
| C# | short vicwin.Victorversionex(ref VIC_VERSION_INFO vicVerInfo); |
| C/C++ | WORD Victorversionex(VIC_VERSION_INFO *vicVerInfo); |
| Java | short vic.vic32jni.Victorversionex(VIC_VERSION_INFO vicVerInfo); |
Function Arguments
| vicVerInfo | Variable of type VIC_VERSION_INFO to receive the data |
Description
The Victorversionex function places version information about the Victor Image
Processing Library in vicVerinfo.
The VIC_VERSION_INFO structure elements are defined as follows:
| version | Version number |
| exver | Extended version information |
The library version number is placed in the version element as a two-byte short integer. 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.
| 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 | |
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 short integer.
victowinpal
Function Prototypes
| Visual Basic | Declare Function victowinpal Lib "VIC32.DLL" (srcimg As imgdes, hPal As Long) As Long |
| VB.NET | Declare Function victowinpal Lib "VIC32.DLL" (ByRef srcimg As imgdes, ByRef hPal As Integer) As Integer |
| C# | int vicwin.victowinpal(ref imgdes srcimg, ref int hPal); |
| C/C++ | int victowinpal(imgdes *srcimg, HPALETTE *hPal); |
| Java | int vic.vic32jni.victowinpal(imgdes srcimg, refvar hPal); |
| viclib64 | |
| C# | int vicwin.victowinpal(ref imgdes srcimg, ref System.IntPtr hPal); |
Function Arguments
| srcimg | Source image |
| hPal | Variable to receive the logical palette handle |
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
| NO_ERROR | Function successful |
| BAD_MEM | Insufficient local memory |
viewimage
| 1 | 8 | 24 |
Function Prototypes
| 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 |
| VB.NET | Declare Function viewimage Lib "VIC32.DLL" (ByVal hWnd As Integer, ByVal hdc As Integer, ByRef hPal As Integer, ByVal xpos As Integer, ByVal ypos As Integer, ByRef srcimg As imgdes) As Integer |
| C# | int vicwin._export WINAPI viewimage(int hWnd, int hdc, ref int hPal, int xpos, int ypos, ref imgdes srcimg); |
| 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); |
| viclib64 | |
| C# | int vicwin._export WINAPI viewimage( System.IntPtr hWnd, System.IntPtr hdc, ref System.IntPtr hPal, int xpos, int ypos, ref imgdes srcimg); |
Function Arguments
| 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 |
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:
-
horiz scroll range = image width - client rect width
- vert scroll range = image height - client rect height
If the scroll ranges are set in this manner, the Windows GetScrollPos function can be used to determine xpos and ypos (see example).
-
xpos = GetScrollPos(hWnd, SB_HORZ)
- ypos = GetScrollPos(hWnd, SB_VERT)
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.
| NO_ERROR | Function successful |
| BAD_MEM | Insufficient local memory |
See also
viewimageex
viewimageex
| 1 | 8 | 24 |
Function Prototypes
| 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 |
| VB.NET | Declare Function viewimageex Lib "VIC32.DLL" (ByVal hWnd As Integer, ByVal hdc As Integer, ByRef hPal As Integer, ByVal xpos As Integer, ByVal ypos As Integer, ByRef srcimg As imgdes, ByVal scrx As Integer, ByVal scry As Integer, ByVal colRedMode As Integer) As Integer |
| C# | int vicwin.viewimageex(int hWnd, int hdc, ref int hPal, int xpos, int ypos, ref imgdes srcimg, int scrnx, int scrny, int colRedMode); |
| 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); |
| viclib64 | |
| C# | int vicwin.viewimageex( System.IntPtr hWnd, System.IntPtr hdc, ref System.IntPtr hPal, int xpos, int ypos, ref imgdes srcimg, int scrnx, int scrny, int colRedMode); |
Function Arguments
| 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 |
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:
-
horiz scroll range = image width - client rect width + scrnx
- vert scroll range = image height - client rect height + scrny
If the scroll ranges are set in this manner, the Windows GetScrollPos function can be used to set xpos and ypos (see example).
-
xpos = GetScrollPos(hWnd, SB_HORZ)
- ypos = GetScrollPos(hWnd, SB_VERT)
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.
| 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 |
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
| 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 |
See also
viewimage
windowtoimage
| 1 | 8 | 24 |
Function Prototypes
| Visual Basic | Declare Function windowtoimage Lib "VIC32.DLL" (ByVal hWnd As Long, resimg As imgdes) As Long |
| VB.NET | Declare Function windowtoimage Lib "VIC32.DLL" (ByVal hWnd As Integer, ByRef resimg As imgdes) As Integer |
| C# | int vicwin.windowtoimage(HWND hWnd, ref imgdes resimg); |
| C/C++ | int windowtoimage(HWND hWnd, imgdes *resimg); |
| Java | int vic.vic32jni.windowtoimage(int hWnd, imgdes resimg); |
| viclib64 | |
| C# | int vicwin.windowtoimage( System.IntPtr hWnd, ref imgdes resimg); |
Function Arguments
| hWnd | Window handle |
| resimg | Result image |
Description
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.
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
| NO_ERROR | Function successful |
| BAD_MEM | Insufficient memory |
| BAD_BPP | Bits per pixel not 1, 4, 8, 16, or 24 |
See also
clienttoimage
wintovicpal
Function Prototypes
| Visual Basic | Declare Function wintovicpal Lib "VIC32.DLL" (ByVal hpal As Long, resimg As imgdes) As Long |
| VB.NET | Declare Function wintovicpal Lib "VIC32.DLL" (ByVal hPal As Integer, ByRef resimg As imgdes) As Integer |
| C# | int vicwin.wintovicpal(int hPal, ref imgdes resimg); |
| C/C++ | int wintovicpal(HPALETTE hPal, imgdes *resimg); |
| Java | int vic.vic32jni.wintovicpal(int hPal, imgdes resimg); |
| viclib64 | |
| C# | int vicwin.wintovicpal( System.IntPtr hPal, ref imgdes resimg); |
Function Arguments
| hPal | Logical palette handle |
| resimg | Result image |
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
| NO_ERROR | Function successful |
| BAD_MEM | Insufficient local memory |
wtaverage
| 8 | 24 |
Function Prototypes
| Visual Basic | Declare Function wtaverage Lib "VIC32.DLL" (ByVal weight As Long, srcimg As imgdes, oprimg As imgdes, resimg As imgdes) As Long |
| VB.NET | Declare Function wtaverage Lib "VIC32.DLL" (ByVal weight As Integer, ByRef srcimg As imgdes, ByRef oprimg As imgdes, ByRef resimg As imgdes) As Integer |
| C# | int vicwin.wtaverage(int weight, ref imgdes srcimg, ref imgdes oprimg, ref imgdes resimg); |
| 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); |
Function Arguments
| weight | Weight factor for the source image (0-100) |
| srcimg | Source image |
| oprimg | Operator image |
| resimg | Result image |
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.
-
Result = (weight * Source + (100 - weight) * Operator) / 100
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 |
| BAD_FAC | Weight value is outside the range 0 - 100 |
wtaveragemask
| 8 | 24 |
Function Prototypes
| Visual Basic | Declare Function wtaveragemask Lib "VIC32.DLL" (srcimg As imgdes, oprimg As imgdes, resimg As imgdes, masimg As imgdes) As Long |
| VB.NET | Declare Function wtaveragemask Lib "VIC32.DLL" (ByRef srcimg As imgdes, ByRef oprimg As imgdes, ByRef resimg As imgdes, ByRef masimg As imgdes) As Integer |
| C# | int vicwin.wtaveragemask(ref imgdes srcimg, ref imgdes oprimg, ref imgdes resimg, ref imgdes masimg); |
| C/C++ | int wtaveragemask(imgdes *srcimg, imgdes *oprimg, imgdes *resimg, imgdes *masimg); |
| Java | int vic.vic32jni.wtaveragemask(imgdes srcimg, imgdes oprimg, imgdes resimg, imgdes masimg); |
Function Arguments
| srcimg | Source image |
| oprimg | Operator image |
| resimg | Result image |
| masimg | Mask image |
Description
The wtaveragemask 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 weight for each pixel calculation is based on the value of the corresponding pixel in the mask image.
Source, operator, and result images can all be either 8- or 24-bit images. The mask image must be 8-bit.
- Result = ((100 - Mask) * Source + Mask * Operator) / 255
The source, operator, and result 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, operator, and result are not all 8- or 24-bit or mask is not 8-bit |
| BAD_DIB | Source or result is a compressed DIB |
xorimage
| 1 | 8 | 24 |
Function Prototypes
| Visual Basic | Declare Function xorimage Lib "VIC32.DLL" (srcimg As imgdes, oprimg As imgdes, resimg As imgdes) As Long |
| VB.NET | Declare Function xorimage Lib "VIC32.DLL" (ByRef srcimg As imgdes, ByRef oprimg As imgdes, ByRef resimg As imgdes) As Integer |
| C# | int vicwin.xorimage(ref imgdes srcimg, ref imgdes oprimg, ref imgdes resimg); |
| C/C++ | int xorimage(imgdes *srcimg, imgdes *oprimg, imgdes *resimg); |
| Java | int vic.vic32jni.xorimage(imgdes srcimg, imgdes oprimg, imgdes resimg); |
Function Arguments
| srcimg | Source image |
| oprimg | Operator image |
| resimg | Result image |
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.
-
Result = Source ^ Operator
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 1-, 8-, or 24-bit |
| BAD_DIB | Image is a compressed DIB |
See also
andimage, orimage
zeroimage
| 1 | 8 | 24 |
Function Prototypes
| Visual Basic | Declare Function zeroimage Lib "VIC32.DLL" (ByVal newval As Long, resimg As imgdes) As Long |
| VB.NET | Declare Function zeroimage Lib "VIC32.DLL" (ByVal newval As Integer, ByRef resimg As imgdes) As Integer |
| C# | int vicwin.zeroimage(int newval, ref imgdes resimg); |
| C/C++ | int zeroimage(int newval, imgdes *resimg); |
| Java | int vic.vic32jni.zeroimage(int newval, imgdes resimg); |
Function Arguments
| newval | New pixel value to set (0-255) |
| resimg | Result image |
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
| 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
Function Prototypes
| Visual Basic | Declare Sub zeroimgdes Lib "VIC32.DLL" (resimg As imgdes) |
| VB.NET | Declare Sub zeroimgdes Lib "VIC32.DLL" (ByRef resimg As imgdes) |
| C# | void vicwin.zeroimgdes(ref resimg image); |
| C/C++ | void zeroimgdes(resimg *image); |
| Java | void vic.vic32jni.zeroimgdes(resimg image); |
Function Arguments
| resimg | Result image |
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:
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));
Return value
There is no return value.