36 QPainter *painter = context.
painter();
41 QTransform t = createTransform( context );
42 painter->setTransform( t,
true );
49 props.insert( QStringLiteral(
"reflect_x" ), mReflectX ?
"1" :
"0" );
50 props.insert( QStringLiteral(
"reflect_y" ), mReflectY ?
"1" :
"0" );
51 props.insert( QStringLiteral(
"scale_x" ), QString::number( mScaleX ) );
52 props.insert( QStringLiteral(
"scale_y" ), QString::number( mScaleY ) );
53 props.insert( QStringLiteral(
"rotation" ), QString::number( mRotation ) );
54 props.insert( QStringLiteral(
"shear_x" ), QString::number( mShearX ) );
55 props.insert( QStringLiteral(
"shear_y" ), QString::number( mShearY ) );
56 props.insert( QStringLiteral(
"translate_x" ), QString::number( mTranslateX ) );
57 props.insert( QStringLiteral(
"translate_y" ), QString::number( mTranslateY ) );
60 props.insert( QStringLiteral(
"enabled" ),
mEnabled ?
"1" :
"0" );
61 props.insert( QStringLiteral(
"draw_mode" ), QString::number(
int(
mDrawMode ) ) );
67 mEnabled = props.value( QStringLiteral(
"enabled" ), QStringLiteral(
"1" ) ).toInt();
69 mReflectX = props.value( QStringLiteral(
"reflect_x" ), QStringLiteral(
"0" ) ).toInt();
70 mReflectY = props.value( QStringLiteral(
"reflect_y" ), QStringLiteral(
"0" ) ).toInt();
71 mScaleX = props.value( QStringLiteral(
"scale_x" ), QStringLiteral(
"1.0" ) ).toDouble();
72 mScaleY = props.value( QStringLiteral(
"scale_y" ), QStringLiteral(
"1.0" ) ).toDouble();
73 mRotation = props.value( QStringLiteral(
"rotation" ), QStringLiteral(
"0.0" ) ).toDouble();
74 mShearX = props.value( QStringLiteral(
"shear_x" ), QStringLiteral(
"0.0" ) ).toDouble();
75 mShearY = props.value( QStringLiteral(
"shear_y" ), QStringLiteral(
"0.0" ) ).toDouble();
76 mTranslateX = props.value( QStringLiteral(
"translate_x" ), QStringLiteral(
"0.0" ) ).toDouble();
77 mTranslateY = props.value( QStringLiteral(
"translate_y" ), QStringLiteral(
"0.0" ) ).toDouble();
90 QTransform t = createTransform( context );
91 return t.mapRect( rect );
94 QTransform QgsTransformEffect::createTransform(
const QgsRenderContext &context )
const
101 int width =
source()->boundingRect().width();
102 int height =
source()->boundingRect().height();
103 int top =
source()->boundingRect().top();
104 int left =
source()->boundingRect().left();
115 t.rotate( mRotation );
116 t.shear( mShearX, mShearY );
117 t.scale( mScaleX, mScaleY );
119 if ( mReflectX || mReflectY )
121 t.scale( mReflectX ? -1 : 1, mReflectY ? -1 : 1 );
124 t.translate( -left - width / 2.0,
125 -top - height / 2.0 );