Skip to content

Commit

Permalink
Modification to make sure that QPixmaps do not get filled with a tran…
Browse files Browse the repository at this point in the history
…sparent colour, if the X11 system does not have the RENDER extension at runtime.

git-svn-id: http://svn.osgeo.org/qgis/trunk@4867 c8812cc2-4d05-0410-92ff-de0c093fc19c
  • Loading branch information
morb_au committed Feb 16, 2006
1 parent 935e6b5 commit ec7838e
Show file tree
Hide file tree
Showing 2 changed files with 42 additions and 2 deletions.
22 changes: 21 additions & 1 deletion src/core/qgsmarkercatalogue.cpp
Expand Up @@ -91,7 +91,27 @@ QPixmap QgsMarkerCatalogue::marker ( QString fullName, int size, QPen pen, QBrus
{
QPicture myPicture = hardMarker ( fullName.mid(5), size, pen, brush, qtBug );
QPixmap myPixmap = QPixmap (myPicture.width(),myPicture.height());
myPixmap.fill(QColor(255,255,255,0)); //transparent

// The following is window-system-conditional since (at least)
// the combination of Qt 4.1.0 and RealVNC's Xvnc 4.1
// will result in the pixmap becoming invisible if it is filled
// with a non-opaque colour.
// This is probably because Xvnc 4.1 doesn't have the RENDER
// extension compiled into it.
#if defined(Q_WS_X11)
// Do a runtime test to see if the X RENDER extension is available
if ( myPixmap.x11PictureHandle() )
{
#endif
myPixmap.fill(QColor(255,255,255,0)); // transparent
#if defined(Q_WS_X11)
}
else
{
myPixmap.fill(QColor(255,255,255)); // opaque
}
#endif

QPainter myPainter(&myPixmap);
myPainter.drawPicture(0,0,myPicture);
return myPixmap;
Expand Down
22 changes: 21 additions & 1 deletion src/core/qgssvgcache.cpp
Expand Up @@ -96,7 +96,27 @@ QPixmap QgsSVGCache::getPixmap(QString filename, double scaleFactor)

//QPixmap myPixmap = QPixmap(width,height);
QPixmap myPixmap = QPixmap(scaleFactor,scaleFactor);
myPixmap.fill(QColor(255,255,255,0)); //transparent

// The following is window-system-conditional since (at least)
// the combination of Qt 4.1.0 and RealVNC's Xvnc 4.1
// will result in the pixmap becoming invisible if it is filled
// with a non-opaque colour.
// This is probably because Xvnc 4.1 doesn't have the RENDER
// extension compiled into it.
#if defined(Q_WS_X11)
// Do a runtime test to see if the X RENDER extension is available
if ( myPixmap.x11PictureHandle() )
{
#endif
myPixmap.fill(QColor(255,255,255,0)); // transparent
#if defined(Q_WS_X11)
}
else
{
myPixmap.fill(QColor(255,255,255)); // opaque
}
#endif

QPainter myPainter(&myPixmap);
myPainter.setRenderHint(QPainter::Antialiasing);
mySVG.render(&myPainter);
Expand Down

0 comments on commit ec7838e

Please sign in to comment.