Re: [GD-DEVEL] Problem filling an image

[email protected] ("Pierre Joye") Thu, 6 Nov 2008 21:54:20 +0100
Newsgroups php.gd.devel
Message-ID <[email protected]>
hi!

On Thu, Nov 6, 2008 at 9:35 PM, Brian Peschel <[email protected]> wrote:
> I have some class that generates an image through GD.  I new the class for
> each image I create and I create thousand of images in the life of the
> program.  I have a problem where the background color is a random color if I
> set the background color to black (RGB 0,0,0).  It works if I set it to just
> about anything else (grey RGB 190,190,190 or linen 250,240,230).  The actual
> fill color is black on the first image I generate (in the lifetime), then it
> will go random.  I have seen green, blue, red, purple, etc.  I assume this
> is a problem with GD, as it works with every other color I have tried except
> black.
>
> Here is the code I am using.
>    gdImagePtr _image;
>   int _line_color;
>   int style[20];
>
>  _image = gdImageCreateTrueColor(xPixels, yPixels);
>
>   // Allocate the first color
>   gdImageColorAllocate(_image, backgroundColor.red(),
> backgroundColor.green(), backgroundColor.blue());
>
>   // Fill the background
>    _line_color = gdImageColorAllocate(_image, backgroundColor.red(),
> backgroundColor.green(), backgroundColor.blue());

> Any thoughts?

The code is not complete so hard to say.  Where is define
backgroundColor? Which language do you use? c++?

Cheers,
-- 
Pierre
http://blog.thepimp.net | http://www.libgd.org