24#include "kis_layer_visitor.h"
25#include "kis_composite_op.h"
26#include <koffice_export.h>
41class KRITACORE_EXPORT
KisLayer :
public TQObject,
public TDEShared
47 KisLayer(KisImage *img,
const TQString &name, TQ_UINT8 opacity);
55 virtual void setClean(
const TQRect & rect);
65 virtual bool dirty(
const TQRect & rc);
68 virtual TQRect dirtyRect()
const;
75 virtual void setDirty(
bool propagate =
true);
82 virtual void setDirty(
const TQRect & rect,
bool propagate =
true);
85 virtual KisLayerSP
clone()
const = 0;
88 int id()
const {
return m_id; }
93 virtual int index()
const;
96 virtual void setIndex(
int index);
101 virtual KisGroupLayerSP parent()
const;
108 virtual KisLayerSP prevSibling()
const;
115 virtual KisLayerSP nextSibling()
const;
139 virtual KisLayerSP findLayer(
const TQString& name)
const;
142 virtual KisLayerSP findLayer(
int id)
const;
144 enum { Visible = 1, Hidden = 2, Locked = 4, Unlocked = 8 };
147 virtual int numLayers(
int type = 0)
const;
157 virtual TQ_INT32 x()
const = 0;
158 virtual void setX(TQ_INT32) = 0;
160 virtual TQ_INT32 y()
const = 0;
161 virtual void setY(TQ_INT32) = 0;
163 virtual KNamedCommand *moveCommand(TQPoint oldPosition, TQPoint newPosition);
170 virtual const bool visible()
const;
171 virtual void setVisible(
bool v);
172 KNamedCommand *setVisibleCommand(
bool visiblel);
174 TQ_UINT8 opacity()
const;
175 void setOpacity(TQ_UINT8 val);
176 KNamedCommand *setOpacityCommand(TQ_UINT8 val);
177 KNamedCommand *setOpacityCommand(TQ_UINT8 prevOpacity, TQ_UINT8 newOpacity);
180 void setLocked(
bool l);
181 KNamedCommand *setLockedCommand(
bool locked);
183 void notifyPropertyChanged();
185 bool temporary()
const;
186 void setTemporary(
bool t);
188 virtual TQString name()
const;
189 virtual void setName(
const TQString& name);
191 KisCompositeOp compositeOp() {
return m_compositeOp; }
192 void setCompositeOp(
const KisCompositeOp& compositeOp);
193 KNamedCommand *setCompositeOpCommand(
const KisCompositeOp& compositeOp);
195 KisImage *image()
const {
return m_image; }
196 virtual void setImage(KisImage *image) { m_image = image; }
198 KisUndoAdapter *undoAdapter()
const;
201 virtual void paintSelection(TQImage &img, TQ_INT32 x, TQ_INT32 y, TQ_INT32 w, TQ_INT32 h);
202 virtual void paintSelection(TQImage &img,
const TQRect& scaledImageRect,
const TQSize& scaledImageSize,
const TQSize& imageSize);
205 virtual void paintMaskInactiveLayers(TQImage &img, TQ_INT32 x, TQ_INT32 y, TQ_INT32 w, TQ_INT32 h);
209 virtual TQImage createThumbnail(TQ_INT32 w, TQ_INT32 h);
212 virtual bool accept(KisLayerVisitor &) = 0;
217 bool matchesFlags(
int flags)
const;
229 KisGroupLayerSP m_parent;
233 KisCompositeOp m_compositeOp;
237class KRITACORE_EXPORT KisLayerSupportsIndirectPainting {
239 KisPaintDeviceSP m_temporaryTarget;
240 KisCompositeOp m_compositeOp;
241 TQ_UINT8 m_compositeOpacity;
244 void setTemporaryTarget(KisPaintDeviceSP t);
245 void setTemporaryCompositeOp(
const KisCompositeOp& c);
246 void setTemporaryOpacity(TQ_UINT8 o);
247 KisPaintDeviceSP temporaryTarget();
248 KisCompositeOp temporaryCompositeOp()
const;
249 TQ_UINT8 temporaryOpacity()
const;
A KisLayer that bundles child layers into a single layer.
Abstract class that represents the concept of a Layer in Chalk.
KisLayerSP siblingBelow() const
Returns the sibling below this layer in its parent's list.
KisLayerSP siblingAbove() const
Returns the sibling above this layer in its parent's list.
int id() const
Returns the ID of the layer, which is guaranteed to be unique among all KisLayers.
virtual KisLayerSP firstChild() const
Returns the first child layer of this layer (if it supports that).
virtual void activate()
Called when the layer is made active.
virtual KisLayerSP clone() const =0
Return a copy of this layer.
virtual bool accept(KisLayerVisitor &)=0
Accept the KisLayerVisitor (for the Visitor design pattern), should call the correct function on the ...
virtual KisLayerSP lastChild() const
Returns the last child layer of this layer (if it supports that).
virtual TQRect extent() const =0
Returns an approximation of where the bounds on actual data are in this layer.
virtual TQRect exactBounds() const =0
Returns the exact bounds of where the actual data resides in this layer.
virtual uint childCount() const
Returns how many direct child layers this layer has (not recursive).
virtual void deactivate()
Called when another layer is made active.