Martin Desruisseaux wrote:
Anaxa Gore a écrit :
  
The only thing i do is this :

Color[][] colors = new Color[][] {{Color.WHITE, color}};

GridCoverage2D gc = gcf.create("Horizon Coverage", rasterCoverage, 
this.rasterEnvelope,null,null,null,colors,null);

I am searching how to create the style !!!
I want the white (value = 0) to be transparent and the "color" (200) to 
be in color "color" and to have an opacity of 0.5.
    

If you work only with GridCoverage2D factory API (not with an object from the 
org.opengis/geotools.style package or a XML document), you can do the following 
(change the category name as you wish). Note, I'm writting from memory; we need 
to check the javadoc for exact API:

Category nodata = new Category("Absence de données", 0, new Color(0,0,0,0));
Category color = new Category("N'importe quoi", 200, new Color(100,100,100,128));
Category temperature = new Category("Température", 1, 199, 0.1, 0, new Color[] 
{Color.WHITE, Color.YELLOW, Color.ORANGE, Color.RED});
SampleDimension band = new SampleDimension("Température", new Category[] 
{nodata, color, temperature}, SI.CELSIUS);
GridCoverage2D gc = gcf.create("Horizon", raster, envelope, band);

	Martin
  

If your final "destination" is a Geotiff (I'm gathering that from the subject line), you may have trouble with the opacity.  I've learned that the TIFF encoder in imageio strips out the alpha channel.  If you are able to get the opacity to work in a GeoTiff or find a workaround, please report back.

Matt

-- 
The cosmos is all that is or ever was or ever will be.
-- Carl Sagan
begin:vcard
fn:Matt Foster - N0EYE
n:Foster;Matt
org:;NWS Forecast Office - Norman OK
email;internet:[EMAIL PROTECTED]
title:Information Technology Officer
tel;work:(405) 325-3406
x-mozilla-html:TRUE
version:2.1
end:vcard

-------------------------------------------------------------------------
Check out the new SourceForge.net Marketplace.
It's the best place to buy or sell services for
just about anything Open Source.
http://sourceforge.net/services/buy/index.php
_______________________________________________
Geotools-gt2-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/geotools-gt2-users

Reply via email to