ddbtoimage

            1    8   24 

Function Prototypes
Visual BasicDeclare Function ddbtoimage Lib "VIC32.DLL" (ByVal hbitmap As Long, ByVal hpal As Long, resimg As imgdes) As Long
C/C++int ddbtoimage(HBITMAP hbitmap, HPALETTE hPal, imgdes *resimg);
Javaint vic.vic32jni.ddbtoimage(int hbitmap, int hPal, imgdes resimg);

Function Arguments
hbitmap Device dependent bitmap handle
hPal Palette handle or NULL
resimg Result image

Description
The ddbtoimage function creates a Victor-compatible image from a device dependent bitmap and palette. If hPal is NULL the Windows default palette will be used. If the function is successful the image descriptor resimg is filled in.

Ddbtoimage allocates memory to hold the image, so freeimage must be called when this memory is no longer needed.

Return value

See also
dibtoimage

Example C/C++


defaultpalette

      8 

Function Prototypes
Visual BasicDeclare Function defaultpalette Lib "VIC32.DLL" (resimg As imgdes) As Long
C/C++int defaultpalette(imgdes *resimg);
Javaint vic.vic32jni.defaultpalette(imgdes resimg);

Function Arguments
resimg Image which is to receive the new palette

Description

The defaultpalette function creates a 16-color palette consisting of the Windows default (or static) colors. This palette is stored in the palette location defined in the image descriptor element palette. The red, green, and blue contributions for each color are shown in Table 6. The function enters 16 into the image descriptor element colors. Defaultpalette is for use with 8-bit images. Defaultpalette creates an all-purpose palette for displaying color images. It can be used with matchcolorimage to force an 8-or 24-bit image to use a standard palette. When limited to using 16 colors use defaultpalette 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 6. The 16-color Default Palette
Color number

Red

Green

Blue

0

0

0 0
1 128 0 0
2 0 0 128
3 128 0 128
4 0 128 0
5 128 128 0
6 0 128 128
7 192 192 192
8 128 128 128
9 255 0 0
10 0 0 255
11 255 0 255
12 0 255 0
13 255 255 0
14 0 255 255
15 255 255 255

Return value

Returns number of colors placed in the palette, 0 - 16.

See also

rainbowpalette

Example C/C++




dibsecttoimage

            1    8   24 

Function Prototypes
Visual BasicDeclare Function dibsecttoimage Lib "VIC32.DLL" (ByVal hBitmap As Long, resimg As imgdes) As Long
C/C++int dibsecttoimage(HBITMAP hBitmap, imgdes *resimg);
Javaint vic.vic32jni.dibsecttoimage(int hBitmap, imgdes resimg);

Function Arguments
hBitmap DIB section handle
resimg Result image

Description
The dibsecttoimage function creates a Victor-compatible image from a DIB-section (WIN32 device independent bitmap). This function is useful when a DIB is imported from another source to allow Victor functions to operate on it.

Although Windows allows the palette data of a DIB to be indexes into the currently realized logical palette, dibsecttoimage assumes explicit RGB values. If the function is successful the image descriptor resimg is filled in.

Dibsecttoimage allocates memory to hold the image, so freeimage must be called when this memory is no longer needed. Dibsecttoimage is available only in the Victor Library for 32-bit Windows, excluding Windows NT versions earlier than 3.51.

Return value

See also
dibtoimage

Example C/C++




dibtobitmap

Function Prototypes
Visual BasicDeclare Function dibtobitmap Lib "VIC32.DLL" (ByVal hdc As Long, ByVal dib As Long, hBitmap As Long) As Long
C/C++int dibtobitmap(HDC hdc, UCHAR *dib, HBITMAP *hBitmap);
Javaint vic.vic32jni.dibtobitmap(int hdc, int dib, refvar hBitmap);

Function Arguments
hdc Device context handle
dib Address of packed DIB
hBitmap Bitmap handle to be filled in

Description

The dibtobitmap function creates a device dependent bitmap based on an existing packed device independent bitmap (DIB). In the Victor Library for 32-bit Windows this function is generally unneeded because the allocimage function enters a handle to a bitmap in the image descriptor element hBitmap. If dibtobitmap must be used, then the original DIB must be allocated with the allocdib function instead of allocimage.

Although Windows allows the palette data of a DIB to be indexes into the currently realized logical palette, dibtobitmap assumes explicit RGB values, not palette indexes.

If the function successfully creates the device dependent bitmap, the bitmap handle is placed in the hBitmap variable. This handle must be released with the Windows DeleteObject function when no longer needed.

Return value

See also

Converting a Victor Image to a Device Dependent Bitmap, in the Victor User's Guide.

Example C/C++




dibtoimage

Visual BasicDeclare Function dibtoimage Lib "VIC32.DLL" (ByVal dib As Long, resimg As imgdes) As Long
C/C++int dibtoimage(UCHAR *dib, imgdes *resimg);
Javaint vic.vic32jni.dibtoimage(int dib, imgdes resimg);

Function Arguments
dib Address of source packed dib
resimg Result image

Description

The dibtoimage function creates a Victor-compatible image from a source packed device independent bitmap (DIB). This function is useful when a DIB is imported from the clipboard or other source, to allow Victor functions to operate on it.

Although Windows allows the palette data of a DIB to be indexes into the currently realized logical palette, dibtoimage assumes explicit RGB values.

