<gems - Graphic Gems - Graphic Support Methods;/


NAME



-gems - Graphic Gems - Graphic Support Methods




(

SYNOPSIS



0GenerateNoise(pixel,noise_type)

GHSLTransform(hue,saturation,luminosity,red,green,blue)

BHull(x_offset,y_offset,polarity,columns,rows,f,g)

Sopacity=InsidePrimitive(primitive_info,annotate_info,target,image)

:InterpolateColor(image,x_offset,y_offset)

GTransformHSL(red,green,blue,hue,saturation,luminosity)

;Upsample(width,height,scaled_width,pixels)




B

FUNCTION DESCRIPTIONS






*

Constrast



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

+The format of the ContrastImage routine is:

&

    Contrast(sign,red,green,blue)


(A description of each parameter follows:

3
sign:


?A positive value enhances the contrast otherwise it is reduced.*

red, green, blue:


/A pointer to a pixel component of type Quantum.






2

GenerateNoise



+Method GenerateNoise adds noise to a pixel.

+The format of the GenerateNoise routine is:

,

        GenerateNoise(pixel,noise_type)


(A description of each parameter follows:


pixel:


A 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 routine is:

C

        HSLTransform(hue,saturation,luminosity,red,green,blue)


(A description of each parameter follows:

5
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



DMethod Hull implements the eight hull algorithm described in AppliedDOptics, Vol. 24, No. 10, 15 May 1985, ``Geometric filter for SpeckleIReduction'', by Thomas R Crimmins. Each pixel in the image is replaced byHone of its eight of its surrounding pixels using a polarity and negativehull function.

"The format of the Hull routine is:

>

        Hull(x_offset,y_offset,polarity,columns,rows,f,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:


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






6

InsidePrimitive



KMethod InsidePrimitive returns the opacity of the pen at the (x,y) positionGof the image. The opacity is Opaque if the (x,y) position is within theJprimitive as defined in primitive_info. A value less than fully opaque andHgreater than fully transparent is returned for a primitive edge pixel toAallow for anti-aliasing. Otherwise fully transparent is returned.

?Rick Mabry provided the algorithms for anti-aliased primitives.

-The format of the InsidePrimitive routine is:

O

        opacity=InsidePrimitive(primitive_info,annotate_info,target,image)


(A description of each parameter follows:

!
opacity:


FMethod InsidePrimitive returns a pen opacity associated with the (x,y)position of the image.(

primitive_info:


1Specifies a pointer to a PrimitiveInfo structure.'

annotate_info:


0Specifies a pointer to a AnnotateInfo structure.

target:


7PointInfo representing the (x,y) location in the image.

image:


)The address of a structure of type Image.






8

InterpolateColor



KMethod InterpolateColor applies bi-linear interpolation between a pixel andit's neighbors.

.The format of the InterpolateColor routine is:

6

        InterpolateColor(image,x_offset,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



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

+The format of the ModulateImage routine is:

N

    Modulate(percent_hue,percent_saturation,percent_brightness,red,green,




      blue)


(A description of each parameter follows:

M
percent_hue, percent_saturation, percent_brightness:


HA 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.






0

TransformHSL



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

*The format of the TransformHSL routine is:

C

        TransformHSL(red,green,blue,hue,saturation,luminosity)


(A description of each parameter follows:

*
red, green, blue:


DA Quantum value representing the red, green, and blue component of apixel..5

hue, saturation, luminosity:


EA pointer to a double value representing a component of the HSL colorspace.






(

Upsample



.Method Upsample doubles the size of the image.

&The format of the UpSample routine is:

7

        Upsample(width,height,scaled_width,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.