LMPX.COM |
Home | Linux | Mysql | PHP | XML | ||
|
|
|||
From: Roger Oberholtzer Date: Fri May 2 06:25:41 2008 Subject: Re: [GD-DEVEL] Newbie transparent gif question- possibly solved.
On Fri, 2008-05-02 at 13:49 +0200, Pierre Joye wrote: > On Fri, May 2, 2008 at 1:28 PM, Roger Oberholtzer <roger@opq.se> wrote: > > On Fri, 2008-05-02 at 12:26 +0200, Roger Oberholtzer wrote: > > > Hello > > > > > > I know, bad form to follow one's own post. I have more info, but no > > > solution. > > > > And here I go again. > > > > I think that I wind up with the color I want to be transparent being > > defined more than once in the color map. Due to the way my code is > > written, it could wind up setting the transparent color to a later > > duplicate instance of the desired transparent color. Then it is no > > longer going to be transparent. If I ensure that the transparent color > > is defined as the first one, AND that I only set the transparent color > > to this index (0), then all is ok. I think that my code wound up setting > > the transparent color to the correct color, but the color was a > > duplicate at some place other than 0 in the color map. > > > > IMHO, the function gdImageColorTransparent is not fully correct, at > > least when making a GIF. The second argument seems to need to be 0. > > Anything else results in loff of transparency. > > That's not correct. It works as expected by using a color index (not a > color value!) for palette images and a color value for true color > images. > > I don't have the time now to give you a small examples but it does > work as expected. You can take a look in the examples or tests > directories, a couple of them use the transparent color. OK. But that is how it looks. If an image has the transparent color more than once in the color map, and gdImageColorTransparent is called with anything other than the first in the color map, you do not get a transparent image. There may be more at play here, but it seems I can manipulate this in a predictable manner. The change to my application was minor, but I now seem to get transparent gifs as expected. I looked a the transparency test program in the source: it is for true color images. I did not see a transparency test program for colors as I am using them. Maybe it is not a program on it's own. I am happy to explore more as I would like to know that my code is correct and not hiding some stupid bug on my part. -- Roger Oberholtzer OPQ Systems / Ramböll RST Ramböll Sverige AB Kapellgränd 7 P.O. Box 4205 SE-102 65 Stockholm, Sweden Office: Int +46 8-615 60 20 Mobile: Int +46 70-815 1696
| Navigate in group php.gd.devel at sever news.php.net | |
| Previous | Next |
| © No Copyright You are free to use Anything |
Site Maintained by Zareef Ahmed
Powered By PHP Consultants |