If the function is successful the image descriptor resimg is filled in.

Note: this function allocates global memory to hold the image, this memory must be released with freeimage when no longer needed.

Return value

See also

setupimgdes

Example C/C++ | Example VB




dilate

                8   24 

Function Prototypes
Visual BasicDeclare Function dilate Lib "VIC32.DLL" (ByVal amount As Long, srcimg As imgdes, resimg As imgdes) As Long
C/C++int dilate(int amount, imgdes *srcimg, imgdes *resimg);
Javaint vic.vic32jni.dilate(int amount, imgdes srcimg, imgdes resimg);

Function Arguments
amount Amount of dilation (0 - 255)
srcimg Source image
resimg Result image

Description
The dilate function darkens an image area by enlarging the dark regions of the image. The variable amount determines the extent of the darkening. Maximum dilation is obtained when amount set to 255 and no dilation occurs if amount is set to zero. If the average brightness of a pixel's 3 x 3 local area is darker than amount, the pixel is replaced by its darkest neighbor.

The image areas are defined by the corresponding image descriptors.

Return value

Example C/C++ | Example VB




divide

      8   24 

Function Prototypes
Visual BasicDeclare Function divide Lib "VIC32.DLL" (ByVal divisor As Long, srcimg As imgdes, resimg As imgdes) As Long
C/C++int divide(int divisor, imgdes *srcimg, imgdes *resimg);
Javaint vic.vic32jni.divide(int divisor, imgdes srcimg, imgdes resimg);

Function Arguments
divisor Divisor (1 - 32767)
srcimg Source image
resimg Result image

Description

The divide function decreases the brightness level of each pixel in the source image area by dividing the level value by a factor and placing the quotient in the result image area.

Result = Source / divisor

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

Return value

Example C/C++ | Example VB




drawhisto

      8   24 

Function Prototypes
Visual BasicDeclare Function drawhisto Lib "VIC32.DLL" (ByVal hdc As Long, rect As RECT, ByVal bppixel As Long, redtab As Long, grntab As Long, blutab As Long) As Long
C/C++int drawhisto(HDC hdc, RECT *rect, int bppixel, long *redtab, long *grntab, long *blutab);
Javaint vic.vic32jni.drawhisto(int hdc, RECT rect, int bppixel, int[] redtab, int[] grntab, int[] blutab);

Function Arguments
hdc Device context handle
rect Size and location of histogram in device pixels
bppixel Bits per pixel (8 or 24)
redtab Red histogram data to display
grntab Green histogram data to display)
blutab Blue histogram data to display

Description

The drawhisto function creates a graph of the histogram data on a device context. The vertical axis is frequency and the horizontal axis is brightness level. The histogram data are taken from arrays of 256 long integers.

The rect structure defines the size and location of the histogram transferred to the device context.

If bppixel is 8 the redtab data is plotted as a single graph. If bppixel is 24 the redtab, grntab, and blutab data is plotted as three stacked graphs.

Return value

Example C/C++ 1

Example C/C++ 2




erode

                8   24 

Function Prototypes
Visual BasicDeclare Function erode Lib "VIC32.DLL" (ByVal amount As Long, srcimg As imgdes, resimg As imgdes) As Long
C/C++int erode(int amount, imgdes *srcimg, imgdes *resimg);
Javaint vic.vic32jni.erode(int amount, imgdes srcimg, imgdes resimg);

Function Arguments
amount Amount of erosion (0 - 255)
srcimg Source image
resimg Result image

Description
The erode function brightens an image area by enlarging the bright regions of the image. The variable amount determines the extent of the brightening. Maximum erosion is obtained with amount set to 255 and no erosion occurs if amount is set to zero.

Erode examines a pixel's 3 x 3 local area. If the average brightness of the local area is brighter than 255 minus amount, the central pixel is replaced by its brightest neighbor.

The image areas are defined by the corresponding image descriptors.

Return value

Example C/C++ | Example VB




exchangelevel

      8   24 

Function Prototypes
Visual Basicexchangelevel Lib "VIC32.DLL" (ByVal min As Long, ByVal max As Long, ByVal newval As Long, srcimg As imgdes, resimg As imgdes) As Long
C/C++int exchangelevel(int min, int max, int newval, imgdes *srcimg, imgdes *resimg);
Javaint vic.vic32jni.exchangelevel(int min, int max, int newval, imgdes srcimg, imgdes resimg);

Function Arguments
min Low end of pixel values to change (0-255)
max High end of pixel values to change (0-255)
newval Replacement value (0-255)
srcimg Source image
resimg Result image

Description

The exchangelevel function selectively changes a range of brightness levels within an image area to a new value.

For an RGB image the source red, green, and blue components all must be between min and max for the result pixel to be set to newval. The source and result image areas are defined by the corresponding image descriptors.

Return value

Example C/C++ | Example VB




expandcontrast

      8   24 

Function Prototypes
Visual BasicDeclare Function expandcontrast Lib "VIC32.DLL" (ByVal min As Long, ByVal max As Long, srcimg As imgdes, resimg As imgdes) As Long
C/C++int expandcontrast(int min, int max, imgdes *srcimg, imgdes *resimg);
Javaint vic.vic32jni.expandcontrast(int min, int max, imgdes srcimg, imgdes resimg);

Function Arguments
min Low end of pixel values to expand (0-255)
max High end of pixel values to expand (0-255)
srcimg Source image
resimg Result image

