layers, masks, nodes

Boudewijn Rempt boud at valdyas.org
Fri Oct 19 14:46:29 CEST 2007


Cyrille asked me yesterday if I was done enough with the layers, masks and node
refactor that others can start fixing bugs. The answer is: yes. Finally. Originally,
I had intended to be where I am now around April.

There is one big refactor still to come, and that is taking KisSelection out
of KisPaintDevice: then selections will also be KisMask based and assocated 
with layers (and the image, for the global selection).

There are quite a few bits that I still need to implement: property dialogs
for masks, for instnance, and other mask menu options. Loading and saving of
all new node types needs to be done. There are probably bugs in the rendering
of the projection, and we need a new, cache-less recomposition path.

Just for the record, the design looks like this:

* KisBaseNode: implements properties common to all nodes
* KisNode::KisBaseNode: implements the graph (but adding and removing nodes
  is private)
* KisNodeFacade: the only way to add and remove nodes. This class together with
  KisNodeGraphListener guarantees that when adding and removing nodes the right
  signals are emitted
* KisImage: KisImage is a node facade and a node graph listener. There are still
  a number of functions that take layers instead of nodes: those are deprecated
* KisMask::KisNode: the basis of all masks. Masks have a selection and cannot
  have child nodes. Masks apply their effect on the associated layer, they do
  not composite pixels. There are the following types of masks:
     - KisTransparencyMask (makes pixels more or less transparent)
     - KisTransformationMask (transforms the selected pixels)
     - KisEffectMask (applies a filter to the associated layer)
     - KisSelectionMask (defines the per-layer selection)
* KisLayer::KisNode: The basis for all layers. Layers are composited in groups
  and can have masks. There are paint layers, group layers, adjustment layers,
  clone layers and shape layers. Layers have a projection and may have a paint
  device (like a selection for an adj. layer, or the dried and current paint
  devices for paint layers).
* KisNodeModel: a QAbstractItemModel on the image's layer stack. This is connected
  to the layer box.
* KisShapeController: creates a shape for every node so the flake mechanism can
  activate the right tools

The visitor mechanism has changed slightly, too -- there's a visitAll function
that can be pretty handy.

Note also that we're not storing the properties like visible, locked etc. hardcoded
anymore, but in an extensible list. And it's possible to define a list of preferred
properties and check for that. See for instance KisImage:189, where we check whether
a layer is temporary. 

Well, that's all, I guess I'll put it on the wiki when I get home and have access again.

Boudewijn



More information about the kimageshop mailing list