Notes on Krita
boud at valdyas.org
Sat Oct 4 23:44:53 CEST 2003
While trying to figure out how to make my test tool put squares of the select
colour down on the canvas, I made some notes on what how I think krita
sticks together. I'm still not sure what makes it tick, though, and there's a
couple of head-scratchers near the end.
Anyway, to preserve this bit of work (might save the next man or woman some
time) for posterity, I post it here:
A Perspective on Krita's Design
Krita's codebase has been through as many changes as the app's name
itself. It started with KImageShop (hence the 'kis' prefix one finds
everwhere, and which would have been unnessary had Krita used
namespaces, one fancies), then became Krayon to end up as Krita. The
stated design goal was to create a application geared towards the
more artistic user; the kind of user who settles down with his
tablet to create a spot of Art. It now is partway to becoming a kimplet.
These are what I recognize as Design patterns in Krita. This is by-and-large
Patrick Julien's work:
* Change brushes handling to a generic Mediator pattern
(kis_resource_mediator). Resources are brush shapes,
patterns (and colours, too?)
* Change colourspace handling to a Strategy pattern
* Change moving chunks of painting to a Strategy pattern
* kis_factory points towards a Factory pattern, but I
don't know what it's for yet. (Creates the pluginserver
* Tools are created by a Factory pattern (but it isn't
dynamic yet): kis_tool_factory.
* There's the start of a Memento pattern for tools, but it
doesn't seem to be used (kis_tool_memento)
* The Builder pattern is used to do conversion to and/or
from ImageMagick. I guess this is used for importing
images in other file-formats than .krita.
* Flyweight pattern used for background tiles.
* Nameserver. Perhaps not a pattern -- at least not one
with an obvious GOF name. Appears to be computing a
number for new layers and new documents.
* kis_render. Interface implemented by kis_paint_device
* Rename kisTool to kisToolInterface -- but the file is
still called kis_tool.
* Addition of kis_types. Defines shared pointer pointers
to core krita objects: image, paintdevice, channel,
mask, layer etc.
* Tile architecture. There's Mediator and a Singleton
pattern here at least. This stuff seems to work, doesn't
need hacking at the moment.
* Visitor pattern used to flatten an image or merge
layers. Merging exposes a funny bug where the tiles
are re-arranged in an interesting mosaic pattern.
Krita uses a fairly ugly side-panel to collect what are palettes
in other applications. I would prefer dockable, attachable
palettes myself. Doesn't KDE have a lib for that already?
These classes are used in the statusbar.
The dialogs appear to be created by hand, not with Qt
Designer. Besides, many are inoperational.
The canvas, rules and sidebar panels are defined here, too,
Working: select_rectangular, test, zoom, colorpicker, paste, move
Not working: airbrush, brush, colorchanger (no idea what it should
do), ellipse, eraser, fill, line, pen, polygon, polyline,
rectangle, select_contiguous, select_elliptical, select_freehand,
Missing tools: convolve, smear, smudge, whirl, charcoal, chalk,
oils, clone, select_by_colour
The single plugin example has been present in krita since about day
one, as far as I can see. It doesn't show anything about what one
can do with plugins.
To judge from the code in kis_plugin_server, it never got beyond
an idea. (kdDebug() << "hallo\n"...)
There still appear to be some dependencies upon ImageMagick (builder
subdir). What are these for, and should they stay? Is it for
importing/exporting foreign file formats?
Undo and Redo make use of the standard KDE mechanism, which I don't
really understand either.
The following files appear to be unused:
core/kis_krayon (was predecessor of kis_resource)
- Why the QUANTUM redefinition?
- is_mask unimplemented? What was it meant to do, or is it an
- nameserver presents unique numbers for new layers?
- what does 'upscale' do?
- Is KisVector only used in obsolete tools?
- I take it that the two tests that are present in krita/test are
- what with the dummmmmy.cc?
- which bits of the krita/ui files are still relevant?
- kis_selection.h needs to be included to compile code that
uses kis_paint_device, and I wonder why.
- what is paint-offset?
Boudewijn Rempt | http://www.valdyas.org/index2.html
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Size: 198 bytes
Url : http://mail.kde.org/pipermail/kimageshop/attachments/20031004/ea3124e1/attachment.bin
More information about the kimageshop