Project

General

Profile

Bug #109

wrong position in function Wpainter::drawImage

Added by Anonymous over 12 years ago. Updated over 12 years ago.

Status:
Closed
Priority:
Normal
Assignee:
Target version:
-
Start date:
10/06/2009
Due date:
% Done:

0%

Estimated time:

Description

The function WSvgImage::drawImage(...) produces a wrong transformation string if the image size must be transformed.

See my correction in the following code:

void WSvgImage::drawImage(const WRectF& rect, const std::string& imageUri,

int imgWidth, int imgHeight,

const WRectF& srect)

{

:

:

if (drect.width() != srect.width()

|| drect.height() != srect.height()) {

shapes_ << "<"SVG"g transform=\"matrix(\"

<< Utils::round_str(drect.width() / srect.width(), 3, buf);

shapes_ << \" 0 0 \"

<< Utils::round_str(drect.height() / srect.height(), 3, buf);

// WP: 05.10.2009

// !!! wrong result in shapes_ (reason is double piping of function Utils::round_str(...)) !!!

// for example: drect.x() = 8.75 and drect.y() = 6.0

// instead of

// shapes_ ... transform=\"matrix(0.5, 0, 0, 0.5, 8.75, 6)\">
// the result is
// shapes_ ... transform="matrix(0.5, 0, 0, 0.5, 8.75, 8.75)">

//

// shapes_ << ' ' << Utils::round_str(drect.x(), 3, buf)

// << ' ' << Utils::round_str(drect.y(), 3, buf)

// << ")\">\";

shapes_ << ' ' << Utils::round_str(drect.x(), 3, buf);

shapes_ << ' ' << Utils::round_str(drect.y(), 3, buf) << ")\">\";

drect = WRectF(0, 0, srect.width(), srect.height());

transformed = true;

}

:

:

#1

Updated by Koen Deforche over 12 years ago

  • Status changed from New to Closed

That was wrong, and the fix is right.

Also available in: Atom PDF