summaryrefslogtreecommitdiffstats
path: root/src/openvg
diff options
context:
space:
mode:
authorRhys Weatherley <rhys.weatherley@nokia.com>2009-08-10 00:36:01 (GMT)
committerRhys Weatherley <rhys.weatherley@nokia.com>2009-08-10 00:36:01 (GMT)
commite54e4f19ec2fd06f9d383b2cd83a565479e3cced (patch)
tree3e95f546f8bb6a56bb9faa9d6b6ccb49366325cb /src/openvg
parentd13418effc5f00474541ae513a30c9a42c2a1cb3 (diff)
downloadQt-e54e4f19ec2fd06f9d383b2cd83a565479e3cced.zip
Qt-e54e4f19ec2fd06f9d383b2cd83a565479e3cced.tar.gz
Qt-e54e4f19ec2fd06f9d383b2cd83a565479e3cced.tar.bz2
Add a private function for conversion a QPixmap into a VGImage
Custom OpenVG pixmap filters written by users will need to access the VGImage form of a QPixmap. The qPixmapToVGImage() function is provided for this purpose, as a private API. Reviewed-by: Sarah Smith
Diffstat (limited to 'src/openvg')
-rw-r--r--src/openvg/qpixmapdata_vg.cpp25
1 files changed, 25 insertions, 0 deletions
diff --git a/src/openvg/qpixmapdata_vg.cpp b/src/openvg/qpixmapdata_vg.cpp
index 90fd9a5..6f2024f 100644
--- a/src/openvg/qpixmapdata_vg.cpp
+++ b/src/openvg/qpixmapdata_vg.cpp
@@ -341,4 +341,29 @@ QImage::Format QVGPixmapData::sourceFormat() const
return QImage::Format_ARGB32_Premultiplied;
}
+/*
+ \internal
+
+ Returns the VGImage that is storing the contents of \a pixmap.
+ Returns VG_INVALID_HANDLE if \a pixmap is not owned by the OpenVG
+ graphics system or \a pixmap is invalid.
+
+ This function is typically used to access the backing store
+ for a pixmap when executing raw OpenVG calls. It must only
+ be used when a QPainter is active and the OpenVG paint engine
+ is in use by the QPainter.
+
+ \sa {QtOpenVG Module}
+*/
+Q_OPENVG_EXPORT VGImage qPixmapToVGImage(const QPixmap& pixmap)
+{
+ QPixmapData *pd = pixmap.pixmapData();
+ if (pd->classId() == QPixmapData::OpenVGClass) {
+ QVGPixmapData *vgpd = static_cast<QVGPixmapData *>(pd);
+ if (vgpd->isValid())
+ return vgpd->toVGImage();
+ }
+ return VG_INVALID_HANDLE;
+}
+
QT_END_NAMESPACE