Skip to content
Permalink
Browse files

Add asImage method for QgsSymbol

  • Loading branch information
NathanW2 committed Sep 19, 2014
1 parent 11be64d commit 8c327ed35e5b99918c2c9b2a09ce3d6791c7a023
@@ -85,6 +85,8 @@ class QgsSymbolV2
//! @note customContext parameter added in 2.6
void drawPreviewIcon( QPainter* painter, QSize size, QgsRenderContext* customContext = 0 );

QImage asImage( QSize size, QgsRenderContext* customContext = 0 );

QImage bigSymbolPreviewImage();

QString dump() const;
@@ -308,6 +308,19 @@ void QgsSymbolV2::drawPreviewIcon( QPainter* painter, QSize size, QgsRenderConte
}
}

QImage QgsSymbolV2::asImage( QSize size, QgsRenderContext* customContext )
{
QImage image( size , QImage::Format_ARGB32_Premultiplied );
image.fill( 0 );

QPainter p( &image );
p.setRenderHint( QPainter::Antialiasing );

drawPreviewIcon( &p, size, customContext );

return image;
}


QImage QgsSymbolV2::bigSymbolPreviewImage()
{
@@ -110,6 +110,8 @@ class CORE_EXPORT QgsSymbolV2
//! @note customContext parameter added in 2.6
void drawPreviewIcon( QPainter* painter, QSize size, QgsRenderContext* customContext = 0 );

QImage asImage( QSize size, QgsRenderContext* customContext = 0 );

QImage bigSymbolPreviewImage();

QString dump() const;

0 comments on commit 8c327ed

Please sign in to comment.
You can’t perform that action at this time.