<HTML>
<HEAD>
<TITLE>gems - Graphic Gems - Graphic Support Methods</TITLE>
<LINK REV="made" HREF="mailto:magick@wizards.dupont.com">
</HEAD>

<body background="../../images/background.png">

<!-- INDEX BEGIN -->

<UL>

	<LI><A HREF="#NAME">NAME</A>
	<LI><A HREF="#SYNOPSIS">SYNOPSIS</A>
	<LI><A HREF="#FUNCTION_DESCRIPTIONS">FUNCTION DESCRIPTIONS</A>
	<UL>

		<LI><A HREF="#Constrast">Constrast</A>
		<LI><A HREF="#GenerateNoise">GenerateNoise</A>
		<LI><A HREF="#HSLTransform">HSLTransform</A>
		<LI><A HREF="#Hull">Hull</A>
		<LI><A HREF="#InterpolateColor">InterpolateColor</A>
		<LI><A HREF="#Modulate">Modulate</A>
		<LI><A HREF="#TransformHSL">TransformHSL</A>
		<LI><A HREF="#Upsample">Upsample</A>
	</UL>

</UL>
<!-- INDEX END -->

<HR>
<P>
<H1><A NAME="NAME">NAME</A></H1>
<P>
gems - Graphic Gems - Graphic Support Methods

<P>
<HR>
<H1><A NAME="SYNOPSIS">SYNOPSIS</A></H1>
<P>
Quantum  <STRONG>GenerateNoise</STRONG>( const Quantum pixel, const NoiseType noise_type );

<P>
void  <STRONG>HSLTransform</STRONG>( const double hue, const double saturation, const double luminosity,
Quantum *red, Quantum *green, Quantum <CODE>*blue</CODE> );

<P>
void  <STRONG>Hull</STRONG>( const int x_offset, const int y_offset, const int polarity, const
unsigned int columns, const unsigned int rows, Quantum *f, Quantum
<CODE>*g</CODE> );

<P>
ColorPacket  <STRONG>InterpolateColor</STRONG>( Image *image, const double x_offset, const double y_offset );

<P>
void  <STRONG>Modulate</STRONG>( double percent_hue, double percent_saturation, double percent_brightness,
Quantum *red, Quantum *green, Quantum <CODE>*blue</CODE> )blue );

<P>
void  <STRONG>TransformHSL</STRONG>( const Quantum red, const Quantum green, const Quantum blue, double *hue,
double *saturation, double <CODE>*luminosity</CODE> );

<P>
void  <STRONG>Upsample</STRONG>( const unsigned int width, const unsigned int height, const unsigned int
scaled_width, unsigned char <CODE>*pixels</CODE> );

<P>
<HR>
<H1><A NAME="FUNCTION_DESCRIPTIONS">FUNCTION DESCRIPTIONS</A></H1>
<P>
<HR>
<H2><A NAME="Constrast">Constrast</A></H2>
<P>
Method Contrast enhances the intensity differences between the lighter and
darker elements of the image.

<P>
The format of the Contrast method is:

<P>
<PRE>    void Contrast(const int sign,Quantum *red,Quantum *green,Quantum *blue)
</PRE>
<P>

<FONT SIZE=-1>A</FONT> description of each parameter follows:

<DL><DL>
<p><dt><STRONG><A NAME="item_o">sign:</A></STRONG><DD>
<P>

<FONT SIZE=-1>A</FONT> positive value enhances the contrast otherwise it is
reduced.

<p><dt><STRONG>red, green, blue:</STRONG><DD>
<P>

<FONT SIZE=-1>A</FONT> pointer to a pixel component of type Quantum.

</DL></DL>
<P>
<HR>
<H2><A NAME="GenerateNoise">GenerateNoise</A></H2>
<P>
Method GenerateNoise adds noise to a pixel.

<P>
The format of the GenerateNoise method is:

<blockquote>Quantum GenerateNoise ( const Quantum pixel, const <A HREF="types/Enumerations.html#NoiseType">NoiseType</A> noise_type ); </blockquote>

<P>

<FONT SIZE=-1>A</FONT> description of each parameter follows:

<DL><DL>
<p><dt><STRONG>pixel:</STRONG><DD>
<P>

<FONT SIZE=-1>A</FONT> structure of type Quantum.

<p><dt><STRONG>noise_type:</STRONG><DD>
<P>
The type of noise: Gaussian, multiplicative Gaussian, impulse, laplacian,
or Poisson.

</DL></DL>
<P>
<HR>
<H2><A NAME="HSLTransform">HSLTransform</A></H2>
<P>
Method HSLTransform converts a (hue, saturation, luminosity) to a (red,
green, blue) triple.

<P>
The format of the HSLTransformImage method is:

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

<P>

<FONT SIZE=-1>A</FONT> description of each parameter follows:

