[Qgis-developer] Raster Transparency

Tim Sutton lists at linfiniti.com
Tue Aug 18 17:29:28 EDT 2009


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Hi



sergio cavalcante wrote:
> People, can anyone give me a little help with my transparency function?
> Here is it:
> 
> void CViewPort::SetRasterTransparent(QgsRasterLayer * mRasterLayer)
> 
> {
> 
>   double myTransparentValue;
> 
>   double myPercentTransparent;
> 
> 
>   QgsRasterTransparency::TransparentSingleValuePixel myTransparentPixel;
> 
>   QList<QgsRasterTransparency::TransparentSingleValuePixel>
> myTransparentSingleValuePixelList;
> 
> 
>   myTransparentPixel.pixelValue = 0.00;
> 
>   myTransparentPixel.percentTransparent = 100.00;
> 
>   myTransparentSingleValuePixelList.append( myTransparentPixel );
> 
> 
>   myTransparentPixel.pixelValue = 65.00;
> 
>   myTransparentPixel.percentTransparent = 100.00;
> 
>   myTransparentSingleValuePixelList.append( myTransparentPixel );
> 
> 
>   mRasterLayer->rasterTransparency()->setTransparentSingleValuePixelList(
> myTransparentSingleValuePixelList );
> 
> }
> 
> The pixels I need to become transparent are the 0 and 65. I put the same
> values on the quantum gis application transparent pixel list and they become
> transparent, but I couldn't get the same result in my app.

Does calling:

 mRasterLayer->triggerRepaint();

at the end make any difference?

Regards

- --

Tim Sutton - QGIS Project Steering Committee Member (Release  Manager)
==============================================
Please do not email me off-list with technical
support questions. Using the lists will gain
more exposure for your issues and the knowledge
surrounding your issue will be shared with all.

Visit http://linfiniti.com to find out about:
 * QGIS programming and support services
 * Mapserver and PostGIS based hosting plans
 * FOSS Consulting Services
Skype: timlinux
Irc: timlinux on #qgis at freenode.net
==============================================

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.9 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iEYEARECAAYFAkqLHTAACgkQqk07qZdiYjdATACfVDRkxiODPGBiaLNsqeqNV0PC
Xo0AniB2GQRY+wzpW7ZOyAQXRzq1XHAH
=pS5H
-----END PGP SIGNATURE-----


More information about the Qgis-developer mailing list