Re: gd function/parameters

From: Date: Sat, 29 Jul 2000 21:08:58 +0000
Subject: Re: gd function/parameters
References: 1  Groups: php.dev 
Request: Send a blank email to php-dev+get-26861@lists.php.net to get a copy of this message
> Well, why not add this functionality? Create a function that defines a > brush. It might take a filename of a brush source file, or whatever other > args might be relevant when it comes to creating a brush. Return a > resource identifier for this brush, but don't actually create it. Just > store the brush parameters in the resource struct. Then when this > resource identifier is used in place of the colour argument in any of the > various functions that understand brushes, create the brush by pulling > the brush parameters from the resource struct (if it isn't the current > brush). > > This will make it easy for people to work with multiple brushes the same > way they work with multiple colours. right, that was the other route. the image being used as a brush has to be defined before it can be set as the brush, so the only thing that would have to be stored would be the gdImagePtr of the brush image. I could also store the style info that setstyle is called with. but I'd have weirdness trying to call a drawing function with a style and a brush (gdStyledBrushed). that's why I discarded that option. short of adding an additional optional parameter or passing the thing in as an array or adding a function to merge a brush and a style into a styled brush, I'd be at a loss to come up with a reasonably clean solution. I think I'd lean towards something like int imageSetStyledBrush(int style,int brush), but it's deviating from the gd library a bit. how important is that? it would be nice to be able to switch things around at will (as a side effect, you'd be able to specify brushes, tiles, and styles without specifying which image they'd be linked to, and just use them to draw on any of the images that are open... that's almost a bad thing, since colors don't work like that, but it's still nice.). --jlp

« previous php.dev (#26861) next »