ID:               39314
 Updated by:       [EMAIL PROTECTED]
 Reported By:      slyc6 at aol dot com
-Status:           Open
+Status:           Assigned
 Bug Type:         *General Issues
 Operating System: Windows XP
 PHP Version:      5.1.6
-Assigned To:      
+Assigned To:      pajoye


Previous Comments:
------------------------------------------------------------------------

[2006-10-31 02:50:02] slyc6 at aol dot com

Description:
------------
Ok the problem is that when you use imagesetpixel in an nested loop it
fails to draw the specified pixel. Im trying to make an image mask and
need imagecolorallocatealpha to change according to the mask image im
using. But in this case i just simply set it to a grey color and an
alpha value of 63. But anyway when I run this loop the image draws the
pixels up to a certain point. Usually it stops on the second line 1/3
of the way. 

The way I fixed this porblem was taking imagecolorallocatealpha out of
the nested loop and put it in the first loop. In my code I have a for
loop using $x nested inside of for loop using $y. So when
imagecolorallocatealpha is in the loop of $y I get my problem. But if I
move it to $x I dont any problems (but I can't achieve my goal)

Reproduce code:
---------------
<?php
$newim = imagecreate(238,226);
$tran = imagecolorallocate($newim,4,4,4);
imagefill($newim,0,0,$tran);
imagecolortransparent ($newim,$tran);
$maskcolor = 0;

for($y=0;$y<226;$y++)
{
        for($x=0;$x<238;$x++)
        {       
$maskcolor = imagecolorallocatealpha ($newim,0,0,0,63);         
imagesetpixel ($newim,$x,$y,$maskcolor);
        }
}
header("Content-type: image/png");
imagepng($newim);
?>



Expected result:
----------------
what it should doing is something along the lines of this
----------------------------------

xxxxxxxxxxxxxxxxxxxxxxxxxx
xxxxxxxxxxxxxxxxxxxxxxxxxx
xxxxxxxxxxxxxxxxxxxxxxxxxx
etc...


Actual result:
--------------
but I get something like this
--------------------------

xxxxxxxxxxxxxxxxxxxxxxxxxx
xxxxxx


------------------------------------------------------------------------


-- 
Edit this bug report at http://bugs.php.net/?id=39314&edit=1

Reply via email to