Hello,
is there an alpha transparency support in grass5?
I have a raster map (grayscaled elevation map) and I would like to paint some vector areas on it (small regions filled-in with different plain colors: d.vect.area regionname fillcolor=xxx such as red, green, blue, ...). Now I would like to keep the elevation grayscale slightly visible beneath this colored areas, which means that I need to paint these small areas with some alpha transparency.
Thanks for your ideas,
Miroslav
Miroslav Sedivy wrote:
is there an alpha transparency support in grass5?
No.
I have a raster map (grayscaled elevation map) and I would like to
paint some vector areas on it (small regions filled-in with different
plain colors: d.vect.area regionname fillcolor=xxx such as red, green,
blue, ...). Now I would like to keep the elevation grayscale slightly
visible beneath this colored areas, which means that I need to paint
these small areas with some alpha transparency.
The easiest way would be to generate separate images (e.g. using the
PNG driver) and compose them with an image processing program such as
GIMP.
Alternatively, you could use the CELL driver, and generate a composite
map using r.mapcalc and r.composite, e.g.
d.mon start=CELL
d.rast ...
d.mon stop=CELL
g.rename rast=D_cell,map1
d.mon start=CELL
d.vect.area ...
d.mon stop=CELL
g.rename rast=D_cell,map2
k=0.5 # opacity
r.mapcalc <<EOF
blend.r = r#map2 * $k + r#map1 * (1 - $k)
blend.g = g#map2 * $k + g#map1 * (1 - $k)
blend.b = b#map2 * $k + b#map1 * (1 - $k)
EOF
r.colors map=blend.r color=rules << EOF
0 black
255 white
EOF
r.colors map=blend.g rast=blend.r
r.colors map=blend.b rast=blend.r
r.composite output=blend r=blend.r g=blend.g b=blend.b
g.remove rast=map1,map2,blend.r,blend.g,blend.b
--
Glynn Clements <glynn.clements@virgin.net>