krita

kis_adjustment_layer.h

00001 /*
00002  *  Copyright (c) 2006 Boudewijn Rempt
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_ADJUSTMENT_LAYER_H_
00019 #define KIS_ADJUSTMENT_LAYER_H_
00020 
00021 #include <qobject.h>
00022 #include "kis_types.h"
00023 #include "kis_layer_visitor.h"
00024 #include "kis_composite_op.h"
00025 #include <koffice_export.h>
00026 
00027 class KNamedCommand;
00028 class QPainter;
00029 class KisUndoAdapter;
00030 class KisGroupLayer;
00031 class KisFilterConfiguration;
00032 
00038 class KRITACORE_EXPORT KisAdjustmentLayer : public KisLayer, public KisLayerSupportsIndirectPainting
00039 {
00040     Q_OBJECT
00041 
00042 public:
00047     KisAdjustmentLayer(KisImageSP img, const QString &name, KisFilterConfiguration * kfc, KisSelectionSP selection);
00048     KisAdjustmentLayer(const KisAdjustmentLayer& rhs);
00049     virtual ~KisAdjustmentLayer();
00050 
00052     virtual KisLayerSP clone() const;
00053 
00054 public:
00055     
00056     KisFilterConfiguration * filter();
00057     void setFilter(KisFilterConfiguration * filterConfig);
00058 
00059     KisSelectionSP selection();
00060     
00062     void setSelection(KisSelectionSP selection);
00063 
00065     void clearSelection();
00066 
00067     virtual void paintSelection(QImage &img, Q_INT32 x, Q_INT32 y, Q_INT32 w, Q_INT32 h);
00068     virtual void paintSelection(QImage &img, const QRect& scaledImageRect, const QSize& scaledImageSize, const QSize& imageSize);
00069 public:
00070     
00071     virtual Q_INT32 x() const;
00072     virtual void setX(Q_INT32);
00073 
00074     virtual Q_INT32 y() const;
00075     virtual void setY(Q_INT32);
00076 
00078     virtual QRect extent() const;
00079     
00081     virtual QRect exactBounds() const;
00082 
00083     virtual bool accept(KisLayerVisitor &);
00084 
00085     virtual void resetCache();
00086     virtual KisPaintDeviceSP cachedPaintDevice() { return m_cachedPaintDev; }
00087 
00088     bool showSelection() const { return m_showSelection; }
00089     void setSelection(bool b) { m_showSelection = b; }
00090 
00091     virtual QImage createThumbnail(Q_INT32 w, Q_INT32 h);
00092 
00093     // KisLayerSupportsIndirectPainting
00094     virtual KisLayer* layer() { return this; }
00095 private:
00096     bool m_showSelection;
00097     KisFilterConfiguration * m_filterConfig;
00098     KisSelectionSP m_selection;
00099     KisPaintDeviceSP m_cachedPaintDev;
00100 private slots:
00101     void slotSelectionChanged(KisImageSP image);
00102 };
00103 
00104 #endif // KIS_ADJUSTMENT_LAYER_H_
00105 
KDE Home | KDE Accessibility Home | Description of Access Keys