NAME

gems - Graphic Gems - Graphic Support Methods


SYNOPSIS

Quantum GenerateNoise( const Quantum pixel, const NoiseType noise_type );

void HSLTransform( const double hue, const double saturation, const double luminosity, Quantum *red, Quantum *green, Quantum *blue );

void Hull( const int x_offset, const int y_offset, const int polarity, const unsigned int columns, const unsigned int rows, Quantum *f, Quantum *g );

ColorPacket InterpolateColor( Image *image, const double x_offset, const double y_offset );

void Modulate( double percent_hue, double percent_saturation, double percent_brightness, Quantum *red, Quantum *green, Quantum *blue )blue );

void TransformHSL( const Quantum red, const Quantum green, const Quantum blue, double *hue, double *saturation, double *luminosity );

void Upsample( const unsigned int width, const unsigned int height, const unsigned int scaled_width, unsigned char *pixels );


FUNCTION DESCRIPTIONS


Constrast

Method Contrast enhances the intensity differences between the lighter and darker elements of the image.

The format of the Contrast method is:

    void Contrast(const int sign,Quantum *red,Quantum *green,Quantum *blue)

A description of each parameter follows:

sign:

A positive value enhances the contrast otherwise it is reduced.

red, green, blue:

A pointer to a pixel component of type Quantum.


GenerateNoise

Method GenerateNoise adds noise to a pixel.

The format of the GenerateNoise method is:

Quantum GenerateNoise ( const Quantum pixel, const NoiseType noise_type );

A description of each parameter follows:

pixel:

A structure of type Quantum.

noise_type:

The type of noise: Gaussian, multiplicative Gaussian, impulse, laplacian, or Poisson.


HSLTransform

Method HSLTransform converts a (hue, saturation, luminosity) to a (red, green, blue) triple.

The format of the HSLTransformImage method is:

void HSLTransform ( const double hue, const double saturation, const double luminosity, Quantum *red, Quantum *green, Quantum *blue );

A description of each parameter follows:

hue, saturation, luminosity:

A double value representing a component of the HSL color space.

red, green, blue:

A pointer to a pixel component of type Quantum.


Hull

Method 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 method is:

void Hull ( const int x_offset, const int y_offset, const int polarity, const unsigned int columns, const unsigned int rows, Quantum *f, Quantum *g );

A description of each parameter follows:

x_offset, y_offset:

An integer value representing the offset of the current pixel within the image.

polarity:

An integer value declaring the polarity (+,-).

columns, rows:

Specifies the number of rows and columns in the image.

f, g:

A pointer to an image pixel and one of it's neighbor.


InterpolateColor

Method InterpolateColor applies bi-linear interpolation between a pixel and it's neighbors.

The format of the InterpolateColor method is:

ColorPacket InterpolateColor ( Image *image, const double x_offset, const double y_offset );

A description of each parameter follows:

image:

The address of a structure of type Image.

x_offset,y_offset:

A double representing the current (x,y) position of the pixel.


Modulate

Method Modulate modulates the hue, saturation, and brightness of an image.

The format of the ModulateImage method is:

void Modulate ( double percent_hue, double percent_saturation, double percent_brightness, Quantum *red, Quantum *green, Quantum *blue ) blue );

A description of each parameter follows:

percent_hue, percent_saturation, percent_brightness:

A double value representing the percent change in a component of the HSL color space.

red, green, blue:

A pointer to a pixel component of type Quantum.


TransformHSL

Method TransformHSL converts a (red, green, blue) to a (hue, saturation, luminosity) triple.

The format of the TransformHSL method is:

void TransformHSL ( const Quantum red, const Quantum green, const Quantum blue, double *hue, double *saturation, double *luminosity );

A description of each parameter follows:

red, green, blue:

A Quantum value representing the red, green, and blue component of a pixel..

hue, saturation, luminosity:

A pointer to a double value representing a component of the HSL color space.


Upsample

Method Upsample doubles the size of the image.

The format of the UpSample method is:

void Upsample ( const unsigned int width, const unsigned int height, const unsigned int scaled_width, unsigned char *pixels );

A description of each parameter follows:

width,height:

Unsigned values representing the width and height of the image pixel array.

scaled_width:

Specifies the final width of the upsampled pixel array.

pixels:

An unsigned char containing the pixel data. On output the upsampled pixels are returned here.