<DL><DL>
<p><dt><STRONG>hue, saturation, luminosity:</STRONG><DD>
<P>

<FONT SIZE=-1>A</FONT> double value representing a component of the 
<FONT SIZE=-1>HSL</FONT> color space.


<p><dt><STRONG>red, green, blue:</STRONG><DD>
<P>

<FONT SIZE=-1>A</FONT> pointer to a pixel component of type Quantum.

</DL></DL>
<P>
<HR>
<H2><A NAME="Hull">Hull</A></H2>
<P>
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 
<FONT SIZE=-1>R</FONT> Crimmins. Each pixel in the image is replaced by one of its eight of its surrounding pixels using a polarity and negative hull function.


<P>
The format of the Hull method is:

<blockquote>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 ); </blockquote>

<P>

<FONT SIZE=-1>A</FONT> description of each parameter follows:

<DL><DL>
<p><dt><STRONG>x_offset, y_offset:</STRONG><DD>
<P>
An integer value representing the offset of the current pixel within the
image.

<p><dt><STRONG>polarity:</STRONG><DD>
<P>
An integer value declaring the polarity (+,-).

<p><dt><STRONG>columns, rows:</STRONG><DD>
<P>
Specifies the number of rows and columns in the image.

<p><dt><STRONG>f, g:</STRONG><DD>
<P>

<FONT SIZE=-1>A</FONT> pointer to an image pixel and one of it's neighbor.

</DL></DL>
<P>
<HR>
<H2><A NAME="InterpolateColor">InterpolateColor</A></H2>
<P>
Method InterpolateColor applies bi-linear interpolation between a pixel and
it's neighbors.

<P>
The format of the InterpolateColor method is:

<blockquote><A HREF="types/ColorPacket.html">ColorPacket</A> InterpolateColor ( <A HREF="types/Image.html">Image</A> *image, const double x_offset, const double y_offset ); </blockquote>

<P>

<FONT SIZE=-1>A</FONT> description of each parameter follows:

<DL><DL>
<p><dt><STRONG>image:</STRONG><DD>
<P>
The address of a structure of type Image.

<p><dt><STRONG>x_offset,y_offset:</STRONG><DD>
<P>

<FONT SIZE=-1>A</FONT> double representing the current (x,y) position of
the pixel.

</DL></DL>
<P>
<HR>
<H2><A NAME="Modulate">Modulate</A></H2>
<P>
Method Modulate modulates the hue, saturation, and brightness of an image.

<P>
The format of the ModulateImage method is:

<blockquote>void Modulate ( double percent_hue, double percent_saturation, double percent_brightness, Quantum *red, Quantum *green, Quantum *blue ) blue ); </blockquote>

<P>

<FONT SIZE=-1>A</FONT> description of each parameter follows:

<DL><DL>
<p><dt><STRONG>percent_hue, percent_saturation, percent_brightness:</STRONG><DD>
<P>

<FONT SIZE=-1>A</FONT> double value representing the percent change in a component of the 
<FONT SIZE=-1>HSL</FONT> color space.


<p><dt><STRONG>red, green, blue:</STRONG><DD>
<P>

<FONT SIZE=-1>A</FONT> pointer to a pixel component of type Quantum.

</DL></DL>
<P>
<HR>
<H2><A NAME="TransformHSL">TransformHSL</A></H2>
<P>
Method TransformHSL converts a (red, green, blue) to a (hue, saturation,
luminosity) triple.

<P>
The format of the TransformHSL method is:

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

<P>

<FONT SIZE=-1>A</FONT> description of each parameter follows:

<DL><DL>
<p><dt><STRONG>red, green, blue:</STRONG><DD>
<P>

<FONT SIZE=-1>A</FONT> Quantum value representing the red, green, and blue
component of a pixel..

<p><dt><STRONG>hue, saturation, luminosity:</STRONG><DD>
<P>

<FONT SIZE=-1>A</FONT> pointer to a double value representing a component of the 
<FONT SIZE=-1>HSL</FONT> color space.


</DL></DL>
<P>
<HR>
<H2><A NAME="Upsample">Upsample</A></H2>
<P>
Method Upsample doubles the size of the image.

<P>
The format of the UpSample method is:

<blockquote>void Upsample ( const unsigned int width, const unsigned int height, const unsigned int scaled_width, unsigned char *pixels ); </blockquote>

<P>

<FONT SIZE=-1>A</FONT> description of each parameter follows:

<DL><DL>
<p><dt><STRONG>width,height:</STRONG><DD>
<P>
Unsigned values representing the width and height of the image pixel array.

<p><dt><STRONG>scaled_width:</STRONG><DD>
<P>
Specifies the final width of the upsampled pixel array.

<p><dt><STRONG>pixels:</STRONG><DD>
<P>
An unsigned char containing the pixel data. On output the upsampled pixels
are returned here.

</DL></DL>
</BODY>

</HTML>
