php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #28490 function ImageFillToBorder fails to fill the entire zone
Submitted: 2004-05-22 17:00 UTC Modified: 2004-06-05 21:44 UTC
From: philippe dot nonn at capgemini dot com Assigned:
Status: Not a bug Package: GD related
PHP Version: 4.3.6 OS: Windows XP / IIS
Private report: No CVE-ID: None
 [2004-05-22 17:00 UTC] philippe dot nonn at capgemini dot com
Description:
------------
Using the las version of Graphical Library PHP_GD2 leads to display images which are only partially filled when using the function ImageFillToBorder.
It looks like only the upper part of the zone which should be filled gets the selected color.
The problem doesn't appear when using le 4.3.5 version of php_gd2.


Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2004-05-22 17:40 UTC] derick@php.net
Thank you for this bug report. To properly diagnose the problem, we
need a short but complete example script to be able to reproduce
this bug ourselves. 

A proper reproducing script starts with <?php and ends with ?>,
is max. 10-20 lines long and does not require any external 
resources such as databases, etc.

If possible, make the script source available online and provide
an URL to it here. Try avoid embedding huge scripts into the report.
 [2004-05-22 20:39 UTC] philippe dot nonn at capgemini dot com
find above a script showing the part of pie not completely filled of red color

Philippe

<?php
     /*
    ** Convertir les degr?s en radians
    */
    function radians($degrees)
    {
        return($degrees * (pi()/180.0));
    }

    /*
    ** prendre x,y dans le cercle,
    ** centre = 0,0
    */
      function circle_point($degrees, $diameter)
      {
        $x = cos(radians($degrees)) * ($diameter/2);
        $y = sin(radians($degrees)) * ($diameter/2);

        return (array($x, $y));
      }


    $image = imagecreate(400, 400 );
    //arri?re-plan
    //couleurs
    $colorBody = imagecolorallocate($image, 0xFF, 0xFF, 0xFF);
    imagefill($image, 0, 0, $colorBody);
    $CurrentColor = imagecolorallocate($image, 0xFF, 0x00, 0x00);
    $ChartCenterX = 200;
    $ChartCenterY =200;
    $ChartDiameter = 300;
    $StartDegrees = 0;
    $EndDegrees = 50;
    

	        //dessiner un arc
	        imagearc($image,
	            $ChartCenterX,
	            $ChartCenterY,
	            $ChartDiameter,
	            $ChartDiameter,
	            $StartDegrees,
	            $EndDegrees,
	            $CurrentColor);
	
	        //Tracer le d?but de la ligne ? partir du centre
	        list($ArcX, $ArcY) = circle_point($StartDegrees, $ChartDiameter);
	        imageline($image,
	            $ChartCenterX,
	            $ChartCenterY,
	            floor($ChartCenterX + $ArcX),
	            floor($ChartCenterY + $ArcY),
	            $CurrentColor);
	
	
	        //dessiner la fin de la ligne
	        list($ArcX, $ArcY) = circle_point($EndDegrees, $ChartDiameter);
	        imageline($image,
	            $ChartCenterX,
	            $ChartCenterY,
	            ceil($ChartCenterX + $ArcX),
	            ceil($ChartCenterY + $ArcY),
	            $CurrentColor);

		if (($EndDegrees - $StartDegrees) > 1)	
			{
		        //remplir les portions
		        $MidPoint = round((($EndDegrees - $StartDegrees)/2) +  $StartDegrees);
		        list($ArcX, $ArcY) = circle_point($MidPoint, $ChartDiameter/2);
		        imagefilltoborder($image,
		            floor($ChartCenterX + $ArcX),
		            floor($ChartCenterY + $ArcY),
		            $CurrentColor,
		            $CurrentColor);
	        	}
       //afficher l'image
    header("Content-type: image/jpeg");
    imagejpeg($image);
php?>
 [2004-05-22 23:52 UTC] pajoye@php.net
Hello,

Are you talking about the lower left gap (at 50 deg)?

Anyway, please provide a script which only fills an area. You can provide a link to the source and expected result images.

I feel like you should take a look here:
http://www.php.net/imagefilledarc

-- Pierre
 [2004-05-22 23:55 UTC] pajoye@php.net
Thank you for taking the time to write to us, but this is not
a bug. Please double-check the documentation available at
http://www.php.net/manual/ and the instructions on how to report
a bug at http://bugs.php.net/how-to-report.php

It works as expected. I only looked the non filled arc and compare with filled area. It is exactly what I expect.

--Pierre
 [2004-05-23 14:20 UTC] philippe dot nonn at capgemini dot com
Thak'a a lot, Pierre : Using function ImageFilledArc permits to get the expected pie result.

However, the older way of proceeding worked well with many older versions of php : drowing the 2 radius and the arc of cercle, and then asking to fill with color the defined surface starting from a spot in the center of it.

For me, the problem is now fixed. I hope that the FillToBorder function will be OK for other people using more complex figures.

Philippe
 [2004-06-05 21:44 UTC] philippe dot nonn at capgemini dot com
this bogus has beend fixed in 4.3.7 version

Thank you
Philippe
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Wed May 29 06:01:32 2024 UTC