Transformation issue
    Sven Langkamp 
    sven.langkamp at gmail.com
       
    Sun Dec 30 20:23:04 UTC 2012
    
    
  
Hi,
I have a strange problem with the transformations in the path stroking
feature. I try to map a path form the flake/shape layer coordinates
into image coordinates.
My original approach was based in the things we did in the shape tool:
    foreach(KoShape* shape, shapes) {
        QTransform matrix;
        matrix.scale(image->xRes(), image->yRes());
        matrix.translate(shape->position().x(), shape->position().y());
        QPainterPath mapedOutline = matrix.map(shape->outline());
        helper.paintPainterPath(mapedOutline);
    }
This works fine with a 300 dpi resolution, but when I tried it on an
imported svg file (tiger.svg) with 72 dpi resolution it doesn't work
anymore (everything appears in the upper left).
Then I tried a different approach which looked like this:
    foreach(KoShape* shape, shapes) {
        QTransform matrix = shape->absoluteTransformation(0);
        matrix.scale(image->xRes(), image->yRes());
        QPainterPath mapedOutline = matrix.map(shape->outline());
        helper.paintPainterPath(mapedOutline);
    }
This works fine with imported svg files, but breaks with the 300 dpi image.
I stuck there. Does anyone have an idea what might go wrong?
Sven
    
    
More information about the kimageshop
mailing list