GD colorAllocate()
syntax: |
gd.colorAllocate(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 - Color index of allocated color, or -1 if none available.
|
description: |
This method searches through the color table for the next available color index, and sets it to be the supplied RGB color. If no color indexes are available, then -1 is returned. If the supplied RGB colors are invalid, a runtime error is generated. When creating a new image, the first time you call this function, you set the background color for the image.
|
see: |
#link <gd>, GD colorExact(), GD colorClosest(), GD colorDeallocate()
|
example: |
var gd = new GD(10,10); var index = gd.colorAllocate(255,255,255); // index now points to white, and the background // of the image is also white |