[prev in list] [next in list] [prev in thread] [next in thread]
List: koffice-devel
Subject: [flake] Unit based flakes
From: Thomas Zander <zander () kde ! org>
Date: 2006-04-29 9:38:04
Message-ID: 200604291138.10640.zander () kde ! org
[Download RAW message or body]
[Attachment #2 (multipart/signed)]
This is a status update as I think this is a significant step forward for
Flake.
Remember how we spoke about flake being pixel based? Well, no more!
From now on all measurements in flake (like position and size etc) are in
postscript-points. Which is a unit just like meters is.
The commit in question;
SVN commit 535304 by zander:
This commit converts the internal format of KoShape to not be pixel based
anymore, but to be based on postscript-points. This means that a 50pt
wide box will now have the same width on screen for everybody (1.76 cm).
This has added some (needed) complexity to the paint methods. Which
extending objects will naturally see since they have to implement the
paint.
I chose to not use painter-based scaling since thats not always the right
thing to do. You can imagine an application showing at zoom 30% and all
the borders dissapearing because they are too thin. Not fun.
So, what I did was leave the choice up to the extending class. If you have
an Image-flake shape; the you can simply use Painter based scaling by
calling:
void Image::paint(QPainter &painter, KoViewConverter &converter) {
applyConversion(painter, converter);
// do rest in units of the shape itself, no conversions needed!
}
If you, on the other hand, need to do your painting more accurately
including stuff like cliprects and all; then you can use the converter
API. Like this one: (taken from KoRectangleShape)
painter.drawRect( converter.normalToView(QRectF( 0, 0,
size().width(), size().height() ) ));
I'll be updating the API docs soon. (I always wait half a day so I don't
fall in the trap of describing the wrong thing; the implementation while
you should have been describing the usage).
--
Thomas Zander
[Attachment #5 (application/pgp-signature)]
_______________________________________________
koffice-devel mailing list
koffice-devel@kde.org
https://mail.kde.org/mailman/listinfo/koffice-devel
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic