From 56b7fa929af6d0b3de60ae494aa2893794279833 Mon Sep 17 00:00:00 2001 From: Noldor Date: Wed, 18 Apr 2007 16:03:39 +0000 Subject: added some QT4 painter new functions. git-svn-id: https://svn.kvirc.de/svn/trunk/kvirc@515 17fca916-40b9-46aa-a4ea-0a15b648b75c --- src/modules/objects/class_painter.cpp | 46 ++++++++++++++++++++++++++++++++++- 1 file changed, 45 insertions(+), 1 deletion(-) (limited to 'src/modules/objects/class_painter.cpp') diff --git a/src/modules/objects/class_painter.cpp b/src/modules/objects/class_painter.cpp index 23210abda..5c45910d2 100644 --- a/src/modules/objects/class_painter.cpp +++ b/src/modules/objects/class_painter.cpp @@ -152,7 +152,15 @@ !fn: $setOpacity() [QT4 ONLY] Sets the painter opacity that affects all painter operations (drawpixmap, drawtext...). Valid values range are from 0 (total transparency) to 1 (total opacity)[br] You must invoke the [classfnc]$begin[/classfnc] before using it. - + !fn: $setTextAntialiasing() [QT4 ONLY] + Enable/disable antialias in text if possible. + You must call the [classfnc]$begin[/classfnc] before using it. + !fn: $setAntialiasing() [QT4 ONLY] + Enable/disable antialias in edges of primitives if possible. + You must call the [classfnc]$begin[/classfnc] before using it. + !fn: $setSmoothPixmapTransform() [QT4 ONLY] + Enable/disable smooth bilinear pixmap transformation algorithm (such as bilinear). + You must call the [classfnc]$begin[/classfnc] before using it. Example:[br] [br] class (hello,widget)[br] @@ -365,6 +373,9 @@ KVSO_BEGIN_REGISTERCLASS(KviKvsObject_painter,"painter","object") #ifdef COMPILE_USE_QT4 KVSO_REGISTER_HANDLER(KviKvsObject_painter,"setOpacity",functionsetOpacity) + KVSO_REGISTER_HANDLER(KviKvsObject_painter,"setTextAntialiasing",functionsetTextAntialiasing) + KVSO_REGISTER_HANDLER(KviKvsObject_painter,"setAntialiasing",functionsetAntialiasing) + KVSO_REGISTER_HANDLER(KviKvsObject_painter,"setSmoothPixmapTransform",functionsetSmoothPixmapTransform) #endif KVSO_REGISTER_HANDLER(KviKvsObject_painter,"begin",functionbegin) @@ -956,6 +967,39 @@ bool KviKvsObject_painter::functionsetOpacity(KviKvsObjectFunctionCall *c) m_pPainter->setOpacity(dOpacity); return true; } +bool KviKvsObject_painter::functionsetTextAntialiasing(KviKvsObjectFunctionCall *c) +{ + if(!m_pPainter)return true; + + bool bEnabled; + KVSO_PARAMETERS_BEGIN(c) + KVSO_PARAMETER("bEnabled",KVS_PT_BOOL,0,bEnabled) + KVSO_PARAMETERS_END(c) + m_pPainter->setRenderHint(QPainter::TextAntialiasing,bEnabled); + return true; +} +bool KviKvsObject_painter::functionsetAntialiasing(KviKvsObjectFunctionCall *c) +{ + if(!m_pPainter)return true; + + bool bEnabled; + KVSO_PARAMETERS_BEGIN(c) + KVSO_PARAMETER("bEnabled",KVS_PT_BOOL,0,bEnabled) + KVSO_PARAMETERS_END(c) + m_pPainter->setRenderHint(QPainter::Antialiasing,bEnabled); + return true; +} +bool KviKvsObject_painter::functionsetSmoothPixmapTransform(KviKvsObjectFunctionCall *c) +{ + if(!m_pPainter)return true; + + bool bEnabled; + KVSO_PARAMETERS_BEGIN(c) + KVSO_PARAMETER("bEnabled",KVS_PT_BOOL,0,bEnabled) + KVSO_PARAMETERS_END(c) + m_pPainter->setRenderHint(QPainter::SmoothPixmapTransform,bEnabled); + return true; +} #endif -- cgit v1.3.1-10-gc9f91