DrawPoint vs DrawLine color

Questions and postings pertaining to the development of ImageMagick, feature enhancements, and ImageMagick internals. ImageMagick source code and algorithms are discussed here. Usage questions which are too arcane for the normal user list should also be posted here.
Post Reply
168gr
Posts: 47
Joined: 2013-01-09T22:46:19-07:00
Authentication code: 6789

DrawPoint vs DrawLine color

Post by 168gr »

Hopefully this has a simple answer. I can't figure out how to make DrawPoint() draw in any color other than black.

Trivial example:

Code: Select all

  DrawingWand *dw = NULL;
  PixelWand *pw = NULL;

  dw = NewDrawingWand();
  pw = NewPixelWand();
  ClearPixelWand( pw );
  PixelSetColor( pw, "#0000ff" );
  ClearDrawingWand( dw );
  DrawSetStrokeColor( dw, pw );
  DrawSetStrokeWidth( dw, 1 );
  DrawSetStrokeOpacity( dw, 1 );
  DrawSetFillOpacity( dw, 1 );


  DrawPoint( dw, x, y );
  DrawPoint( dw, x+1, y );
  DrawPoint( dw, x+2, y );

  DrawLine( dw, x, y+10, x+2, y+10 );


  MagickDrawImage( ffc_debug_image, dw );
I get a black line (from DrawPoint) and a blue line (from DrawLine).

Why isn't DrawPoint making blue pixels? Thanks.


ImageMagick 6.8.3-7
Cygwin environment on Windows 7.
User avatar
anthony
Posts: 8883
Joined: 2004-05-31T19:27:03-07:00
Authentication code: 8675308
Location: Brisbane, Australia

Re: DrawPoint vs DrawLine color

Post by anthony »

Drawpoint used fill color

Drawline uses fill and stroke color over the top.

See examples of CLI use at
http://www.imagemagick.org/Usage/draw/#primitives
And more nitty gritty a little further down in.
http://www.imagemagick.org/Usage/draw/#color

NOTE fill in lines is actually too-wide, and for a single line should probably be zero width (no fill).
But that is not what happens. See...
http://www.imagemagick.org/Usage/draw/#bounds
Anthony Thyssen -- Webmaster for ImageMagick Example Pages
https://imagemagick.org/Usage/
Post Reply