<gems - Graphic Gems - Graphic Support Methods9/


NAME



-gems - Graphic Gems - Graphic Support Methods




(

SYNOPSIS



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

hvoid 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, constBunsigned int columns, const unsigned int rows, Quantum *f, Quantum*g );

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

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

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

hvoid Upsample( const unsigned int width, const unsigned int height, const unsigned int3scaled_width, unsigned char *pixels );




B

FUNCTION DESCRIPTIONS






*

Constrast



JMethod Contrast enhances the intensity differences between the lighter anddarker elements of the image.

%The format of the Contrast method is:

P

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


=A description of each parameter follows:

6

sign:


KA positive value enhances the contrast otherwise it isreduced.-

red, green, blue:


DA pointer to a pixel component of type Quantum.






2

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:


1A structure of type Quantum.'

noise_type:


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






0

HSLTransform



GMethod 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:

8

hue, saturation, luminosity:


DA double value representing a component of the %HSL color space.-

red, green, blue:


DA 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:


HAn integer value representing the offset of the current pixel within theimage.%

polarity:


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

columns, rows:


6Specifies the number of rows and columns in the image.!

f, g:


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






8

InterpolateColor



KMethod InterpolateColor applies bi-linear interpolation between a pixel andit'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:


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






(

Modulate



JMethod 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:

P

percent_hue, percent_saturation, percent_brightness:


ZA double value representing the percent change in a component of the %HSL color space.-

red, green, blue:


DA pointer to a pixel component of type Quantum.






0

TransformHSL



HMethod 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:


JA Quantum value representing the red, green, and bluecomponent of a pixel..8

hue, saturation, luminosity:


QA 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:


KUnsigned values representing the width and height of the image pixel array.)

scaled_width:


7Specifies the final width of the upsampled pixel array.#

pixels:


JAn unsigned char containing the pixel data. On output the upsampled pixelsare returned here.