Come for the quick hacks, stay for the epiphanies. | |
PerlMonks |
comment on |
( [id://3333]=superdoc: print w/replies, xml ) | Need Help?? |
So, you bought a can of white color and a brush, but for some strange reason, the walls of the room you are standing in still show a nasty 1960s style flower decor. What has gone wrong? Hint: $white, as shown in your code, is a write-only variable. You assign to it, twice, but you do not use it. When $white is checked it is always a positive number. 16777215 for colorAllocate(255, 255, 255) and different positive numbers for different colours. Sure. 16777215 is 0x00FFFFFF, RGB for white. Other colors use other bit patterns. colorAllocate() is mainly needed for paletted image formats (like GIF), that can only display a limited selection ("palette") of colors. For those formats, colorAllocate() allocates one of the few possible palette entries (trueColor in GD speak is off). Other image formats allow using three (or four) color channels, each with a color depth of typically 8 bit (more or less bits are possible), and for those formats, colorAllocate() just translates RGB to a bit pattern (trueColor in GD speek is on). Alexander
-- Today I will gladly share my knowledge and experience, for there are no sweeter words than "I told you so". ;-) In reply to Re: GD colorAllocate not changing colour
by afoken
|
|