pcxinfo

Function Prototypes
Visual BasicDeclare Function pcxinfo Lib "VIC32.DLL" (ByVal filename As String, pinfo As PcxData) As Long
VB.NETDeclare 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);
Javaint vic.vic32jni.pcxinfo(String filename, PcxData pinfo);

Function Arguments
filename Filename to read
pinfoPcxData 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:
PCXversVersion number
widthImage width in pixels
lengthImage length in pixels
BPPixelBits per pixel
NplanesNumber of planes of data
BytesPerLineBytes per line
PalIntPalette interpretation
vbitcountVictor bits per pixel (used to allocate an imagebuffer with allocimage).

Return value

See also

loadpcx, loadpcxpalette, savepcx

Example

See loadpcx




pixelcount

      8   24 

Function Prototypes
Visual BasicDeclare 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.NETDeclare 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);
Javaint 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

Example C/C++




pixellize

      8   24 

Function Prototypes
Visual BasicDeclare Function pixellize Lib "VIC32.DLL" (ByVal pixfactor As Long, srcimg As imgdes, resimg As imgdes) As Long
VB.NETDeclare 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);
Javaint 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

Example C/C++ | Example VB




pnggeterror


Function Prototypes
Visual Basic Declare Function pnggeterror Lib "VIC32.DLL" () As Long
VB.NETDeclare 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

Example C/C++




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.NETDeclare 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:

Return value

See also

pnginfo, pngsetxyres




pnginfo

Function Prototypes
Visual Basic Declare Function pnginfo Lib "VIC32.DLL" (ByVal filename As String, pinfo As PngData) As Long
VB.NETDeclare 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:
widthImage width in pixels
lengthImage length in pixels
bitDepthBits per pixel, 1, 2, 4, 8, or 16
vbitcountVictor bits per pixel (used to allocate an image buffer with allocimage)
colorTypeColor type
0 = Grayscale
2 = RGB
3 = Palette Color
4 = Grayscale + alpha channel
6 = RGB + alpha channel
interlaced0 = non-interlaced, 1 = interlaced
imageIdIdentifier for colorType/bitDepth
channelsNumber of channels of data per pixel
pixelDepthNumber of bits per pixel
rowBytesBytes in one image row
transDataTransparency color data of type PNGTRANSINFO
isPresentTRUE if transparency data is present
data[6]Up to 6 bytes of transparency data
byteCountBytes of transparency data
backDataBackground color data of type PNGTRANSINFO
isPresentTRUE if background color data is present
data[6]Up to 6 bytes of transparency data
byteCountBytes of transparency data
igammaGamma as float = igamma / 100000
physXresX-axis pixels per unit
physYresY-axis pixels per unit
physUnitsPhysical units
sigBitSignificant bits in file of type PNGSIGBITS
sb_char[4];Signigicant bits data
offsXoffsetX-axis offset
offsYoffsetY-axis offset
offsUnitsOffset 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
ColorTypeTransData.byteCountInterpretation of TransData.data[]
0, grayscale2grayscale value as a 16-bit integer
2, RGB6RGB integer values
3, palette color1palette index

Return value

See also

loadpng

Example C/C++ | Example VB




pnginfofrombuffer

            1    8   24 

