contents   index   previous   next



Point specifications

A number of GD routines expect a Point Specification as one of the parameters. This is a pseudo-type that can take one of several forms. It is either an object with two members, 'x' and 'y', representing the two coordinates of the point, or an array with two members, element 0 being the x coordinate and element 1 being the y coordinate. All of the following are equivalent:

 

var point1 = {x:1, y:2};

var point2 = [1, 2];

 

Note also that every routine can also have the x and y coordinates passed as separate parameters, so these are equivalent:

 

gd.getPixel( 1, 2 );

gd.getPixel( [1,2] );

 

As such, the Point object is really just a matter of convenience to help distinguish points as a unit.


Font specifications