Description

The expandcontrast function increases the contrast of the source image area by expanding the brightness range. The value for the lower level is set to 0 (black) and the value for the upper level is set to 255 (white). Values between lower and upper are rescaled.

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

Return value

Example C/C++ | Example VB




flipimage

  1    8   24 

Function Prototypes
Visual BasicDeclare Function flipimage Lib "VIC32.DLL" (srcimg As imgdes, resimg As imgdes) As Long
C/C++int flipimage(imgdes *srcimg, imgdes *resimg);
Javaint vic.vic32jni.flipimage(imgdes srcimg, imgdes resimg);

Function Arguments
srcimg Source image
resimg Result image

Description

The flipimage function flips an image area top to bottom. The source and result image areas are defined by the corresponding image descriptors.

Return value

Example C/C++ | Example VB




freeimage

  1    8    16   24 

Function Prototypes
Visual BasicDeclare Sub freeimage Lib "VIC32.DLL" (image As imgdes)
C/C++void freeimage(imgdes far *image);
Javavoid vic.vic32jni.freeimage(imgdes image);

Function Arguments
image Image

Description

The freeimage function releases the global memory associated with the image descriptor and sets all image descriptor elements to zero. Use freeimage to release memory allocated with allocimage, allocDIB, clienttoimage, ddbtoimage, dibtoimage, dibsecttoimage, windowtoimage, and all of the TWscanxxxx functions.

Return value

There is no return value

See also

allocimage, dibtoimage

Example C/C++ | Example VB




gammabrighten

      8   24 

Function Prototypes
Visual BasicDeclare Function gammabrighten Lib "VIC32.DLL" (ByVal gamma As Double, srcimg As imgdes, resimg As imgdes) As Long
C/C++int gammabrighten(double gamma, imgdes far *srcimg, imgdes far *resimg);
Javaint vic.vic32jni.gammabrighten(double gamma, imgdes srcimg, imgdes resimg);

Function Arguments
gamma Gamma factor
srcimg Source image
resimg Result image

Description

The gammabrighten function increases or decreases the brightness level of each pixel in the source image area and places the result in the result image area. The new pixel value is calculated as

To brighten an image use a gamma value between 0.0 and 1.0. The lower the value, the brighter the resulting image. To darken an image enter a value above 1.0. The higher the value, the darker the resulting image.

To reverse a gamma operation, call gammabrighten a second time and set the gamma value to the inverse of the previous gamma correction factor. For example, brighten an image with gamma of 0.5, and restore it to its original appearance with gamma of 2.0.

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

Return value

Example C/C++ | Example VB




getgifcomment

Function Prototypes
Visual BasicDeclare Function getgifcomment Lib "VIC32.DLL" (ByVal filename As String, ByVal commentstring As String, ByVal commentstringsize As Long) As Long
C/C++int getgifcomment(LPCSTR filename, char *commentstring, int commentstringsize);
Javaint vic.vic32jni.getgifcomment(String filename, char[] commentstring, int commentstringsize);

Function Arguments
filename Filename to read
commentstringBuffer to receive comment
commentstringsize Number of characters buffer can hold

Description

The getgifcomment function copies a comment string (if present) from a GIF file to a buffer. If the number of characters in the comment exceeds commentstringsize, the string is truncated to fit into the buffer. To determine the size of the buffer to allocate to hold the string, call getgifcomment with the commentstring value equal NULL (see example).

Return value

See also

setgifcomment

Example C/C++




getpixelcolor

  1    8   24 

Function Prototypes
Visual BasicDeclare Function getpixelcolor Lib "VIC32.DLL" (srcimg As imgdes, ByVal xcoord As Long, ByVal ycoord As Long) As Long
C/C++long getpixelcolor(imgdes *srcimg, int xcoord, int ycoord);
Javaint vic.vic32jni.getpixelcolor(imgdes srcimg, int xcoord, int ycoord);

Function Arguments
srcimg Source image
xcoord Pixel x-coordinate
ycoord Pixel y-coordinate

Description

The getpixelcolor function returns the value of a pixel in the image buffer at (xcoord,ycoord). A negative return value indicates an error.

The source image is defined by the image descriptor.

For a 1-bit image, the value returned is either 0 or 1. For an 8-bit image, the value returned is between 0 and 255. For a 24-bit image, RGB values are returned as long integers that can be decomposed as follows:

Return value

Example C/C++ | Example VB




getpngcomment


Visual BasicDeclare Function getpngcomment Lib "VIC32.DLL" (ByVal filename As String, ByVal commenttype As String, ByVal commentstring As String, ByVal commentstringsize As Long) As Long
C/C++int getpngcomment(LPCSTR filename, char * commenttype, char * commentstring, int commentstringsize);
Javaint vic.vic32jni.getpngcomment(String filename, String commenttype, char[] commentstring, int commentstringsize);

Function Arguments
filename Filename to read
commenttypeType of comment to receive
commentstringBuffer to receive comment
commentstringsize Number of characters buffer can hold

Description
The getpngcomment function copies a comment string (if present) from a PNG file to a buffer. If the number of characters in the comment exceeds commentstringsize, the string is truncated to fit into the buffer. To determine the size of the buffer to allocate to hold the string, call getpngcomment with the commentstring value equal 0 (see example).