Function Prototypes
Visual Basic Declare Function pnginfofrombuffer Lib "VIC32.DLL" (ByVal buffer As Long, pinfo As PngData) As Long
VB.NETDeclare Function pnginfofrombuffer Lib "VIC32.DLL" (ByVal buffer As Integer, ByRef pinfo As PngData) As Integer
C#int vicwin.pnginfofrombuffer(ref byte_firstelem, ref PngData pinfo);
C/C++int pnginfofrombuffer(UCHAR *buffer, PngData *pinfo);
Java int vic.vic32jni.pnginfofrombuffer(int buffer, PngData pinfo);
viclib64
C#int vicwin.pnginfofrombuffer( System.IntPtr buffer, ref 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:
widthImage width in pixels
lengthImage length in pixels
bitDepthBits per pixel, 1, 2, 4, 8, or 16
vbitcountVictor bits per pixel (used to allocate an image buffer with allocimage)
colorTypeColor type
0 = Grayscale
2 = RGB
3 = Palette Color
4 = Grayscale + alpha channel
6 = RGB + alpha channel
interlaced0 = non-interlaced, 1 = interlaced
imageIdIdentifier for colorType/bitDepth
channelsNumber of channels of data per pixel
pixelDepthNumber of bits per pixel
rowBytesBytes in one image row
transDataTransparency color data of type PNGTRANSINFO
isPresentTRUE if transparency data is present
data[6]Up to 6 bytes of transparency data
byteCountBytes of transparency data
backDataBackground color data of type PNGTRANSINFO
isPresentTRUE if background color data is present
data[6]Up to 6 bytes of transparency data
byteCountBytes of transparency data
igammaGamma as float = igamma / 100000
physXresX-axis pixels per unit
physYresY-axis pixels per unit
physUnitsPhysical units
sigBitSignificant bits in file of type PNGSIGBITS
sb_char[4];Signigicant bits data
offsXoffsetX-axis offset
offsYoffsetY-axis offset
offsUnitsOffset 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




pngsetxyresolution


Function Prototypes
Visual Basic Declare Sub pngsetxyresolution Lib "VIC32.DLL" (ByVal xres As Long, ByVal yres As Long, ByVal resunit As Long)
VB.NETDeclare 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:

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.NETDeclare 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);
viclib64
C#int vicwin.printimage( System.IntPtr hwnd, System.IntPtr hdcprn, int prmode, ref imgdes srcimg, ref RECT prtrect, int bwidth, ref 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:
leftX-coordinate of the rectangle's upper-left corner
topY-coordinate of the rectangle's upper-left corner
rightX-coordinate of the rectangle's lower-right corner
bottomY-coordinate of the rectangle's lower-right corner

Thus the printed width and length are:

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

Example C/C++ | Example VB




printimageenddoc

Function Prototypes
Visual Basic Declare Sub printimageenddoc Lib "VIC32.DLL" (ByVal hdcprn As Long, ByVal ejectPage As Long)
VB.NETDeclare 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);
viclib64
C#void vicwin.printimageenddoc( System.IntPtr 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

Example C/C++




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.NETDeclare 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);
viclib64
C#int vicwin.printimagenoeject( System.IntPtr hwnd, System.IntPtr hdcprn, int prtmode, ref imgdes srcimg, ref RECT prtrect, int bwidth, ref 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:
leftX-coordinate of the rectangle's upper-left corner
topY-coordinate of the rectangle's upper-left corner
rightX-coordinate of the rectangle's lower-right corner
bottomY-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

See also

printimage, printimageenddoc, printimagestartdoc

Example C/C++




printimagestartdoc

Function Prototypes
Visual Basic Declare Function printimagestartdoc Lib "VIC32.DLL" (ByVal hdcprn As Long, ByVal docName As String) As Long
VB.NETDeclare Function printimagestartdoc Lib "VIC32.DLL" (ByVal hdcprn As Integer, ByVal docName As String) As Integer
C#int vicwin.printimagestartdoc(int hdcPrn, string docName);
C/C++int printimagestartdoc(HDC hdcPrn, LPCSTR docName);
Java int vic.vic32jni.printimagestartdoc(int hdcPrn, String docName);
viclib64
C#int vicwin.printimagestartdoc( System.IntPtr 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

See also

printimagenoeject, printimageenddoc

Example C/C++


See printimagenoeject




rainbowpalette

      8 

Function Prototypes
Visual Basic Declare Function rainbowpalette Lib "VIC32.DLL" (resimg As imgdes) As Long
VB.NETDeclare 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

Example C/C++




recttoimagearea

Function Prototypes
Visual Basic Declare Sub recttoimagearea Lib "VIC32.DLL" (srcrect As RECT, resimg As imgdes)
VB.NETDeclare 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:
leftX-coordinate of the rectangle's upper-left corner
topY-coordinate of the rectangle's upper-left corner
rightX-coordinate of the rectangle's lower-right corner
bottomY-coordinate of the rectangle's lower-right corner

This function performs the following assignments:

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.NETDeclare 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

Example C/C++




removenoise

      8   24 

