krita tools

Patrick Julien freak at
Sat Oct 4 08:59:25 CEST 2003

On October 4, 2003 03:43 am, Boudewijn Rempt wrote:
> On Saturday 04 October 2003 00:33, Patrick Julien wrote:
> > Not quite, the code in QPainter probably just forwards to the native GUI
> > library being used (XDrawRectangle in X, Rectangle in Windows and so on).
> > Even if you had a look at the XFree86 code, that code can assumes a
> > linear framebuffer, you have no such thing in Krita, hence the microtile
> > data structure.
> There are bitblt functions that look useful -- if I make a brush mask and
> blit that on KisPainter, that should work, shouldn't it.

Hmm, don't remember, I haven't worked on it since December, I believe it will 
work if and only the if the right raster op is implemented.  I believe only a 
handful of them are implemented, but:

1) New raster operations are easy to add.
2) BitBlt is implemented yes

> > Yes and no, there is both RGB and RGBA.  However, it is dreadfully slow
> > since values are not pre-multiplied.
> >
> > I'm assuming a familiarity with design patterns here, but this is what I
> > wanted to do:
> >
> > 1) Keep the color model in the paint device (KisImage, KisPaintDevice,
> > KisLayer, etc) in the device itself (done).
> > 2) Make a colorspace strategy
> > 	This strategy would actually hold the entire colorspace in
> > pre-multiplied form
> > 3) The strategies are flyweights.
> > 4) When creating a KisPainter, the KisPainter takes the color model id
> > found in the paint device and gives it to the flyweight factory to get
> > back a color space strategy.
> > 5) The actual algorithms for the drawing are in KisPainter since they are
> > the same, but pixels are composed using the strategy.
> >
> > This means we can support all color models.
> > This means rendering is actually fast since all pixel results given a
> > source, a destination, an alpha and a raster operation are know in
> > advance.

Actually, made a small mistake here, it's only for alpha values, not for all 
raster operations.  Assuming an 8 bit color channel, it's already an array of 
USHRT_MAX values here, so yeah, only for pre-multiplied alpha, not all raster 

> > Krita is already considerably faster than Krayon was, memory consumption
> > for the image representation is down 85%.   Also, Krayon could only do 8
> > bit per channel, that restriction has also been lifted.  Also, using what
> > was there, I'm not sure I had to courage to implement undo/redo.
> Well, I was impressed to see the speed with which I could combine two
> images in layers and play with transparency and so on. That was fun.
> Anyway, I guess that I can decide whether I feel confident enough to start
> adding code by Sunday. I'll probably have some more questions for you soon.

All right, I'll be waiting.

More information about the kimageshop mailing list