QGIS API Documentation  3.10.0-A Coruña (6c816b4204)
qgspalettedrasterrenderer.cpp
Go to the documentation of this file.
1 /***************************************************************************
2  qgspalettedrasterrenderer.cpp
3  -----------------------------
4  begin : December 2011
5  copyright : (C) 2011 by Marco Hugentobler
6  email : marco at sourcepole dot ch
7  ***************************************************************************/
8 
9 /***************************************************************************
10  * *
11  * This program is free software; you can redistribute it and/or modify *
12  * it under the terms of the GNU General Public License as published by *
13  * the Free Software Foundation; either version 2 of the License, or *
14  * (at your option) any later version. *
15  * *
16  ***************************************************************************/
17 
19 #include "qgsrastertransparency.h"
20 #include "qgsrasterviewport.h"
21 #include "qgssymbollayerutils.h"
22 #include "qgsstyleentityvisitor.h"
23 
24 #include <QColor>
25 #include <QDomDocument>
26 #include <QDomElement>
27 #include <QImage>
28 #include <QVector>
29 #include <memory>
30 
32  : QgsRasterRenderer( input, QStringLiteral( "paletted" ) )
33  , mBand( bandNumber )
34  , mClassData( classes )
35 {
36  updateArrays();
37 }
38 
40 {
41  QgsPalettedRasterRenderer *renderer = new QgsPalettedRasterRenderer( nullptr, mBand, mClassData );
42  if ( mSourceColorRamp )
43  renderer->setSourceColorRamp( mSourceColorRamp->clone() );
44 
45  renderer->copyCommonProperties( this );
46  return renderer;
47 }
48 
50 {
51  if ( elem.isNull() )
52  {
53  return nullptr;
54  }
55 
56  int bandNumber = elem.attribute( QStringLiteral( "band" ), QStringLiteral( "-1" ) ).toInt();
57  ClassData classData;
58 
59  QDomElement paletteElem = elem.firstChildElement( QStringLiteral( "colorPalette" ) );
60  if ( !paletteElem.isNull() )
61  {
62  QDomNodeList paletteEntries = paletteElem.elementsByTagName( QStringLiteral( "paletteEntry" ) );
63 
64  QDomElement entryElem;
65  int value;
66 
67  for ( int i = 0; i < paletteEntries.size(); ++i )
68  {
69  QColor color;
70  QString label;
71  entryElem = paletteEntries.at( i ).toElement();
72  value = static_cast<int>( entryElem.attribute( QStringLiteral( "value" ), QStringLiteral( "0" ) ).toDouble() );
73  QgsDebugMsgLevel( entryElem.attribute( "color", "#000000" ), 4 );
74  color = QColor( entryElem.attribute( QStringLiteral( "color" ), QStringLiteral( "#000000" ) ) );
75  color.setAlpha( entryElem.attribute( QStringLiteral( "alpha" ), QStringLiteral( "255" ) ).toInt() );
76  label = entryElem.attribute( QStringLiteral( "label" ) );
77  classData << Class( value, color, label );
78  }
79  }
80 
81  QgsPalettedRasterRenderer *r = new QgsPalettedRasterRenderer( input, bandNumber, classData );
82  r->readXml( elem );
83 
84  // try to load color ramp (optional)
85  QDomElement sourceColorRampElem = elem.firstChildElement( QStringLiteral( "colorramp" ) );
86  if ( !sourceColorRampElem.isNull() && sourceColorRampElem.attribute( QStringLiteral( "name" ) ) == QLatin1String( "[source]" ) )
87  {
88  r->setSourceColorRamp( QgsSymbolLayerUtils::loadColorRamp( sourceColorRampElem ) );
89  }
90 
91  return r;
92 }
93 
95 {
96  return mClassData;
97 }
98 
99 QString QgsPalettedRasterRenderer::label( int idx ) const
100 {
101  const auto constMClassData = mClassData;
102  for ( const Class &c : constMClassData )
103  {
104  if ( c.value == idx )
105  return c.label;
106  }
107 
108  return QString();
109 }
110 
111 void QgsPalettedRasterRenderer::setLabel( int idx, const QString &label )
112 {
113  ClassData::iterator cIt = mClassData.begin();
114  for ( ; cIt != mClassData.end(); ++cIt )
115  {
116  if ( cIt->value == idx )
117  {
118  cIt->label = label;
119  return;
120  }
121  }
122 }
123 
125 {
126  std::unique_ptr< QgsRasterBlock > outputBlock( new QgsRasterBlock() );
127  if ( !mInput || mClassData.isEmpty() )
128  {
129  return outputBlock.release();
130  }
131 
132  std::shared_ptr< QgsRasterBlock > inputBlock( mInput->block( mBand, extent, width, height, feedback ) );
133 
134  if ( !inputBlock || inputBlock->isEmpty() )
135  {
136  QgsDebugMsg( QStringLiteral( "No raster data!" ) );
137  return outputBlock.release();
138  }
139 
140  double currentOpacity = mOpacity;
141 
142  //rendering is faster without considering user-defined transparency
143  bool hasTransparency = usesTransparency();
144 
145  std::shared_ptr< QgsRasterBlock > alphaBlock;
146 
147  if ( mAlphaBand > 0 && mAlphaBand != mBand )
148  {
149  alphaBlock.reset( mInput->block( mAlphaBand, extent, width, height, feedback ) );
150  if ( !alphaBlock || alphaBlock->isEmpty() )
151  {
152  return outputBlock.release();
153  }
154  }
155  else if ( mAlphaBand == mBand )
156  {
157  alphaBlock = inputBlock;
158  }
159 
160  if ( !outputBlock->reset( Qgis::ARGB32_Premultiplied, width, height ) )
161  {
162  return outputBlock.release();
163  }
164 
165  QRgb myDefaultColor = NODATA_COLOR;
166 
167  //use direct data access instead of QgsRasterBlock::setValue
168  //because of performance
169  unsigned int *outputData = ( unsigned int * )( outputBlock->bits() );
170 
171  qgssize rasterSize = ( qgssize )width * height;
172  bool isNoData = false;
173  for ( qgssize i = 0; i < rasterSize; ++i )
174  {
175  const double value = inputBlock->valueAndNoData( i, isNoData );
176  if ( isNoData )
177  {
178  outputData[i] = myDefaultColor;
179  continue;
180  }
181  int val = static_cast< int >( value );
182  if ( !mColors.contains( val ) )
183  {
184  outputData[i] = myDefaultColor;
185  continue;
186  }
187 
188  if ( !hasTransparency )
189  {
190  outputData[i] = mColors.value( val );
191  }
192  else
193  {
194  currentOpacity = mOpacity;
195  if ( mRasterTransparency )
196  {
197  currentOpacity = mRasterTransparency->alphaValue( val, mOpacity * 255 ) / 255.0;
198  }
199  if ( mAlphaBand > 0 )
200  {
201  currentOpacity *= alphaBlock->value( i ) / 255.0;
202  }
203 
204  QRgb c = mColors.value( val );
205  outputData[i] = qRgba( currentOpacity * qRed( c ), currentOpacity * qGreen( c ), currentOpacity * qBlue( c ), currentOpacity * qAlpha( c ) );
206  }
207  }
208 
209  return outputBlock.release();
210 }
211 
212 void QgsPalettedRasterRenderer::writeXml( QDomDocument &doc, QDomElement &parentElem ) const
213 {
214  if ( parentElem.isNull() )
215  {
216  return;
217  }
218 
219  QDomElement rasterRendererElem = doc.createElement( QStringLiteral( "rasterrenderer" ) );
220  _writeXml( doc, rasterRendererElem );
221 
222  rasterRendererElem.setAttribute( QStringLiteral( "band" ), mBand );
223  QDomElement colorPaletteElem = doc.createElement( QStringLiteral( "colorPalette" ) );
224  ClassData::const_iterator it = mClassData.constBegin();
225  for ( ; it != mClassData.constEnd(); ++it )
226  {
227  QColor color = it->color;
228  QDomElement colorElem = doc.createElement( QStringLiteral( "paletteEntry" ) );
229  colorElem.setAttribute( QStringLiteral( "value" ), it->value );
230  colorElem.setAttribute( QStringLiteral( "color" ), color.name() );
231  colorElem.setAttribute( QStringLiteral( "alpha" ), color.alpha() );
232  if ( !it->label.isEmpty() )
233  {
234  colorElem.setAttribute( QStringLiteral( "label" ), it->label );
235  }
236  colorPaletteElem.appendChild( colorElem );
237  }
238  rasterRendererElem.appendChild( colorPaletteElem );
239 
240  // save source color ramp
241  if ( mSourceColorRamp )
242  {
243  QDomElement colorRampElem = QgsSymbolLayerUtils::saveColorRamp( QStringLiteral( "[source]" ), mSourceColorRamp.get(), doc );
244  rasterRendererElem.appendChild( colorRampElem );
245  }
246 
247  parentElem.appendChild( rasterRendererElem );
248 }
249 
250 void QgsPalettedRasterRenderer::toSld( QDomDocument &doc, QDomElement &element, const QgsStringMap &props ) const
251 {
252  // create base structure
253  QgsRasterRenderer::toSld( doc, element, props );
254 
255  // look for RasterSymbolizer tag
256  QDomNodeList elements = element.elementsByTagName( QStringLiteral( "sld:RasterSymbolizer" ) );
257  if ( elements.size() == 0 )
258  return;
259 
260  // there SHOULD be only one
261  QDomElement rasterSymbolizerElem = elements.at( 0 ).toElement();
262 
263  // add Channel Selection tags
264  QDomElement channelSelectionElem = doc.createElement( QStringLiteral( "sld:ChannelSelection" ) );
265  rasterSymbolizerElem.appendChild( channelSelectionElem );
266 
267  // for the mapped band
268  QDomElement channelElem = doc.createElement( QStringLiteral( "sld:GrayChannel" ) );
269  channelSelectionElem.appendChild( channelElem );
270 
271  // set band
272  QDomElement sourceChannelNameElem = doc.createElement( QStringLiteral( "sld:SourceChannelName" ) );
273  sourceChannelNameElem.appendChild( doc.createTextNode( QString::number( band() ) ) );
274  channelElem.appendChild( sourceChannelNameElem );
275 
276  // add ColorMap tag
277  QDomElement colorMapElem = doc.createElement( QStringLiteral( "sld:ColorMap" ) );
278  colorMapElem.setAttribute( QStringLiteral( "type" ), QStringLiteral( "values" ) );
279  if ( this->classes().size() >= 255 )
280  colorMapElem.setAttribute( QStringLiteral( "extended" ), QStringLiteral( "true" ) );
281  rasterSymbolizerElem.appendChild( colorMapElem );
282 
283  // for each color set a ColorMapEntry tag nested into "sld:ColorMap" tag
284  // e.g. <ColorMapEntry color="#EEBE2F" quantity="-300" label="label" opacity="0"/>
285  QList<QgsPalettedRasterRenderer::Class> classes = this->classes();
286  QList<QgsPalettedRasterRenderer::Class>::const_iterator classDataIt = classes.constBegin();
287  for ( ; classDataIt != classes.constEnd(); ++classDataIt )
288  {
289  QDomElement colorMapEntryElem = doc.createElement( QStringLiteral( "sld:ColorMapEntry" ) );
290  colorMapElem.appendChild( colorMapEntryElem );
291 
292  // set colorMapEntryElem attributes
293  colorMapEntryElem.setAttribute( QStringLiteral( "color" ), classDataIt->color.name() );
294  colorMapEntryElem.setAttribute( QStringLiteral( "quantity" ), QString::number( classDataIt->value ) );
295  colorMapEntryElem.setAttribute( QStringLiteral( "label" ), classDataIt->label );
296  if ( classDataIt->color.alphaF() != 1.0 )
297  {
298  colorMapEntryElem.setAttribute( QStringLiteral( "opacity" ), QString::number( classDataIt->color.alphaF() ) );
299  }
300  }
301 }
302 
304 {
305  if ( mSourceColorRamp )
306  {
307  QgsStyleColorRampEntity entity( mSourceColorRamp.get() );
308  if ( !visitor->visit( QgsStyleEntityVisitorInterface::StyleLeaf( &entity ) ) )
309  return false;
310  }
311 
312  return true;
313 }
314 
315 void QgsPalettedRasterRenderer::legendSymbologyItems( QList< QPair< QString, QColor > > &symbolItems ) const
316 {
317  ClassData::const_iterator it = mClassData.constBegin();
318  for ( ; it != mClassData.constEnd(); ++it )
319  {
320  QString lab = it->label.isEmpty() ? QString::number( it->value ) : it->label;
321  symbolItems << qMakePair( lab, it->color );
322  }
323 }
324 
326 {
327  QList<int> bandList;
328  if ( mBand != -1 )
329  {
330  bandList << mBand;
331  }
332  return bandList;
333 }
334 
336 {
337  mSourceColorRamp.reset( ramp );
338 }
339 
341 {
342  return mSourceColorRamp.get();
343 }
344 
345 QgsPalettedRasterRenderer::ClassData QgsPalettedRasterRenderer::colorTableToClassData( const QList<QgsColorRampShader::ColorRampItem> &table )
346 {
347  QList<QgsColorRampShader::ColorRampItem>::const_iterator colorIt = table.constBegin();
349  for ( ; colorIt != table.constEnd(); ++colorIt )
350  {
351  int idx = ( int )( colorIt->value );
352  classes << QgsPalettedRasterRenderer::Class( idx, colorIt->color, colorIt->label );
353  }
354  return classes;
355 }
356 
358 {
360 
361  QRegularExpression linePartRx( QStringLiteral( "[\\s,:]+" ) );
362 
363  QStringList parts = string.split( '\n', QString::SkipEmptyParts );
364  const auto constParts = parts;
365  for ( const QString &part : constParts )
366  {
367  QStringList lineParts = part.split( linePartRx, QString::SkipEmptyParts );
368  bool ok = false;
369  switch ( lineParts.count() )
370  {
371  case 1:
372  {
373  int value = lineParts.at( 0 ).toInt( &ok );
374  if ( !ok )
375  continue;
376 
377  classes << Class( value );
378  break;
379  }
380 
381  case 2:
382  {
383  int value = lineParts.at( 0 ).toInt( &ok );
384  if ( !ok )
385  continue;
386 
387  QColor c( lineParts.at( 1 ) );
388 
389  classes << Class( value, c );
390  break;
391  }
392 
393  default:
394  {
395  if ( lineParts.count() < 4 )
396  continue;
397 
398  int value = lineParts.at( 0 ).toInt( &ok );
399  if ( !ok )
400  continue;
401 
402  bool rOk = false;
403  double r = lineParts.at( 1 ).toDouble( &rOk );
404  bool gOk = false;
405  double g = lineParts.at( 2 ).toDouble( &gOk );
406  bool bOk = false;
407  double b = lineParts.at( 3 ).toDouble( &bOk );
408 
409  QColor c;
410  if ( rOk && gOk && bOk )
411  {
412  c = QColor( r, g, b );
413  }
414 
415  if ( lineParts.count() >= 5 )
416  {
417  double alpha = lineParts.at( 4 ).toDouble( &ok );
418  if ( ok )
419  c.setAlpha( alpha );
420  }
421 
422  QString label;
423  if ( lineParts.count() > 5 )
424  {
425  label = lineParts.mid( 5 ).join( ' ' );
426  }
427 
428  classes << Class( value, c, label );
429  break;
430  }
431  }
432 
433  }
434  return classes;
435 }
436 
438 {
439  QFile inputFile( path );
440  QString input;
441  if ( inputFile.open( QIODevice::ReadOnly ) )
442  {
443  QTextStream in( &inputFile );
444  input = in.readAll();
445  inputFile.close();
446  }
447  return classDataFromString( input );
448 }
449 
451 {
452  QStringList out;
453  // must be sorted
455  std::sort( cd.begin(), cd.end(), []( const Class & a, const Class & b ) -> bool
456  {
457  return a.value < b.value;
458  } );
459 
460  const auto constCd = cd;
461  for ( const Class &c : constCd )
462  {
463  out << QStringLiteral( "%1 %2 %3 %4 %5 %6" ).arg( c.value ).arg( c.color.red() )
464  .arg( c.color.green() ).arg( c.color.blue() ).arg( c.color.alpha() ).arg( c.label );
465  }
466  return out.join( '\n' );
467 }
468 
470 {
471  if ( !raster )
472  return ClassData();
473 
474  // get min and max value from raster
475  QgsRasterBandStats stats = raster->bandStatistics( bandNumber, QgsRasterBandStats::Min | QgsRasterBandStats::Max, QgsRectangle(), 0, feedback );
476  if ( feedback && feedback->isCanceled() )
477  return ClassData();
478 
479  double min = stats.minimumValue;
480  double max = stats.maximumValue;
481  // need count of every individual value
482  int bins = std::ceil( max - min ) + 1;
483  if ( bins <= 0 )
484  return ClassData();
485 
486  QgsRasterHistogram histogram = raster->histogram( bandNumber, bins, min, max, QgsRectangle(), 0, false, feedback );
487  if ( feedback && feedback->isCanceled() )
488  return ClassData();
489 
490  double interval = ( histogram.maximum - histogram.minimum + 1 ) / histogram.binCount;
491 
492  ClassData data;
493 
494  double currentValue = histogram.minimum;
495  double presentValues = 0;
496  for ( int idx = 0; idx < histogram.binCount; ++idx )
497  {
498  int count = histogram.histogramVector.at( idx );
499  if ( count > 0 )
500  {
501  data << Class( currentValue, QColor(), QString::number( currentValue ) );
502  presentValues++;
503  }
504  currentValue += interval;
505  }
506 
507  // assign colors from ramp
508  if ( ramp )
509  {
510  int i = 0;
511 
512  if ( QgsRandomColorRamp *randomRamp = dynamic_cast<QgsRandomColorRamp *>( ramp ) )
513  {
514  //ramp is a random colors ramp, so inform it of the total number of required colors
515  //this allows the ramp to pregenerate a set of visually distinctive colors
516  randomRamp->setTotalColorCount( data.count() );
517  }
518 
519  if ( presentValues > 1 )
520  presentValues -= 1; //avoid duplicate first color
521 
522  QgsPalettedRasterRenderer::ClassData::iterator cIt = data.begin();
523  for ( ; cIt != data.end(); ++cIt )
524  {
525  cIt->color = ramp->color( i / presentValues );
526  i++;
527  }
528  }
529  return data;
530 }
531 
532 void QgsPalettedRasterRenderer::updateArrays()
533 {
534  mColors.clear();
535  int i = 0;
536  ClassData::const_iterator it = mClassData.constBegin();
537  for ( ; it != mClassData.constEnd(); ++it )
538  {
539  mColors[it->value] = qPremultiply( it->color.rgba() );
540  i++;
541  }
542 }
void setSourceColorRamp(QgsColorRamp *ramp)
Set the source color ramp.
static QString classDataToString(const QgsPalettedRasterRenderer::ClassData &classes)
Converts classes to a string representation, using the .clr/gdal color table file format...
A rectangle specified with double values.
Definition: qgsrectangle.h:41
QgsPalettedRasterRenderer(QgsRasterInterface *input, int bandNumber, const ClassData &classes)
Constructor for QgsPalettedRasterRenderer.
bool accept(QgsStyleEntityVisitorInterface *visitor) const override
Accepts the specified symbology visitor, causing it to visit all symbols associated with the renderer...
virtual void toSld(QDomDocument &doc, QDomElement &element, const QgsStringMap &props=QgsStringMap()) const
Used from subclasses to create SLD Rule elements following SLD v1.0 specs.
Renderer for paletted raster images.
virtual QgsRectangle extent() const
Gets the extent of the interface.
#define QgsDebugMsg(str)
Definition: qgslogger.h:38
Abstract base class for color ramps.
Definition: qgscolorramp.h:31
double minimum
The minimum histogram value.
virtual QgsRasterInterface * input() const
Current input.
ClassData classes() const
Returns a map of value to classes (colors) used by the renderer.
Properties of a single value class.
static QDomElement saveColorRamp(const QString &name, QgsColorRamp *ramp, QDomDocument &doc)
Encodes a color ramp&#39;s settings to an XML element.
void setLabel(int idx, const QString &label)
Set category label.
double maximumValue
The maximum cell value in the raster band.
void writeXml(QDomDocument &doc, QDomElement &parentElem) const override
Write base class members to xml.
virtual QgsRasterHistogram histogram(int bandNo, int binCount=0, double minimum=std::numeric_limits< double >::quiet_NaN(), double maximum=std::numeric_limits< double >::quiet_NaN(), const QgsRectangle &extent=QgsRectangle(), int sampleSize=0, bool includeOutOfRange=false, QgsRasterBlockFeedback *feedback=nullptr)
Returns a band histogram.
An interface for classes which can visit style entity (e.g.
virtual QColor color(double value) const =0
Returns the color corresponding to a specified value.
QMap< QString, QString > QgsStringMap
Definition: qgis.h:612
virtual bool visit(const QgsStyleEntityVisitorInterface::StyleLeaf &entity)
Called when the visitor will visit a style entity.
QgsRasterTransparency * mRasterTransparency
Raster transparency per color or value. Overwrites global alpha value.
As part of the API refactoring and improvements which landed in the Processing API was substantially reworked from the x version This was done in order to allow much of the underlying Processing framework to be ported into c
static const QRgb NODATA_COLOR
Color, alpha, red, green, blue, 4 bytes the same as QImage::Format_ARGB32_Premultiplied.
Definition: qgis.h:95
The RasterBandStats struct is a container for statistics about a single raster band.
Raster data container.
#define QgsDebugMsgLevel(str, level)
Definition: qgslogger.h:39
virtual QgsRasterBlock * block(int bandNo, const QgsRectangle &extent, int width, int height, QgsRasterBlockFeedback *feedback=nullptr)=0
Read block of data using given extent and size.
QList< QgsPalettedRasterRenderer::Class > ClassData
Map of value to class properties.
void _writeXml(QDomDocument &doc, QDomElement &rasterRendererElem) const
Write upper class info into rasterrenderer element (called by writeXml method of subclasses) ...
static QgsPalettedRasterRenderer::ClassData classDataFromString(const QString &string)
Converts a string containing a color table or class data to to paletted renderer class data...
void copyCommonProperties(const QgsRasterRenderer *other, bool copyMinMaxOrigin=true)
Copies common properties like opacity / transparency data from other renderer.
bool usesTransparency() const
QgsRasterHistogram::HistogramVector histogramVector
Stores the histogram for a given layer.
static QgsColorRamp * loadColorRamp(QDomElement &element)
Creates a color ramp from the settings encoded in an XML element.
QString label(int idx) const
Returns optional category label.
int mAlphaBand
Read alpha value from band.
void readXml(const QDomElement &rendererElem) override
Sets base class members from xml. Usually called from create() methods of subclasses.
Base class for processing filters like renderers, reprojector, resampler etc.
int alphaValue(double value, int globalTransparency=255) const
Returns the transparency value for a single value pixel.
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...
Definition: qgis.h:621
static QgsRasterRenderer * create(const QDomElement &elem, QgsRasterInterface *input)
Totally random color ramp.
Definition: qgscolorramp.h:427
QList< int > usesBands() const override
Returns a list of band numbers used by the renderer.
double maximum
The maximum histogram value.
QgsColorRamp * sourceColorRamp() const
Gets the source color ramp.
virtual QgsRasterBandStats bandStatistics(int bandNo, int stats=QgsRasterBandStats::All, const QgsRectangle &extent=QgsRectangle(), int sampleSize=0, QgsRasterBlockFeedback *feedback=nullptr)
Returns the band statistics.
QgsPalettedRasterRenderer * clone() const override
Clone itself, create deep copy.
static QgsPalettedRasterRenderer::ClassData classDataFromFile(const QString &path)
Opens a color table file and returns corresponding paletted renderer class data.
static QgsPalettedRasterRenderer::ClassData classDataFromRaster(QgsRasterInterface *raster, int bandNumber, QgsColorRamp *ramp=nullptr, QgsRasterBlockFeedback *feedback=nullptr)
Generates class data from a raster, for the specified bandNumber.
bool isCanceled() const
Tells whether the operation has been canceled already.
Definition: qgsfeedback.h:54
void legendSymbologyItems(QList< QPair< QString, QColor > > &symbolItems) const override
Gets symbology items if provided by renderer.
int band() const
Returns the raster band used for rendering the raster.
double minimumValue
The minimum cell value in the raster band.
void toSld(QDomDocument &doc, QDomElement &element, const QgsStringMap &props=QgsStringMap()) const override
Used from subclasses to create SLD Rule elements following SLD v1.0 specs.
The QgsRasterHistogram is a container for histogram of a single raster band.
int binCount
Number of bins (intervals,buckets) in histogram.
double mOpacity
Global alpha value (0-1)
A color ramp entity for QgsStyle databases.
Definition: qgsstyle.h:1003
QgsRasterInterface * mInput
Feedback object tailored for raster block reading.
static QgsPalettedRasterRenderer::ClassData colorTableToClassData(const QList< QgsColorRampShader::ColorRampItem > &table)
Converts a raster color table to paletted renderer class data.
Raster renderer pipe that applies colors to a raster.
Contains information relating to the style entity currently being visited.
QgsRasterBlock * block(int bandNo, const QgsRectangle &extent, int width, int height, QgsRasterBlockFeedback *feedback=nullptr) override
Read block of data using given extent and size.