Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Make lines transparent around polygons when transparency is set
git-svn-id: http://svn.osgeo.org/qgis/trunk@4711 c8812cc2-4d05-0410-92ff-de0c093fc19c
  • Loading branch information
timlinux committed Jan 21, 2006
1 parent 9080dc5 commit 388e266
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 13 deletions.
29 changes: 19 additions & 10 deletions src/gui/qgsvectorlayer.cpp
Expand Up @@ -737,34 +737,43 @@ std::cerr << i << ": " << ring->first[i]
std::cerr << "Smallest Y coordinate was " << smallestY << '\n';
*/

//preserve a copy f the brush before we start fiddling with it
//preserve a copy of the brush and pen before we start fiddling with it
QBrush brush = p->brush(); //to be kept as original
QPen pen = p->pen(); // to be kept original
//
// experimental alpha transparency
// 255 = opaque
//
QBrush myTransparentBrush = p->brush();
QColor myColor = brush.color();
//experimental alpha transparency
//255 = opaque
//I have hardcoded it to opaque out for now
//until I make it user configurable
//and hopefully work out how to improve performance
myColor.setAlpha(transparencyLevelInt);
myTransparentBrush.setColor(myColor);
p->setBrush(myTransparentBrush);
QPen myTransparentPen = p->pen(); // store current pen
myColor = myTransparentPen.color();
myColor.setAlpha(transparencyLevelInt);
myTransparentPen.setColor(myColor);
//
// draw the polygon fill
QPen pen = p->pen(); // store current pen
//
p->setBrush(myTransparentBrush);
p->setPen ( Qt::NoPen ); // no boundary
p->drawPolygon( pa );
p->setPen ( pen );

// draw the polygon outline. Draw each ring as a separate
// polygon to avoid the lines associated with the outerRingPt.
p->setBrush ( Qt::NoBrush );
p->setPen (myTransparentPen);

ringDetailType::const_iterator ri = ringDetails.begin();

for (; ri != ringDetails.end(); ++ri)
p->drawPolygon(pa, FALSE, ri->first, ri->second);


//
//restore brush and pen to original
//
p->setBrush ( brush );
p->setPen ( pen );
}

return ptr;
Expand Down
6 changes: 3 additions & 3 deletions src/raster/Makefile.am
Expand Up @@ -17,9 +17,9 @@ libqgis_raster_la_SOURCES = qgsrasterbandstats.h \
qgsrasterlayer.h \
qgsrasterrendererif.h \
qgsrasterviewport.h \
$(libqgis_raster_la_MOC)
##qgsrastergrayscalerenderer.h \
##qgsrastergrayscalerenderer.cpp
$(libqgis_raster_la_MOC)
#qgsrastergrayscalerenderer.h \
#qgsrastergrayscalerenderer.cpp
BUILT_SOURCES = $(libqgis_raster_la_MOC) $(libqgis_raster_la_SOURCES)
##libqgis_raster_la_LDFLAGS = -no-undefined
libqgis_raster_la_CPPFLAGS = -I$(OMSRCDIR)
Expand Down

0 comments on commit 388e266

Please sign in to comment.