Only uncompressed comments can be retrieved with getpngcomment. The defined comment type values are "Title", "Author", "Description", "Copyright", "Creation Time", "Software", "Disclaimer", "Warning", "Source", and "Comment."

Return value

Example C/C++




gifframecount

Visual BasicDeclare Function gifframecount Lib "VIC32.DLL" (ByVal filenameAs String, ByRef totalframes As Long) As Long
C/C++int gifframecount(LPCSTR filename, int *totalframes);
Javaint vic.vic32jni.gifframecount(String filename, refvar totalframes);

Function Arguments
filename Filename to read
totalframesVariable to receive the number of frames in the file

Description

The gifframecount function determines the number of frames in a multiframe GIF file and places the value in the totalframes parameter.

Return value

Example C/C++




gifframecountfrombuffer

Visual BasicDeclare Function gifframecountfrombuffer Lib "VIC32.DLL" (ByVal buffer As Long, ByRef totalframes As Long) As Long
C/C++int gifframecountfrombuffer(UCHAR *buffer, int *totalframes);
Javaint vic.vic32jni.gifframecountfrombuffer(int buffer, refvar totalframes);

Function Arguments
buffer Buffer address
totalframesVariable to receive the number of frames in the file

Description

The gifframecountfrombuffer function determines the number of frames in a multiframe GIF file stored in memory at buffer address buffer and places the value in the totalframes parameter.

Return value

Example C/C++




gifinfo

Visual BasicDeclare Function gifinfo Lib "VIC32.DLL" (ByVal filenameAs String, gdat As GifData) As Long
C/C++int gifinfo(LPCSTR filename, GifData *gdat);
Javaint vic.vic32jni.gifinfo(String filename, GifData gdat);

Function Arguments
filename Filename to read
gdatVariable of type GifData to receive the data

Description

The gifinfo function reads the header of a GIF file and places the image information in the ginfo structure. The structure is defined in the header file VICDEFS.H.

The GifData structure elements are defined as follows:
width Image width in pixels
length Image length in pixels
BitsColRes Number of bits of color resolution
BitsPPixel Number of bits per pixe
TransColor Transparent color
Laceflag Interlace flag
Codesize LZW code size
GIFvers GIF version 87 or 89
vbitcount Victor bits per pixel (used to allocate an imagebuffer with allocimage)

The purpose of the gifinfo function is to determine if a GIF file is readable and permit allocating enough memory to load the file. The GIF file format specification is available on Compuserve.

If a GIF file contains a transparent color, gifinfo will return it in the structure element TransColor. If a transparent color is not present, TransColor is set to -1.

Return value

See also

loadgif, savegif

Example C/C++ | Example VB




gifinfoallframes

Visual BasicDeclare Function gifinfoallframes Lib "VIC32.DLL" (ByVal filename As String, gdata As GifGlobalData, fdatarray As GifFrameData, ByVal frameElem As Long) As Long
C/C++int gifinfoallframes(LPCSTR filename, GifGlobalData far *gdata, GifFrameData *fdatarray, int frameElem);
Javaint vic.vic32jni.gifinfoallframes(String filename, GifGlobalData gdata, GifFrameData[] fdatarray, int frameElem);

Function Arguments
filename Filename to read
gdataGifGlobalData structure to be filled in
fdatarray Array of GifFrameData structures to be filled in
frameElem Number of GifFrameData structures in fdatarray

Description

The gifinfoallframes function reads through an entire multiframe GIF file and places the file and the frame information for frameElem number of frames in the data structures.

The GifGlobalData structure elements are defined as follows:
saveDataGlobal data of type GifGlobalSaveData
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
BitsPPixelBitcount
colorResint pixelAspectRatio;
commentOffsetBytes from file start to first comment extension
colorsNumber of colors in global color table
colorMapOffsetGlobal color table offset in file

The GifFrameData structure elements are defined as follows:
saveDataFrame data of type GifFrameSaveData
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
vbitcountVictor bits per pixel
widthGIF image width, length
lengthGIF image width, length
frameFrame number the data describes
interlaceInterlaced image
codesizeCode size
colorsNumber of colors in local color table
colorMapOffsetLocal color table offset in file
rasterDataOffsetBytes from file start to start of raster data

This function should be preceded by a call to gifframecount to determine the number of frames in the file.

Return value

See also

loadgif, savegif

Example C/C++




gifinfoframe

Visual BasicDeclare Function gifinfoframe Lib "VIC32.DLL" (ByVal filename As String, ginfo As GifData, gdata As GifGlobalData, fdata As GifFrameData, ByVal frameTarget As Long) As Long
C/C++int gifinfoframe(LPCSTR filename, GifData *ginfo, GifGlobalData *gdata, GifFrameData *fdata, int frameTarget);
Javaint vic.vic32jni.gifinfoframe(String filename, GifData ginfo, GifGlobalData gdata, GifFrameData fdata, int frameTarget);

Function Arguments
filename Filename to read
ginfo GifData structure to be filled in
gdataGifGlobalData structure to be filled in
fdata GifFrameData structure to be filled in
frameTarget Frame number (zero-based)

Description

The gifinfoframe function reads the header of a GIF file and the frame header of a specified frame and places the file and image information in the data structures. The first frame in a file is frame number zero.