Function Prototypes
Visual Basic Declare Function removenoise Lib "VIC32.DLL" (srcimg As imgdes, resimg As imgdes) As Long
VB.NETDeclare 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.

The source and result image areas are defined by the corresponding image descriptors.

Return value

Example C/C++ | Example VB




resize

  1    8   24 

Function Prototypes
Visual Basic Declare Function resize Lib "VIC32.DLL" (srcimg As imgdes, resimg As imgdes) As Long
VB.NETDeclare 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

Example C/C++ | Example VB




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.NETDeclare 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:

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

Example C/C++ | Example VB




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.NETDeclare Sub rgb2hsv Lib "VIC32.DLL" (ByRef rgbtab As RGBQUAD, ByRef hsvtab As HSVTRIPLE, ByVal colors As Integer)
C#void vicwin.rgb2hsv(ref RGBQUAD rgbtab, ref HSVTRIPLE hsvtab, int colors);
C/C++void rgb2hsv(RGBQUAD *rgbtab, HSVTRIPLE *hsvtab, int colors);
Java void vic.vic32jni.rgb2hsv(RGBQUAD rgbtab, HSVTRIPLE hsvtab, int colors);
viclib64
C#void vicwin.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.

Example C/C++




rgbimagetocmykimage

         24 

Function Prototypes
Visual BasicDeclare Function rgbimagetocmykimage Lib "VIC32.DLL" (srcimg As imgdes, resimg As imgdes) As Long
VB.NETDeclare 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);
Javaint 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




rgbimagetohsvimage

         24 

Function Prototypes
Visual BasicDeclare Function rgbimagetohsvimage Lib "VIC32.DLL" (srcimg As imgdes, resimg As imgdes) As Long
VB.NETDeclare 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);
Javaint 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




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.NETDeclare 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

See also

rotate90

Example C/C++ | Example VB




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.NETDeclare 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

Example C/C++ | Example VB




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.NETDeclare 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

See also

rotate

Example C/C++ | Example VB




savebif

      8 

Function Prototypes
Visual Basic Declare Function savebif Lib "VIC32.DLL" (ByVal filename As String, srcimg As imgdes) As Long
VB.NETDeclare 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

Example C/C++




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.NETDeclare 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

Example C/C++ | Example VB




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.NETDeclare 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);
viclib64
C#int vicwin.savebmptobuffer(ref System.IntPtr buffer, ref 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. A file buffer allocated with savebmptobuffer must be released with the freebuffer function when no longer needed.

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




saveeps

      8   24 

Function Prototypes
Visual Basic Declare Function saveeps Lib "VIC32.DLL" (ByVal filename As String, srcimg As imgdes) As Long
VB.NETDeclare 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

Example C/C++




savegif

  1    8 

Function Prototypes
Visual Basic Declare Function savegif Lib "VIC32.DLL" (ByVal filename As String, srcimg As imgdes) As Long
VB.NETDeclare 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

See also

savegifex, setgifcomment

Example C/C++ | Example VB




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.NETDeclare 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
  1. A saveMode of 0 is equivalent to using savegif
  2. Set the parameter transColor to the transparent color when calling savegifex. TransColor must be in the range 0 - 255.
  3. To save an image as a 4-bit GIF file, the image must be an 8-bit image with pixel values ranging from 0 to 15 and have 16 or fewer palette colors. A 256-color image can be converted to a suitable 16-color image using reduceimagecolors.
  4. In general, LZW-compressed files are approximately 50% smaller than uncompressed GIF files.


Values should be ORed together to achieve the desired mode value. For example, to save an interlaced uncompressed image use:

where saveMode is assigned the value of 9.

Return value

See also

savegif, setgifcomment

Example C/C++




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.NETDeclare 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:
scrwidthMaximum pixel width of the animation
scrlengthMaximum pixel length of the animation
hasColorMapnonzero = global palette
bckColorColor index of screen background color
loopNumber of times the animation should repeat

The GifFrameSaveData structure elements are defined as follows:
startxX pixel position with respect to scrwidth
startyY pixel position with respect to scrlength
hasColorMapLocal palette is present!
delay100ths of a second to display frame
transColorTransparent color index, 0 - 255 or -1 for no transparancy
removeByHow 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
waitForUserInputnonzero = 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

