pcxinfo
Function Prototypes
| Visual Basic | Declare Function pcxinfo Lib "VIC32.DLL" (ByVal filename As String, pinfo As PcxData) As Long |
| VB.NET | Declare Function pcxinfo Lib "VIC32.DLL" (ByVal filename As String, ByRef pinfo As PcxData) As Integer |
| C# | int vicwin.pcxinfo(ref string filename, ref PcxData pinfo); |
| C/C++ | int pcxinfo(LPCSTR filename, PcxData *pinfo); |
| Java | int vic.vic32jni.pcxinfo(String filename, PcxData pinfo); |
Function Arguments
| filename | Filename to read |
| pinfo | PcxData structure to be filled in |
Description
The pcxinfo function reads the header of a PCX file and places the image information in the pinfo structure. The structure is defined in the header file VICDEFS.H. The purpose of the pcxinfo function is to determine if a PCX file is valid and to permit allocating enough memory to load the file.
The PcxData structure elements are defined as follows:
| PCXvers | Version number |
| width | Image width in pixels |
| length | Image length in pixels |
| BPPixel | Bits per pixel |
| Nplanes | Number of planes of data |
| BytesPerLine | Bytes per line |
| PalInt | Palette interpretation |
| vbitcount | Victor bits per pixel (used to allocate an imagebuffer with allocimage). |
Return value
| NO_ERROR | Function successful |
| BAD_MEM | Insufficient local memory |
| BAD_OPN | Filename not found |
| BAD_PCX | File is not a valid PCX format |
See also
loadpcx, loadpcxpalette, savepcx
Example
See loadpcx
pixelcount
| 8 | 24 |
Function Prototypes
| Visual Basic | Declare Function pixelcount Lib "VIC32.DLL" (ByVal min As Long, ByVal max As Long, redcount As Long, grncount As Long, blucount As Long, srcimg As imgdes) As Long |
| VB.NET | Declare Function pixelcount Lib "VIC32.DLL" (ByVal min As Integer, ByVal max As Integer, ByRef redcount As Integer, ByRef grncount As Integer, ByRef blucount As Integer, ByRef srcimg As imgdes) As Integer |
| C# | int vicwin.pixelcount(int min, int max, ref int redcount, ref int grncount, ref int blucount, ref imgdes srcimg); |
| C/C++ | int pixelcount(int min, int max, long *redcount, long *grncount, long *blucount, imgdes *srcimg); |
| Java | int vic.vic32jni.pixelcount(int min, int max, refvar redcount, refvar grncount, refvar blucount, imgdes srcimg); |
Function Arguments
| min | Minimum brightness level |
| max | Maximum brightness level |
| redcount | Variable to receive count of pixels with red values between min - max |
| grncount | Variable to receive count of pixels with green values between min - max |
| blucount | Variable to receive count of pixels with blue values between min - max |
| image | Source image |
Description
The pixelcount function counts the number of pixels between a minimum and maximum brightness level within an image area. The image area is defined by the image descriptor.
For an 8-bit grayscale image the number of pixels between min and max is placed in redcount. For an 8-bit palette color or 24-bit RGB image, number of pixels with red, green, and blue color component values between min and max are placed in redcount, grncount, and blucount, respectively.
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- or 24-bit |
| BAD_DIB | Source or result is a compressed DIB |
| BAD_FAC | Min or max is outside the range 0 to 255 |
pixellize
| 8 | 24 |
Function Prototypes
| Visual Basic | Declare Function pixellize Lib "VIC32.DLL" (ByVal pixfactor As Long, srcimg As imgdes, resimg As imgdes) As Long |
| VB.NET | Declare Function pixellize Lib "VIC32.DLL" (ByVal pixfactor As Integer, ByRef srcimg As imgdes, ByRef resimg As imgdes) As Integer |
| C# | int vicwin.pixellize(int pixfactor, ref imgdes srcimg, ref imgdes resimg); |
| C/C++ | int pixellize(const int pixfactor, imgdes *srcimg, imgdes *resimg); |
| Java | int vic.vic32jni.pixellize(int pixfactor, imgdes srcimg, imgdes resimg); |
Function Arguments
| pixfactor | Pixellation factor (2-63) |
| srcimg | Source image |
| resimg | Result image |
Description
The pixellize function assigns brightness levels in a local region within an image area to the average value.
The source and result image areas are defined by the corresponding image descriptors.
The pixellation factor defines the size of the local region (pixfactor x pixfactor). It can range from 2 to 63, but cannot exceed the width or height of the image area.
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 |
| BAD_FAC | Pixfactor is outside the range 2 to 63 or greater than the width or height of the image area |
pnggeterror |
Function Prototypes
| Visual Basic | Declare Function pnggeterror Lib "VIC32.DLL" () As Long |
| VB.NET | Declare Function pnggeterror Lib "VIC32.DLL" () As Integer |
| C# | int vicwin.pnggeterror(void); |
| C/C++ | int pnggeterror(void); |
| Java | int vic.vic32jni.pnggeterror(); |
Description
The pnggeterror function reports extended error information after a PNG function returns
BAD_PNG.
Return value
| 0 | No extended error information |
| -100 | Unknown critical chunk |
| -101 | Not enough IDATs for image |
| -102 | Invalid IHDR chunk |
| -103 | Invalid bit depth in IHDR |
| -104 | Invalid color type in IHDR |
| -105 | Invalid color type/bit depth combo |
| -106 | Invalid interlace method in IHDR |
| -107 | Invalid compression method in IHDR |
| -108 | Invalid filter method in IHDR |
| -109 | Invalid image size in IHDR |
| -110 | Bad PNG signature |
| -111 | Bad CRC value |
| -112 | Extra data at end of file |
| -113 | Unexpected End Of File |
| -114 | Memory error |
| -115 | Decompression error |
| -116 | Compression error |
| -117 | Out of disk space |
pnggetxyresolution
Function Prototypes
| Visual Basic | Declare Function pnggetxyresolution Lib "VIC32.DLL" (ByVal filename As String, ByRef xres As Long, ByRef yres As Long, ByRef resunit As Long) As Long |
| VB.NET | Declare Function pnggetxyresolution Lib "VIC32.DLL" (ByVal filename As String, ByRef xres As Integer, ByRef yres As Integer, ByRef resunit As Integer) As Integer |
| C# | int vicwin.pnggetxyresolution(ref string filename, ref int xres, ref int yres, ref int resunit); |
| C/C++ | int pnggetxyresolution(LPCSTR filename, unsigned *xres, unsigned *yres, unsigned *resunit); |
| Java | int vic.vic32jni.pnggetxyresolution(String filename, refvar xres, refvar yres, refvar resunit); |
Function Arguments
| filename | Filename to load |
| xres | Horizontal resolution in pixels |
| yres | Vertical resolution in pixels |
| resunit | Resolution unit |
Description
The pnggetxyresolution function gets the values for image resolution from a PNG image file. The resolution values are stored in the variables xres and yres. The type of resolution unit is stored in the resunit variable and 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_PNG | File is not a valid PNG file |
| BAD_MEM | Insufficient memory |
pnginfo, pngsetxyres
pnginfo
Function Prototypes
| Visual Basic | Declare Function pnginfo Lib "VIC32.DLL" (ByVal filename As String, pinfo As PngData) As Long |
| VB.NET | Declare Function pnginfo Lib "VIC32.DLL" (ByVal filename As String, ByRef pinfo As PngData) As Integer |
| C# | int vicwin.pnginfo(ref string filename, ref PngData pinfo); |
| C/C++ | int pnginfo(LPCSTR filename, PngData *pinfo); |
| Java | int vic.vic32jni.pnginfo(String filename, PngData pinfo); |
Function Arguments
| filename | Filename to load |
| pinfo | PngData structure to be filled in |
Description
The pnginfo function reads the header of a PNG file and places the image
information in the pinfo structure.
The pnginfo function allows the application to determine
if a PNG file is readable and to allocate memory to load the image.
The PngData structure elements are defined as follows:
| width | Image width in pixels | ||||||
| length | Image length in pixels | ||||||
| bitDepth | Bits per pixel, 1, 2, 4, 8, or 16 | ||||||
| vbitcount | Victor bits per pixel (used to allocate an image buffer with allocimage) | ||||||
| colorType | Color type
0 = Grayscale 2 = RGB 3 = Palette Color 4 = Grayscale + alpha channel 6 = RGB + alpha channel | ||||||
| interlaced | 0 = non-interlaced, 1 = interlaced | ||||||
| imageId | Identifier for colorType/bitDepth | ||||||
| channels | Number of channels of data per pixel | ||||||
| pixelDepth | Number of bits per pixel | ||||||
| rowBytes | Bytes in one image row | ||||||
| transData | Transparency color data of type PNGTRANSINFO
| ||||||
| backData | Background color data of type PNGTRANSINFO
| ||||||
| igamma | Gamma as float = igamma / 100000 | ||||||
| physXres | X-axis pixels per unit | ||||||
| physYres | Y-axis pixels per unit | ||||||
| physUnits | Physical units | ||||||
| sigBit | Significant bits in file of type PNGSIGBITS
| ||||||
| offsXoffset | X-axis offset | ||||||
| offsYoffset | Y-axis offset | ||||||
| offsUnits | Offset units |
If a PNG file image contains a transparent color(s), pnginfo will return it in the element transData. If a transparent color is not present, the isPresent element of transData is set to FALSE.
| Table 9. PNG Transparent Color Interpretation | ||
| ColorType | TransData.byteCount | Interpretation of TransData.data[] |
| 0, grayscale | 2 | grayscale value as a 16-bit integer |
| 2, RGB | 6 | RGB integer values |
| 3, palette color | 1 | palette index |
Return value
| NO_ERROR | Function successful |
| BAD_OPN | Filename not found |
| BAD_PNG | File is not a valid PNG file |
See also
loadpng
pnginfofrombuffer
| 1 | 8 | 24 |
Function Prototypes
| Visual Basic | Declare Function pnginfofrombuffer Lib "VIC32.DLL" (ByVal buffer As Long, pinfo As PngData) As Long |
| VB.NET | Declare Function pnginfofrombuffer Lib "VIC32.DLL" (ByVal buffer As Integer, ByRef pinfo As PngData) As Integer |
| C# | int vicwin.pnginfofrombuffer(ref byte_firstelem buffer, ref PngData pinfo); |
| C/C++ | int pnginfofrombuffer(UCHAR *buffer, PngData *pinfo); |
| Java | int vic.vic32jni.pnginfofrombuffer(int buffer, PngData pinfo); |
Function Arguments
| buffer | Buffer address |
| pinfo | PngData structure to be filled in |
Description
The pnginfofrombuffer function reads the header information
from memory holding PNG file data and places the image
information in the pinfo structure. The structure is defined in the
header file VICDEFS.H.
The PngData structure elements are defined as follows:
| width | Image width in pixels | ||||||
| length | Image length in pixels | ||||||
| bitDepth | Bits per pixel, 1, 2, 4, 8, or 16 | ||||||
| vbitcount | Victor bits per pixel (used to allocate an image buffer with allocimage) | ||||||
| colorType | Color type
0 = Grayscale 2 = RGB 3 = Palette Color 4 = Grayscale + alpha channel 6 = RGB + alpha channel | ||||||
| interlaced | 0 = non-interlaced, 1 = interlaced | ||||||
| imageId | Identifier for colorType/bitDepth | ||||||
| channels | Number of channels of data per pixel | ||||||
| pixelDepth | Number of bits per pixel | ||||||
| rowBytes | Bytes in one image row | ||||||
| transData | Transparency color data of type PNGTRANSINFO
| ||||||
| backData | Background color data of type PNGTRANSINFO
| ||||||
| igamma | Gamma as float = igamma / 100000 | ||||||
| physXres | X-axis pixels per unit | ||||||
| physYres | Y-axis pixels per unit | ||||||
| physUnits | Physical units | ||||||
| sigBit | Significant bits in file of type PNGSIGBITS
| ||||||
| offsXoffset | X-axis offset | ||||||
| offsYoffset | Y-axis offset | ||||||
| offsUnits | Offset units |
If a PNG file image contains a transparent color(s), pnginfo will return it in the element transData. If a transparent color is not present, the isPresent element of transData is set to FALSE.
Return value
| NO_ERROR | Function successful |
| BAD_OPN | Memory handle not available |
| BAD_PNG | File is not a valid PNG file |
| BAD_PTR | Buffer does not point to readable memory |
pngsetxyresolution
Function Prototypes
| Visual Basic | Declare Sub pngsetxyresolution Lib "VIC32.DLL" (ByVal xres As Long, ByVal yres As Long, ByVal resunit As Long) |
| VB.NET | Declare Sub pngsetxyresolution Lib "VIC32.DLL" (ByVal xres As Integer, ByVal yres As Integer, ByVal resunit As Integer) |
| C# | void vicwin.pngsetxyresolution(unsigned xres, unsigned yres, unsigned resunit); |
| C/C++ | void pngsetxyresolution(unsigned xres, unsigned yres, unsigned resunit); |
| Java | void vic.vic32jni.pngsetxyresolution(int xres, int yres, int resunit); |
Function Arguments
| xres | Horizontal resolution in pixels |
| yres | Vertical resolution in pixels |
| resunit | Resolution unit (0-1) |
Description
The pngsetxyresolution function sets the horizontal and vertical resolution and resolution unit for a PNG file. The next file saved with the savepng function will use the values set by pngsetxyres. The default values are xres = 11812, yres = 11812, resunit = 1, that is, the default resolution is 11812 pixels per meter (300 pixels per inch).
The resunit value can be one of the following:
| 0 | No unit of measurement |
| 1 | Meter |
A resunit value of zero means that the xres and yres values define the image aspect ratio.
To save files with non-default values for resolution, this function must be called before each call to savepng.
Return value
There is no return value.
See also
pnggetxyres
printimage
| 1 | 8 | 24 |
Function Prototypes
| Visual Basic | Declare Function printimage Lib "VIC32.DLL" (ByVal hwnd As Long, ByVal hdcprn As Long, ByVal prmode As Long, srcimg As imgdes, prtrect As RECT, ByVal bwidth As Long, ByVal dspfct As Long) As Long |
| VB.NET | Declare Function printimage Lib "VIC32.DLL" (ByVal hWnd As Integer, ByVal hdcprn As Integer, ByVal prmode As Integer, ByRef srcimg As imgdes, ByRef pRect As RECT, ByVal bwidth As Integer, ByVal dspfct As Integer) As Integer |
| C# | int vicwin.printimage(int hwnd, int hdcprn, int prmode, ref imgdes srcimg, ref RECT prtrect, int bwidth, int dspfct); |
| C/C++ | int printimage(HWND hwnd, HDC hdcprn, int prmode, imgdes *srcimg, RECT *prtrect, int bwidth, int (WINAPI *dspfct)()); |
| Java | int vic.vic32jni.printimage(int hwnd, int hdcprn, int prmode, imgdes srcimg, RECT prtrect, int bwidth, DSPFCT dspfct); |
Function Arguments
| hwnd | Window Handle |
| hdcprn | Printer device context handle |
| prtmode | Print mode (0-2) |
| srcimg | Source image |
| prtrect | RECT defining the area to print on page (in mils) |
| bwidth | Border width in device pixels |
| dspfct | Pointer to function that displays the current band number being printed and returns the state of the cancel print flag |
Description
The printimage function prints an image area to a printer device context. The image area to print is defined by the image descriptor. The area printed on the page is defined by the coordinates in the prtrect structure. These dimensions are expressed in 1/1000 inch increments (mils) as measured from the top and left side of the printable page. The printimage function will print every pixel defined by prtrect.
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 |
Thus the printed width and length are:
| print width | = prtrect.right - prtrect.left + 1 |
| print length | = prtrect.bottom - prtrect.top + 1 |
Prtrect units are in mils to accommodate printers with various resolutions. This function prints an image as close to the requested coordinates as possible, depending on the capabilities and configuration of the printer. (The size of the printable page in device pixels may be determined using the Windows GetDeviceCaps function.)
A rectangular box is drawn around the perimeter of the printed area, where the line thickness of the box is set by the variable bwidth in device pixels. If bwidth is zero, a border will not be printed. When printimage finishes, the printed page will be ejected. Supported print techniques are default, halftone, and scatter (error diffusion) depending on image type and printer capabilities. Table 10 lists the print modes for the print techniques and image types.
| Table 10. Print Techniques Supported by printimage | ||
| prtmode | Print Technique | Image Type |
|
PRTDEFAULT (0) |
Default1 |
bilevel (1-bit)
grayscale (8-bit) palette color (8-bit) RGB color (24-bit) |
|
PRTHALFTONE (1) |
Halftone | grayscale (8-bit)
palette color (8-bit)2 |
|
PRTSCATTER (2) |
Scatter3 | grayscale (8-bit)
palette color (8-bit)2 |
|
1The default print technique prints the image using the Windows StretchDIBits function. Depending on the sophistication of the printer driver, results can range from very bad to very good. 1- and 24-bits per pixel images must use the default print mode. 2The halftone and scatter techniques print a grayscale version of a palette color image. 3The scatter technique generally produces a sharper image and takes about 10% longer to print compared to the halftone method. |
||
The printimage function will only print one image at a time. A second application that calls printimage while printimage is printing will receive a PRT_BUSY error code.
Printing Preliminaries
To allow the user to cancel the print job and display a measure of printing progress, the application should do the following before calling printimage (see the Example for sample code in setting up these functions):
- Define a global variable, cancelprt for example. Initialize this variable to FALSE.
- Create a modeless dialog box with a cancel button to allow the user to cancel printing. In the resource file create a dialog box template and associate the cancel button with the IDCANCEL constant.
- Create a dialog box procedure to support the box. In the dialog procedure, under the WM_COMMAND, IDCANCEL case, set cancelprt to TRUE. This sets cancelprt to TRUE when the user selects the cancel button.
- Display the dialog box using the CreateDialog function.
- Create a function, DisplayProgress for example, that displays in the cancel printing dialog box, the value of an integer passed to the function. The value to display is the current band being sent to the printer. DisplayProgress should also return the value of cancelprt.
- Create a procedure-instance pointer, dspfct, of the DisplayProgress function to use as an argument to the printimage function. The DisplayProgress function will be called periodically by printimage to allow canceling the print job.
- Export the dialog box procedure and the DisplayProgress function by adding their names to the module definition file (.DEF).
If dspfct is set to NULL, the cancel printing dialog box and the DisplayProgress function are not needed. However, the user will not be able to cancel printing.
Return value
| NO_ERROR | Function successful |
| BAD_RANGE | Range error (see Appendix A);
area to be printed is outside the printable range; printed image width or length is zero; or bwidth is larger than the printed width or length |
| BAD_IBUF | Invalid image buffer address |
| BAD_MEM | Insufficient local or global memory |
| BAD_BPP | Source image is not 1-, 8-, or 24-bit |
| BAD_DIB | Source or result is a compressed DIB |
| PRT_ERR | Error occurred sending data to printer |
| PRT_BUSY | Printimage function is already executing |
printimageenddoc
Function Prototypes
| Visual Basic | Declare Sub printimageenddoc Lib "VIC32.DLL" (ByVal hdcprn As Long, ByVal ejectPage As Long) |
| VB.NET | Declare Sub printimageenddoc Lib "VIC32.DLL" (ByVal hdcprn As Integer, ByVal ejectPage As Integer) |
| C# | void vicwin.printimageenddoc(int hdcprn, int ejectPage); |
| C/C++ | void printimageenddoc(HDC hdcprn, BOOL ejectPage); |
| Java | void vic.vic32jni.printimageenddoc(int hdcprn, int ejectPage); |
Function Arguments
| hdcprn | Printer device context handle |
| ejectPage | Eject printed page flag
nonzero = eject page after printing zero = cancel printing, do not eject page |
Description
The printimageenddoc function ejects the printed page if ejectPage is TRUE (nonzero) and cancels the print job if ejectPage is FALSE (zero).
Printimageenddoc should be used after printing one or more image areas with printimagenoeject. Printimageenddoc should not be used if an image was printed with printimage.
Internally, printimageenddoc calls the Windows EndPage and EndDoc or AbortDoc functions.
Return value
There is no return value
See also
printimagenoeject, printimagestartdoc
printimagenoeject
| 1 | 8 | 24 |
Function Prototypes
| Visual Basic | Declare Function printimagenoeject Lib "VIC32.DLL" (ByVal hwnd As Long, ByVal hdcprn As Long, ByVal prtmode As Long, srcimg As imgdes, prtrect As RECT, ByVal boxsiz As Long, ByVal dspfct As Long) As Long |
| VB.NET | Declare Function printimagenoeject Lib "VIC32.DLL" (ByVal hWnd As Integer, ByVal hdcprn As Integer, ByVal prtmode As Integer, ByRef image As imgdes, ByRef prtRect As RECT, ByVal boxsiz As Integer, ByVal dspfct As Integer) As Integer |
| C# | int vicwin.printimagenoeject(int hwnd, int hdcprn, int prtmode, ref imgdes srcimg, ref RECT prtrect, int bwidth, int dspfct); |
| C/C++ | int printimagenoeject(HWND hwnd, HDC hdcprn, int prtmode, imgdes *srcimg, RECT *prtrect, int bwidth, int (WINAPI *dspfct)()); |
| Java | int vic.vic32jni.printimagenoeject(int hwnd, int hdcprn, int prtmode, imgdes srcimg, RECT prtrect, int bwidth, DSPFCT dspfct); |
Function Arguments
| hwnd | Window Handle |
| hdcprn | Printer device context handle |
| prtmode | Print mode (0-2) |
| srcimg | Source image |
| prtrect | RECT defining the area to print on page (in mils) |
| bwidth | Border width in device pixels |
| dspfct | Pointer to function that displays the current band number being printed and returns the state of the cancel print flag |
Description
The printimagenoeject function prints an image area to a printer device context.
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 |
Printimagenoeject is almost identical to the printimage function, except printimagenoeject allows printing multiple images and graphic elements (text, lines, etc.) on a single page. The sequence to follow in using printimagenoeject is:
- Call printimagestartdoc to initialize the printer
- Repeatedly call printimagenoeject to print as many image areas as are necessary
- Print any text, lines, etc., using Window's GDI functions
- Call printimageenddoc to eject the printed page
- For greater detail, see the example below.
Return value
| NO_ERROR | Function successful |
| BAD_RANGE | Range error (see Appendix A);
area to be printed is outside the printable range; printed image width or length is zero; or bwidth is larger than the printed width or length |
| BAD_IBUF | Invalid image buffer address |
| BAD_MEM | Insufficient local or global memory |
| BAD_BPP | Source image is not 1-, 8-, or 24-bit |
| BAD_DIB | Source or result is a compressed DIB |
| PRT_ERR | Error occurred sending data to printer |
| PRT_BUSY | Printimagenoeject function already executing |
See also
printimage, printimageenddoc, printimagestartdoc
printimagestartdoc
Function Prototypes
| Visual Basic | Declare Function printimagestartdoc Lib "VIC32.DLL" (ByVal hdcprn As Long, ByVal docName As String) As Long |
| VB.NET | Declare Function printimagestartdoc Lib "VIC32.DLL" (ByVal hdcprn As Integer, ByVal docName As String) As Integer |
| C# | int vicwin.printimagestartdoc(int hdcPrn, ref string docName); |
| C/C++ | int printimagestartdoc(HDC hdcPrn, LPCSTR docName); |
| Java | int vic.vic32jni.printimagestartdoc(int hdcPrn, String docName); |
Function Arguments
| hdcprn | Printer device context handle |
| docName | Document name to be passed to Print Manager |
Description
The printimagestartdoc function initializes the printer beforeprinting one or more image areas with printimagenoeject. Printimagestartdoc should not be used if an image is to be printed with printimage. DocName should be a null-terminated string specifying the name of the document. DocName must not be longer than 32 characters, including the null terminating character. Internally, printimagestartdoc calls Windows StartDoc and StartPage functions.
Return value
| NO_ERROR | Function successful |
| PRT_ERR | Printer could not be initialized |
See also
printimagenoeject, printimageenddoc
See printimagenoeject
rainbowpalette
| 8 |
Function Prototypes
| Visual Basic | Declare Function rainbowpalette Lib "VIC32.DLL" (resimg As imgdes) As Long |
| VB.NET | Declare Function rainbowpalette Lib "VIC32.DLL" (ByRef resimg As imgdes) As Integer |
| C# | int vicwin.rainbowpalette(ref imgdes resimg); |
| C/C++ | int rainbowpalette(imgdes *resimg); |
| Java | int vic.vic32jni.rainbowpalette(imgdes resimg); |
Function Arguments
| resimg | Image which is to receive the new palette |
Description
The rainbowpalette function creates a 256-color palette consisting of 216 rainbow colors, 20 shades of gray, and the 20 Windows default colors. 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. Rainbowpalette is for use with 8-bit images.
Rainbowpalette creates a good all-purpose palette for displaying most color and grayscale images. It can be used with matchcolorimage to force any 8- or 24-bit image to use a standard palette. Use rainbowpalette with matchcolorimage to display a 24-bit RGB image as an 8-bit palette color image and to display multiple 8-bit images using the same palette.
| Table 11. The 256-color Rainbow Palette | |
| Color number | Description |
| 0 to 9 | Windows default colors (0 - 9), see defaultpalette |
| 10 to 225 | Rainbow colors: 216 combinations of Red, Green,
Blue values 0, 51, 102, 153, 204, and 255. Given a
palette color, the red, green, and blue components can
be calculated:
Blue[cindx] = (cindx mod 6) * 51 Green[cindx] = (cindx / 6) * 51 Red[cindx] = (cindx / 36) * 51 where cindx = palette color - 10 |
| 226 to 245 | Grayscale values selected to avoid duplication |
| 246 to 255 | Windows default colors (10 - 19), see default palette |
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, standardpalette
recttoimagearea
Function Prototypes
| Visual Basic | Declare Sub recttoimagearea Lib "VIC32.DLL" (srcrect As RECT, resimg As imgdes) |
| VB.NET | Declare Sub recttoimagearea Lib "VIC32.DLL" (ByRef srcrect As RECT, ByRef resimg As imgdes) |
| C# | void vicwin.recttoimagearea(ref RECT srcrect, ref imgdes resimg); |
| C/C++ | void recttoimagearea(RECT *srcrect, imgdes *resimg); |
| Java | void vic.vic32jni.recttoimagearea(RECT srcrect, imgdes resimg); |
Function Arguments
| srcrect | RECT holding values to set image area |
| resimg | Result image |
Description
The recttoimagearea function sets the image area defined by the image descriptor based on the values of the elements in a RECT data structure.
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 |
This function performs the following assignments:
| image.stx | = srcrect.left; |
| image.sty | = srcrect.top; |
| image.endx | = srcrect.right; |
| image.endy | = srcrect.bottom; |
Return value
There is no return value.
Example
See copyimagebits
reduceimagecolors
| 8 |
Function Prototypes
| Visual Basic | Declare Function reduceimagecolors Lib "VIC32.DLL" (srcimg As imgdes, resimg As imgdes) As Long |
| VB.NET | Declare Function reduceimagecolors Lib "VIC32.DLL" (ByRef srcimg As imgdes, ByRef resimg As imgdes) As Integer |
| C# | int vicwin.reduceimagecolors(ref imgdes srcimg, ref imgdes resimg); |
| C/C++ | int reduceimagecolors(imgdes *srcimg, imgdes *resimg); |
| Java | int vic.vic32jni.reduceimagecolors(imgdes srcimg, imgdes resimg); |
Function Arguments
| srcimg | Source image |
| resimg | Result image |
Description
The reduceimagecolors function reduces the number of colors present in an image area from srcimg.colors to resimg.colors. The new reduced color palette is computed and stored at resimg.palette. The new reduced color image data is stored in the result image area. The source and result image areas are defined by the corresponding image descriptors. Note that this function should be called with two distinct image descriptors because two separate palettes are used. This function is useful to convert 256-color images to 16 colors for display in 16-color display modes.
Return value
| NO_ERROR | Function successful |
| BAD_RANGE | Range error (see Appendix A);
source colors is smaller than result colors; result colors is outside the range 2 to 255; or source or result does not have a palette address or size |
| BAD_IBUF | Invalid image buffer address |
| BAD_MEM | Insufficient local memory |
| BAD_BPP | Images are not both 8-bit |
| BAD_DIB | Source or result is a compressed DIB |
removenoise
| 8 | 24 |
Function Prototypes
| Visual Basic | Declare Function removenoise Lib "VIC32.DLL" (srcimg As imgdes, resimg As imgdes) As Long |
| VB.NET | Declare Function removenoise Lib "VIC32.DLL" (ByRef srcimg As imgdes, ByRef resimg As imgdes) As Integer |
| C# | int vicwin.removenoise(ref imgdes srcimg, ref imgdes resimg); |
| C/C++ | int removenoise(imgdes *srcimg, imgdes *resimg); |
| Java | int vic.vic32jni.removenoise(imgdes srcimg, imgdes resimg); |
Function Arguments
| srcimg | Source image |
| resimg | Result image |
Description
The removenoise function removes random noise from an image area by replacing each pixel value with the median of the 9-pixel local region.
-
Result = median of 3 x 3 local region
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) or Image is less than 3 x 3 pixels |
| 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 |
resize
| 1 | 8 | 24 |
Function Prototypes
| Visual Basic | Declare Function resize Lib "VIC32.DLL" (srcimg As imgdes, resimg As imgdes) As Long |
| VB.NET | Declare Function resize Lib "VIC32.DLL" (ByRef srcimg As imgdes, ByRef resimg As imgdes) As Integer |
| C# | int vicwin.resize(ref imgdes srcimg, ref imgdes resimg); |
| C/C++ | int resize(imgdes *srcimg, imgdes *resimg); |
| Java | int vic.vic32jni.resize(imgdes srcimg, imgdes resimg); |
Function Arguments
| srcimg | Source image |
| resimg | Result image |
Description
The resize function resizes an image area in a source buffer horizontally and vertically to fit into an image area in a destination buffer. The source and result image areas are defined by the corresponding image descriptors. This function is useful for zoom applications, where an image is captured and then enlarged or reduced for display.
The image area can be reduced or increased by any amount as long as the final image dimensions allow it to fit in the destination image area.
Most image areas are resized into new buffers, so the resize function copies the source image palette data to the result image.
Return value
| NO_ERROR | Function successful |
| BAD_RANGE | Range error (see Appendix A) or destination image area width or height is zero |
| BAD_IBUF | Invalid image buffer address |
| BAD_MEM | Insufficient local memory |
| BAD_BPP | Images are not both 1-, 8-, or 24-bit |
| BAD_DIB | Source or result is a compressed DIB |
resizeex
| 1 | 8 | 24 |
Function Prototypes
| Visual Basic | Declare Function resizeex Lib "VIC32.DLL" (srcimg As imgdes, resimg As imgdes, ByVal resizeMode As Long) As Long |
| VB.NET | Declare Function resizeex Lib "VIC32.DLL" (ByRef srcimg As imgdes, ByRef resimg As imgdes, ByVal resizeMode As Integer) As Integer |
| C# | int vicwin.resizeex(ref imgdes srcimg, ref imgdes resimg, int resizeMode); |
| C/C++ | int resizeex(imgdes *srcimg, imgdes *resimg, int resizeMode); |
| Java | int vic.vic32jni.resizeex(imgdes srcimg, imgdes resimg, int resizeMode); |
Function Arguments
| srcimg | Source image |
| resimg | Result image |
| resizeMode | Resize mode 0 = pixel replication 1 = interpolation |
Description
The resizeex function resizes an image area in a source buffer
horizontally and vertically to fit into an image area in a
destination buffer. The source and result image areas are
defined by the corresponding image descriptors.
This function is useful for zoom applications, where an image is
enlarged or reduced for display.
The image area can be reduced or increased to any size. Most image areas are resized into new buffers, so resizeex copies the source image palette data to the result image.
Defined constants for resize mode determine the algorithm to use for generating the new pixels:
| RESIZEFAST | 0 | Pixel replication for the fastest resize |
| RESIZEBILINEAR | 1 | Bilinear interpolation for the best quality image |
Resizeex is a more flexible version of the resize function, since it allows resizing by interpolation in addition to pixel replication. Resizing by interpolation generally produces better quality images without blockiness.
The RESIZEBILINEAR resize mode is not available for 1-bit images, so 1-bit images always use the RESIZEFAST resize mode. If the mode value is out of range the RESIZEFAST mode is used. Most image areas are resized into new buffers, so the resizeex function copies the source image palette data to the result image.
Return value
| NO_ERROR | Function successful |
| BAD_RANGE | Range error (see Appendix A) or destination image area width or height is zero |
| BAD_IBUF | Invalid image buffer address |
| BAD_MEM | Insufficient memory |
| BAD_BPP | Images are not both 1-, 8-, or 24-bit |
| BAD_DIB | Source or result is a compressed DIB (bad mode value results in pixel replication) |
rgb2hsv
Function Prototypes
| Visual Basic | Declare Function Declare Sub rgb2hsv Lib "VIC32.DLL" (ByRef rgbtab As RGBQUAD, ByRef hsvtab As HSVTRIPLE, ByVal colors As Long) |
| VB.NET | Declare Sub rgb2hsv Lib "VIC32.DLL" (ByRef rgbtab As RGBQUAD, ByRef hsvtab As HSVTRIPLE, ByVal colors As Integer) |
| C# | int vicwin.rgb2hsv(ref RGBQUAD rgbtab, ref HSVTRIPLE hsvtab, int colors); |
| C/C++ | int rgb2hsv(RGBQUAD *rgbtab, HSVTRIPLE *hsvtab, int colors); |
| Java | int vic.vic32jni.rgb2hsv(RGBQUAD rgbtab, HSVTRIPLE hsvtab, int colors); |
Function Arguments
| rgbtab | RGB palette table |
| hsvtab | HSV data table |
| colors | Number of colors to convert |
Description
The rgb2hsv function converts a red, green, blue (RGB) color palette to a hue, saturation, value (HSV) table. This function and the hsv2rgb function are used to convert between the RGB and HSV color models.
The HSVTRIPLE structure describes a color consisting of relative intensities of hue, saturation, and value. The hsvtab variable is an array of HSVTRIPLE structures. HSVTRIPLE is defined in VICDEFS.H.
The RGBQUAD structure describes a color consisting of relative intensities of red, green, and blue. The rgbtab variable is an array of RGBQUAD structures. RGBQUAD is defined in WINDOWS.H.
Each RGB or HSV table entry can range from 0 to 255. The HSV table must be large enough to hold colors HSVTRIPLE structures.
Return value
There is no return value.
rgbimagetocmykimage
| 24 |
Function Prototypes
| Visual Basic | Declare Function rgbimagetocmykimage Lib "VIC32.DLL" (srcimg As imgdes, resimg As imgdes) As Long |
| VB.NET | Declare Function rgbimagetocmykimage Lib "VIC32.DLL" (ByRef srcimg As imgdes, ByRef resimg As imgdes) As Integer |
| C# | int vicwin.rgbimagetocmykimage(ref imgdes srcimg, ref imgdes resimg); |
| C/C++ | int rgbimagetocmykimage(imgdes *srcimg, imgdes *resimg); |
| Java | int vic.vic32jni.rgbimagetocmykimage(imgdes srcimg, imgdes resimg); |
Function Arguments
| srcimg | Source image |
| resimg | Result image |
Description The rgbimagetocmykimage function converts a red, green, blue (RGB) image area to a cyan, magenta, yellow, black (CMYK) image area. This function and the cmykimagetorgbimage function are used to convert between the RGB and CMYK color models. The source and result image areas are defined by the corresponding image descriptors. The source image must be 24-bit and the result image must be 32-bit.
For more information about a color models, see any introductory graphics textbook.
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 is not 24-bit or result is not 32-bit |
| BAD_DIB | Source or result is a compressed DIB |
rgbimagetohsvimage
| 24 |
Function Prototypes
| Visual Basic | Declare Function rgbimagetohsvimage Lib "VIC32.DLL" (srcimg As imgdes, resimg As imgdes) As Long |
| VB.NET | Declare Function rgbimagetohsvimage Lib "VIC32.DLL" (ByRef srcimg As imgdes, ByRef resimg As imgdes) As Integer |
| C# | int vicwin.rgbimagetohsvimage(ref imgdes srcimg, ref imgdes resimg); |
| C/C++ | int rgbimagetohsvimage(imgdes *srcimg, imgdes *resimg); |
| Java | int vic.vic32jni.rgbimagetohsvimage(imgdes srcimg, imgdes resimg); |
Function Arguments
| srcimg | Source image |
| resimg | Result image |
Description The rgbimagetohsvimage function converts a red, green, blue (RGB) image area to a hue, saturation, value (HSV) image area. This function and the hsvimagetorgbimage function are used to convert between the RGB and HSV color models. The source and result image areas are defined by the corresponding image descriptors. The source and result images must be 24-bit.
For more information about a color models, see any introductory graphics textbook.
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 24-bit |
| BAD_DIB | Source or result is a compressed DIB |
rotate
| 1 | 8 | 24 |
Function Prototypes
| Visual Basic | Declare Function rotate Lib "VIC32.DLL" (ByVal angle As Double, srcimg As imgdes, resimg As imgdes) As Long |
| VB.NET | Declare Function rotate Lib "VIC32.DLL" (ByVal angle As Double, ByRef srcimg As imgdes, ByRef resimg As imgdes) As Integer |
| C# | int vicwin.rotate(double angle, ref imgdes srcimg, ref imgdes resimg); |
| C/C++ | int rotate(double angle, imgdes *srcimg, imgdes *resimg); |
| Java | int vic.vic32jni.rotate(double angle, imgdes srcimg, imgdes resimg); |
Function Arguments
| angle | Angle in degrees to rotate |
| srcimg | Source image |
| resimg | Result image |
Description
The rotate function rotates an image area. The source and result image areas are defined by the corresponding image descriptors. The angle of rotation is specified by angle in degrees.
Rotation occurs about the center of the image area. If the result image area is not large enough to hold the rotated image, the edges will be clipped.
Return value
| NO_ERROR | Function successful |
| BAD_RANGE | Range error, see Appendix A |
| BAD_IBUF | Invalid image buffer address |
| BAD_MEM | Insufficient memory |
| BAD_BPP | Images are not both 1-, 8-, or 24-bit |
| BAD_DIB | Source or result is a compressed DIB |
See also
rotate90
rotateex
| 1 | 8 | 24 |
Function Prototypes
| Visual Basic | Declare Function rotateex Lib "VIC32.DLL" (ByVal angle As Double, srcimg As imgdes, resimg As imgdes, ByVal mode As Long) As Long |
| VB.NET | Declare Function rotateex Lib "VIC32.DLL" (ByVal angle As Double, ByRef srcimg As imgdes, ByRef resimg As imgdes, ByVal mode As Integer) As Integer |
| C# | int vicwin.rotateex(double angle, ref imgdes srcimg, ref imgdes resimg, int mode); |
| C/C++ | int rotateex(double angle, imgdes *srcimg, imgdes *resimg, int mode); |
| Java | int vic.vic32jni.rotateex(double angle, imgdes srcimg, imgdes resimg, int mode); |
Function Arguments
| angle | Angle in degrees to rotate |
| srcimg | Source image |
| resimg | Result image |
| mode | Mode for calculating interstitial pixels
0 = interpolation 1 = replication |
Description
The rotateex function rotates an image area. The source and result image areas are defined by the corresponding image descriptors. The angle of rotation is specified by angle in degrees.
Rotation occurs about the center of the image area. If the result image area is not large enough to hold the rotated image, the edges will be clipped.
The mode value specifies how the rotated pixel value are calculated, zero for interpolation and one for pixel replication.
Return value
| NO_ERROR | Function successful |
| BAD_RANGE | Range error, see Appendix A |
| BAD_IBUF | Invalid image buffer address |
| BAD_MEM | Insufficient memory |
| BAD_BPP | Images are not both 1-, 8-, or 24-bit |
| BAD_DIB | Source or result is a compressed DIB |
rotate90
| 1 | 8 | 24 |
Function Prototypes
| Visual Basic | Declare Function Declare Function rotate90 Lib "VIC32.DLL" (ByVal rotflag As Long, srcimg As imgdes, resimg As imgdes) As Long |
| VB.NET | Declare Function rotate90 Lib "VIC32.DLL" (ByVal rotflag As Integer, ByRef srcimg As imgdes, ByRef resimg As imgdes) As Integer |
| C# | int vicwin.rotate90(int rotflag, ref imgdes srcimg, ref imgdes resimg); |
| C/C++ | int rotate90(int rotflag, imgdes *srcimg, imgdes *resimg); |
| Java | int vic.vic32jni.rotate90(int rotflag, imgdes srcimg, imgdes resimg); |
Function Arguments
| rotflag | Direction to rotate
0 = clockwise 1 = counter clockwise |
| srcimg | Source image |
| resimg | Result image |
Description
The rotate90 function rotates an image area 90 degrees. The source and result image areas are defined by the corresponding image descriptors. The direction of rotation is set by rotflag. To rotate clockwise set rotflag to 0, to rotate counter clockwise set rotflag to any nonzero value.
Rotation occurs about the center of the image area. If the result image area is not large enough to hold the rotated image, the edges will be clipped
Return value
| NO_ERROR | Function successful |
| BAD_RANGE | Range error, see Appendix A |
| BAD_IBUF | Invalid image buffer address |
| BAD_MEM | Insufficient memory |
| BAD_BPP | Images are not both 1-, 8-, or 24-bit |
| BAD_DIB | Source or result is a compressed DIB |
See also
rotate
savebif
| 8 |
Function Prototypes
| Visual Basic | Declare Function savebif Lib "VIC32.DLL" (ByVal filename As String, srcimg As imgdes) As Long |
| VB.NET | Declare Function savebif Lib "VIC32.DLL" (ByVal filename As String, ByRef srcimg As imgdes) As Integer |
| C# | int vicwin.savebif(ref string filename, ref imgdes srcimg); |
| C/C++ | int savebif(LPCSTR filename, imgdes *srcimg); |
| Java | int vic.vic32jni.savebif(String filename, imgdes srcimg); |
Function Arguments
| filename | Filename to save |
| srcimg | Source image |
Description
The savebif function saves an image area as a binary image file (BIF). The image area is defined by the image descriptor. BIF files contain only brightness level data stored as one byte per pixel. Level data can range from 0 to 255. The image data is stored in rows, with the first row of data corresponding to the top of the image.
BIF files are fast to load and save, but is there is no way to determine the dimensions of the file when loaded, that the file is a BIF file, or to save palette information.
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 |
| BAD_CRT | Cannot create file or directory is invalid |
| BAD_DSK | Disk full, file not written |
savebmp
| 1 | 8 | 24 |
Function Prototypes
| Visual Basic | Declare Function savebmp Lib "VIC32.DLL" (ByVal filename As String, srcimg As imgdes, ByVal comp As Long) As Long |
| VB.NET | Declare Function savebmp Lib "VIC32.DLL" (ByVal filename As String, ByRef srcimg As imgdes, ByVal comp As Integer) As Integer |
| C# | int vicwin.savebmp(ref string filename, ref imgdes srcimg, int comp); |
| C/C++ | int savebmp(LPCSTR filename, imgdes *srcimg, int comp); |
| Java | int vic.vic32jni.savebmp(String filename, imgdes srcimg, int comp); |
Function Arguments
| filename | Filename to save |
| srcimg | Source image |
| comp | Compression type
0 = none 1 = RLE8 |
Description
The savebmp function saves an image area as a 1-, 8-, or 24-bit BMP file. The image area and palette are defined by the image descriptor. Palette information must be stored in a table pointed to by the image descriptor member palette. The number of colors in the table must be contained in the image descriptor member colors.
8-Bit per pixel images may be saved as uncompressed or compressed BMP files. The RLE8 compression scheme efficiency can be poor for photographic-type images and may actually result in larger files.
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_CRT | Cannot create file or directory is invalid |
| BAD_DSK | Disk full, file not written |
| BAD_CMP | Unsupported compression scheme for the image bits per pixel |
savebmptobuffer
| 1 | 8 | 24 |
Function Prototypes
| Visual Basic | Declare Function savebmptobuffer Lib "VIC32.DLL" (ByRef buffer As Long, srcimg As imgdes, ByVal comp As Long) As Long |
| VB.NET | Declare Function savebmptobuffer Lib "VIC32.DLL" (ByRef buffer As Integer, ByRef srcimg As imgdes, ByVal comp As Integer) As Integer |
| C# | int vicwin.savebmptobuffer(ref int buffer, ref imgdes srcimg, int comp); |
| C/C++ | int savebmptobuffer(UCHAR * *buffer, imgdes *srcimg, int comp); |
| Java | int vic.vic32jni.savebmptobuffer(refvar buffer, imgdes srcimg, int comp); |
Function Arguments
| buffer | Variable to receive resulting buffer address |
| srcimg | Source image |
| comp | Compression type
0 = none 1 = RLE8 |
Description
The savebmptobuffer function saves an image area as 1-, 8-, or
24-bit BMP file data in a memory buffer. The memory buffer is
allocated by the savebmptobuffer function and the resulting buffer
address is returned in buffer. This memory must be released when
no longer needed.
To free the memory:
GlobalFreePtr(buffer); // Windowsx.h macro
To determine the size of the buffer:
BUFFER_SIZE(buffer); // Vicdefs.h macro
The image area and palette are defined by the image descriptor. Palette information must be located in a table pointed to by the image descriptor member palette. The number of colors in the table must be contained in the image descriptor member colors.
8-Bit per pixel images may be saved as uncompressed or compressed BMP files. The RLE8 compression scheme efficiency can be poor for photographic-type images and may actually result in larger files.
Return value
| NO_ERROR | Function successful |
| BAD_RANGE | Range error, see Appendix A |
| BAD_IBUF | Invalid image buffer address |
| BAD_MEM | Insufficient memory |
| BAD_BPP | Image is not 1-, 8-, or 24-bit |
| BAD_DIB | Image is a compressed DIB |
| BAD_CRT | Cannot write BMP data to buffer |
| BAD_CMP | Unsupported compression scheme for the image bits per pixel |
saveeps
| 8 | 24 |
Function Prototypes
| Visual Basic | Declare Function saveeps Lib "VIC32.DLL" (ByVal filename As String, srcimg As imgdes) As Long |
| VB.NET | Declare Function saveeps Lib "VIC32.DLL" (ByVal filename As String, ByRef srcimg As imgdes) As Integer |
| C# | saveepsvicwin.(ref string filename, ref imgdes srcimg); |
| C/C++ | saveeps(LPCSTR filename, imgdes *srcimg); |
| Java | int vic.vic32jni.saveeps(String filename, imgdes srcimg); |
Function Arguments
| filename | Filename to save |
| srcimg | Source image |
Description
The saveeps function saves an image area as an 8- or 24-bit Encapsulated Postscript file.
The image area is defined by the image descriptor.
If the image area to be saved is grayscale (i.e., image descriptor element biBitCount equals 8 and imgtype bit 0 equals 1), the file will be written as a grayscale EPS. Palette color and RGB images will be written as 24-bit color EPS files.
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- or 24-bit |
| BAD_DIB | Image is a compressed DIB |
| BAD_CRT | Cannot create file or directory is invalid |
| BAD_DSK | Disk full, file not written |
savegif
| 1 | 8 |
Function Prototypes
| Visual Basic | Declare Function savegif Lib "VIC32.DLL" (ByVal filename As String, srcimg As imgdes) As Long |
| VB.NET | Declare Function savegif Lib "VIC32.DLL" (ByVal filename As String, ByRef srcimg As imgdes) As Integer |
| C# | int vicwin.savegif(ref string filename, ref imgdes srcimg); |
| C/C++ | int savegif(LPCSTR filename, imgdes *srcimg); |
| Java | int vic.vic32jni.savegif(String filename, imgdes srcimg); |
Function Arguments
| filename | Filename to save |
| srcimg | Source image |
Description
The savegif function saves an image area as a 1- or 8-bit GIF file with palette information. The image area and palette are defined by the image descriptor.
The savegif function saves an image as an LZW-compressed file.
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 |
| BAD_CRT | Cannot create file or directory is invalid |
| BAD_DSK | Disk full, file not written |
| LZW_DISABLED | LZW functionality locked, see unlockLZW |
See also
savegifex, setgifcomment
savegifex
| 1 | 8 |
Function Prototypes
| Visual Basic | Declare Function savegifex Lib "VIC32.DLL" (ByVal filename As String, srcimg As imgdes, ByVal savemode As Long, ByVal transColor As Long) As Long |
| VB.NET | Declare Function savegifex Lib "VIC32.DLL" (ByVal filename As String, ByRef srcimg As imgdes, ByVal savemode As Integer, ByVal transColor As Integer) As Integer |
| C# | int vicwin.savegifex(ref string filename, ref imgdes srcimg, int savemode, int transColor); |
| C/C++ | int savegifex(LPCSTR filename, imgdes *srcimg, int savemode, int transColor); |
| Java | int vic.vic32jni.savegifex(String filename, imgdes srcimg, int savemode, int transColor); |
Function Arguments
| filename | Filename to save |
| srcimg | Source image |
| savemode | Save mode
0 = Write baseline GIF LZW-compressed file 1 = Use interlaced row storage 2 = Use transColor as transparent color 4 = Save image with 4 bits per pixel 8 = Write GIF without LZW compression 0x00010000 = Save image with 1 bits per pixel 0x00020000 = Save image with 2 bits per pixel 0x00030000 = Save image with 3 bits per pixel 0x00040000 = Save image with 4 bits per pixel 0x00050000 = Save image with 5 bits per pixel 0x00060000 = Save image with 6 bits per pixel 0x00070000 = Save image with 7 bits per pixel 0x00080000 = Save image with 8 bits per pixel |
| transColor | Transparent color (0-255) |
Description
The savegifex function saves an image area as a GIF file with 1- through 8-bit per pixel, interlace, transparent color, and compression options. The image area and palette are defined by the image descriptor.
The parameter savemode determines which options are used. SaveMode is assembled from defined constants that have the values listed in Table 12. Any combination of values can be ORed together.
| Table 12. GIF File Types Written by savegifex | ||
| Savemode | Meaning | |
| GIFLZWCOMP (0) | Write baseline GIF LZW-compressed file1 | |
| GIFINTERLACE (1) | Use interlaced row storage | |
| GIFTRANSPARENT (2) | Use transColor as transparent color2 | |
| GIFWRITE4BIT (4) | Save image with 4 bits per pixel3 | |
| GIFNOCOMP (8) | Write GIF without LZW compression4 | |
| GIFWRITE_1BIT (0x00010000) | Save image with 1 bit per pixel | |
| GIFWRITE_2BIT (0x00020000) | Save image with 2 bits per pixel | |
| GIFWRITE_3BIT (0x00030000) | Save image with 3 bits per pixel | |
| GIFWRITE_4BIT (0x00040000) | Save image with 4 bits per pixel | |
| GIFWRITE_5BIT (0x00050000) | Save image with 5 bits per pixel | |
| GIFWRITE_6BIT (0x00060000) | Save image with 6 bits per pixel | |
| GIFWRITE_7BIT (0x00070000) | Save image with 7 bits per pixel | |
| GIFWRITE_8BIT (0x00080000) | Save image with 8 bits per pixel | |
|
||
Values should be ORed together to achieve the desired mode value. For example, to save an interlaced uncompressed image use:
-
saveMode = GIFINTERLACE | GIFNOCOMP
Return value
| NO_ERROR | Function successful |
| BAD_RANGE | Range error, see Appendix A |
| BAD_RANGE | Greater than 16 palette colors (4-bit GIF file only) |
| BAD_FAC | TransColor not 0 to 255 (transparent GIF file only) |
| BAD_IBUF | Invalid image buffer address |
| BAD_MEM | Insufficient local memory |
| BAD_BPP | Image is not 1- or 8-bit |
| BAD_DIB | Image is a compressed DIB |
| BAD_CRT | Cannot create file or directory is invalid |
| BAD_DSK | Disk full, file not written |
| LZW_DISABLED | LZW functionality locked, see unlockLZW |
See also
savegif, setgifcomment
savegifframe
| 1 | 8 |
Function Prototypes
| Visual Basic | Declare Function savegifframe Lib "VIC32.DLL" (ByVal filename As String, srcimg As imgdes, gsdata As GifGlobalSaveData, fsdata As GifFrameSaveData, ByVal savemode As Long) As Long |
| VB.NET | Declare Function savegifframe Lib "VIC32.DLL" (ByVal filename As String, ByRef srcimg As imgdes, ByRef gsdata As GifGlobalSaveData, ByRef fsdata As GifFrameSaveData, ByVal savemode As Integer) As Integer |
| C# | int vicwin.savegifframe(ref string filename, ref imgdes srcimg, ref GifGlobalSaveData gdata, ref GifFrameSaveData fdata, int savemode); |
| C/C++ | int savegifframe(LPCSTR filename, imgdes *srcimg, GifGlobalSaveData *gdata, GifFrameSaveData *fdata, int savemode); |
| Java | int vic.vic32jni.savegifframe(String filename, imgdes srcimg, GifGlobalSaveData gdata, GifFrameSaveData fdata, int savemode); |
Function Arguments
| filename | Filename to save |
| srcimg | Source image |
| gdata | GifGlobalSaveData data structure describing the gif file |
| fdata | GifFrameSaveData data structure describing the frame |
Description
The savegifframe function saves an image area with palette information as a frame in a multiframe GIF file. The image area and palette are defined by the image descriptor. If filename already exists, the frame is appended to the end of the file. If filename does not exist, filename is created and the image is written as the first frame.
The GifGlobalSaveData gdata and GifFrameSaveData fdata data structures must be completed with the desired settings for the file and the specific frame before this function is called. These data structures are defined in VICDEFS.H.
The GifGlobalSaveData structure elements are defined as follows:
| scrwidth | Maximum pixel width of the animation |
| scrlength | Maximum pixel length of the animation |
| hasColorMap | nonzero = global palette |
| bckColor | Color index of screen background color |
| loop | Number of times the animation should repeat |
The GifFrameSaveData structure elements are defined as follows:
| startx | X pixel position with respect to scrwidth |
| starty | Y pixel position with respect to scrlength |
| hasColorMap | Local palette is present! |
| delay | 100ths of a second to display frame |
| transColor | Transparent color index, 0 - 255 or -1 for no transparancy |
| removeBy | How frame is to be treated after display:
0 – The image is left unremoved 1 – The image is left unremoved 2 – The image is replaced by the background 3 – The image is replaced by the previous image |
| waitForUserInput | nonzero = expect user input |
Refer to Table 12 in the description of savegifex for information about savemode values.
Refer to the description of savegif for additional information about the gif format and lzw compression restrictions.
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 |
| BAD_CRT | Cannot create file or directory is invalid |
| BAD_DSK | Disk full, file not written |
| LZW_DISABLED | LZW functionality locked, see unlockLZW |
| BAD_FAC | Transparent color not in range 0 - 255, -1 |
| BAD_DIM | Image format does not support image width or length > 65535 |
See also
savegifex
savegifmultiframetobuffer
| 1 | 8 |
Function Prototypes
| Visual Basic | Declare Function savegifmultiframetobuffer Lib "VIC32.DLL" (ByRef buffer As Long, srcimg As imgdes, gsdata As GifGlobalSaveData, fsdata As GifFrameSaveData, ByVal savemode As Long, ByVal nelem As Long) As Long |
| VB.NET | Declare Function savegifmultiframetobuffer Lib "VIC32.DLL" (ByRef buffer As Integer, ByRef srcimgarray As imgdes, ByRef gsdata As GifGlobalSaveData, ByRef fsdataarray As GifFrameSaveData, ByVal savemode As Integer, ByVal nelem As Integer) As Integer |
| C# | int vicwin.savegifmultiframetobuffer(ref int buffer, ref imgdes srcimgarray, ref GifGlobalSaveData gdata, ref GifFrameSaveData fdataarray, int savemode, int nelem); |
| C/C++ | int savegifmultiframetobuffer(UCHAR **buffer, imgdes *srcimgarray, GifGlobalSaveData *gdata, GifFrameSaveData *fdataarray, int savemode, int nelem); |
Function Arguments
| buffer | Variable to receive resulting buffer address |
| srcimgarray | Array of image descriptors for images to save |
| gdata | GifGlobalSaveData data structure describing the gif file, see savegifframe |
| fdata | Array of GifFrameSaveData data structures describing the frames, see savegifframe |
| savemode | 0 = standard GIF with LZW compressions, see savegifex |
| nelem | Number of frames to save, corresponds to number of elements in the arrays |
Description
The savegifmultiframetobuffer function saves multiple images as frames as multiframe GIF file data in a memory buffer. The memory buffer is allocated by the savegifmultiframetobuffer function and the resulting buffer address is returned in buffer. This memory must be released when no longer needed.
C/C++ code to free the buffer:
GlobalFreePtr(buffer); // Windowsx.h macro
To determine the size of the buffer:
BUFFER_SIZE(buffer); // Vicdefs.h macro
VB.NET code to transfer the buffer data to a VB byte array:
<!-- #include file="../vicdefs.aspx" -->
.
.
.
dim buffhandle as integer
dim buffsize as integer
buffhandle = GlobalHandle(buffer)
buffsize = GlobalSize(buffhandle)
redim barray(buffsize)
CopyDatatbufftoBytearray(barray(0), buffaddr, buffsize)
GlobalFree(buffhandle)
The image areas are defined by the image descriptors contained in the srcimgarray.
The GifGlobalSaveData gdata and GifFrameSaveData fdata data structures must be completed with the desired settings for the file and the specific frames before this function is called. These data structures are defined in VICDEFS.H and VICDEFS.ASPX.
The GifGlobalSaveData structure elements are defined as follows:
| scrwidth | Maximum pixel width of the animation |
| scrlength | Maximum pixel length of the animation |
| hasColorMap | nonzero = global palette |
| bckColor | Color index of screen background color |
| loop | Number of times the animation should repeat |
The GifFrameSaveData structure elements are defined as follows:
| startx | X pixel position with respect to scrwidth |
| starty | Y pixel position with respect to scrlength |
| hasColorMap | Local palette is present! |
| delay | 100ths of a second to display frame |
| transColor | Transparent color index, 0 - 255 or -1 for no transparancy |
| removeBy | How frame is to be treated after display:
0 – The image is left unremoved 1 – The image is left unremoved 2 – The image is replaced by the background 3 – The image is replaced by the previous image |
| waitForUserInput | nonzero = expect user input |
Refer to Table 12 in the description of savegifex for information about savemode values.
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 |
| BAD_CRT | Cannot write GIF data to buffer |
| BAD_DSK | Disk full, file not written |
| LZW_DISABLED | LZW functionality locked, see unlockLZW |
| BAD_FAC | Transparent color not in range 0 - 255, -1 |
| BAD_DIM | Image format does not support image width or length > 65535 |
See also
savegifex
savegiftobufferex
| 1 | 8 |
Function Prototypes
| Visual Basic | Declare Function savegiftobufferex Lib "VIC32.DLL" (ByRef buffer As Long, srcimg As imgdes, ByVal savemode As Long, ByVal transColor As Long) As Long |
| VB.NET | Declare Function savegiftobufferex Lib "VIC32.DLL" (ByRef buffer As Integer, ByRef srcimg As imgdes, ByVal savemode As Integer, ByVal transColor As Integer) As Integer |
| C# | int vicwin.savegiftobufferex(ref int buffer, ref imgdes srcimg, int savemode, int transColor); |
| C/C++ | int savegiftobufferex(UCHAR * *buffer, imgdes *srcimg, int savemode, int transColor); |
| Java | int vic.vic32jni.savegiftobufferex(refvar buffer, imgdes srcimg, int savemode, int transColor); |
Function Arguments
| buffer | Variable to receive resulting buffer address |
| srcimg | Source image |
| savemode | Save mode
0 = Write baseline GIF LZW-compressed file 1 = Use interlaced row storage 2 = Use transColor as transparent color 4 = Save image with 4 bits per pixel 8 = Write GIF without LZW compression 0x00010000 = Save image with 1 bits per pixel 0x00020000 = Save image with 2 bits per pixel 0x00030000 = Save image with 3 bits per pixel 0x00040000 = Save image with 4 bits per pixel 0x00050000 = Save image with 5 bits per pixel 0x00060000 = Save image with 6 bits per pixel 0x00070000 = Save image with 7 bits per pixel 0x00080000 = Save image with 8 bits per pixel |
| transColor | Transparent color (0-255) |
Description
The savegiftobufferex function saves an image area as 1- through
8-bit per pixel GIF file data in a memory buffer. The memory buffer is
allocated by the savegiftobufferex function and the resulting buffer
address is returned in buffer. This memory must be released when
no longer needed.
To free the memory:
GlobalFreePtr(buffer); // Windowsx.h macro
To determine the size of the buffer:
BUFFER_SIZE(buffer); // Vicdefs.h macro
The image area and palette are defined by the image descriptor.
The parameter savemode determines which options are used just as in the savegifex function. Savemode is assembled from defined constants that have the values listed in Table 12. Any combination of flags can be used. Flag values should be ORed together to achieve the desired mode value. For example, to save an interlaced uncompressed image use:
-
savemode = GIFINTERLACE | GIFNOCOMP
Return value
| NO_ERROR | Function successful |
| BAD_RANGE | Range error, see Appendix A, or greater than 16 palette colors (4-bit GIF file only) |
| BAD_FAC | TransColor not 0 to 255 (transparent GIF only) |
| BAD_IBUF | Invalid image buffer address |
| BAD_MEM | Insufficient memory |
| BAD_BPP | Image is not 1- or 8-bit |
| BAD_DIB | Image is a compressed DIB |
| BAD_CRT | Cannot write GIF data to buffer |
| LZW_DISABLED | LZW functionality not available, see unlockLZW |
See also savegifex, loadgiffrombuffer