The GifData structure elements are defined as follows:
width Image width in pixels
length Image length in pixels
BitsColRes Number of bits of color resolution
BitsPPixel Number of bits per pixe
TransColor Transparent color
Laceflag Interlace flag
Codesize LZW code size
GIFvers GIF version 87 or 89
vbitcount Victor bits per pixel (used to allocate an imagebuffer with allocimage)

The GifGlobalData structure elements are defined as follows:
saveDataGlobal data of type GifGlobalSaveData
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
BitsPPixelBitcount
colorResint pixelAspectRatio;
commentOffsetBytes from file start to first comment extension
colorsNumber of colors in global color table
colorMapOffsetGlobal color table offset in file

The GifFrameData structure elements are defined as follows:
saveDataFrame data of type GifFrameSaveData
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
vbitcountVictor bits per pixel
widthGIF image width, length
lengthGIF image width, length
frameFrame number the data describes
interlaceInterlaced image
codesizeCode size
colorsNumber of colors in local color table
colorMapOffsetLocal color table offset in file
rasterDataOffsetBytes from file start to start of raster data

Return value

See also

loadgif, savegif

Example C/C++


gifinfoframefrombuffer

Visual BasicDeclare Function gifinfoframefrombuffer Lib "VIC32.DLL" (ByVal buffer As Long, ginfo As GifData, gdata As GifGlobalData, fdata As GifFrameData, ByVal frameTarget As Long) As Long
C/C++int gifinfoframefrombuffer(UCHAR *buffer, GifData *ginfo, GifGlobalData *gdata, GifFrameData *fdata, int frameTarget);
Javaint vic.vic32jni.gifinfoframefrombuffer(int buffer, GifData ginfo, GifGlobalData gdata, GifFrameData fdata, int frameTarget);

Function Arguments
buffer Buffer address
ginfo GifData structure to be filled in
gdataGifGlobalData structure to be filled in
fdata GifFrameData structure to be filled in
frameTarget Frame number (zero-based)

Description

The gifinfoframefrombuffer function reads from a GIF file in memory and places the file and frame image information in the data structures. The first frame in a file is frame number zero.

The GifData structure elements are defined as follows:
width Image width in pixels
length Image length in pixels
BitsColRes Number of bits of color resolution
BitsPPixel Number of bits per pixe
TransColor Transparent color
Laceflag Interlace flag
Codesize LZW code size
GIFvers GIF version 87 or 89
vbitcount Victor bits per pixel (used to allocate an imagebuffer with allocimage)

The GifGlobalData structure elements are defined as follows:
saveDataGlobal data of type GifGlobalSaveData
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
BitsPPixelBitcount
colorResint pixelAspectRatio;
commentOffsetBytes from file start to first comment extension
colorsNumber of colors in global color table
colorMapOffsetGlobal color table offset in file

The GifFrameData structure elements are defined as follows:
saveDataFrame data of type GifFrameSaveData
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
vbitcountVictor bits per pixel
widthGIF image width, length
lengthGIF image width, length
frameFrame number the data describes
interlaceInterlaced image
codesizeCode size
colorsNumber of colors in local color table
colorMapOffsetLocal color table offset in file
rasterDataOffsetBytes from file start to start of raster data

Return value

See also

loadgif, savegif




gifinfofrombuffer

Visual BasicDeclare Function gifinfofrombuffer Lib "VIC32.DLL" (ByVal buffer As Long, ginfo As GifData) As Long
C/C++int gifinfofrombuffer(UCHAR *buffer, GifData *ginfo);
Javaint vic.vic32jni.gifinfofrombuffer(int buffer, GifData ginfo);

Function Arguments
buffer Buffer address
ginfo Variable of type GifData to receive the data

Description

The gifinfofrombuffer function reads the header information from memory holding GIF file data and places the image information in the ginfo structure.

The GifData structure elements are defined as follows:
width Image width in pixels
length Image length in pixels
BitsColRes Number of bits of color resolution
BitsPPixel Number of bits per pixe
TransColor Transparent color
Laceflag Interlace flag
Codesize LZW code size
GIFvers GIF version 87 or 89
vbitcount Victor bits per pixel (used to allocate an imagebuffer with allocimage)

The purpose of the gifinfofrombuffer function is to identify the type and size of the image and permit allocating enough memory to load the image.

If a GIF file contains a transparent color, gifinfo will return it in the structure element TransColor. If a transparent color is not present, TransColor is set to -1.

Return value

See also
gifinfo

Example C/C++




histobrighten

      8   24 

Function Prototypes
Visual BasicDeclare Function histobrighten Lib "VIC32.DLL" (srcimg As imgdes, resimg As imgdes) As Long
C/C++int histobrighten(imgdes *srcimg, imgdes *resimg);
Javaint vic.vic32jni.histobrighten(imgdes srcimg, imgdes resimg);

Function Arguments
srcimg Source image
resimg Result image

Description

The histobrighten function brightens an image area by reassigning brightness levels so that the integral of the resulting histogram increases quadratically with brightness level. The source and result image areas are defined by the corresponding image descriptors.

Histogram brightening generally reduces the number of brightness levels present in the image. Contrast is improved, but details may be lost. Histogram brightening is sometimes very effective in bringing out the details of an image when the subject of interest is hidden in shadows.

Return value

See also

histoequalize

Example C/C++ | Example VB




histoequalize

      8   24 

Function Prototypes
Visual BasicDeclare Function histoequalize Lib "VIC32.DLL" (srcimg As imgdes, resimg As imgdes) As Long
C/C++int histoequalize(imgdes *srcimg, imgdes *resimg);
Javaint vic.vic32jni.histoequalize(imgdes srcimg, imgdes resimg);