See also

savegifex

Example C/C++




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);
viclib64
C#int vicwin.savegifmultiframetobuffer(ref System.IntPtr buffer, ref imgdes srcimgarray, ref GifGlobalSaveData gdata, ref 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. A file buffer allocated with savegifmultiframetobuffer must be released with the freebuffer function when no longer needed.

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:
scrwidthMaximum pixel width of the animation
scrlengthMaximum pixel length of the animation
hasColorMapnonzero = global palette
bckColorColor index of screen background color
loopNumber of times the animation should repeat

The GifFrameSaveData structure elements are defined as follows:
startxX pixel position with respect to scrwidth
startyY pixel position with respect to scrlength
hasColorMapLocal palette is present!
delay100ths of a second to display frame
transColorTransparent color index, 0 - 255 or -1 for no transparancy
removeByHow 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
waitForUserInputnonzero = expect user input

Refer to Table 12 in the description of savegifex for information about savemode values.

Return value

See also

savegifex

Example C/C++




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.NETDeclare 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);
viclib64
C#int vicwin.savegiftobufferex(ref System.IntPtr buffer, ref 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. A file buffer allocated with savegiftobufferex must be released with the freebuffer function when no longer needed.

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:

where savemode is assigned the value of 9.

Return value

See also savegifex, loadgiffrombuffer




savejpg

      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
VB.NETDeclare Function savejpg Lib "VIC32.DLL" (ByVal filename As String, ByRef srcimg As imgdes, ByVal quality As Integer) As Integer
C#int vicwin.savejpg(ref string filename, ref imgdes srcimg, int quality);
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

Example C/C++ | Example 1 VB | Example 2 VB




savejpgex

                8   24 

Function Prototypes
Visual Basic Declare Function savejpgex Lib "VIC32.DLL" (ByVal filename As String, srcimg As imgdes, ByVal quality As Long, ByVal savemode As Long) As Long
VB.NETDeclare Function savejpgex Lib "VIC32.DLL" (ByVal filename As String, ByRef srcimg As imgdes, ByVal quality As Integer, ByVal savemode As Integer) As Integer
C#int vicwin.savejpgex(ref string filename, ref imgdes srcimg, int quality, int savemode);
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
ModeDescriptionFile 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 thumbnailSOF0 or SOF1
JPGPROGTN (0x11)Progressive with thumbnailSOF2
JPGSEQOPTTN (0x12)Sequential optimized with thumbnailSOF0 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

See also
savejpg, savejpgtobuffer, savejpgtobufferex

Example C/C++




savejpgtobuffer

      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
VB.NETDeclare Function savejpgtobuffer Lib "VIC32.DLL" (ByRef buffer As Integer, ByRef srcimg As imgdes, ByVal quality As Integer) As Integer
C#int vicwin.savejpgtobuffer(ref int buffer, ref imgdes srcimg, int quality);
C/C++int savejpgtobuffer(UCHAR * *buffer, imgdes *srcimg, int quality);
Java int vic.vic32jni.savejpgtobuffer(refvar buffer, imgdes srcimg, int quality);
viclib64
C#int vicwin.savejpgtobuffer(ref System.IntPtr buffer, ref 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. A file buffer allocated with savejpgtobuffer must be released with the freebuffer function when no longer needed.

Refer to savejpg for additional information about saving an image using JPEG compression.

Return value Explanation

Example C/C++




savejpgtobufferex

            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
VB.NETDeclare Function savejpgtobufferex Lib "VIC32.DLL" (ByRef buffer As Integer, ByRef srcimg As imgdes, ByVal quality As Integer, ByVal savemode As Integer) As Integer
C#int vicwin.savejpgtobufferex(ref int buffer, ref imgdes srcimg, int quality, int savemode);
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);
viclib64
C#int vicwin.savejpgtobufferex(ref System.IntPtr buffer, ref 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. A file buffer allocated with savejpgtobufferex must be released with the freebuffer function when no longer needed.

Refer to savejpgtobuffer and savejpgex for additional information.

Return value

See also
savejpg, savejpgtobuffer, savejpgtobufferex

