The stupid question is the question not asked | |
PerlMonks |
comment on |
( [id://3333]=superdoc: print w/replies, xml ) | Need Help?? |
Well, the reason you can't find any documentation on doing other things with setpixel is that it would make no sense: a pixel is the atomic element of an image, like a character for a text file*. To attempt to manipulate a "bigger pixel" would be like asking tr to translate digraphs or words: that's not what it's for, and it doesn't really make sense to try to do it that way. On the other hand, as the analogy suggests, there are mechanisms for dealing with larger blocks, in most well-designed schemes for manipulation: in the case of manipulating text in Perl, we have s///, and in the case of manipulating images in GD, we have filledRectangle($x1,$y1,$x2,$y2,$color) (among others). The following code is an attempt to do what you seem to want to do: <disclaimer type="weasly">it is absolutely, completely and totally untested.</disclaimer>
Preliminary testing indicates that this works--let me know if it doesn't. Have fun! Update: as indicated, I got intimidated into testing (and finding the stupid bug, which is fortunate, isn't it?). Using the above as a drop-in replacement for the relevant lines of bladx's code, see the results at http://chemboy.perlmonk.org/bladx.cgi. *Note that a pixel may have a varying amount of data behind it--between 1 and 32 bits, IIRC--just as a character may have 7 (ASCII) to 16 (Unicode) significant bits behind it. If God had meant us to fly, he would *never* have given us the railroads. --Michael Flanders In reply to Re: Changing setpixel size using GD.pm
by ChemBoy
|
|