contents   index   previous   next



GD colorExact()

syntax:

gd.colorExact(red, green, blue)

where:

red - Red value, from 0 to 255

 

green - Green value, from 0 to 255

 

blue - Blue value, from 0 to 255

 

return:

number - The first index matching the supplied color, or -1 if it doesn't exist.

 

description:

This method searches through the color table and tries to find the first index whose red, green, and blue values are exactly equal to the supplied values. If no index is found, then -1 is returned.

 

see:

#link <gd>, GD colorClosest(), GD colorAllocate()

 

example:

// Attempt to get the color,

// and create it if it does not exist

var gd = GD.fromGif("test.gif");

var index;

if( -1 == (index = gd.colorExact(1,1,1)) )

   index = gd.colorAllocate(1,1,1);

 


GD colorsTotal()