QGIS API Documentation  3.8.0-Zanzibar (11aff65)
qgsrendererrasterpropertieswidget.cpp
Go to the documentation of this file.
1 /***************************************************************************
2  qgsrendererrasterpropertieswidget.cpp
3  ---------------------
4  begin : May 2016
5  copyright : (C) 2016 by Nathan Woodrow
6  email : woodrow dot nathan at gmail dot com
7  ***************************************************************************
8  * *
9  * This program is free software; you can redistribute it and/or modify *
10  * it under the terms of the GNU General Public License as published by *
11  * the Free Software Foundation; either version 2 of the License, or *
12  * (at your option) any later version. *
13  * *
14  ***************************************************************************/
16 
17 #include "qgis.h"
18 #include "qgsmapcanvas.h"
20 #include "qgshuesaturationfilter.h"
21 #include "qgsrasterlayer.h"
34 #include "qgsapplication.h"
35 
36 
37 #include "qgsmessagelog.h"
38 
39 static void _initRendererWidgetFunctions()
40 {
41  static bool sInitialized = false;
42  if ( sInitialized )
43  return;
44 
50 
51  sInitialized = true;
52 }
53 
54 
55 
57  : QgsMapLayerConfigWidget( layer, canvas, parent )
58 
59 {
60  mRasterLayer = qobject_cast<QgsRasterLayer *>( layer );
61 
62  if ( !( mRasterLayer && mRasterLayer->isValid() ) )
63  return;
64 
65  setupUi( this );
66  connect( mResetColorRenderingBtn, &QToolButton::clicked, this, &QgsRendererRasterPropertiesWidget::mResetColorRenderingBtn_clicked );
67 
68  _initRendererWidgetFunctions();
69 
70  mZoomedInResamplingComboBox->insertItem( 0, tr( "Nearest neighbour" ) );
71  mZoomedInResamplingComboBox->insertItem( 1, tr( "Bilinear" ) );
72  mZoomedInResamplingComboBox->insertItem( 2, tr( "Cubic" ) );
73  mZoomedOutResamplingComboBox->insertItem( 0, tr( "Nearest neighbour" ) );
74  mZoomedOutResamplingComboBox->insertItem( 1, tr( "Average" ) );
75 
76  connect( cboRenderers, static_cast<void ( QComboBox::* )( int )>( &QComboBox::currentIndexChanged ), this, &QgsRendererRasterPropertiesWidget::rendererChanged );
77 
78  connect( mSliderBrightness, &QAbstractSlider::valueChanged, mBrightnessSpinBox, &QSpinBox::setValue );
79  connect( mBrightnessSpinBox, static_cast < void ( QSpinBox::* )( int ) > ( &QSpinBox::valueChanged ), mSliderBrightness, &QAbstractSlider::setValue );
80 
81  connect( mSliderContrast, &QAbstractSlider::valueChanged, mContrastSpinBox, &QSpinBox::setValue );
82  connect( mContrastSpinBox, static_cast < void ( QSpinBox::* )( int ) > ( &QSpinBox::valueChanged ), mSliderContrast, &QAbstractSlider::setValue );
83 
84  // Connect saturation slider and spin box
85  connect( sliderSaturation, &QAbstractSlider::valueChanged, spinBoxSaturation, &QSpinBox::setValue );
86  connect( spinBoxSaturation, static_cast < void ( QSpinBox::* )( int ) > ( &QSpinBox::valueChanged ), sliderSaturation, &QAbstractSlider::setValue );
87 
88  // Connect colorize strength slider and spin box
89  connect( sliderColorizeStrength, &QAbstractSlider::valueChanged, spinColorizeStrength, &QSpinBox::setValue );
90  connect( spinColorizeStrength, static_cast < void ( QSpinBox::* )( int ) > ( &QSpinBox::valueChanged ), sliderColorizeStrength, &QAbstractSlider::setValue );
91 
92  // enable or disable saturation slider and spin box depending on grayscale combo choice
93  connect( comboGrayscale, static_cast<void ( QComboBox::* )( int )>( &QComboBox::currentIndexChanged ), this, &QgsRendererRasterPropertiesWidget::toggleSaturationControls );
94 
95  // enable or disable colorize colorbutton with colorize checkbox
96  connect( mColorizeCheck, &QAbstractButton::toggled, this, &QgsRendererRasterPropertiesWidget::toggleColorizeControls );
97 
98  // Just connect the spin boxes because the sliders update the spinners
99  connect( mBrightnessSpinBox, static_cast < void ( QSpinBox::* )( int ) > ( &QSpinBox::valueChanged ), this, &QgsPanelWidget::widgetChanged );
100  connect( mContrastSpinBox, static_cast < void ( QSpinBox::* )( int ) > ( &QSpinBox::valueChanged ), this, &QgsPanelWidget::widgetChanged );
101  connect( spinBoxSaturation, static_cast < void ( QSpinBox::* )( int ) > ( &QSpinBox::valueChanged ), this, &QgsPanelWidget::widgetChanged );
102  connect( spinColorizeStrength, static_cast < void ( QSpinBox::* )( int ) > ( &QSpinBox::valueChanged ), this, &QgsPanelWidget::widgetChanged );
103  connect( btnColorizeColor, &QgsColorButton::colorChanged, this, &QgsPanelWidget::widgetChanged );
104 
105  connect( mBlendModeComboBox, static_cast<void ( QComboBox::* )( int )>( &QComboBox::currentIndexChanged ), this, &QgsPanelWidget::widgetChanged );
106  connect( mZoomedInResamplingComboBox, static_cast<void ( QComboBox::* )( int )>( &QComboBox::currentIndexChanged ), this, &QgsPanelWidget::widgetChanged );
107  connect( mZoomedOutResamplingComboBox, static_cast<void ( QComboBox::* )( int )>( &QComboBox::currentIndexChanged ), this, &QgsPanelWidget::widgetChanged );
108  connect( mMaximumOversamplingSpinBox, static_cast < void ( QDoubleSpinBox::* )( double ) > ( &QDoubleSpinBox::valueChanged ), this, &QgsPanelWidget::widgetChanged );
109 
110  // finally sync to the layer - even though some actions may emit widgetChanged signal,
111  // this is not a problem - nobody is listening to our signals yet
112  syncToLayer( mRasterLayer );
113 
114  connect( mRasterLayer, &QgsMapLayer::styleChanged, this, &QgsRendererRasterPropertiesWidget::refreshAfterStyleChanged );
115 }
116 
118 {
119  mMapCanvas = canvas;
120 }
121 
123 {
124  QString rendererName = cboRenderers->currentData().toString();
125  setRendererWidget( rendererName );
126  emit widgetChanged();
127 }
128 
130 {
131 
132  if ( ! mRasterLayer->isValid() )
133  return;
134 
135  mRasterLayer->brightnessFilter()->setBrightness( mSliderBrightness->value() );
136  mRasterLayer->brightnessFilter()->setContrast( mSliderContrast->value() );
137 
138  QgsRasterRendererWidget *rendererWidget = dynamic_cast<QgsRasterRendererWidget *>( stackedWidget->currentWidget() );
139  if ( rendererWidget )
140  {
141  rendererWidget->doComputations();
142 
143  QgsRasterRenderer *newRenderer = rendererWidget->renderer();
144 
145  // there are transparency related data stored in renderer instances, but they
146  // are not configured in the widget, so we need to copy them over from existing renderer
147  QgsRasterRenderer *oldRenderer = mRasterLayer->renderer();
148  if ( oldRenderer )
149  newRenderer->copyCommonProperties( oldRenderer, false );
150  mRasterLayer->setRenderer( newRenderer );
151  }
152 
153  // Hue and saturation controls
154  QgsHueSaturationFilter *hueSaturationFilter = mRasterLayer->hueSaturationFilter();
155  if ( hueSaturationFilter )
156  {
157  hueSaturationFilter->setSaturation( sliderSaturation->value() );
158  hueSaturationFilter->setGrayscaleMode( ( QgsHueSaturationFilter::GrayscaleMode ) comboGrayscale->currentIndex() );
159  hueSaturationFilter->setColorizeOn( mColorizeCheck->checkState() );
160  hueSaturationFilter->setColorizeColor( btnColorizeColor->color() );
161  hueSaturationFilter->setColorizeStrength( sliderColorizeStrength->value() );
162  }
163 
164  QgsRasterResampleFilter *resampleFilter = mRasterLayer->resampleFilter();
165  if ( resampleFilter )
166  {
167  QgsRasterResampler *zoomedInResampler = nullptr;
168  QString zoomedInResamplingMethod = mZoomedInResamplingComboBox->currentText();
169  if ( zoomedInResamplingMethod == tr( "Bilinear" ) )
170  {
171  zoomedInResampler = new QgsBilinearRasterResampler();
172  }
173  else if ( zoomedInResamplingMethod == tr( "Cubic" ) )
174  {
175  zoomedInResampler = new QgsCubicRasterResampler();
176  }
177 
178  resampleFilter->setZoomedInResampler( zoomedInResampler );
179 
180  //raster resampling
181  QgsRasterResampler *zoomedOutResampler = nullptr;
182  QString zoomedOutResamplingMethod = mZoomedOutResamplingComboBox->currentText();
183  if ( zoomedOutResamplingMethod == tr( "Average" ) )
184  {
185  zoomedOutResampler = new QgsBilinearRasterResampler();
186  }
187 
188  resampleFilter->setZoomedOutResampler( zoomedOutResampler );
189 
190  resampleFilter->setMaxOversampling( mMaximumOversamplingSpinBox->value() );
191  }
192 
193  mRasterLayer->setBlendMode( mBlendModeComboBox->blendMode() );
194 }
195 
197 {
198  mRasterLayer = layer;
199 
200  cboRenderers->blockSignals( true );
201  cboRenderers->clear();
203  const auto constRenderersList = QgsApplication::rasterRendererRegistry()->renderersList();
204  for ( const QString &name : constRenderersList )
205  {
206  if ( QgsApplication::rasterRendererRegistry()->rendererData( name, entry ) )
207  {
208  if ( ( mRasterLayer->rasterType() != QgsRasterLayer::ColorLayer && entry.name != QLatin1String( "singlebandcolordata" ) ) ||
209  ( mRasterLayer->rasterType() == QgsRasterLayer::ColorLayer && entry.name == QLatin1String( "singlebandcolordata" ) ) )
210  {
211  cboRenderers->addItem( entry.icon(), entry.visibleName, entry.name );
212  }
213  }
214  }
215  cboRenderers->setCurrentIndex( -1 );
216  cboRenderers->blockSignals( false );
217 
218  QgsRasterRenderer *renderer = mRasterLayer->renderer();
219  if ( renderer )
220  {
221  setRendererWidget( renderer->type() );
222  }
223 
224  QgsBrightnessContrastFilter *brightnessFilter = mRasterLayer->brightnessFilter();
225  if ( brightnessFilter )
226  {
227  mSliderBrightness->setValue( brightnessFilter->brightness() );
228  mSliderContrast->setValue( brightnessFilter->contrast() );
229  }
230 
231  btnColorizeColor->setColorDialogTitle( tr( "Select Color" ) );
232  btnColorizeColor->setContext( QStringLiteral( "symbology" ) );
233 
234  // Hue and saturation color control
235  const QgsHueSaturationFilter *hueSaturationFilter = mRasterLayer->hueSaturationFilter();
236  //set hue and saturation controls to current values
237  if ( hueSaturationFilter )
238  {
239  sliderSaturation->setValue( hueSaturationFilter->saturation() );
240  comboGrayscale->setCurrentIndex( ( int ) hueSaturationFilter->grayscaleMode() );
241 
242  // Set initial state of saturation controls based on grayscale mode choice
243  toggleSaturationControls( static_cast<int>( hueSaturationFilter->grayscaleMode() ) );
244 
245  // Set initial state of colorize controls
246  mColorizeCheck->setChecked( hueSaturationFilter->colorizeOn() );
247  btnColorizeColor->setColor( hueSaturationFilter->colorizeColor() );
248  toggleColorizeControls( hueSaturationFilter->colorizeOn() );
249  sliderColorizeStrength->setValue( hueSaturationFilter->colorizeStrength() );
250  }
251 
252  //blend mode
253  mBlendModeComboBox->setBlendMode( mRasterLayer->blendMode() );
254 
255  const QgsRasterResampleFilter *resampleFilter = mRasterLayer->resampleFilter();
256  //set combo boxes to current resampling types
257  if ( resampleFilter )
258  {
259  const QgsRasterResampler *zoomedInResampler = resampleFilter->zoomedInResampler();
260  if ( zoomedInResampler )
261  {
262  if ( zoomedInResampler->type() == QLatin1String( "bilinear" ) )
263  {
264  mZoomedInResamplingComboBox->setCurrentIndex( 1 );
265  }
266  else if ( zoomedInResampler->type() == QLatin1String( "cubic" ) )
267  {
268  mZoomedInResamplingComboBox->setCurrentIndex( 2 );
269  }
270  }
271  else
272  {
273  mZoomedInResamplingComboBox->setCurrentIndex( 0 );
274  }
275 
276  const QgsRasterResampler *zoomedOutResampler = resampleFilter->zoomedOutResampler();
277  if ( zoomedOutResampler )
278  {
279  if ( zoomedOutResampler->type() == QLatin1String( "bilinear" ) ) //bilinear resampler does averaging when zooming out
280  {
281  mZoomedOutResamplingComboBox->setCurrentIndex( 1 );
282  }
283  }
284  else
285  {
286  mZoomedOutResamplingComboBox->setCurrentIndex( 0 );
287  }
288  mMaximumOversamplingSpinBox->setValue( resampleFilter->maxOversampling() );
289  }
290 }
291 
292 void QgsRendererRasterPropertiesWidget::mResetColorRenderingBtn_clicked()
293 {
294  mBlendModeComboBox->setBlendMode( QPainter::CompositionMode_SourceOver );
295  mSliderBrightness->setValue( 0 );
296  mSliderContrast->setValue( 0 );
297  sliderSaturation->setValue( 0 );
298  comboGrayscale->setCurrentIndex( ( int ) QgsHueSaturationFilter::GrayscaleOff );
299  mColorizeCheck->setChecked( false );
300  sliderColorizeStrength->setValue( 100 );
301 }
302 
303 void QgsRendererRasterPropertiesWidget::toggleSaturationControls( int grayscaleMode )
304 {
305  // Enable or disable saturation controls based on choice of grayscale mode
306  if ( grayscaleMode == 0 )
307  {
308  sliderSaturation->setEnabled( true );
309  spinBoxSaturation->setEnabled( true );
310  }
311  else
312  {
313  sliderSaturation->setEnabled( false );
314  spinBoxSaturation->setEnabled( false );
315  }
316  emit widgetChanged();
317 }
318 
319 void QgsRendererRasterPropertiesWidget::toggleColorizeControls( bool colorizeEnabled )
320 {
321  // Enable or disable colorize controls based on checkbox
322  btnColorizeColor->setEnabled( colorizeEnabled );
323  sliderColorizeStrength->setEnabled( colorizeEnabled );
324  spinColorizeStrength->setEnabled( colorizeEnabled );
325  emit widgetChanged();
326 }
327 
328 void QgsRendererRasterPropertiesWidget::setRendererWidget( const QString &rendererName )
329 {
330  QgsDebugMsg( "rendererName = " + rendererName );
331  QgsRasterRendererWidget *oldWidget = mRendererWidget;
332  QgsRasterRenderer *oldRenderer = mRasterLayer->renderer();
333 
334  int alphaBand = -1;
335  double opacity = 1;
336  if ( oldRenderer )
337  {
338  // Retain alpha band and opacity when switching renderer
339  alphaBand = oldRenderer->alphaBand();
340  opacity = oldRenderer->opacity();
341  }
342 
343  QgsRasterRendererRegistryEntry rendererEntry;
344  if ( QgsApplication::rasterRendererRegistry()->rendererData( rendererName, rendererEntry ) )
345  {
346  if ( rendererEntry.widgetCreateFunction ) // Single band color data renderer e.g. has no widget
347  {
348  QgsDebugMsg( QStringLiteral( "renderer has widgetCreateFunction" ) );
349  // Current canvas extent (used to calc min/max) in layer CRS
351  if ( oldWidget )
352  {
353  if ( rendererName == QLatin1String( "singlebandgray" ) )
354  {
355  whileBlocking( mRasterLayer )->setRenderer( QgsApplication::rasterRendererRegistry()->defaultRendererForDrawingStyle( QgsRaster::SingleBandGray, mRasterLayer->dataProvider() ) );
356  whileBlocking( mRasterLayer )->setDefaultContrastEnhancement();
357  }
358  else if ( rendererName == QLatin1String( "multibandcolor" ) )
359  {
360  whileBlocking( mRasterLayer )->setRenderer( QgsApplication::rasterRendererRegistry()->defaultRendererForDrawingStyle( QgsRaster::MultiBandColor, mRasterLayer->dataProvider() ) );
361  whileBlocking( mRasterLayer )->setDefaultContrastEnhancement();
362  }
363  }
364  mRasterLayer->renderer()->setAlphaBand( alphaBand );
365  mRasterLayer->renderer()->setOpacity( opacity );
366  mRendererWidget = rendererEntry.widgetCreateFunction( mRasterLayer, myExtent );
367  mRendererWidget->setMapCanvas( mMapCanvas );
368  connect( mRendererWidget, &QgsRasterRendererWidget::widgetChanged, this, &QgsPanelWidget::widgetChanged );
369  stackedWidget->addWidget( mRendererWidget );
370  stackedWidget->setCurrentWidget( mRendererWidget );
371  if ( oldWidget )
372  {
373  // Compare used bands in new and old renderer and reset transparency dialog if different
374  QgsRasterRenderer *oldRenderer = oldWidget->renderer();
375  QgsRasterRenderer *newRenderer = mRendererWidget->renderer();
376 #if 0
377  QList<int> oldBands = oldRenderer->usesBands();
378  QList<int> newBands = newRenderer->usesBands();
379 
380  if ( oldBands != newBands )
381  {
382  populateTransparencyTable( newRenderer );
383  }
384 #endif
385 
386  delete oldRenderer;
387  delete newRenderer;
388  }
389  }
390  }
391 
392  if ( mRendererWidget != oldWidget )
393  delete oldWidget;
394 
395  int widgetIndex = cboRenderers->findData( rendererName );
396  if ( widgetIndex != -1 )
397  {
398  whileBlocking( cboRenderers )->setCurrentIndex( widgetIndex );
399  }
400 
401 }
402 
403 void QgsRendererRasterPropertiesWidget::refreshAfterStyleChanged()
404 {
405  if ( mRendererWidget )
406  {
407  QgsRasterRenderer *renderer = mRasterLayer->renderer();
408  if ( QgsMultiBandColorRenderer *mbcr = dynamic_cast<QgsMultiBandColorRenderer *>( renderer ) )
409  {
410  const QgsContrastEnhancement *redCe = mbcr->redContrastEnhancement();
411  if ( redCe )
412  {
413  mRendererWidget->setMin( QString::number( redCe->minimumValue() ), 0 );
414  mRendererWidget->setMax( QString::number( redCe->maximumValue() ), 0 );
415  }
416  const QgsContrastEnhancement *greenCe = mbcr->greenContrastEnhancement();
417  if ( greenCe )
418  {
419  mRendererWidget->setMin( QString::number( greenCe->minimumValue() ), 1 );
420  mRendererWidget->setMax( QString::number( greenCe->maximumValue() ), 1 );
421  }
422  const QgsContrastEnhancement *blueCe = mbcr->blueContrastEnhancement();
423  if ( blueCe )
424  {
425  mRendererWidget->setMin( QString::number( blueCe->minimumValue() ), 2 );
426  mRendererWidget->setMax( QString::number( blueCe->maximumValue() ), 2 );
427  }
428  }
429  else if ( QgsSingleBandGrayRenderer *sbgr = dynamic_cast<QgsSingleBandGrayRenderer *>( renderer ) )
430  {
431  const QgsContrastEnhancement *ce = sbgr->contrastEnhancement();
432  if ( ce )
433  {
434  mRendererWidget->setMin( QString::number( ce->minimumValue() ) );
435  mRendererWidget->setMax( QString::number( ce->maximumValue() ) );
436  }
437  }
438  }
439 }
A panel widget that can be shown in the map style dock.
double maximumValue() const
Returns the maximum value for the contrast enhancement range.
A rectangle specified with double values.
Definition: qgsrectangle.h:41
Base class for all map layer types.
Definition: qgsmaplayer.h:78
Cubic Raster Resampler.
Interface for resampling rasters (e.g.
QgsHueSaturationFilter * hueSaturationFilter() const
virtual QList< int > usesBands() const
Returns a list of band numbers used by the renderer.
double opacity() const
Returns the opacity for the renderer, where opacity is a value between 0 (totally transparent) and 1...
QgsRasterRendererWidgetCreateFunc widgetCreateFunction
void setColorizeColor(const QColor &colorizeColor)
void setRenderer(QgsRasterRenderer *renderer)
Sets raster renderer. Takes ownership of the renderer object.
#define QgsDebugMsg(str)
Definition: qgslogger.h:38
This class provides qgis with the ability to render raster datasets onto the mapcanvas.
QgsRectangle outputExtentToLayerExtent(const QgsMapLayer *layer, QgsRectangle extent) const
transform bounding box from output CRS to layer&#39;s CRS
virtual QString type() const
double minimumValue() const
Returns the minimum value for the contrast enhancement range.
Resample filter pipe for rasters.
void syncToLayer(QgsRasterLayer *layer)
Sync the widget to the given layer.
QgsRasterRenderer * renderer() const
bool isValid() const
Returns the status of the layer.
void setBlendMode(QPainter::CompositionMode blendMode)
Set the blending mode used for rendering a layer.
Map canvas is a class for displaying all GIS data types on a canvas.
Definition: qgsmapcanvas.h:73
void styleChanged()
Signal emitted whenever a change affects the layer&#39;s style.
virtual void setMapCanvas(QgsMapCanvas *canvas)
Sets the map canvas associated with the widget.
QgsBrightnessContrastFilter * brightnessFilter() const
static QgsRasterRendererWidget * create(QgsRasterLayer *layer, const QgsRectangle &extent)
virtual void setMax(const QString &value, int index=0)
QgsRasterDataProvider * dataProvider() override
Returns the layer&#39;s data provider, it may be nullptr.
static QgsRasterRendererWidget * create(QgsRasterLayer *layer, const QgsRectangle &extent)
Creates new raster renderer widget.
QgsRendererRasterPropertiesWidget(QgsMapLayer *layer, QgsMapCanvas *canvas, QWidget *parent=nullptr)
A widget to hold the renderer properties for a raster layer.
virtual QString type() const =0
Gets a descriptive type identifier for this raster resampler.
void copyCommonProperties(const QgsRasterRenderer *other, bool copyMinMaxOrigin=true)
Copies common properties like opacity / transparency data from other renderer.
QgsRectangle extent() const
Returns the current zoom extent of the map canvas.
Raster renderer pipe for single band gray.
LayerType rasterType()
Returns the raster layer type (which is a read only property).
void setAlphaBand(int band)
void setColorizeOn(bool colorizeOn)
static QgsRasterRendererWidget * create(QgsRasterLayer *layer, const QgsRectangle &extent)
void widgetChanged()
Emitted when the widget state changes.
void apply() override
Apply the changes from the dialog to the layer.
const QgsMapSettings & mapSettings() const
Gets access to properties used for map rendering.
Registry for raster renderer entries.
void setMapCanvas(QgsMapCanvas *canvas)
Sets the map canvas associated with the dialog.
void colorChanged(const QColor &color)
Emitted whenever a new color is set for the button.
void rendererChanged()
called when user changes renderer type
virtual void doComputations()
Load programmatically with current values.
QgsHueSaturationFilter::GrayscaleMode grayscaleMode() const
QgsSignalBlocker< Object > whileBlocking(Object *object)
Temporarily blocks signals from a QObject while calling a single method from the object.
Definition: qgis.h:212
void setZoomedInResampler(QgsRasterResampler *r)
Sets resampler for zoomed in scales. Takes ownership of the object.
QgsRasterResampleFilter * resampleFilter() const
Sets raster resample filter. Takes ownership of the resample filter object.
static QgsRasterRendererWidget * create(QgsRasterLayer *layer, const QgsRectangle &extent)
Factory method to create the renderer for this type.
Brightness/contrast filter pipe for rasters.
Bilinear Raster Resampler.
const QgsRasterResampler * zoomedOutResampler() const
Color and saturation filter pipe for rasters.
void setZoomedOutResampler(QgsRasterResampler *r)
Sets resampler for zoomed out scales. Takes ownership of the object.
Renderer for multiband images with the color components.
Manipulates raster pixel values so that they enhanceContrast or clip into a specified numerical range...
virtual void setMin(const QString &value, int index=0)
void setColorizeStrength(int colorizeStrength)
void setOpacity(double opacity)
Sets the opacity for the renderer, where opacity is a value between 0 (totally transparent) and 1...
void widgetChanged()
Emitted when something on the widget has changed.
virtual QgsRasterRenderer * renderer()=0
void insertWidgetFunction(const QString &rendererName, QgsRasterRendererWidgetCreateFunc func)
static QgsRasterRendererRegistry * rasterRendererRegistry()
Returns the application&#39;s raster renderer registry, used for managing raster layer renderers...
Raster renderer pipe that applies colors to a raster.
static QgsRasterRendererWidget * create(QgsRasterLayer *layer, const QgsRectangle &extent)
QPainter::CompositionMode blendMode() const
Returns the current blending mode for a layer.
void setGrayscaleMode(QgsHueSaturationFilter::GrayscaleMode grayscaleMode)
void setSaturation(int saturation)
const QgsRasterResampler * zoomedInResampler() const