Visual Basic | Declare Function pcxinfo Lib "VIC32.DLL" (ByVal filename As String, pinfo As PcxData) As Long |
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
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 |
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 |
8 | 24 |
Function Prototypes
Visual Basic | Declare Function changebright Lib "VIC32.DLL" (ByVal amount As Long, srcimg As imgdes, resimg As imgdes) As Long |
C/C++ | int pixellize(const int factr, imgdes *srcimg, imgdes *resimg); |
Java | int vic.vic32jni.pixellize(int factr, 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 |
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 |
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 |
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
Function Prototypes
Visual Basic | Declare Function pnginfofrombuffer Lib "VIC32.DLL" (ByVal buff As Long, pinfo As PngData) As Long |
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
1 | 8 | 24 |
Function Prototypes
Visual Basic | Declare Function pnginfofrombuffer Lib "VIC32.DLL" (ByVal buffer As Long, pinfo As PngData) As Long |
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 |
Function Prototypes
Visual Basic | Declare Sub pngsetxyresolution Lib "VIC32.DLL" (ByVal xres As Long, ByVal yres As Long, ByVal resunit As Long) |
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
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 |
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):
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 |
Function Prototypes
Visual Basic | Declare Sub printimageenddoc Lib "VIC32.DLL" (ByVal hdcprn As Long, ByVal ejectPage As Long) |
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
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 |
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:
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
Function Prototypes
Visual Basic | Declare Function printimagestartdoc Lib "VIC32.DLL" (ByVal hdcprn As Long, ByVal docName As String) As Long |
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
8 |
Function Prototypes
Visual Basic | Declare Function rainbowpalette Lib "VIC32.DLL" (resimg As imgdes) As Long |
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
Function Prototypes
Visual Basic | Declare Sub recttoimagearea Lib "VIC32.DLL" (srcrect As RECT, resimg As imgdes) |
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
8 |
Function Prototypes
Visual Basic | Declare Function reduceimagecolors Lib "VIC32.DLL" (srcimg As imgdes, resimg As imgdes) As Long |
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 |
8 | 24 |
Function Prototypes
Visual Basic | Declare Function removenoise Lib "VIC32.DLL" (srcimg As imgdes, resimg As imgdes) As Long |
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.
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 |
1 | 8 | 24 |
Function Prototypes
Visual Basic | Declare Function resize Lib "VIC32.DLL" (srcimg As imgdes, resimg As imgdes) As Long |
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 |
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 |
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) |
Function Prototypes
Visual Basic | Declare Function Declare Sub rgb2hsv Lib "VIC32.DLL" (ByRef rgbtab As RGBQUAD, ByRef hsvtab As HSVTRIPLE, ByVal colors As Long) |
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.
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 |
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
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 |
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
8 |
Function Prototypes
Visual Basic | Declare Function savebif Lib "VIC32.DLL" (ByVal filename As String, srcimg As imgdes) As Long |
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 |
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 |
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 |
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 |
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 buff. This memory must be released when
no longer needed.
To free the memory:
GlobalFreePtr(buff); // Windowsx.h macro
BUFFER_SIZE(buff); // 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 |
8 | 24 |
Function Prototypes
Visual Basic | Declare Function saveeps Lib "VIC32.DLL" (ByVal filename As String, srcimg As imgdes) As Long |
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 |
1 | 8 |
Function Prototypes
Visual Basic | Declare Function savegif Lib "VIC32.DLL" (ByVal filename As String, srcimg As imgdes) As Long |
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 only if LZW compression has been enabled with unlockLZW. Otherwise, the image is saved as an uncompressed file. In general, LZW-compressed files are approximately 50% smaller than uncompressed GIF files.
The use of LZW compression requires an LZW license from Unisys Corporation. For information concerning licensing the LZW compression and/or decompression capability, please contact: Unisys Corporation, Welch Licensing Department - C1SW19, Township Line & Union Meeting Roads, P O Box 500, Blue Bell PA 19424.
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
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 |
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 | |
|
An attempt to save an image as an LZW-compressed file will return the error code LZW_DISABLED unless LZW functionality has been enabled with unlockLZW. The use of LZW compression requires an LZW license from Unisys Corporation. For information concerning licensing the LZW compression and/or decompression capability, please contact: Unisys Corporation, Welch Licensing Department - C1SW19, Township Line & Union Meeting Roads, P O Box 500, Blue Bell PA 19424.
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
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 |
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
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 |
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 buff. This memory must be released when
no longer needed.
To free the memory:
GlobalFreePtr(buff); // Windowsx.h macro
BUFFER_SIZE(buff); // 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:
An attempt to save an image as an LZW-compressed file will return the error code LZW_DISABLED unless LZW functionality has been enabled with unlockLZW. The use of LZW compression requires an LZW license from Unisys Corporation. For information concerning licensing the LZW compression and/or decompression capability, please contact: Unisys Corporation, Welch Licensing Department - C1SW19, Township Line & Union Meeting Roads, P O Box 500, Blue Bell PA 19424, www.unisys.com.
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
8 | 24 |
Function Prototypes
Visual Basic | Declare Function savejpg Lib "VIC32.DLL" (ByVal filename As String, srcimg As imgdes, ByVal quality As Long) As Long |
C/C++ | int savejpg(LPCSTR filename, imgdes *srcimg, int quality); |
Java | int vic.vic32jni.savejpg(String filename, imgdes srcimg, int quality); |
Function Arguments
filename | Filename to save |
srcimg | Source image |
quality | Image quality (1 - 100) |
Description
The savejpg function saves an 8- or 24-bit image area as a color or grayscale JPEG File Interchange Format (JFIF) file. The JPEG format is suitable for photographic type images. The image area is defined by the image descriptor.
If the image area to be saved is grayscale (i.e., image descriptor elements biBitCount equals 8 and imgtype bit 0 equals 1), the file will be written as a JPEG one-component grayscale file. Palette color and RGB images will be written as JPEG three-component color files. This is summarized in Table 13.
The JPEG format written by savejpg is "lossy" in that not all of the information contained in the image is saved in the file. Depending on the value of quality, more or less image information is retained. This makes possible excellent compression ratios, often 15:1 without much apparent loss of image quality, since much of the image information is redundant or extraneous with respect to how the image is perceived. The value chosen for quality will depend on how much image degradation can be tolerated and how small a file is needed.
A quality factor of 100 retains the most image data (although some data is still lost). A quality factor of 75 generally produces excellent images indistinguishable from the original with substantial file size reduction. As a guideline, we recommend starting with quality factors of 75 or 50. Quality factors less than 25 are not recommended. If quality outside the range 1 - 100 is specified, the value will be set to 1 or 100.
Savejpg saves an image as a baseline DCT sequential Huffman encoded file (type SOF0) if quality is 25 or greater. For quality factors less than 25 an image is saved as an extended DCT sequential file (type SOF1). All JPEG readers should be able to read baseline DCT files, but may not be capable of loading extended DCT files. Therefore, for maximum compatibility quality factors less than 25 are not recommended. The JPEG lossless mode format is not supported by savejpg.
Since some image information is lost each time an image is saved as a JPEG file, this is not the file format to use if images are to be loaded and saved repeatedly. For example, where intermediate images are saved to disk during a lengthy image processing sequence.
Producing JPEG files is computationally complex, so saving an image as a JPEG file will generally take longer than saving an image in some other format.
Table 13. JPEG File Types Written by savejpg | |
Image type | JPEG file type |
Grayscale (8-bit) | Grayscale (1 component) |
Palette color (8-bit) | Color (3 components) |
RGB (24-bit) | Color (3 components) |
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 |
8 | 24 |
Function Prototypes
Visual Basic | Declare Function savejpgex Lib "VIC32.DLL" (ByVal filename As String, image As imgdes, ByVal quality As Long, ByVal savemode As Long) As Long |
C/C++ | int savejpgex(LPCSTR filename, imgdes *srcimg, int quality, int savemode); |
Java | int vic.vic32jni.savejpgex(String filename, imgdes srcimg, int quality, int savemode); |
Function Arguments
filename | Filename to save |
srcimg | Source image |
quality | Image quality (1 - 100) |
savemode | Save mode (0 - 2, 0x10 - 0x12) |
Description
The savejpgex function saves an 8- or 24-bit image area in the JPEG File
Interchange Format (JFIF) file format to a disk file. The image area is
defined by the image descriptor. The amount of data compression is determined
by quality. A quality of 100 represents maximum quality and minimum compression.
The mode determines the type of JPEG file to be written.
Table 14. JPEG File Types Written by savejpgex | ||
Mode | Description | File type |
JPGSEQ (0) | Baseline sequential (uses standard Huffman tables) | SOF0 or SOF1 |
JPGPROG (1) | Progressive (multipass) | SOF2 |
JPGSEQOPT (2) | Sequential optimized (computes best Huffman tables) | SOF0 or SOF1 |
JPGSEQTN (0x10) | Baseline sequential with thumbnail | SOF0 or SOF1 |
JPGPROGTN (0x11) | Progressive with thumbnail | SOF2 |
JPGSEQOPTTN (0x12) | Sequential optimized with thumbnail | SOF0 or SOF1 |
Progressive JPEG files are generally slightly smaller than baseline sequential, but are normally slower to write and load. Also, many applications do not read progressive JPEG files.
Sequential optimized JPEG files are generally 5-10 percent smaller than baseline JPEG files. Any JPEG reader should be able to read sequential optimized JPEG files. If mode is out of the range 0 - 2 or 0x10 - 0x12 a baseline sequential file is written.
Refer to savejpg for additional information about saving an image using JPEG compression. Savejpgex is an enhanced version of the savejpg function (savejpg writes only baseline sequential, mode = 0 files).
Modes 0x10 - 0x12 save a thumbnail version of the image in addition to saving the main image. A grayscale image creates an 8-bit thumbnail and a 24-bit RGB or 8-bit palette color image creates a 24-bit thumbnail. The default thumbnail size is 64. To change the thumbnail size use jpegsetthumbnailsize. See jpegsetthumbnailsize for thumbnail size limitations.
Return value
NO_ERROR | Function successful |
BAD_RANGE | Range error, see Appendix A |
NO_ERROR | Function successful |
BAD_IBUF | Invalid image buffer address |
BAD_MEM | Insufficient 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 |
See also
savejpg, savejpgtobuffer, savejpgtobufferex
8 | 24 |
Function Prototypes
Visual Basic | Declare Function savejpgtobuffer Lib "VIC32.DLL" (ByRef buffer As Long, srcimg As imgdes, ByVal quality As Long) As Long |
C/C++ | int savejpgtobuffer(UCHAR * *buffer, imgdes *srcimg, int quality); |
Java | int vic.vic32jni.savejpgtobuffer(refvar buffer, imgdes srcimg, int quality); |
Function Arguments
buffer | Variable to receive resulting buffer address |
srcimg | Source image |
quality | Image quality (1 - 100) |
Description The savejpgtobuffer function saves an 8- or 24-bit image area in the JPEG File Interchange Format (JFIF) file format into a memory buffer. The image area is defined by the image descriptor. The memory buffer is allocated by the savejpgtobuffer function and the address is returned in buffer. This memory must be released when no longer needed. To free the memory the following code can be used:
GlobalFreePtr(buffer); // Windowsx.h macro
hmem = GlobalPtrHandle(buffer); // Windowsx.h macro size = GlobalSize(hmem);
Refer to savejpg for additional information about saving an image using JPEG compression.
Return value Explanation
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 JPEG data in buffer |
1 | 8 | 24 |
Function Prototypes
Visual Basic | Declare Function savejpgtobufferex Lib "VIC32.DLL" (ByRef buffer As Long, srcimg As imgdes, ByVal quality As Long, ByVal savemode As Long) As Long |
C/C++ | int savejpgtobufferex(UCHAR * *buffer, imgdes *srcimg, int quality, int savemode); |
Java | int vic.vic32jni.savejpgtobufferex(refvar buffer, imgdes srcimg, int quality, int savemode); |
Function Arguments
buffer | Variable to receive resulting buffer address |
srcimg | Source image |
quality | Image quality (1 - 100) |
savemode | Save mode (0 - 2, 0x10 - 0x12) |
Description
The savejpgtobufferex function saves an 8- or 24-bit image area in the JPEG File Interchange Format (JFIF)
file format into a memory buffer. The image area is defined by the image descriptor.
The amount of data compression is determined by quality. A quality of 100 represents maximum quality and minimum
compression. The mode determines the type of JPEG file to be written.
The memory buffer is allocated by savejpgtobufferex and the address is returned in buffer. This memory must be released when no longer needed by calling:
GlobalFreePtr(buffer); // WINDOWSX.H macro
BUFFER_SIZE(buffer); // Vicdefs.h macro
Refer to savejpgtobuffer and savejpgex for additional information.
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 8- or 24-bit |
BAD_DIB | Image is a compressed DIB |
BAD_CRT | Cannot create JPEG data in buffer |
BAD_TN_SIZE | Thumbnail width or length outside the range 0-255 or thumbnail bytes greater than 65535 |
See also
savejpg, savejpgtobuffer, savejpgtobufferex
Example
See savejpgtobuffer
1 | 8 |
Function Prototypes
Visual Basic | Declare Function Declare Function savepcx Lib "VIC32.DLL" (ByVal filename As String, srcimg As imgdes) As Long |
C/C++ | int savepcx(LPCSTR filename, imgdes *srcimg); |
Java | int vic.vic32jni.savepcx(String filename, imgdes srcimg); |
Function Arguments
filename | Filename to save |
srcimg | Source image |
Description
The savepcx function saves an image area as a 1- or 8-bit PCX file, with or without palette information. 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. If colors is zero, no palette information will be saved.
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- 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 |
1 | 8 | 24 |
Function Prototypes
Visual Basic | Declare Function savepng Lib "VIC32.DLL" (ByVal filename As String, image As imgdes, ByVal comp As Long) As Long |
C/C++ | int savepng(LPCSTR filename, imgdes *srcimg, int comp); |
Java | int vic.vic32jni.savepng(String filename, imgdes srcimg, int comp);; |
Function Arguments
filename | Filename to save |
srcimg | Source image |
comp | Compression type (0-11) |
Description
The savepng function saves an image area as a 1-, 8-, or 24-bit PNG file. The
image area and palette are defined by the image descriptor.
Comp selects the type of filtering to use while compressing the image data.
Table 15. PNG File Types Written by savepng | |
Comp | Description | PNGALLFILTERS (0) | Use best filter for each row (best compression) | PNGNOFILTER (2) | No filter is used (fastest to execute) | PNGSUBFILTER (4) | Difference filter with adjacent pixel | PNGUPFILTER (6) | Difference filter with pixel in previous row | PNGAVGFILTER (8) | Average filter | PNGPAETHFILTER (10) | Paeth filter |
To save an image as an interlaced file, bitwise OR comp with the defined constant PNGINTERLACE (1). For example, to save the image with maximum compression in an interlaced file use
The Victor savepng function is based on the source code for the ZLIB compression library by Jean-loup Gailly and Mark Adler. PNG stands for Portable Network Graphics. This format is intended to be a patent-free replacement for GIF and uses the LZ77 compression rather than LZW.
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 create file or directory is invalid |
BAD_DSK | Disk full, file not written |
BAD_PNG_CMP | Compressor error |
1 | 8 | 24 |
Function Prototypes
Visual Basic | Declare Function savepngtobuffer Lib "VIC32.DLL" (ByRef buffer As Long, srcimg As imgdes, ByVal comp As Long) As Long |
C/C++ | int savepngtobuffer(UCHAR * *buffer, imgdes *srcimg, int comp); |
Java | int vic.vic32jni.savepngtobuffer(refvar buffer, imgdes srcimg, int comp); |
Function Arguments
buffer | Variable to receive resulting buffer address |
srcimg | Source image |
comp | Compression type (0-11) |
Description
The savepngtobuffer function saves an image area as 1-, 8-, or
24-bit PNG file data in a memory buffer. The memory buffer is
allocated by the savepngtobuffer function and the resulting buffer
address is returned in buff. This memory must be released when
no longer needed.
To free the memory:
GlobalFreePtr(buff); // Windowsx.h macro
BUFFER_SIZE(buff); // Vicdefs.h macro
The comp argument in a PNG file lets you select the type of filtering to use while compressing the image data.
Comp | Description | PNGALLFILTERS (0) | Use best filter for each row (best compression) | PNGNOFILTER (2) | No filter is used (fastest to execute) | PNGSUBFILTER (4) | Difference filter with adjacent pixel | PNGUPFILTER (6) | Difference filter with pixel in previous row | PNGAVGFILTER (8) | Average filter | PNGPAETHFILTER (10) | Paeth filter |
The Victor savepngtobuffer function is based on the source code for the ZLIB compression library by Jean-loup Gailly and Mark Adler. PNG stands for Portable Network Graphics. This format is intended to be a patent-free replacement for GIF. It uses the LZ77 compression rather than LZW. The PNG file format specification is available at ftp://ftp.uu.net/graphics/png/.
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 PNG data to buffer |
BAD_PNG_CMP | Compressor error |
24 |
Function Prototypes
Visual Basic | Declare Function savetga Lib "VIC32.DLL" (ByVal filename As String, srcimg As imgdes, ByVal comp As Long) As Long |
C/C++ | int savetga(LPCSTR filename, imgdes *srcimg, int comp); |
Java | int vic.vic32jni.savetga(String filename, imgdes srcimg, int comp); |
Function Arguments
filename | Filename to save |
srcimg | Source image |
comp | Compression type
0 = none 1 = RLE8 |
Description
The savetga function saves a 24-bit RGB image area as an uncompressed or run length encoded
TGA true color image file. 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 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 |
1 | 8 | 16 | 24 |
Function Prototypes
Visual Basic | Declare Function savetif Lib "VIC32.DLL" (ByVal filename As String, srcimg As imgdes, ByVal comp As Long) As Long |
C/C++ | int savetif(LPCSTR filename, imgdes *srcimg, int comp); |
Java | int vic.vic32jni.savetif(String filename, imgdes srcimg, int comp); |
Function Arguments
filename | Filename to save |
srcimg | Source image |
comp | Compression type
0 = none 1 = LZW 2 = Packbits 3 = Group 3 4 = Group 4 5 = CCITT Group 3 |
Description
The savetif function saves an image area as a bilevel, grayscale, palette color, or RGB TIFF file. The image area is defined by the image descriptor.
To save the image as a palette color TIFF file, palette information must be stored as an array of RGBQUAD structures pointed to by the image descriptor member palette. The number of colors in the table must be contained in the image descriptor member colors. If colors is zero or bit 0 of the image descriptor member imgtype is set to 1, no palette information will be saved and the image will be saved as a grayscale TIFF file.
The TIFF uncompressed file format consists essentially of a header followed by binary image data. File size may be reduced significantly by using compression. The formats supported by this function are shown in Table 16.
To write a TIFF file as a single strip, bitwise OR comp with 0x10.
To write a 1-bit image with fill order 2, bitwise OR comp with 0x20. 1-Bit images are generally written to TIFF files using fill order 1.
An attempt to save an LZW-compressed TIFF image will return the error code LZW_DISABLED unless LZW functionality has been enabled with unlockLZW. The use of the savetif function to write TIFF LZW compressed files requires an LZW license from Unisys Corporation. For information concerning licensing the LZW compression and/or decompression capability, please contact: Unisys Corporation, Welch Licensing Department - C1SW19, Township Line & Union Meeting Roads, P O Box 500, Blue Bell PA 19424.
Table 16. TIFF File Types Written by savetif | ||
Image type | Compression | comp |
Bilevel (1-bit) | none | 0 |
LZW | 1 | |
PackBits | 2 | |
Group 3 | 3 | |
Group 4 | 4 | |
CCITT Group 3 | 5 | |
Grayscale or palette color (8-bit) | none | 0 |
LZW | 1 | |
PackBits | 2 | Grayscale (16-bit) | none | 0 |
RGB (24-bit) | none | 0 |
LZW | 1 |
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-, 16-, 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 |
LZW_DISABLED | LZW functionality not available, see unlockLZW |
1 | 8 | 16 | 24 |
Function Prototypes
Visual Basic | Declare Function savetifpage Lib "VIC32.DLL" (ByVal filename As String, srcimg As imgdes, ByVal comp As Long, ByVal page As Long) As Long |
C/C++ | int savetifpage(LPCSTR filename, imgdes *srcimg, int comp, int page); |
Java | int vic.vic32jni.savetifpage(String filename, imgdes srcimg, int comp, int page); |
Function Arguments
filename | Filename to save |
srcimg | Source image |
comp | Compression type
0 = none 1 = LZW 2 = Packbits 3 = Group 3 4 = Group 4 5 = CCITT Group 3 |
page | Page number label value |
Description
The savetifpage function saves an image area with page information in a multipage TIFF file. The image area is defined by the image descriptor.
If filename already exists, the image is appended to filename at the end of the file. Savetifpage writes an image to a TIFF file in the Intel byte order. If the existing file is of Motorola byte order the function will not succeed and will return TIFF_MOTYPE.
If filename does not exist, filename is created and the page number label is set to the value of page.
If page is set to -1, this function behaves just like savetif and saves the image as a TIFF file without page information. In all other respects savetifpage is identical to savetif. See savetif for information about saving in the TIFF format.
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-, 16-, 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 |
LZW_DISABLEDLZW | functionality not available, see unlockLZW |
TIFF_NOTYPE | Existing file is in Motorola byte order |
See also
savetif
1 | 8 | 16 | 24 |
Function Prototypes
Visual Basic | Declare Function savetiftobuffer Lib "VIC32.DLL" (ByRef buffer As Long, srcimg As imgdes, ByVal comp As Long) As Long |
C/C++ | int savetiftobuffer(UCHAR * *buffer, imgdes *srcimg, int comp); |
Java | int vic.vic32jni.savetiftobuffer(refvar buffer, imgdes srcimg, int comp); |
Function Arguments
buffer | Variable to receive resulting buffer address |
srcimg | Source image |
comp | Compression type
0 = none 1 = LZW 2 = Packbits 3 = Group 3 4 = Group 4 5 = CCITT Group 3 |
Description
The savetiftobuffer function saves an image area as TIFF file data
in a memory buffer.
The image area is defined by the image descriptor.
The memory buffer is allocated by the savetiftobuffer function and the resulting buffer address is returned in buff. This memory must be released when no longer needed.
To free the memory:
GlobalFreePtr(buff); // Windowsx.h macro
BUFFER_SIZE(buff); // Vicdefs.h macro
For additional information about saving in the TIFF file format refer to savetif.
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-, 16-, 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 |
LZW_DISABLED | LZW functionality not available, see unlockLZW |
See also savetif, loadtiffrombuffer
Function Prototypes
Visual Basic | Declare Sub setgifcomment Lib "VIC32.DLL" (ByVal version As Long, ByVal commentstring As String) |
C/C++ | void setgifcomment(int version, char *commentstring); |
Java | void vic.vic32jni.setgifcomment(int version, String commentstring); |
Function Arguments
version | GIF version, 87 or 89 |
commentstring | Comment string to use when writing a 89a GIF file |
Description
The setgifcomment function sets the version number the GIF file will be saved as (either GIF87a or GIF89a) and optionally, saves a comment string within the GIF file. Valid version numbers are 87 and 89. If an invalid version number is specified, the file will be written as a GIF87a file.
If the version number is 89 and commentstring is not NULL, commentstring will be added to the GIF file as a GIF89a comment extension block.
Return value
There is no return value.
See also
getgifcomment
Function Prototypes
Visual Basic | Declare Sub setimagearea Lib "VIC32.DLL" (image As imgdes, ByVal stx As Long, ByVal sty As Long, ByVal endx As Long, ByVal endy As Long) |
C/C++ | void setimagearea(imgdes *image, unsigned stx, unsigned sty, unsigned endx, unsigned endy); |
Java | void vic.vic32jni.setimagearea(imgdes resimg, int stx, int sty, int endx, int endy); |
Function Arguments
resimg | Result image |
stx | X-coordinate of upper left corner of area |
sty | Y-coordinate of upper left corner of area |
endx | X-coordinate of lower right corner of area |
endy | Y-coordinate of lower right corner of area |
Description
The setimagearea function enters the starting and ending coordinates of an image area into the image descriptor. This function performs the following assignments:
resimg.stx | = startx |
resimg.sty | = starty |
resimg.endx | = endx |
resimg.endy | = endy |
Image area coordinates are in pixels. The image area must be set before calling any image processing, file handling, or print functions. If the Victor allocation function allocimage or allocDIB is used, image area coordinates are initialized to 0, 0, resimg.bmh->biWidth - 1, and resimg.bmh->biHeight - 1.
Return value
There is no return value.
See also
recttoimagearea, imageareatorect
1 | 8 | 24 |
Function Prototypes
Visual Basic | Declare Function setpixelcolor Lib "VIC32.DLL" (resimg As imgdes, ByVal xcoord As Long, ByVal ycoord As Long, ByVal color As Long) As Long |
C/C++ | int setpixelcolor(imgdes *resimg, int xcoord, int ycoord, ULONG color); |
Java | int vic.vic32jni.setpixelcolor(imgdes resimg, int xcoord, int ycoord, int color); |
Function Arguments
resimg | Result image |
xcoord | Pixel x-coordinate |
ycoord | Pixel y-coordinate |
color | Color value to set |
Description
The setpixelcolor function sets the color of a pixel in the image at (xcoord,ycoord). The image is defined by the image descriptor.
For a 1-bit image, color can be 0 or 1.
For an 8-bit image, color is a grayscale value or an index into the color palette and can range from 0 to 255.
For a 24-bit image, color is calculated by the formula:
where blu, grn, and red range from 0 - 255. Alternatively, use the Windows RGB function to assemble the color value.
Return value
NO_ERROR | Function successful |
BAD_RANGE | Xcoord is greater than or equal to image.bmh->biWidth or
ycoord is greater than or equal to image.bmh->biHeight |
BAD_IBUF | Invalid image buffer address |
BAD_BPP | Image is not 1-, 8-, or 24-bit |
BAD_DIB | Image is a compressed DIB |
Function Prototypes
Visual Basic | Declare Function setupimgdes Lib "VIC32.DLL" (ByVal dib As Long, resimg As imgdes) As Long |
C/C++ | int setupimgdes(UCHAR *dib, imgdes *resimg); |
Java | int vic.vic32jni.setupimgdes(int dibaddr, imgdes image); |
Function Arguments
dib | Address of the packed DIB |
resimg | Result image |
Description
The setupimgdes function enters values into the elements of an image descriptor to describe an existing packed DIB (device independent bitmap). An image descriptor is necessary for the Victor functions to operate on a DIB.
Setupimgdes does not create a new image from a DIB, but merely fills in an image descriptor that describes an existing DIB.
The DIB must be in a contiguous memory block, i.e., of type CF_DIB.
If the DIB is compressed or biBitCount is 4, this function will fail because the DIB is not Victor compatible. In this case use dibtoimage to create a new Victor image from the DIB.
Return value
NO_ERROR | Function successful |
BAD_BPP | Image is not 1-, 8-, or 24-bit |
BAD_DIB | Source or result is a compressed DIB |
See also
dibtoimage
8 | 24 |
Function Prototypes
Visual Basic | Declare Function sharpen Lib "VIC32.DLL" (srcimg As imgdes, resimg As imgdes) As Long |
C/C++ | int sharpen(imgdes *srcimg, imgdes *resimg); |
Java | int vic.vic32jni.sharpen(imgdes srcimg, imgdes resimg); |
Function Arguments
srcimg | Source image |
resimg | Result image |
Description
The sharpen function increases the perceived sharpness of an image area by increasing the differences in brightness levels of neighbor pixels. This function makes details of the image more visible, but also introduces noise. This function transforms an image area with a 3 x 3 convolution matrix.
-1 | -1 | -1 |
-1 | 9 | -1 |
-1 | -1 | -1 |
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 | Source and result are not both 8- or 24-bit |
BAD_DIB | Source or result is a compressed DIB |
See also
sharpengentle
8 | 24 |
Function Prototypes
Visual Basic | Declare Function sharpengentle Lib "VIC32.DLL" (srcimg As imgdes, resimg As imgdes) As Long |
C/C++ | int sharpengentle(imgdes *srcimg, imgdes *resimg); |
Java | int vic.vic32jni.sharpengentle(imgdes srcimg, imgdes resimg); |
Function Arguments
srcimg | Source image |
resimg | Result image |
Description
The sharpengentle function increases the perceived sharpness of an image area by increasing the differences in brightness levels of neighbor pixels. This function makes details of the image more visible, but may introduce noise. This function transforms an image area with a 3 x 3 convolution matrix.
0 | 0 | 0 |
-1 | 3 | -1 |
0 | 0 | 0 |
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 | Source and result are not both 8- or 24-bit |
BAD_DIB | Source or result is a compressed DIB |
See also
sharpen