Example
See savejpgtobuffer




savepcx

  1    8 

Function Prototypes
Visual Basic Declare Function Declare Function savepcx Lib "VIC32.DLL" (ByVal filename As String, srcimg As imgdes) As Long
VB.NETDeclare Function savepcx Lib "VIC32.DLL" (ByVal filename As String, ByRef srcimg As imgdes) As Integer
C#int vicwin.savepcx(ref string filename, ref imgdes srcimg);
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

Example C/C++




savepng

            1    8   24 

Function Prototypes
Visual Basic Declare Function savepng Lib "VIC32.DLL" (ByVal filename As String, srcimg As imgdes, ByVal comp As Long) As Long
VB.NETDeclare Function savepng Lib "VIC32.DLL" (ByVal filename As String, ByRef srcimg As imgdes, ByVal comp As Integer) As Integer
C#int vicwin.savepng(ref string filename, ref imgdes srcimg, int comp);
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

where comp is set to the value one (1).

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

Example C/C++ | Example VB




savepngex

            1    8   24 

Function Prototypes
Visual Basic Declare Function savepngex Lib "VIC32.DLL" (ByVal filename As String, srcimg As imgdes, ByVal comp As Long, ByVal mode as long, ByRef savedata as PNG_DATA) As Long
VB.NET Declare Function savepngex Lib "VIC32.DLL" (ByVal filename As String, ByRef srcimg As imgdes, ByVal comp As Integer, ByVal mode As Integer, ByRef savedata as PNG_DATA) As Integer
C#int vicwin.savepngex(ref string filename, ref imgdes srcimg, int comp, int mode, ref PNG_DATA savedata);
C/C++int savepngex(LPCSTR filename, imgdes *srcimg, int comp, int mode, PNG_DATA *savedata);
Java int vic.vic32jni.savepngex(String filename, imgdes srcimg, int comp, int mode, PNG_DATA savedata);

Function Arguments
filename Filename to save
srcimg Source image
comp Compression type (0-11)
mode Save mode
0 = Write baseline PNG file
1 = Use savedata element transcolor value as transparent color
savedata Variable of type PNG_DATA

Description
The savepngex 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 savepngex
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

where comp is set to the value one (1).

To save an image with a transparent color set the value of mode to 1 and place the transparent color value in the transcolor element of the PNG_DATA structure. For an 8-bit image use 0 - 255 to represent the palette color index value. For a 24-bit image use the RGB color, for example to make red transparent use 0xff0000 in C#, C/C++ or Java, or &hff0000 in Visual Basic.

The PNG_DATA structure elements are defined as follows:
transcolorTransparent color for grayscale, RGB and palette color images
reserved1Unused
reserved2Unused
reserved3Unused

The Victor savepngex 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

Example C/C++ | Example VB




savepngtobuffer

            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
VB.NETDeclare Function savepngtobuffer Lib "VIC32.DLL" (ByRef buffer As Integer, ByRef srcimg As imgdes, ByVal comp As Integer) As Integer
C#int vicwin.savepngtobuffer(ref int buffer, ref imgdes srcimg, int comp);
C/C++int savepngtobuffer(UCHAR * *buffer, imgdes *srcimg, int comp);
Java int vic.vic32jni.savepngtobuffer(refvar buffer, imgdes srcimg, int comp);
viclib64
C#int vicwin.savepngtobuffer(ref System.IntPtr buffer, ref 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 buffer. This memory must be released when no longer needed. A file buffer allocated with savepngtobuffer must be released with the freebuffer function when no longer needed.
The image area and palette are defined by the image descriptor.

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

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

where comp is set to the value one (1).

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




savepngtobufferex

            1    8   24 

