@@ -3680,6 +3680,39 @@ void QgsRasterLayer::thumbnailAsPixmap( QPixmap * theQPixmap )
3680
3680
3681
3681
}
3682
3682
3683
+ void QgsRasterLayer::thumbnailAsImage ( QImage * thepImage )
3684
+ {
3685
+ // TODO: This should be depreciated and a new function written that just returns a new QImage, it will be safer
3686
+ if ( 0 == thepImage ) { return ; }
3687
+
3688
+ thepImage->fill (Qt::white); // defaults to white
3689
+
3690
+ // Raster providers are disabled (for the moment)
3691
+ if ( mProviderKey .isEmpty () )
3692
+ {
3693
+ QgsRasterViewPort *myRasterViewPort = new QgsRasterViewPort ();
3694
+ myRasterViewPort->rectXOffset = 0 ;
3695
+ myRasterViewPort->rectYOffset = 0 ;
3696
+ myRasterViewPort->clippedXMin = 0 ;
3697
+ myRasterViewPort->clippedXMax = mWidth ;
3698
+ myRasterViewPort->clippedYMin = mHeight ;
3699
+ myRasterViewPort->clippedYMax = 0 ;
3700
+ myRasterViewPort->clippedWidth = mWidth ;
3701
+ myRasterViewPort->clippedHeight = mHeight ;
3702
+ myRasterViewPort->topLeftPoint = QgsPoint ( 0 , 0 );
3703
+ myRasterViewPort->bottomRightPoint = QgsPoint ( thepImage->width (), thepImage->height () );
3704
+ myRasterViewPort->drawableAreaXDim = thepImage->width ();
3705
+ myRasterViewPort->drawableAreaYDim = thepImage->height ();
3706
+
3707
+ QPainter * myQPainter = new QPainter ( thepImage );
3708
+ draw ( myQPainter, myRasterViewPort );
3709
+ delete myRasterViewPort;
3710
+ myQPainter->end ();
3711
+ delete myQPainter;
3712
+ }
3713
+
3714
+ }
3715
+
3683
3716
void QgsRasterLayer::triggerRepaint ()
3684
3717
{
3685
3718
emit repaintRequested ();
0 commit comments