How to use DrawableSkewX/Y?

Magick++ is an object-oriented C++ interface to ImageMagick. Use this forum to discuss, make suggestions about, or report bugs concerning Magick++.
Post Reply
Airon65
Posts: 75
Joined: 2017-02-26T02:19:38-07:00
Authentication code: 1151

How to use DrawableSkewX/Y?

Post by Airon65 »

I test it using following code:

Code: Select all

Magick::Image testImg( "images/horse.jpg" );

testImg.strokeColor( "red" );
testImg.fillColor( Magick::Color( QuantumRange, QuantumRange, QuantumRange, 0 ) );
testImg.strokeWidth( 2 );

testImg.draw( Magick::DrawableSkewY( 50 ) );

testImg.draw( Magick::DrawableEllipse( 100, 100, w, h, 0, 360 ) );

int extent = 50;
testImg.extent( Magick::Geometry( testImg.columns() + extent, testImg.rows() + extent ), Magick::Color( QuantumRange, QuantumRange, QuantumRange, QuantumRange ), MagickCore::CenterGravity );

testImg.write( "images/test-img.png" );
I absolutely don't see the difference: with DrawableSkewY line and without it. How to properly use it?
snibgo
Posts: 12159
Joined: 2010-01-23T23:01:33-07:00
Authentication code: 1151
Location: England, UK

Re: How to use DrawableSkewX/Y?

Post by snibgo »

See http://www.imagemagick.org/Magick++/Image++.html . "image.draw" takes a single drawable object, or a list of drawable objects.

You call it twice. First with DrawableSkewY that doesn't actually draw anything, because it is a setting. The second time, you call it with DrawableEllipse.

As you want the skew to apply to the ellipse, you need to create a drawable list of those two objects, then draw it.
snibgo's IM pages: im.snibgo.com
Post Reply