[Gvsig_desarrolladores] Transparencia por Pixel

emolin esteban.emolin en gmail.com
Mie Nov 10 17:46:14 CET 2010


Muchas gracias por el post Nacho. Me ha sido de gran utilidad.

Tenía unos TIFF con background (255,255,255), pero al convertirlos a ECW
para aligerarlos la compresión me había generado valores de pixel distintos
al blanco. Al final he implementado transparencia por pixel para todos los
pixel cuyo valor sea >=251 en cualquiera de sus componentes RGB

El código me ha quedado así, por si es útil a alguien:


logger.debug("Aplico Transparencia por pixel");

GridTransparency  transparency = lyrRaster.getRenderTransparency();

transparency.clearListOfTransparencyRange();

//Asignamos transparencia por pixel a los valores RGB entre 251 y 255

List entradas = new ArrayList();

String strEntry = "255 | 255 | 255";

entradas.add(new TransparencyRange(strEntry));

strEntry = "254 | 254 | 254";

entradas.add(new TransparencyRange(strEntry));

strEntry = "253 | 253 | 253";

entradas.add(new TransparencyRange(strEntry));

strEntry = "252 | 252 | 252";

entradas.add(new TransparencyRange(strEntry));

strEntry = "251 | 251 | 251";

entradas.add(new TransparencyRange(strEntry));

transparency.setTransparencyRangeList((ArrayList) entradas);

transparency.activeTransparency();

-- 
View this message in context: http://osgeo-org.1803224.n2.nabble.com/Transparencia-por-Pixel-tp5723972p5725489.html
Sent from the gvSIG desarrolladores mailing list archive at Nabble.com.
------------ próxima parte ------------
Se ha borrado un adjunto en formato HTML...
URL: http://listserv.gva.es/pipermail/gvsig_desarrolladores/attachments/20101110/98d80407/attachment.htm 


Más información sobre la lista de distribución gvSIG_desarrolladores