Is there a way to get GD's function imagefilledarc()
's result in using PHP ImageMagick? I've looked around but haven't found a satisfying solution so far. I want it to support transparency, and use it to draw pies.
views:
494answers:
3
+1
A:
Your best bet would be to use ImageMagick::Draw. It has an arc command; instead of specifying the center, you specify the bounding rectangle. You just need to add a command before it to set the fill, and perhaps after it to close the fill.
Jeff Bowman
2009-06-27 00:31:47
It doesn't work the same way. That command basically does an ellipse within the bounding box, cuts at a line between the given degrees and deletes one of the pieces.
antennen
2009-06-27 00:47:58
+1
A:
As far as I know ImagickDraw::arc is the only way to do it (unless you want to create a function that draws it pixel by pixel). But to get it working the same way as gd, you just have to make minor changes. For instance, this:
imagearc($image, $cx, $cy, $width, $height, $start, $end, $color);
Should be equivalent to this (I haven't tested it):
ImagickDraw::setStrokeColor($imageMagickColor); //I don't remember how to allocate the color
ImagickDraw::arc($cx-$width/2, $cy-$height/2, $cx+$width/2, $cy+$height/2, $start, $end);
dutchflyboy
2009-07-06 15:37:54