Function Arguments
srcimg Source image
resimg Result image

Description

The histoequalize function reassigns brightness levels of the image area so that the integral of the resulting histogram increases linearly with brightness level. The source and result image areas are defined by the corresponding image descriptors. Histogram equalization is most effective when applied to a dark image.

Return value

Example C/C++ | Example VB




hsv2rgb

Function Prototypes
Visual BasicDeclare Sub hsv2rgb Lib "VIC32.DLL" (ByRef hsvtab As HSVTRIPLE, ByRef rgbtab As RGBQUAD, ByVal colors As Long)
C/C++void hsv2rgb(HSVTRIPLE *hsvtab, RGBQUAD *rgbtab, int colors);
Javavoid vic.vic32jni.hsv2rgb(HSVTRIPLE[] hsvtab, RGBQUAD[] rgbtab, int colors);

Function Arguments
hsvtab HSV data table
rgbtab RGB palette table
colors Number of colors to convert

Description

The hsv2rgb function converts a hue, saturation, value (HSV) table to a red, green, blue (RGB) color palette. This function and the rgb2hsv 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 a Victor Library data structure.

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 a Windows data structure.

Each HSV table entry can range from 0 to 255. The RGB table must be large enough to hold colors RGBQUAD structures. Each RGB table entry will range from 0 to 255.

Return value

There is no return value.

Example C/C++




imageareatorect

Function Prototypes
Visual BasicDeclare Sub imageareatorect Lib "VIC32.DLL" (ByRef srcimg As imgdes, ByRef arect As RECT)
C/C++void imageareatorect(imgdes *srcimg, RECT *arect);
Javavoid vic.vic32jni.imageareatorect(imgdes srcimg, RECT arect);

Function Arguments
srcimg Source image
arect Variable of type RECT to receive the data

Description

The imageareatorect function sets the members of a RECT data structure to the image area defined by the image descriptor.

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 C/C++




imagetodib

  1    8   24 

Function Prototypes
Visual BasicDeclare Function imagetodib Lib "VIC32.DLL" (ByRef srcimg As imgdes, ByRef dibaddr As Long) As Long
C/C++int imagetodib(imgdes *srcimg, UCHAR **dibaddr);
Javaint vic.vic32jni.imagetodib(imgdes srcimg, refvar dibaddr);

Function Arguments
srcimg Source image
dibaddr Variable to receive result DIB address

Description

The imagetodib example creates a packed device independent bitmap (DIB) from an image area. The image area is defined by the image descriptor. This function is useful for passing an image to the clipboard. In 32-bit Windows imagetoDIB uses the allocDIB function to create a clipboard-compatible DIB in contiguous memory.

A DIB created with this function must be released when no longer needed. To free the memory the following code can be used:

   hMem = GlobalPtrHandle(dib); // WINDOWSX.H macro
   GlobalUnlock(hMem);  // Unlock the handle to the DIB
   GlobalFree(hMem);

If the DIB is passed to the clipboard, memory owned by the DIB must NOT be freed, since Windows assumes responsibility for this memory.

Return value

Example C/C++ | Example VB




isgrayscaleimage

            1    8   24 

Function Prototypes
Visual BasicDeclare Function isgrayscaleimage Lib "VIC32.DLL" (srcimg As imgdes) As Long
C/C++BOOL isgrayscaleimage(imgdes far *srcimg);
Javaint vic.vic32jni.isgrayscaleimage(imgdes srcimg);

Function Arguments
srcimg Source image


Description
The isgrayscaleimage function examines the image's palette information and reports whether it is grayscale. This function does not alter the value of the image descriptor element imgtype.

The source image is defined by the image descriptor.

To be judged grayscale an image must have a palette with these characteristics:

This function returns FALSE if the image does not have a palette, for example for a 16-bit grayscale or a 24-bit RGB image.

The loadfile functions call isgrayscaleimage internally and correctly set the value of the image descriptor element imgtype.

Return value




jpeggeterror

Function Prototypes
Visual BasicDeclare Function jpeggeterror Lib "VIC32.DLL" () As Long
C/C++int jpeggeterror(void);
Javaint vic.vic32jni.jpeggeterror();

Description
The jpeggeterror function reports extended error information after a JPEG function returns BAD_JPEG.

Return value

Example C/C++




jpeginfo

Visual BasicDeclare Function jpeginfo Lib "VIC32.DLL" (ByVal filename As String, ByRef jinfo As JpegData) As Long
C/C++int jpeginfo(LPCSTR filename, JpegData *jinfo);
Javaint vic.vic32jni.jpeginfo(String filename, JpegData jinfo);

Function Arguments
filename Filename to read
jinfoVariable of type JpegData to receive the data

Description

The jpeginfo function reads the header of a JPEG File Interchange Format (JFIF) file and places the image information in the jinfo structure.

The purpose of the jpeginfo function is to determine if a JPEG file is readable and permit allocating enough memory to load the image.

