diff options
author | Michael Brasser <michael.brasser@nokia.com> | 2009-04-27 04:33:07 (GMT) |
---|---|---|
committer | Michael Brasser <michael.brasser@nokia.com> | 2009-04-27 04:33:07 (GMT) |
commit | 7e3aee5b4f50733fa8d88def28b4fce78070f9e2 (patch) | |
tree | 0e3b3f26ebc7a38d47f2f057572b5a7367ac90a4 /src/declarative/fx/qfxblendedimage.cpp | |
parent | c818abd743a6877aa27ded1a01d5f8fd498cc116 (diff) | |
download | Qt-7e3aee5b4f50733fa8d88def28b4fce78070f9e2.zip Qt-7e3aee5b4f50733fa8d88def28b4fce78070f9e2.tar.gz Qt-7e3aee5b4f50733fa8d88def28b4fce78070f9e2.tar.bz2 |
Add 'smooth' property to BlendedImage.
Diffstat (limited to 'src/declarative/fx/qfxblendedimage.cpp')
-rw-r--r-- | src/declarative/fx/qfxblendedimage.cpp | 37 |
1 files changed, 36 insertions, 1 deletions
diff --git a/src/declarative/fx/qfxblendedimage.cpp b/src/declarative/fx/qfxblendedimage.cpp index b5d9a9a..b5b7bb3 100644 --- a/src/declarative/fx/qfxblendedimage.cpp +++ b/src/declarative/fx/qfxblendedimage.cpp @@ -73,7 +73,7 @@ QT_BEGIN_NAMESPACE secondary image. */ QFxBlendedImage::QFxBlendedImage(QFxItem *parent) -: QFxItem(parent), _blend(0), dirty(false) +: QFxItem(parent), _blend(0), _smooth(false), dirty(false) { #if defined(QFX_RENDER_OPENGL2) setOptions(HasContents); @@ -154,16 +154,51 @@ void QFxBlendedImage::setBlend(qreal b) update(); } +/*! + \qmlproperty bool BlendedImage::smooth + + Set this property if you want the image to be smoothly filtered when scaled or + transformed. Smooth filtering gives better visual quality, but is slower. If + the BlendedImage is displayed at its natural size, this property has no visual or + performance effect. + + \note Generally scaling artifacts are only visible if the image is stationary on + the screen. A common pattern when animating an image is to disable smooth + filtering at the beginning of the animation and reenable it at the conclusion. + */ +bool QFxBlendedImage::smoothTransform() const +{ + return _smooth; +} + +void QFxBlendedImage::setSmoothTransform(bool s) +{ + if(_smooth == s) + return; + _smooth = s; + update(); +} + #if defined(QFX_RENDER_QPAINTER) void QFxBlendedImage::paintContents(QPainter &p) { if (primSrc.isNull() && secSrc.isNull()) return; + + if(_smooth) { + p.save(); + p.setRenderHints(QPainter::Antialiasing | QPainter::SmoothPixmapTransform, _smooth); + } + if (_blend < 0.75) p.drawImage(0, 0, primPix); else p.drawImage(0, 0, secPix); + + if(_smooth) { + p.restore(); + } } #elif defined(QFX_RENDER_OPENGL2) |