20 #include <QDomDocument>
21 #include <QDomElement>
50 int band = elem.attribute(
"band",
"-1" ).toInt();
67 if ( !inputBlock || inputBlock->
isEmpty() )
75 if ( !hasTransparency )
92 QRgb c = inputBlock->
color( i );
93 double alpha = qAlpha( c );
95 outputBlock->
setColor( i, pixelColor );
104 if ( parentElem.isNull() )
107 QDomElement rasterRendererElem = doc.createElement(
"rasterrenderer" );
109 rasterRendererElem.setAttribute(
"band",
mBand );
110 parentElem.appendChild( rasterRendererElem );
126 if ( !input )
return false;
A rectangle specified with double values.
bool convert(QGis::DataType destDataType)
Convert data to different type.
~QgsSingleBandColorDataRenderer()
virtual QgsRasterInterface * input() const
Current input.
QgsSingleBandColorDataRenderer(QgsRasterInterface *input, int band)
Raster renderer pipe for single band color.
bool usesTransparency() const
QgsRasterTransparency * mRasterTransparency
Raster transparency per color or value.
bool setColor(int row, int column, QRgb color)
Set color on position.
int mAlphaBand
Read alpha value from band.
QList< int > usesBands() const
Returns a list of band numbers used by the renderer.
virtual QGis::DataType dataType(int bandNo) const =0
Returns data type for the band specified by number.
void setAlphaBand(int band)
Base class for processing filters like renderers, reprojector, resampler etc.
QgsRasterBlock * block(int bandNo, const QgsRectangle &extent, int width, int height)
Read block of data using given extent and size.
unsigned long long qgssize
qgssize is used instead of size_t, because size_t is stdlib type, unknown by SIP, and it would be har...
void readXML(const QDomElement &rendererElem)
Sets base class members from xml.
bool reset(QGis::DataType theDataType, int theWidth, int theHeight)
Reset block.
static QgsRasterRenderer * create(const QDomElement &elem, QgsRasterInterface *input)
bool setInput(QgsRasterInterface *input)
Set input.
virtual QgsRasterBlock * block(int bandNo, const QgsRectangle &extent, int width, int height)=0
Read block of data using given extent and size.
double mOpacity
Global alpha value (0-1)
QgsRasterInterface * clone() const
Clone itself, create deep copy.
void setOpacity(double opacity)
QRgb color(int row, int column) const
Read a single color.
void _writeXML(QDomDocument &doc, QDomElement &rasterRendererElem) const
Write upper class info into rasterrenderer element (called by writeXML method of subclasses) ...
QgsRasterInterface * mInput
void writeXML(QDomDocument &doc, QDomElement &parentElem) const
Write base class members to xml.
void setRasterTransparency(QgsRasterTransparency *t)
Raster renderer pipe that applies colors to a raster.
bool isEmpty() const
Returns true if block is empty, i.e.