The JpegData structure elements are defined as follows:
ftype File type, 0 - 11 are valid file types, ftype is set to -1 if the file type cannot be determined.
width Image width in pixels
length Image length in pixels
comps Number of components, 1 for a grayscale image, 3 or 4 for a color image
precision Sample precision, 8 or 12 bits per component
sampFac[4] Sampling factors for each component. Each sampFac[] element contains the horizontal and vertical sampling factors in the most significant 4 bits and the least significant 4 bits, respectively. Each sampling factor can be 1, 2, or 4.
vbitcount Victor bits per pixel (used to allocate an imagebuffer with allocimage).

JPEG references:

  1. The Data Compression Book, Mark Nelson, M & T Books, San Mateo, CA 94402, 1992. A good discussion of most of the principles involved in JPEG compression, but this book does not actually implement the algorithm as specified in the standard.
  2. The archive JPSRC3.ZIP. Available from various sources including CompuServe in the GRAPHICSUPPORT forum (GO PICS), library 10. This archive contains CJPEG.EXE, DJPEG.EXE, and oodles of source code.
  3. "Digital Compression and Coding of Continuous-tone Still Images, Part 1, Requirements and Guidelines", ISO/IEC DIS 10918-1. Available from ANSI sales at (212) 642-4900.
  4. JFIF file specification. Available from Literature Dept., C-Cube Microsystems, Inc., 399A W. Trimble Rd., San Jose, CA 95131, (408) 944-6300. The savejpg() and loadjpg() routines read and write files using the JPEG File Interchange Format (JFIF), which is described in this document.

Return value

See also

loadjpg, savejpg

Example C/C++




jpeginfoex

Visual BasicDeclare Function jpeginfoex Lib "VIC32.DLL" (ByVal filename As String, ByRef jinfoex As JpegDataEx) As Long
C/C++int jpeginfoex(LPCSTR filename, JpegDataEx *jinfoex);
Javaint vic.vic32jni.jpeginfoex(String filename, JpegDataEx jinfoex);

Function Arguments
filename Filename to read
jinfoexJpegDataEx structure to be filled in

Description

The jpeginfoex function reads the header of a JPEG File Interchange Format (JFIF) file and places the image information in the jinfoex structure. Jpeginfoex provides the same information as jpeginfo and, in addition, supplies resolution and thumbnail data.

The JpegDataEx structure elements are defined as follows:
ftype File type, 0 - 11 are valid file types, ftype is set to -1 if the file type cannot be determined.
width Image width in pixels
length Image length in pixels
comps Number of components, 1 for a grayscale image, 3 or 4 for a color image
precision Sample precision, 8 or 12 bits per component
sampFac[4] Sampling factors for each component. Each sampFac[] element contains the horizontal and vertical sampling factors in the most significant 4 bits and the least significant 4 bits, respectively. Each sampling factor can be 1, 2, or 4.
vbitcount Victor bits per pixel (used to allocate an imagebuffer with allocimage).
xres Horizontal resolution
yres Vertical resolution
resunit Resolution units:
0 = No units, xres/yres represent aspect ratio
1 = Dots per inch (dpi)
2 = Dots per centimeter (dpc)
thumbNail Thumbnail descriptor of type JPEG_THUMB_DATA
hasThumbNailnonzero if thumbnail image is present
widthThumbnail width in pixels
lengthThumbnail length in pixels
bitcountThumbnail bits per pixel, 8 or 24
codingThumbnail coding
0x10 = JPEG encoded thumbnail
0x11 = 8-bit palette color thumbnail
0x13 = 24-bit RGB thumbnail

Return value

See also

jpeginfo




jpeginfofrombuffer

Visual BasicDeclare Function jpeginfofrombuffer Lib "VIC32.DLL" (ByVal buff As Long, ByRef jinfo As JpegData) As Long
C/C++int jpeginfofrombuffer(UCHAR *buff, JpegData *jinfo);
Javaint vic.vic32jni.jpeginfofrombuffer(int buff, JpegData jinfo);

Function Arguments
buff Buffer address
jinfoJpegData structure to be filled in

Description

The jpeginfofrombuffer function reads JPEG header data from memory holding JPEG file data and places the image information in the jinfo structure.

The purpose of the jpeginfofrombuffer function is to determine if JPEG data is readable and permit allocating enough memory to load the image.

The JpegData structure elements are defined as follows:
ftype File type, 0 - 11 are valid file types, ftype is set to -1 if the file type cannot be determined.
width Image width in pixels
length Image length in pixels
comps Number of components, 1 for a grayscale image, 3 or 4 for a color image
precision Sample precision, 8 or 12 bits per component
sampFac[4] Sampling factors for each component. Each sampFac[] element contains the horizontal and vertical sampling factors in the most significant 4 bits and the least significant 4 bits, respectively. Each sampling factor can be 1, 2, or 4.
vbitcount Victor bits per pixel (used to allocate an imagebuffer with allocimage).

JPEG references:

  1. The Data Compression Book, Mark Nelson, M & T Books, San Mateo, CA 94402, 1992. A good discussion of most of the principles involved in JPEG compression, but this book does not actually implement the algorithm as specified in the standard.
  2. The archive JPSRC3.ZIP. Available from various sources including CompuServe in the GRAPHICSUPPORT forum (GO PICS), library 10. This archive contains CJPEG.EXE, DJPEG.EXE, and oodles of source code.
  3. "Digital Compression and Coding of Continuous-tone Still Images, Part 1, Requirements and Guidelines", ISO/IEC DIS 10918-1. Available from ANSI sales at (212) 642-4900.
  4. JFIF file specification. Available from Literature Dept., C-Cube Microsystems, Inc., 399A W. Trimble Rd., San Jose, CA 95131, (408) 944-6300. The savejpg() and loadjpg() routines read and write files using the JPEG File Interchange Format (JFIF), which is described in this document.

