[Qgis-developer] Rejigging raster layer drawing
Barry Rowlingson
b.rowlingson at lancaster.ac.uk
Fri Apr 27 13:54:48 EDT 2007
Peter Ersts wrote:
> Thing specifically being addressed at this time are:
> Stretching
> Transparency
> Color maps
Here's what I've been thinking. A QgsRasterLayer is composed of a
number of bands. There's potentially a separate mapping for each band
that converts band values to RGBA colours. Only some bands are 'live'.
Then the final colour is composed from the colours of the live bands.
The mapping function can take into account stretching and scaling (and
individually for each band) as well as colourmap rotation.
This seems fully general (if slightly inefficent), since you can map
single band layers to gray colour ramps, or red colour ramps, or complex
palette-style colour ramps.
Multi-band rasters can do just about anything. If you have four bands
you could have red, blue, green and yellow ramps. A fifth band could
just set transparency. You could just have one live band and do single
band grayscale, or have three live bands and do RGB colour, or with
three live bands each with grayscale ramps, get a full grayscale image.
That last examples are where the inefficiency is - you're doing three
colourmap lookups and then combining three colours rather than adding
three numbers and doing one colourmap lookup - or with RGBA in four
separate bands just constructing the colour from the band values with no
lookups. Perhaps there's a need for a more efficient rendering only
when bands map directly to RGBA colours.
Colourmap palettes could initially come from the dataset itself if it
supplies one, or defined by the user (have you tried the Qt Gradient
Editor?).
A gui for this shouldn't be too bewildering, since there are plenty of
opportunities for simple presets and then a big fat 'Advanced' button.
Maybe I'm way off-beam on this, but in my mind, it should translate
into quite simple and neat code... But then most things that seem
simple and neat in my mind never work out that way!
Barry
More information about the Qgis-developer
mailing list