36 QPainter *painter = context.
painter();
41 QTransform t = createTransform( context );
42 painter->setTransform( t,
true );
51 props.insert( QStringLiteral(
"reflect_x" ), mReflectX ?
"1" :
"0" );
52 props.insert( QStringLiteral(
"reflect_y" ), mReflectY ?
"1" :
"0" );
53 props.insert( QStringLiteral(
"scale_x" ), QString::number( mScaleX ) );
54 props.insert( QStringLiteral(
"scale_y" ), QString::number( mScaleY ) );
55 props.insert( QStringLiteral(
"rotation" ), QString::number( mRotation ) );
56 props.insert( QStringLiteral(
"shear_x" ), QString::number( mShearX ) );
57 props.insert( QStringLiteral(
"shear_y" ), QString::number( mShearY ) );
58 props.insert( QStringLiteral(
"translate_x" ), QString::number( mTranslateX ) );
59 props.insert( QStringLiteral(
"translate_y" ), QString::number( mTranslateY ) );
62 props.insert( QStringLiteral(
"enabled" ),
mEnabled ?
"1" :
"0" );
63 props.insert( QStringLiteral(
"draw_mode" ), QString::number(
int(
mDrawMode ) ) );
69 mEnabled = props.value( QStringLiteral(
"enabled" ), QStringLiteral(
"1" ) ).toInt();
71 mReflectX = props.value( QStringLiteral(
"reflect_x" ), QStringLiteral(
"0" ) ).toInt();
72 mReflectY = props.value( QStringLiteral(
"reflect_y" ), QStringLiteral(
"0" ) ).toInt();
73 mScaleX = props.value( QStringLiteral(
"scale_x" ), QStringLiteral(
"1.0" ) ).toDouble();
74 mScaleY = props.value( QStringLiteral(
"scale_y" ), QStringLiteral(
"1.0" ) ).toDouble();
75 mRotation = props.value( QStringLiteral(
"rotation" ), QStringLiteral(
"0.0" ) ).toDouble();
76 mShearX = props.value( QStringLiteral(
"shear_x" ), QStringLiteral(
"0.0" ) ).toDouble();
77 mShearY = props.value( QStringLiteral(
"shear_y" ), QStringLiteral(
"0.0" ) ).toDouble();
78 mTranslateX = props.value( QStringLiteral(
"translate_x" ), QStringLiteral(
"0.0" ) ).toDouble();
79 mTranslateY = props.value( QStringLiteral(
"translate_y" ), QStringLiteral(
"0.0" ) ).toDouble();
92 QTransform t = createTransform( context );
93 return t.mapRect( rect );
96 QTransform QgsTransformEffect::createTransform(
const QgsRenderContext &context )
const
103 int width =
source()->boundingRect().width();
104 int height =
source()->boundingRect().height();
105 int top =
source()->boundingRect().top();
106 int left =
source()->boundingRect().left();
117 t.rotate( mRotation );
118 t.shear( mShearX, mShearY );
119 t.scale( mScaleX, mScaleY );
121 if ( mReflectX || mReflectY )
123 t.scale( mReflectX ? -1 : 1, mReflectY ? -1 : 1 );
126 t.translate( -left - width / 2.0,
127 -top - height / 2.0 );