Skip Menu |

This queue is for tickets about the GD CPAN distribution.

Report information
The Basics
Id: 17860
Status: resolved
Priority: 0/
Queue: GD

People
Owner: LDS [...] cpan.org
Requestors: markem [...] airmail.net
Cc:
AdminCc:

Bug Information
Severity: Normal
Broken in: 2.31
Fixed in: (no value)



Subject: fillRectangle Problem
When called on certain colors, fillRectangle properly fills the area. When called on other colors, fillRectangle inserts color dots from another color. Example program provided.
Subject: t.cgi
Download t.cgi
application/octet-stream 1.7k

Message body not shown because it is not plain text.

From: markem [...] airmail.net
On Sat Feb 25 20:01:00 2006, guest wrote: Show quoted text
> When called on certain colors, fillRectangle properly fills the area. > When called on other colors, fillRectangle inserts color dots from > another color. Example program provided.
Sorry! I thought I could take the part that did the random dots out. But if I do that then fillRectangle works properly. It only happens when random dots are being put into the filled area. :-/ Also - the program generates four files. Two GIF files and two PNG files. This is so you can see what is happening. The PNG files are generated properly. Only the first GIF file is created properly. Also again - there are only two colors being used. A foreground color (fg) and a background color (bg). GIF can contain up to 256 colors - so GIF should be able to handle this without a problem.
Download t.cgi
application/octet-stream 2.2k

Message body not shown because it is not plain text.

From: markem [...] airmail.net
I have already figured out a work-around. In trueColor mode, the colorAllocate et al do not need to be used. Instead, each color can be generated by just using: $myColor = ($red << 16) | ($green << 8) | $blue; This color can then just be used in the setPixel call. Since trueColor has been enabled it will simply insert the color and when the GIF output command is issued - no line of dots appears. The documentation does not say anything about this problem I have reported and instead says that the colorAllocate will work in both GIF mode as well as in trueColor mode. (Which is true for the most part.) Neither colorAllocate, nor colorExact gave me errors. Both returned (for me) the same colors. It is strange, therefore, to me that the dots showed up. In any case - I have a work-around. This is not a life and death kind of bug but I thought I'd report it anyway. Later!
From: markem [...] airmail.net
I have been looking through the GD code and have (as of yet) to find any reason for this bug happening. The colorAllocate code does a test for true color and if the value is one(1) it then calls the appropriate function to return the true color value. Therefore, the color dots should not show up because of that error. My suspicion is that there is some flag being set somewhere which is causing GD to act both as a truecolor image as well as a GIF image and a routine is trying to create the GIF header table (or to insert colors) which, in turn, is causing the row of dots to appear. This is based on the fact that the row of dots are equidistant from each other. Since GIF uses bytes to store data; a single dot separated by four places would indicate a long is being used for each of the dots that are being placed. Or to put that another way: If an array is allocated for the true color image at 32bits per pixel (ie:long) and a GIF image is allocated via a 8bits per pixel (ie: char), then the dots are mapping one dot per long as if they were the GIF bytes in the array. (If that makes sense.)
This is unlikely to be a GD bug, but rather a problem in the underlying libgd library. It should be reported to Tom Boutell. On Sat Feb 25 20:01:00 2006, guest wrote: Show quoted text
> When called on certain colors, fillRectangle properly fills the
area. Show quoted text
> When called on other colors, fillRectangle inserts color dots from > another color. Example program provided.
I cannot reproduce this problem on recent versions of libgd and GD. I tested with gd 2.0.33 and GD 2.32. Upgrade to the current versions and feel free to reopen the ticket if you continue to have problems. On Sat Feb 25 20:01:00 2006, guest wrote: Show quoted text
> When called on certain colors, fillRectangle properly fills the
area. Show quoted text
> When called on other colors, fillRectangle inserts color dots from > another color. Example program provided.
Subject: Re: [rt.cpan.org #17860] Resolved: fillRectangle Problem
Date: Thu, 02 Mar 2006 17:01:03 -0600
To: bug-GD [...] rt.cpan.org
From: Mark Manning <markem [...] airmail.net>
Thanks. As you point out - I've looked through the gd.pm code and can not find a problem with it. I'll take your advise but instead of reporting it I'd rather first find exactly where the problem is so I can present both the problem and solution. Thus, if no problem can be determined - I'll not say anything further. Thanks for your time in this matter. Lincoln_D_Stein via RT wrote: Show quoted text
> <URL: http://rt.cpan.org/Ticket/Display.html?id=17860 > > > According to our records, your request has been resolved. If you have any > further questions or concerns, please respond to this message. > >