Function Prototypes
Visual Basic Declare Function savepngtobufferex Lib "VIC32.DLL" (ByRef buffer As Long, srcimg As imgdes, ByVal comp As Long, ByVal mode as long, ByRef savedata as PNG_DATA) As Long
VB.NET Declare Function savepngtobufferex Lib "VIC32.DLL" (ByRef buffer As Integer, ByRef srcimg As imgdes, ByVal comp As Integer, ByVal mode As Integer, ByRef savedata as PNG_DATA) As Integer
C# vicwin.int savepngtobufferex(ref int buffer, ref imgdes srcimg, int comp, int mode, ref PNG_DATA savedata);
C/C++ int savepngtobufferex(UCHAR * *buffer, imgdes *srcimg, int comp, int mode, PNG_DATA *savedata);
Java int vic.vic32jni.savepngtobufferex(refvar buffer, imgdes srcimg, int comp, int mode, PNG_DATA savedata);
viclib64
C# vicwin.int savepngtobufferex(ref System.IntPtr buffer, ref imgdes srcimg, int comp, int mode, ref PNG_DATA savedata);

Function Arguments
buffer Variable to receive resulting buffer address
srcimg Source image
comp Compression type (0-11)
mode Save mode
0 = Write baseline PNG file
1 = Use savedata element transcolor value as transparent color
savedata Variable of type PNG_DATA

Description
The savepngtobufferex 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 savepngtobufferex function and the resulting buffer address is returned in buffer. This memory must be released when no longer needed. A file buffer allocated with savepngtobufferex must be released with the freebuffer function when no longer needed. 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 savepngtobufferex
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

where comp is set to the value one (1).

To save an image with a transparent color set the value of mode to 1 and place the transparent color value in the transcolor element of the PNG_DATA structure. For an 8-bit image use 0 - 255 to represent the palette color index value. For a 24-bit image use the RGB color, for example to make red transparent use 0xff0000 in C#, C/C++ or Java, or &hff0000 in Visual Basic.

The PNG_DATA structure elements are defined as follows:
transcolorTransparent color for grayscale, RGB and palette color images
reserved1Unused
reserved2Unused
reserved3Unused

The Victor savepngtobufferex 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




savetga

         24 

Function Prototypes
Visual Basic Declare Function savetga Lib "VIC32.DLL" (ByVal filename As String, srcimg As imgdes, ByVal comp As Long) As Long
VB.NETDeclare Function savetga Lib "VIC32.DLL" (ByVal filename As String, ByRef srcimg As imgdes, ByVal comp As Integer) As Integer
C#int vicwin.savetga(ref string filename, ref imgdes srcimg, int comp);
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

Example C/C++




savetif

  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
VB.NETDeclare Function savetif Lib "VIC32.DLL" (ByVal filename As String, ByRef srcimg As imgdes, ByVal comp As Integer) As Integer
C#int vicwin.savetif(ref string filename, ref imgdes srcimg, int comp);
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
7 = JPEG

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.

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
JPEG 7
Grayscale (16-bit) none 0
RGB (24-bit) none 0
LZW 1
JPEG 7

Return value

Example C/C++ | Example 1 VB | Example 2 VB




savetifpage

  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
VB.NETDeclare Function savetifpage Lib "VIC32.DLL" (ByVal filename As String, ByRef srcimg As imgdes, ByVal cmp As Integer, ByVal page As Integer) As Integer
C#int vicwin.savetifpage(ref string filename, ref imgdes srcimg, int comp, int page);
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
7 = JPEG
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.

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.

To append a tiff page without creating a (temporary) backup file, bitwise OR comp with 0x40. This will make the operation much faster when saving images to files that have many pages. But, in the event of a problem during the save operation, the original tiff file could be corrupted. It is the programmer's responsibility to handle this type of occurance.

See savetif for additional information about saving in the TIFF format.

Return value

See also

savetif

Example C/C++ | Example VB




savetiftobuffer

            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
VB.NETDeclare Function savetiftobuffer Lib "VIC32.DLL" (ByRef buffer As Integer, ByRef srcimg As imgdes, ByVal comp As Integer) As Integer
C#int vicwin.savetiftobuffer(ref int buffer, ref imgdes srcimg, int comp);
C/C++int savetiftobuffer(UCHAR * *buffer, imgdes *srcimg, int comp);
Java int vic.vic32jni.savetiftobuffer(refvar buffer, imgdes srcimg, int comp);
viclib64
C#int vicwin.savetiftobuffer(ref System.IntPtr buffer, ref 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
7 = JPEG

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 buffer. This memory must be released when no longer needed. A file buffer allocated with savetiftobuffer must be released with the freebuffer function when no longer needed.

