Magick++ bug with RoundJoin

Kevin Anthoney <[email protected]>
Newsgroups gmane.comp.video.image-magick.bugs
Organization Home User
Message-ID <[email protected]>
I've got this problem using ImageMagick 6.3.3 on Slackware Linux.

This C++ code should produce two figures, identical apart from the type of 
line join.  The shape using MiterJoin is three sides of a square, as it 
should be.  The RoundJoin shape has an extra line from the square's top right 
corner to the bottom left.  I can work round this problem by tacking a 
PathMoveto onto the end of the path (as in the commented out line), although 
if I do that, the endcaps become round, even if I specify something else.


#include <Magick++.h>
#include <list>

using namespace std;
using namespace Magick;

void shape( Image& I, int x, int y, LineJoin J )
{
  list< VPath > path;
  list< Drawable > draw_list;
  path.push_back( PathMovetoAbs( Coordinate( x, y ) ) );
  path.push_back( PathLinetoRel( Coordinate( 0, 100 ) ) );
  path.push_back( PathLinetoRel( Coordinate( 100, 0 ) ) );
  path.push_back( PathLinetoRel( Coordinate( 0, -100 ) ) );
  //path.push_back( PathMovetoRel( Coordinate( 0, 0 ) ) );
  draw_list.push_back( DrawableFillColor( Color() ) );
  draw_list.push_back( DrawableStrokeWidth( 10 ) );
  draw_list.push_back( DrawableStrokeColor( Color( "black" ) ) );
  draw_list.push_back( DrawableStrokeLineJoin( J ) );
  draw_list.push_back( DrawablePath( path ) );
  I.draw( draw_list );
  return;
}

int main()
{
  Image I( Geometry( 250, 150 ),
	   Color( "white" ) );
  shape( I, 10, 25, RoundJoin );
  shape( I, 140, 25, MiterJoin );
  I.write( "test.png" );
  return 0;
}


-- 
Kevin Anthoney
[email protected]
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.