Return value

See also

jpeginfo

Example C/C++




jpeginfofrombufferex

Visual BasicDeclare Function jpeginfofrombufferex Lib "VIC32.DLL" (ByVal buff As Long, ByRef jinfoex As JpegDataEx) As Long
C/C++int jpeginfofrombufferex(UCHAR *buff, JpegDataEx *jinfoex);
Javaint vic.vic32jni.jpeginfofrombufferex(int buff, JpegDataEx jinfoex);

Function Arguments
buff Buffer address
jinfoexJpegDataEx structure to be filled in

Description

The jpeginfofrombufferex function reads the header information from memory holding JPEG file data and places the image information in the jinfoex structure. Jpeginfofrombufferex provides the same information as jpeginfofrombuffer and, in addition, supplies resolution and thumbnail data.

The JpegDataEx structure elements are defined as follows:
ftype File type, 0 - 11 are valid file types, ftype is set to -1 if the file type cannot be determined.
width Image width in pixels
length Image length in pixels
comps Number of components, 1 for a grayscale image, 3 or 4 for a color image
precision Sample precision, 8 or 12 bits per component
sampFac[4] Sampling factors for each component. Each sampFac[] element contains the horizontal and vertical sampling factors in the most significant 4 bits and the least significant 4 bits, respectively. Each sampling factor can be 1, 2, or 4.
vbitcount Victor bits per pixel (used to allocate an imagebuffer with allocimage).
xres Horizontal resolution
yres Vertical resolution
resunit Resolution units:
0 = No units, xres/yres represent aspect ratio
1 = Dots per inch (dpi)
2 = Dots per centimeter (dpc)
thumbNail Thumbnail descriptor of type JPEG_THUMB_DATA
hasThumbNailnonzero if thumbnail image is present
widthThumbnail width in pixels
lengthThumbnail length in pixels
bitcountThumbnail bits per pixel, 8 or 24
codingThumbnail coding
0x10 = JPEG encoded thumbnail
0x11 = 8-bit palette color thumbnail
0x13 = 24-bit RGB thumbnail
Return value

See also

jpeginfofrombuffer, loadjpgfrombuffer




jpegsetthumbnailsize

Function Prototypes
Visual BasicDeclare Function jpegsetthumbnailsize Lib "VIC32.DLL" (ByVal longEdge As Long) As Long
C/C++int jpegsetthumbnailsize(int longEdge);/td>
Javaint vic.vic32jni.jpegsetthumbnailsize(int longEdge);

Function Arguments
longEdge Size of longer dimension, width or length (1 - 255)

Description

The jpegsetthumbnailsize function sets the size for embedded thumbnails for all subsequent JPEG files created with savejpgex. The value of longEdge is used for the longer dimension, width or length, and the other dimension is calculated to preserve the image aspect ratio. LongEdge must be in the range 1 - 255.

Even if jpegsetthumbnailsize returns NO_ERROR, that does not guarantee that savejpgex will be able to write a JPEG file with an embedded thumbnail of the size specified. The embedded thumbnail must occupy less than 65536 bytes. This is only a concern for 24-bit images where the calculation is

   thumbnail bytes = width * length * 3 +16

So, for example, if longEdge is set to 255 and the other dimension is greater than 85, savejpgex will fail and return BAD_TN_SIZE.

Return value

See also
savejpgex

Example C/C++




jpegsetxyresolution

Visual BasicDeclare Sub jpegsetxyresolution Lib "VIC32.DLL" (ByVal xres As Long, ByVal yres As Long, ByVal resUnit As Long)
C/C++void jpegsetxyresolution(unsigned xres, unsigned yres, unsigned resUnit);
Javavoid vic.vic32jni.jpegsetxyresolution(int xres, int yres, int resUnit);

Function Arguments
xres Horizontal resolution in pixels (0 - 65535)
yres Vertical resolution in pixels (0 - 65535)
resUnit Resolution unit (0-2)
0 = No unit of measurement, xres/yres represent aspect ratio
1 = Inch
2 = Centimeter
Description

The jpegsetxyresolution function sets the horizontal and vertical resolution and resolution unit for a JPEG file. All subsequent files saved with the savejpg functions will use the values set by jpegsetxyresolution. The default values are xres = 1, yres = 1, resunit = 0 (no units); that is, the default setting represents a pixel aspect ratio of 1:1 (square).

Return value

There is no return value.

See also

tiffsetxyresolution




kodalith

      8   24 

Function Prototypes
Visual BasicDeclare Function kodalith Lib "VIC32.DLL" (ByVal threshold As Long, srcimg As imgdes, resimg As imgdes) As Long
C/C++int kodalith(const int threshold, imgdes far *srcimg, imgdes far *resimg);
Javaint vic.vic32jni.kodalith(int threshold, imgdes srcimg, imgdes resimg);

Function Arguments
threshold Threshold value for separation (0-255)
srcimg Source image
resimg Result image

Description

The kodalith function creates a high contrast image area, containing only black and white pixels, similar to a Kodalith print. The threshold value determines whether a pixel is set to black or white.

For an RGB image the source pixel value is calculated

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

Return value

Example C/C++ | Example VB


next section