[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-devel
Subject:    Re: KPaint
From:       Nicolas Goutte <nicolasg () snafu ! de>
Date:       2003-09-08 15:08:55
[Download RAW message or body]

On Monday 08 September 2003 13:31, Michael Thaler wrote:
> Hello,

Even if I have invited you to join Krita's developement, I think that it will 
be more polite if I would try to answer your questions.  :-)

>
> I was thinking about writing a little KDE paint application. Since I
> am new to KDE programming I cannot write an application from scratch
> and I was thinking of improving kpaint. I already read through the
> source and I understand most of it (I hope).
>
> First of all, how can I compile just kpaint? I don't know how to use
> automake and I don't want to write my own Makefile. Is there a
> possibility to use the Makefile from kdegraphics and just tell it to
> only compile kpaint? There are two Makefiles in the kpaint-directory:
> Makefile.am  Makefile.in. Can they be used to create a Makefile
> somehow?

You must run ./configure

(There are files in http://developer.kde.org that explains how to build from 
source.)

>
> Second, reading through the code, I saw that there is a manager-class
> that handles the drawing tools. Why is this necessary? Wouldn't it be
> more clean to just use KRadioAction to create the toolbar for the
> drawing tools? The advantage would be, that one can use XMLUI and that
> the code is easier to read. Is there some reason, why KRadioAction is
> not used?

Probably because KPaint is so old that such classes and such possibilities did 
not exist at that time.

>
> I also think, the GUI can be improved considerably. First of all, I
> think it makes not much sense to set line properties etc. globally. It
> would be nicer to have a configuration dialoge for each tool to set
> line width, filled/not filled (e.g. for squares), rounded corners
> etc. We would get rid of at least two toolbar actions: Tool Properties
> and the Round Angle tool.

If you need such a code, I think that you can take it from Krita, which should 
already have that if I am not misinformed.

>
> I think a fill-tool would also be very nice. I guess with the current
> approach of KPaint it is not possible, because we cannot read out
> pixels from QPixmap. I think, a solution would be to paint to QPixmap
> and also to QImage and read the pixels then from QImage. GPaint has a
> fill-tool, so maybe I will have a look, how they do it.

Perhaps you should try using the QImage only.

As for the fill tool, I do not know if Krita's tool already works or not.

The algorithm for filling tools is not very complex but uses recursion.

You start from the pixel that has been clicked on. The color of that pixel is 
the color that you want to replace. As soon as one pixel has another colour, 
the algorythmn must stop progressing in that direction.

So for one point, you have:
- check if it is in the replaced colour, if not return to the previous 
recursion level.
- replace the colour by the colour of the filling tool.
- recurse the algorithm on the neightbour pixels.

Normally the neightbour pixels used are the left, right, top and bottom ones. 
So the filling tool does not leak as easily as when your take all eight 
neightbour pixels.

>
> It would be also nice to have some tools to oilify the picture
> etc. like GPaint.

That I think that this is too much for the paiting program in kde-graphics. We 
need this for the high-end painting application, which is currently Krita. 
(Of course, you could probably do it, move KPaint to the KOffice class and 
let KPaint be the high-end application. But you might make duplicated work.)

>
> It would be nice if you can give me some hints how to setup a Makefile
> so that I can get started. I think I will set up my own CVS version,
> because I don't know if I get my inteded changes working and I don't
> know how much time I find for that. And I do not want to work on an
> official KDE application right now:-)

Then again my invitation to Krita: it is not in the regular KOffice releases 
yet, as it is not finished yet. So here you could really help Patrick Julien.

And do not worry too much to make errors. Everybody has make errors when they 
started. Nothing to worry about... :-)

>
> Greetings,
> Michael

Have a nice day!
 
>> Visit http://mail.kde.org/mailman/listinfo/kde-devel#unsub to unsubscribe <<

[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic