krita

kis_paint_layer.h

00001 /*
00002  *  Copyright (c) 2005 Casper Boemann <cbr@boemann.dk>
00003  *
00004  *  this program is free software; you can redistribute it and/or modify
00005  *  it under the terms of the gnu general public license as published by
00006  *  the free software foundation; either version 2 of the license, or
00007  *  (at your option) any later version.
00008  *
00009  *  this program is distributed in the hope that it will be useful,
00010  *  but without any warranty; without even the implied warranty of
00011  *  merchantability or fitness for a particular purpose.  see the
00012  *  gnu general public license for more details.
00013  *
00014  *  you should have received a copy of the gnu general public license
00015  *  along with this program; if not, write to the free software
00016  *  foundation, inc., 675 mass ave, cambridge, ma 02139, usa.
00017  */
00018 #ifndef KIS_PAINT_LAYER_H_
00019 #define KIS_PAINT_LAYER_H_
00020 
00021 #include "kis_types.h"
00022 #include "kis_layer.h"
00023 #include "kis_paint_device.h"
00024 #include "kis_colorspace.h"
00028 class KisPaintLayer : public KisLayer {
00029     typedef KisLayer super;
00030 
00031     Q_OBJECT
00032 
00033 public:
00034     KisPaintLayer(KisImage *img, const QString& name, Q_UINT8 opacity, KisPaintDeviceSP dev);
00035     KisPaintLayer(KisImage *img, const QString& name, Q_UINT8 opacity);
00036     KisPaintLayer(KisImage *img, const QString& name, Q_UINT8 opacity, KisColorSpace * colorSpace);
00037     KisPaintLayer(const KisPaintLayer& rhs);
00038     virtual ~KisPaintLayer();
00039 
00040     virtual KisLayerSP clone() const;
00041 public:
00042 
00043     // Called when the layer is made active
00044     virtual void activate() {};
00045 
00046     // Called when another layer is made active
00047     virtual void deactivate() {};
00048 
00049     virtual Q_INT32 x() const;
00050     virtual void setX(Q_INT32 x);
00051 
00052     virtual Q_INT32 y() const;
00053     virtual void setY(Q_INT32 y);
00054 
00055     virtual QRect extent() const;
00056     virtual QRect exactBounds() const;
00057 
00058     virtual void paintSelection(QImage &img, Q_INT32 x, Q_INT32 y, Q_INT32 w, Q_INT32 h);
00059     virtual void paintSelection(QImage &img, const QRect& scaledImageRect, const QSize& scaledImageSize, const QSize& imageSize);
00060 
00061     virtual void paintMaskInactiveLayers(QImage &img, Q_INT32 x, Q_INT32 y, Q_INT32 w, Q_INT32 h);
00062 
00063     virtual QImage createThumbnail(Q_INT32 w, Q_INT32 h);
00064 
00065     virtual bool accept(KisLayerVisitor &v)
00066         {
00067 //            kdDebug(41001) << "\tPAINT\t" << name()
00068 //                    << " dirty: " << dirty() << "\n";
00069             return v.visit(this);
00070         };
00071 
00072 
00074     inline KisPaintDeviceSP paintDevice() const { return m_paintdev; };
00075 
00076 private:
00077     KisPaintDeviceSP m_paintdev;
00078 };
00079 
00080 #endif // KIS_PAINT_LAYER_H_
00081 
KDE Home | KDE Accessibility Home | Description of Access Keys