gems - Graphic Gems - Graphic Support Routines
GenerateNoise(pixel,noise_type)
HSLTransform(hue,saturation,luminosity,red,green,blue)
Hull(x_offset,y_offset,polarity,columns,rows,f,g)
status=InsidePrimitive(primitive_info,annotate_info,x,y,image)
Interpolate(image,pixel,x,y)
TransformHSL(red,green,blue,hue,saturation,luminosity)
Upsample(width,height,scaled_width,pixels)
Function Contrast enhances the intensity differences between the lighter
and darker elements of the image.
The format of the ContrastImage routine is:
Contrast(sign,red,green,blue)
A description of each parameter follows:
- o sign:
-
A positive value enhances the contrast otherwise it is reduced.
- o red, green, blue:
-
A pointer to a pixel component of type Quantum.
Function GenerateNoise adds noise to a pixel.
The format of the GenerateNoise routine is:
GenerateNoise(pixel,noise_type)
A description of each parameter follows:
- o pixel:
-
A structure of type Quantum.
- o noise_type:
-
The type of noise: gaussian, multiplicative gaussian, impulse, laplacian,
or poisson.
Function HSLTransform converts a (hue, saturation, luminosity) to a (red,
green, blue) triple.
The format of the HSLTransformImage routine is:
HSLTransform(hue,saturation,luminosity,red,green,blue)
A description of each parameter follows:
- o hue, saturation, luminosity:
-
A double value representing a component of the HSL color space.
- o red, green, blue:
-
A pointer to a pixel component of type Quantum.
Function Hull implements the eight hull algorithm described in Applied
Optics, Vol. 24, No. 10, 15 May 1985, ``Geometric filter for Speckle
Reduction'', by Thomas R Crimmins. Each pixel in the image is replaced by
one of its eight of its surrounding pixels using a polarity and negative
hull function.
The format of the Hull routine is:
Hull(x_offset,y_offset,polarity,columns,rows,f,g)
A description of each parameter follows:
- o x_offset, y_offset:
-
An integer value representing the offset of the current pixel within the
image.
- o polarity:
-
An integer value declaring the polarity (+,-).
- o columns, rows:
-
Specifies the number of rows and columns in the image.
- o f, g:
-
A pointer to an image pixel and one of it's neighbor.
Function InsidePrimitive returns True if the (x,y) position is inside the
primitive as defined in primitive_info. Otherwise False is returned.
The format of the InsidePrimitive routine is:
status=InsidePrimitive(primitive_info,annotate_info,x,y,image)
A description of each parameter follows:
- o status:
-
Function InsidePrimitive returns True if the (x,y) position is inside the
primitive as defined in primitive_info. Otherwise False is returned.
- o primitive_info:
-
Specifies a pointer to a PrimitiveInfo structure.
- o annotate_info:
-
Specifies a pointer to a AnnotateInfo structure.
- o x,y:
-
Integers representing the (x,y) location in the image.
- o image:
-
The address of a structure of type Image.
Function Interpolate applies bi-linear interpolation between a pixel and
it's neighbors.
The format of the Interpolate routine is:
Interpolate(image,pixel,x,y)
A description of each parameter follows:
- o image:
-
The address of a structure of type Image.
- o pixel:
-
A pointer to a RunlengthPacket representing the current pixel.
- o x,y:
-
A double representing the current (x,y) position of the pixel.
Function Modulate modulates the hue, saturation, and brightness of an
image.
The format of the ModulateImage routine is:
Modulate(percent_hue,percent_saturation,percent_luminosity,red,green,
blue)
A description of each parameter follows:
- o percent_hue, percent_saturation, percent_luminosity:
-
A double value representing the percent change in a component of the HSL
color space.
- o red, green, blue:
-
A pointer to a pixel component of type Quantum.
Function TransformHSL converts a (red, green, blue) to a (hue, saturation,
luminosity) triple.
The format of the TransformHSL routine is:
TransformHSL(red,green,blue,hue,saturation,luminosity)
A description of each parameter follows:
- o red, green, blue:
-
A Quantum value representing the red, green, and blue component of a
pixel..
- o hue, saturation, luminosity:
-
A pointer to a double value representing a component of the HSL color
space.
Function Upsample
The format of the UpSample routine is:
Upsample(width,height,scaled_width,pixels)
A description of each parameter follows:
- o width,height:
-
Unsigned values representinf the width and height of the image pixel array.
- o scaled_width:
-
Specifies the final width of the upsampled pixel array.
- o pixels:
-
An unsigned char containing the pixel data. On output the upsampled pixels
are returned here.