Skip to content

Commit

Permalink
scale SVG
Browse files Browse the repository at this point in the history
git-svn-id: http://svn.osgeo.org/qgis/trunk/qgis@4860 c8812cc2-4d05-0410-92ff-de0c093fc19c
  • Loading branch information
rblazek committed Feb 15, 2006
1 parent 97ac905 commit e088e62
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions src/plugins/grass/qgsgrassmodule.cpp
Expand Up @@ -30,6 +30,7 @@
#include <qinputdialog.h>
#include <qsettings.h>
#include <qpainter.h>
#include <q3painter.h>
#include <qpixmap.h>
#include <qpen.h>
#include <q3pointarray.h>
Expand Down Expand Up @@ -501,12 +502,17 @@ QPixmap QgsGrassModule::pixmap ( QString path, int height )
QRect br = pic.boundingRect();

double scale = 1. * height / br.height();

int width = (int) ( scale * br.width() );
if ( width <= 0 ) width = height; //should not happen
QPixmap pixmap ( width, height );
pixmap.fill ( QColor(255,255,255) );
QPainter painter ( &pixmap );

// I am not sure if this factor is OK
scale *= 72.0 / pixmap.logicalDpiX() ;
painter.scale ( scale, scale );

painter.drawPicture ( -br.x(), -br.y(), pic );
painter.end();

Expand Down

0 comments on commit e088e62

Please sign in to comment.