PaintDevice/Layer/Mask/Selection/Overlay

Boudewijn Rempt boud at valdyas.org
Mon May 14 22:26:50 CEST 2007


Here's the datamodel I am trying to implement for the mask/selection/overlay 
design. Because all layers now can have modifications, all layers have a 
projection.

I am assuming that painterly overlays are only useful for paint layers. 
Thrain: am I correct in that assumption?

Let's first map the generation of the projection for the various types of 
layers:

Paint Layer

paint device -> overlays -> effect masks -> projection

Shapes Layer

shapes -> canvas paint device -> effect masks -> projection

Group Layer

layers -> composition -> projection 1 -> effect masks -> projection 2

Adjustment Layer

projection of the stack under the adj layer -> filter -> projection


So, I'm right now implementing the following class model:

KisLayer {
	KisPaintDeviceSP projection
	QList<KisMask> effectMasks
}

KisPaintLayer::KisLayer {
	KisPaintDevice canvas
	QList<KistMask> painterlyOverlays
}

KisShapeLayer::KisLayer {
	KisPaintDevice canvas
	KoShapeManager shapeManager
}

KisGroupLayer::KisLayer {
	KisPaintDevice projection
	QList<KisLayer> layers
}

KisAdjustmentLayer::KisLayer {
	KisMaskSP mask
	KisFilter filter
}


Two complications:

* KisAdjustmentLayer shouldn't have effect masks, that's silly.
* The optimization where if there's only one layer and no effect masks, that 
layer is also the projection of the owning group layer should be kept

Design problem:

* I want to make this as generic as possible: so, for composition, 
thumbnailing etc. we should always be able to call KisLayer::projection(), 
for painting we should be able to call KisLayer::canvas() -- which returns 
the mask in the case of an adj. layer, the canvas in the case of a paint 
layer and nothing in the case of other layer types.

* Masks and overlays can have several types of representation: a visible one 
(like the red or blue editing mask) and an effect one (like, well, like adj. 
layers now). So maybe also a method to toggle the showing of the mask and a 
method to get the current mask. This needs to be integrated with the layer 
box, so the mask is shown as a mask and not an effect when the mask is not 
selected in the layerbox.

Selections:

Right now the selection is part of KisPaintDevice. We have agreed on having 
more than one selection type per layer: namely one that determines reading 
and one that determines writing, and one that determines both. That means 
three KisSelectionSP's on the paint device, unless we go a KisSelection with 
three channels, of course.


-- 
Boudewijn Rempt 
http://www.valdyas.org/fading/index.cgi
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: not available
Url : http://mail.kde.org/pipermail/kimageshop/attachments/20070514/02603580/attachment.pgp 


More information about the kimageshop mailing list