Tuesday, July 11, 2006

KolourPaint paint engine experiment works

Today was one of those days where I started out thinking "I should really do some real [thesis] work today ... but half an hour of KDE hacking first can't hurt ..." Naturally, it is now almost midnight and the only thing I have done is KDE hacking. Maybe KDE programming has a secret ingredient that makes it addictive - NiKotine?

Anyway, given the sweeping Qt4 changes in the painting classes, I was extremely worried that it would not be possible to port the KolourPaint backend such that it would a) still perform OK b) support both XRENDER and non-XRENDER. In the meantime, I was fighting a battle to simply get KolourPaint compiling given the pace of kdelibs changes (see my previous blog entry's comments for an example). But today, I finally managed to hack around the last few important QPixmap/QPainter bugs and can demonstrate some 100% working tools: the Rectangle, Rounded Rectangle, Ellipse, Line, Connected Lines, Curve and Polygon:



[Note: if you appreciate abstract art and can see some deep meaning in the picture that I did not intend, feel free to contact me for licensing terms :)]

From this screenie, it should be obvious that KDE's new toolbar default of "Text Under Icons" does not work unless one has a screen with 5,000 x 5,000 resolution. As for why the Tool Box is in such a weird place and orientation, the short version is: breakages due to KToolBar changes. I will fix this and the longstanding problem of unconfigurable icon size by creating a new KToolPalette class after LiveUi (aka. XMLGUI2) is merged into trunk as I expect the merge will break all underlying assumptions all over again. Hopefully, blackarrow / Hamish Rodda will implement the class before I do so that I won't have to do any work :)

Previously, I got KolourPaint to not suck 100% of CPU doing QPixmap -> QImage -> QPixmap translations for opaque drawing operations but transparency was still unreliable and really slow. Now, I have opaque and transparent operations working with and without XRENDER.

So now that I have the underlying infrastructure working, porting the rest of the tools should be fairly straightforward and more importantly, now appears possible. Expect a set of fully working tools real soon now.

But don't use it for anything serious yet: shortcuts don't work (must have checked out kdelibs at a bad time), attempting to save causes a crash in kdelibs (yes, my previous piece of abstract painting was much better):


ASSERT: "d" in file /home/kde4/dist/include/ksharedptr.h, line 108
Aborted


I doubt the clipboard works due to the Qt4 changes and more importantly, I have rigged up assertions such that almost any tool not in the above list will cause KolourPaint to crash as the way they play with the paint engine violates some invariants. Sorry.

Finally, given the amount of time I've wasted hacking around QPainter bugs (read my commit messages and see), I'm going to try to charge Trolltech for bug reports (hey, they charge for the toolkit). Wish me luck :)

3 comments:

Anonymous said...

All I see is you complaining a lot without giving absolutely any subsential evidence for your claims. For example I know I haven't gotten any emails from you. Unfortunately support through telapathy is not one of the services I offer.
If it's such a hassle, then don't port your code, no one is forcing you.

Zack

Clarence Dang said...

> All I see is you complaining a lot
> without giving absolutely any subsential
> evidence for your claims.

Here are two appetisers:

http://lists.kde.org/?l=kde-commits&m=115260407831522&w=2
http://lists.kde.org/?l=kde-commits&m=115261146223374&w=2

From memory, previous blog entries contain some others about the graphics system. Some others non-graphics related I've already reported (see task tracker items 121507, 121547, 120866 - feel free to look for my other ones). I report too many bugs already.

> For example I know I
> haven't gotten any emails from you.

I certainly emailed Gunnar 1 or 2 and some other concerns. No reply yet...

In any case, KDE apps act as free advertising for Qt. On top of this, I provide free bug reports for Trolltech's benefit - not mine. So it follows I should not give away all my time reporting bugs.

> Unfortunately support through telapathy
> is not one of the services I offer.

Wasting my time fighting the library's bugs, then producing a nice testcase and then dealing with the additional communication ("sorry, that's a feature" or "could you explain precisely what you mean by") is definitely not a service I would like to offer for free. But I do it anyway and have not had the time to do the exact bug reporting for all the bugs I encounter. Aren't I allowed to be frustrated by the number of bugs I bump into in a single day and not report them, in precise terms, yet?

> If it's such a hassle, then don't port
> your code, no one is forcing you.

Of course not, no pressure at all: the app just dies if it doesn't get ported.

Fontana Painters said...

Lovely blog, thanks for taking the time to share this.