[prev in list] [next in list] [prev in thread] [next in thread]
List: kde-bugs-dist
Subject: [Bug 128278] Symbol scaling is wrong when printing
From: Andrew Walker <arwalker () sumusltd ! com>
Date: 2006-06-01 16:00:45
Message-ID: 20060601160045.13429.qmail () ktown ! kde ! org
[Download RAW message or body]
------- You are receiving this mail because: -------
You are on the CC list for the bug, or are watching someone who is.
http://bugs.kde.org/show_bug.cgi?id=128278
arwalker sumusltd com changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|NEW |RESOLVED
Resolution| |FIXED
------- Additional Comments From arwalker sumusltd com 2006-06-01 18:00 -------
SVN commit 547292 by arwalker:
BUG:128278 Better scale symbols when printing.
M +8 -4 kstpainter.cpp
M +21 -10 kstvcurve.cpp
--- trunk/extragear/graphics/kst/src/libkstmath/kstpainter.cpp #547291:547292
@ -57,10 +57,14 @
int KstPainter::lineWidthAdjustmentFactor() const {
- const QRect& w(window());
- /* For square windows, the line width is in units of 0.1% of window size */
- /* For printing to Letter or A10, line width is ~in points */
- const int factor = (w.width() + w.height()) / 2000;
+ int factor = 1;
+
+ if (type() == P_PRINT || type() == P_EXPORT) {
+ const QRect& w(window());
+
+ factor = (w.width() + w.height()) / 800;
+ }
+
return factor > 0 ? factor : 1;
}
--- trunk/extragear/graphics/kst/src/libkstmath/kstvcurve.cpp #547291:547292
@ -871,8 +871,14 @
if (sampleCount() > 0) {
Qt::PenStyle style = KstLineStyle[lineStyle()];
int i0, iN;
- int width = lineWidth() * penWidth; //kMax(lineWidth(), penWidth);
-
+ int width;
+
+ if (lineWidth() == 0) {
+ width = penWidth;
+ } else {
+ width = lineWidth() * penWidth;
+ }
+
if (xv->isRising()) {
i0 = indexNearX(XMin, xv, NS);
if (i0 > 0) {
@ -1323,7 +1329,6 @
QRegion rgn((int)Lx, (int)Ly, (int)w, (int)h);
const int size = int(kMax(w, h)) / int(pow(3.0, KSTPOINTDENSITY_MAXTYPE - \
pointDensity())); QPoint pt;
- const int lineWidth = width; //this->lineWidth();
for (i_pt = i0; i_pt <= iN; ++i_pt) {
rX = xv->interpolate(i_pt, NS);
rY = yv->interpolate(i_pt, NS);
@ -1337,12 +1342,11 @
pt.setX(d2i(m_X * rX + b_X));
pt.setY(d2i(m_Y * rY + b_Y));
if (rgn.contains(pt)) {
- KstCurvePointSymbol::draw(pointType, p, pt.x(), pt.y(), lineWidth);
+ KstCurvePointSymbol::draw(pointType, p, pt.x(), pt.y(), width);
rgn -= QRegion(pt.x()-(size/2), pt.y()-(size/2), size, size, \
QRegion::Ellipse); }
}
} else {
- const int lineWidth = width; //this->lineWidth();
for (i_pt = i0; i_pt <= iN; ++i_pt) {
rX = xv->interpolate(i_pt, NS);
rY = yv->interpolate(i_pt, NS);
@ -1356,7 +1360,7 @
X1 = m_X * rX + b_X;
Y1 = m_Y * rY + b_Y;
if (X1 >= Lx && X1 <= Hx && Y1 >= Ly && Y1 <= Hy) {
- KstCurvePointSymbol::draw(pointType, p, d2i(X1), d2i(Y1), lineWidth);
+ KstCurvePointSymbol::draw(pointType, p, d2i(X1), d2i(Y1), width);
}
}
}
@ -1640,9 +1644,10 @
}
if (hasLines() && xv->isRising()) {
- // if hasLines then we should find the distance between the curve and the point, \
not the data and the point. if isRising because it is (probably) to slow to use this \
technique if the data is unordered.
-
- // borrowed from indexNearX. use binary search to find the indices immediately \
above and below our xpos. + // if hasLines then we should find the distance \
between the curve and the point, not the data and + // the point. if isRising \
because it is (probably) to slow to use this technique if the data is + // \
unordered. borrowed from indexNearX. use binary search to find the indices \
immediately above + // and below our xpos.
int i_top = NS - 1;
int i_bot = 0;
@ -1676,8 +1681,14 @
void KstVCurve::paintLegendSymbol(KstPainter *p, const QRect& bound) {
- int width = lineWidth() * p->lineWidthAdjustmentFactor();
+ int width;
+ if (lineWidth() == 0) {
+ width = p->lineWidthAdjustmentFactor();
+ } else {
+ width = lineWidth() * p->lineWidthAdjustmentFactor();
+ }
+
p->save();
if (hasLines()) {
// draw a line from left to right centered vertically
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic