38 if ( !p || !
mIterator || !viewPort || !theQgsMapToPixel )
60 &block, topLeftCol, topLeftRow ) )
68 QImage img = block->
image();
72 QPrinter *printer =
dynamic_cast<QPrinter *
>( p->device() );
73 if ( printer && printer->outputFormat() == QPrinter::PdfFormat )
77 img = img.convertToFormat( QImage::Format_ARGB32 );
78 QRgb transparentBlack = qRgba( 0, 0, 0, 0 );
79 QRgb transparentWhite = qRgba( 255, 255, 255, 0 );
80 for (
int x = 0; x < img.width(); x++ )
82 for (
int y = 0; y < img.height(); y++ )
84 if ( img.pixel( x, y ) == transparentBlack )
86 img.setPixel( x, y, transparentWhite );
92 drawImage( p, viewPort, img, topLeftCol, topLeftRow );
100 if ( !p || !viewPort )
108 p->setRenderHint( QPainter::Antialiasing,
false );
113 p->setBrush( QBrush( QColor( Qt::white ), Qt::NoBrush ) );
115 p->drawImage( tlPoint, img );
Iterator for sequentially processing raster cells.
void startRasterRead(int bandNumber, int nCols, int nRows, const QgsRectangle &extent)
Start reading of raster band.
int mWidth
Width, number of columns to be rendered.
void drawImage(QPainter *p, QgsRasterViewPort *viewPort, const QImage &img, int topLeftCol, int topLeftRow) const
Draws raster part.
void draw(QPainter *p, QgsRasterViewPort *viewPort, const QgsMapToPixel *theQgsMapToPixel)
Perform transforms between map coordinates and device coordinates.
QgsRasterDrawer(QgsRasterIterator *iterator)
bool readNextRasterPart(int bandNumber, int &nCols, int &nRows, QgsRasterBlock **block, int &topLeftCol, int &topLeftRow)
Fetches next part of raster data, caller takes ownership of the block and caller should delete the bl...
int mHeight
Distance in map units from bottom edge to top edge for the part of the raster that is to be rendered...
QgsRasterIterator * mIterator
QImage image() const
Get image if type is color.
QgsPoint mTopLeftPoint
Coordinate (in output device coordinate system) of top left corner of the part of the raster that is ...
This class provides details of the viewable area that a raster will be rendered into.
QgsRectangle mDrawnExtent
Intersection of current map extent and layer extent.