For additional information about saving in the TIFF file format refer to savetif.

Return value

See also savetif, loadtiffrombuffer




screen

      8   24 

Function Prototypes
Visual BasicDeclare Function screen Lib "VIC32.DLL" (srcimg As imgdes, oprimg As imgdes, resimg As imgdes) As Long
VB.NETDeclare Function screen Lib "VIC32.DLL" (ByRef srcimg As imgdes, ByRef oprimg As imgdes, ByRef resimg As imgdes) As Integer
C#int vicwin.screen(ref imgdes srcimg, ref imgdes oprimg, ref imgdes resimg);
C/C++int screen(imgdes *srcimg, imgdes *oprimg, imgdes *resimg);
Javaint vic.vic32jni.screen(imgdes srcimg, imgdes oprimg, imgdes resimg);

Function Arguments
srcimg Source image
oprimg Operator image
resimg Result image

Description

The screen function combines two images using the operator image as a screen for the source. The operator is considered to be an ordered dither matrix and the result image is a dithered representation of the source. The source and result image areas are defined by the corresponding image descriptors.

Return value




setgifcomment

Function Prototypes
Visual Basic Declare Sub setgifcomment Lib "VIC32.DLL" (ByVal version As Long, ByVal commentstring As String)
VB.NETDeclare Sub setgifcomment Lib "VIC32.DLL" (ByVal version As Integer, ByVal gifcomment As String)
C#void vicwin.setgifcomment(int version, ref string commentstring);
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

Example C/C++




setimagearea

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)
VB.NETDeclare Sub setimagearea Lib "VIC32.DLL" (ByRef image As imgdes, ByVal stx As Integer, ByVal sty As Integer, ByVal endx As Integer, ByVal endy As Integer)
C#void vicwin.setimagearea(ref imgdes image, int stx, int sty, int endx, int endy);
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:

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

Example C/C++




setpixelcolor

  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
VB.NETDeclare Function setpixelcolor Lib "VIC32.DLL" (ByRef resimg As imgdes, ByVal xcoord As Integer, ByVal ycoord As Integer, ByVal color As Integer) As Integer
C#int vicwin.setpixelcolor(ref imgdes resimg, int xcoord, int ycoord, int color);
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

Example C/C++




setupimgdes

Function Prototypes
Visual Basic Declare Function setupimgdes Lib "VIC32.DLL" (ByVal dib As Long, resimg As imgdes) As Long
VB.NETDeclare Function setupimgdes Lib "VIC32.DLL" (ByVal dib As Integer, ByRef resimg As imgdes) As Integer
C#int vicwin.setupimgdes(int dib, ref imgdes resimg);
C/C++int setupimgdes(UCHAR *dib, imgdes *resimg);
Java int vic.vic32jni.setupimgdes(int dibaddr, imgdes image);
viclib64
C#int vicwin.setupimgdes( System.IntPtr dib, ref imgdes resimg);

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

See also

dibtoimage

Example C/C++




sharpen

      8   24 

Function Prototypes
Visual Basic Declare Function sharpen Lib "VIC32.DLL" (srcimg As imgdes, resimg As imgdes) As Long
VB.NETDeclare Function sharpen Lib "VIC32.DLL" (ByRef srcimg As imgdes, ByRef resimg As imgdes) As Integer
C#int vicwin.sharpen(ref imgdes srcimg, ref imgdes resimg);
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.

The source and result image areas are defined by the corresponding image descriptors.

Return value

See also

sharpengentle

Example C/C++ | Example VB




sharpengentle

      8   24 

Function Prototypes
Visual Basic Declare Function sharpengentle Lib "VIC32.DLL" (srcimg As imgdes, resimg As imgdes) As Long
VB.NETDeclare Function sharpengentle Lib "VIC32.DLL" (ByRef srcimg As imgdes, ByRef resimg As imgdes) As Integer
C#int vicwin.sharpengentle(ref imgdes srcimg, ref imgdes resimg);
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.

The source and result image areas are defined by the corresponding image descriptors.

Return value

See also

sharpen

Example C/C++ | Example VB


next section