Page 1 of 1

How to use DrawableSkewX/Y?

Posted: 2017-04-18T07:48:39-07:00
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?

Re: How to use DrawableSkewX/Y?

Posted: 2017-04-18T09:45:43-07:00
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.