Re: gd function/parameters

From: Date: Sat, 29 Jul 2000 18:51:33 +0000
Subject: Re: gd function/parameters
References: 1  Groups: php.dev 
Request: Send a blank email to php-dev+get-26851@lists.php.net to get a copy of this message
On Sat, 29 Jul 2000, Rasmus Lerdorf wrote: > I should probably go read the gd docs again, but the col parameter to > imageline is just an integer, right? So why can't you just treat > ImageSetBrush() just like ImageColorAllocate()? ie. it returns an integer > which can then be fed to subsequent image* calls. > > Or am I missing something? > > -Rasmus you can only have one style and one brush defined at a time (void gdimagesetbrush() and void gdimagesetstyle()...). example from the docs: gdImagePtr im, brush; FILE *in; int black; im = gdImageCreate(100, 100); /* Open the brush PNG. For best results, portions of the brush that should be transparent (ie, not part of the brush shape) should have the transparent color index. */ in = fopen("star.png", "rb"); brush = gdImageCreateFromPng(in); /* Background color (first allocated) */ black = gdImageColorAllocate(im, 0, 0, 0); gdImageSetBrush(im, brush); /* Draw a line from the upper left corner to the lower right corner using the brush. */ gdImageLine(im, 0, 0, 99, 99, gdBrushed); /* ... Do something with the image, such as saving it to a file... */ /* Destroy it */ gdImageDestroy(im); /* Destroy the brush image */ gdImageDestroy(brush); any of the drawing functions should be able to take gdBrushed or gdStyled or gdStyledBrushed. the fill functions should be able to take gdTiled after gdimagesettile() is called... in c, these work out to be special defined colors, but I don't know the best way to do that in php (eg. imageline($im,0,0,99,99,'gdBrushed')?) I was thinking of having setbrush return gdBrushed, but that would seem to create the illusion of being able to have multiple brushes. (same as styles... and then you couldn't pass in gdStyledBrushed anyway) so should I just pass it in as a string and check for type string and a value of one of the specials, or should I do something else? --jlp

« previous php.dev (#26851) next »