22#include <tqdatetime.h>
23#include <tqapplication.h>
24#include <tqvaluelist.h>
33#include "kis_global.h"
35#include "kis_painter.h"
36#include "kis_fill_painter.h"
37#include "kis_undo_adapter.h"
38#include "kis_iterator.h"
39#include "kis_iterators_pixel.h"
40#include "kis_iteratorpixeltrait.h"
41#include "kis_random_accessor.h"
42#include "kis_random_sub_accessor.h"
43#include "kis_transaction.h"
44#include "kis_profile.h"
46#include "kis_integer_maths.h"
47#include "kis_colorspace_factory_registry.h"
48#include "kis_selection.h"
50#include "kis_paint_device_iface.h"
51#include "kis_paint_device.h"
52#include "kis_datamanager.h"
53#include "kis_memento.h"
54#include "kis_selection.h"
56#include "kis_exif_info.h"
60 class KisPaintDeviceCommand : public KNamedCommand {
61 typedef KNamedCommand super;
64 KisPaintDeviceCommand( const TQString& name, KisPaintDeviceSP paintDevice);
65 virtual ~KisPaintDeviceCommand() {}
67 virtual void execute() = 0;
68 virtual void unexecute() = 0;
71 void setUndo( bool undo);
73 KisPaintDeviceSP m_paintDevice;
76 KisPaintDeviceCommand::KisPaintDeviceCommand( const TQString& name, KisPaintDeviceSP paintDevice) :
77 super(name), m_paintDevice(paintDevice)
81 void KisPaintDeviceCommand::setUndo( bool undo)
83 if (m_paintDevice->undoAdapter()) {
84 m_paintDevice->undoAdapter()->setUndo(undo);
88 class MoveCommand : public KNamedCommand {
89 typedef KNamedCommand super;
92 MoveCommand(KisPaintDeviceSP device, const TQPoint& oldpos, const TQPoint& newpos);
93 virtual ~MoveCommand();
95 virtual void execute();
96 virtual void unexecute();
99 void moveTo( const TQPoint& pos);
104 KisPaintDeviceSP m_device;
109 MoveCommand::MoveCommand(KisPaintDeviceSP device, const TQPoint& oldpos, const TQPoint& newpos) :
110 super(i18n( "Move Layer"))
117 MoveCommand::~MoveCommand()
121 void MoveCommand::undoOff()
123 if (m_device->undoAdapter()) {
124 m_device->undoAdapter()->setUndo( false);
128 void MoveCommand::undoOn()
130 if (m_device->undoAdapter()) {
131 m_device->undoAdapter()->setUndo( true);
135 void MoveCommand::execute()
142 void MoveCommand::unexecute()
149 void MoveCommand::moveTo( const TQPoint& pos)
151 m_device->move(pos.x(), pos.y());
154 class KisConvertLayerTypeCmd : public KNamedCommand {
155 typedef KNamedCommand super;
158 KisConvertLayerTypeCmd(KisUndoAdapter *adapter, KisPaintDeviceSP paintDevice,
159 KisDataManagerSP beforeData, KisColorSpace * beforeColorSpace,
160 KisDataManagerSP afterData, KisColorSpace * afterColorSpace
161 ) : super(i18n( "Convert Layer Type"))
164 m_paintDevice = paintDevice;
165 m_beforeData = beforeData;
166 m_beforeColorSpace = beforeColorSpace;
167 m_afterData = afterData;
168 m_afterColorSpace = afterColorSpace;
171 virtual ~KisConvertLayerTypeCmd()
176 virtual void execute()
178 m_adapter->setUndo( false);
179 m_paintDevice->setData(m_afterData, m_afterColorSpace);
180 m_adapter->setUndo( true);
183 virtual void unexecute()
185 m_adapter->setUndo( false);
186 m_paintDevice->setData(m_beforeData, m_beforeColorSpace);
187 m_adapter->setUndo( true);
191 KisUndoAdapter *m_adapter;
193 KisPaintDeviceSP m_paintDevice;
195 KisDataManagerSP m_beforeData;
196 KisColorSpace * m_beforeColorSpace;
198 KisDataManagerSP m_afterData;
199 KisColorSpace * m_afterColorSpace;
205 TQObject(0, name), TDEShared(), m_exifInfo(0), m_lock( false )
207 if (colorSpace == 0) {
208 kdWarning(41001) << "Cannot create paint device without colorstrategy!\n";
211 m_longRunningFilterTimer = 0;
217 m_pixelSize = colorSpace->pixelSize();
218 m_nChannels = colorSpace->nChannels();
220 TQ_UINT8* defPixel = new TQ_UINT8 [ m_pixelSize ];
221 colorSpace->fromTQColor(TQt::black, OPACITY_TRANSPARENT, defPixel);
226 TQ_CHECK_PTR(m_datamanager);
227 m_extentIsValid = true;
231 m_colorSpace = colorSpace;
233 m_hasSelection = false;
234 m_selectionDeselected = false;
240 TQObject(0, name), TDEShared(), m_exifInfo(0), m_lock( false )
243 m_longRunningFilterTimer = 0;
249 m_hasSelection = false;
250 m_selectionDeselected = false;
253 m_parentLayer = parent;
255 if (colorSpace == 0 && parent != 0 && parent->image() != 0) {
256 m_colorSpace = parent->image()->colorSpace();
259 m_colorSpace = colorSpace;
262 Q_ASSERT( m_colorSpace );
264 m_pixelSize = m_colorSpace->pixelSize();
265 m_nChannels = m_colorSpace->nChannels();
267 TQ_UINT8* defPixel = new TQ_UINT8[ m_pixelSize ];
268 m_colorSpace->fromTQColor(TQt::black, OPACITY_TRANSPARENT, defPixel);
272 TQ_CHECK_PTR(m_datamanager);
273 m_extentIsValid = true;
275 if ( TQString ( name ) == TQString( "Layer 1" ) ) {
276 m_longRunningFilters = m_colorSpace->createBackgroundFilters();
278 if (!m_longRunningFilters.isEmpty()) {
279 m_longRunningFilterTimer = new TQTimer( this);
280 connect(m_longRunningFilterTimer, TQ_SIGNAL(timeout()), this, TQ_SLOT(runBackgroundFilters()));
281 m_longRunningFilterTimer->start(2000);
290 m_longRunningFilterTimer = 0;
293 if (rhs.m_datamanager) {
295 TQ_CHECK_PTR(m_datamanager);
298 kdWarning() << "rhs " << rhs.name() << " has no datamanager\n";
300 m_extentIsValid = rhs.m_extentIsValid;
303 m_colorSpace = rhs.m_colorSpace;
304 m_hasSelection = rhs.m_hasSelection;
306 if ( m_hasSelection )
307 m_selection = new KisSelection(*rhs.m_selection);
311 m_pixelSize = rhs.m_pixelSize;
312 m_nChannels = rhs.m_nChannels;
315 m_exifInfo = new KisExifInfo(*rhs.m_exifInfo);
323KisPaintDevice::~KisPaintDevice()
326 delete m_longRunningFilterTimer;
327 TQValueList<KisFilter*>::iterator it;
328 TQValueList<KisFilter*>::iterator end = m_longRunningFilters.end();
329 for (it = m_longRunningFilters.begin(); it != end; ++it) {
330 KisFilter * f = (*it);
333 m_longRunningFilters.clear();
337DCOPObject *KisPaintDevice::dcopObject()
340 m_dcop = new KisPaintDeviceIface( this);
341 TQ_CHECK_PTR(m_dcop);
348 return m_parentLayer;
358 if (m_parentLayer) m_parentLayer->setDirty(rc);
363 if (m_parentLayer) m_parentLayer->setDirty();
369 return m_parentLayer->image();
378 TQRect dirtyRect = extent();
387 m_selection->setX(x);
388 m_selection->setY(y);
393 emit positionChanged( this);
398 move(pt.x(), pt.y());
403 KNamedCommand * cmd = new MoveCommand( this, TQPoint(m_x, m_y), TQPoint(x, y));
411 m_datamanager->extent(x, y, w, h);
420 return TQRect(x, y, w, h);
425 return m_extentIsValid;
430 m_extentIsValid = isValid;
442TQRect KisPaintDevice::exactBoundsOldMethod() const
444 TQ_INT32 x, y, w, h, boundX, boundY, boundW, boundH;
447 extent(boundX, boundY, boundW, boundH);
449 const TQ_UINT8* defaultPixel = m_datamanager->defaultPixel();
453 for (TQ_INT32 y2 = y; y2 < y + h ; ++y2) {
455 while (!it.isDone() && found == false) {
456 if (memcmp(it.rawData(), defaultPixel, m_pixelSize) != 0) {
468 for (TQ_INT32 y2 = y + h; y2 > y ; --y2) {
470 while (!it.isDone() && found == false) {
471 if (memcmp(it.rawData(), defaultPixel, m_pixelSize) != 0) {
472 boundH = y2 - boundY + 1;
482 for (TQ_INT32 x2 = x; x2 < x + w ; ++x2) {
484 while (!it.isDone() && found == false) {
485 if (memcmp(it.rawData(), defaultPixel, m_pixelSize) != 0) {
498 for (TQ_INT32 x2 = x + w; x2 > x ; --x2) {
500 while (!it.isDone() && found == false) {
501 if (memcmp(it.rawData(), defaultPixel, m_pixelSize) != 0) {
502 boundW = x2 - boundX + 1;
517 return TQRect(boundX, boundY, boundW, boundH);
520TQRect KisPaintDevice::exactBoundsImprovedOldMethod() const
523 TQ_INT32 x, y, w, h, boundX2, boundY2, boundW2, boundH2;
525 extent(boundX2, boundY2, boundW2, boundH2);
527 const TQ_UINT8* defaultPixel = m_datamanager->defaultPixel();
531 for (TQ_INT32 y2 = y; y2 < y + h ; ++y2) {
532 while (!it.isDone() && found == false) {
533 if (memcmp(it.rawData(), defaultPixel, m_pixelSize) != 0) {
547 for (TQ_INT32 y2 = y + h; y2 > y ; --y2) {
549 while (!it.isDone() && found == false) {
550 if (memcmp(it.rawData(), defaultPixel, m_pixelSize) != 0) {
551 boundH2 = y2 - boundY2 + 1;
563 for (TQ_INT32 x2 = x; x2 < x + w ; ++x2) {
564 while (!it.isDone() && found == false) {
565 if (memcmp(it.rawData(), defaultPixel, m_pixelSize) != 0) {
581 for (TQ_INT32 x2 = x + w; x2 > x ; --x2) {
583 while (!it.isDone() && found == false) {
584 if (memcmp(it.rawData(), defaultPixel, m_pixelSize) != 0) {
585 boundW2 = x2 - boundX2 + 1;
600 return TQRect(boundX2, boundY2, boundW2, boundH2);
606 TQRect r2 = exactBoundsImprovedOldMethod();
612 m_datamanager->setExtent(x - m_x, y - m_y, w, h);
618 r.moveBy(-m_x, -m_y); m_datamanager->setExtent(r);
623 m_datamanager->clear();
628 m_datamanager->clear(x, y, w, h, fillPixel);
641 for (TQ_INT32 y = r.top(); y <= r.bottom(); ++y) {
645 dstIt += r.width() - 1;
647 while (!srcIt.isDone()) {
648 if (srcIt.isSelected()) {
649 memcpy(dstIt.rawData(), srcIt.oldRawData(), m_pixelSize);
657 m_parentLayer->setDirty(r);
674 for (y1 = r.top(), y2 = r.bottom(); y1 <= r.bottom(); ++y1, --y2) {
677 while (!itTop.isDone() && !itBottom.isDone()) {
678 if (itBottom.isSelected()) {
679 memcpy(itTop.rawData(), itBottom.oldRawData(), m_pixelSize);
687 m_parentLayer->setDirty(r);
691KisMementoSP KisPaintDevice::getMemento()
693 return m_datamanager->getMemento();
696void KisPaintDevice::rollback(KisMementoSP memento) { m_datamanager->rollback(memento); }
698void KisPaintDevice::rollforward(KisMementoSP memento) { m_datamanager->rollforward(memento); }
702 bool retval = m_datamanager->write(store);
703 emit ioProgress(100);
710 bool retval = m_datamanager->read(store);
711 emit ioProgress(100);
718 kdDebug(41004) << "Converting " << name() << " to " << dstColorSpace-> id().id() << " from "
719 << m_colorSpace->id().id() << "\n";
720 if ( colorSpace() == dstColorSpace )
732 for (TQ_INT32 row = y; row < y + h; ++row) {
735 TQ_INT32 columnsRemaining = w;
737 while (columnsRemaining > 0) {
742 TQ_INT32 columns = TQMIN(numContiguousDstColumns, numContiguousSrcColumns);
743 columns = TQMIN(columns, columnsRemaining);
750 const TQ_UINT8 *srcData = srcIt.rawData();
751 TQ_UINT8 *dstData = dstIt.rawData();
754 m_colorSpace->convertPixelsTo(srcData, dstData, dstColorSpace, columns, renderingIntent);
757 columnsRemaining -= columns;
761 KisDataManagerSP oldData = m_datamanager;
764 setData(dst.m_datamanager, dstColorSpace);
766 if (undoAdapter() && undoAdapter()->undo()) {
767 undoAdapter()->addCommand( new KisConvertLayerTypeCmd(undoAdapter(), this, oldData, oldColorSpace, m_datamanager, m_colorSpace));
773 if (profile == 0) return;
776 KisMetaRegistry::instance()->csRegistry()->getColorSpace( colorSpace()-> id(),
779 m_colorSpace = dstSpace;
785 m_datamanager = data;
786 m_colorSpace = colorSpace;
787 m_pixelSize = m_colorSpace->pixelSize();
788 m_nChannels = m_colorSpace->nChannels();
791 m_parentLayer->setDirty( extent());
792 m_parentLayer->notifyPropertyChanged();
796KisUndoAdapter *KisPaintDevice::undoAdapter() const
798 if (m_parentLayer && m_parentLayer->image()) {
799 return m_parentLayer->image()->undoAdapter();
805 TQ_INT32 offsetX, TQ_INT32 offsetY)
810 if (img.bitOrder() == TQImage::LittleEndian) {
811 img = img.convertBitOrder(TQImage::BigEndian);
813 kdDebug() << k_funcinfo << img.bitOrder()<< endl;
815 img = img.convertDepth( 32 );
818 if (colorSpace() == KisMetaRegistry::instance()->csRegistry() ->getColorSpace( KisID( "RGBA", ""), "")) {
819 writeBytes(img.bits(), 0, 0, img.width(), img.height());
823 TQ_UINT8 * dstData = new TQ_UINT8[img.width() * img.height() * pixelSize()];
824 KisMetaRegistry::instance()->csRegistry()
825 ->getColorSpace( KisID( "RGBA", ""),srcProfileName)->
826 convertPixelsTo(img.bits(), dstData, colorSpace(), img.width() * img.height());
827 writeBytes(dstData, offsetX, offsetY, img.width(), img.height());
842 w = image()->width();
843 h = image()->height();
861 TQ_UINT8 * data = new TQ_UINT8 [w * h * m_pixelSize];
867 TQImage image = colorSpace()->convertToTQImage(data, w, h, dstProfile, INTENT_PERCEPTUAL, exposure);
875 KisPaintDeviceSP thumbnail = new KisPaintDevice(colorSpace(), "thumbnail");
882 srcw = image()->width();
883 srch = image()->height();
895 h = TQ_INT32( double(srcw) / w * h);
900 w = TQ_INT32( double(srch) / h * w);
904 h = TQ_INT32( double(srch) / srcw * w);
905 else if (srch > srcw)
906 w = TQ_INT32( double(srcw) / srch * h);
908 for (TQ_INT32 y=0; y < h; ++y) {
909 TQ_INT32 iY = (y * srch ) / h;
910 for (TQ_INT32 x=0; x < w; ++x) {
911 TQ_INT32 iX = (x * srcw ) / w;
912 thumbnail->setPixel(x, y, colorAt(iX, iY));
926 srcw = image()->width();
927 srch = image()->height();
931 const TQRect e = extent();
939 h = TQ_INT32( double(srcw) / w * h);
944 w = TQ_INT32( double(srch) / h * w);
948 h = TQ_INT32( double(srch) / srcw * w);
949 else if (srch > srcw)
950 w = TQ_INT32( double(srcw) / srch * h);
956 for (TQ_INT32 y=0; y < h; ++y) {
957 TQ_INT32 iY = (y * srch ) / h;
958 for (TQ_INT32 x=0; x < w; ++x) {
959 TQ_INT32 iX = (x * srcw ) / w;
960 pixel(iX, iY, &c, &opacity);
961 const TQRgb rgb = c.rgb();
962 img.setPixel(x, y, tqRgba(tqRed(rgb), tqGreen(rgb), tqBlue(rgb), opacity));
972 return KisRectIteratorPixel( this, m_datamanager, m_selection->m_datamanager, left, top, w, h, m_x, m_y, writable);
974 return KisRectIteratorPixel( this, m_datamanager, NULL, left, top, w, h, m_x, m_y, writable);
980 return KisHLineIteratorPixel( this, m_datamanager, m_selection->m_datamanager, x, y, w, m_x, m_y, writable);
988 return KisVLineIteratorPixel( this, m_datamanager, m_selection->m_datamanager, x, y, h, m_x, m_y, writable);
990 return KisVLineIteratorPixel( this, m_datamanager, NULL, x, y, h, m_x, m_y, writable);
996 return KisRandomAccessorPixel(m_datamanager, m_selection->m_datamanager, x, y, m_x, m_y, writable);
998 return KisRandomAccessorPixel(m_datamanager, NULL, x, y, m_x, m_y, writable);
1003 return KisRandomSubAccessorPixel( this);
1008 if (m_parentLayer && m_parentLayer->image()) {
1009 m_parentLayer->image()->slotSelectionChanged();
1015 if (m_parentLayer && m_parentLayer->image()) {
1016 m_parentLayer->image()->slotSelectionChanged(r);
1022 if ( m_selectionDeselected && m_selection ) {
1023 m_selectionDeselected = false;
1025 else if (!m_selection) {
1027 TQ_CHECK_PTR(m_selection);
1028 m_selection->setX(m_x);
1029 m_selection->setY(m_y);
1031 m_hasSelection = true;
1039 return m_hasSelection;
1044 return m_selectionDeselected;
1050 if (m_selection && m_hasSelection) {
1051 m_hasSelection = false;
1052 m_selectionDeselected = true;
1058 m_hasSelection = true;
1059 m_selectionDeselected = false;
1065 TQRect r = selection->selectedExactRect();
1066 painter. bitBlt(r.x(), r.y(), COMPOSITE_OVER, selection.data(), r.x(), r.y(), r.width(), r.height());
1074 TQRect r = selection->selectedExactRect();
1075 painter. bitBlt(r.x(), r.y(), COMPOSITE_ERASE, selection.data(), r.x(), r.y(), r.width(), r.height());
1085 TQRect r = m_selection->selectedExactRect();
1089 for (TQ_INT32 y = 0; y < r.height(); y++) {
1092 KisHLineIterator selectionIt = m_selection->createHLineIterator(r.x(), r.y() + y, r.width(), false);
1094 while (!devIt.isDone()) {
1097 m_colorSpace->applyInverseAlphaU8Mask( devIt.rawData(), selectionIt.rawData(), 1);
1104 if (m_parentLayer) {
1105 m_parentLayer->setDirty(r);
1112 TQRect r = mask->selectedRect();
1115 for (TQ_INT32 y = r.top(); y <= r.bottom(); ++y) {
1118 KisHLineIterator maskIt = mask->createHLineIterator(r.x(), y, r.width(), false);
1120 while (!pixelIt.isDone()) {
1123 m_colorSpace->applyAlphaU8Mask( pixelIt.rawData(), maskIt.rawData(), 1);
1134 KisSelectionSP oldSelection = m_selection;
1136 m_hasSelection = true;
1137 return oldSelection;
1146 TQ_UINT8 *pix = iter.rawData();
1148 if (!pix) return false;
1150 colorSpace()->toTQColor(pix, c, opacity);
1160 TQ_UINT8 *pix = iter.rawData();
1162 if (!pix) return false;
1173 return KisColor(iter.rawData(), m_colorSpace);
1180 colorSpace()->fromTQColor(c, opacity, iter.rawData());
1188 if (kc.colorSpace() != m_colorSpace) {
1197 memcpy(iter.rawData(), pix, m_colorSpace->pixelSize());
1205 return m_datamanager->numContiguousColumns(x - m_x, minY - m_y, maxY - m_y);
1210 return m_datamanager->numContiguousRows(y - m_y, minX - m_x, maxX - m_x);
1215 return m_datamanager->rowStride(x - m_x, y - m_y);
1220 return m_datamanager->pixel(x - m_x, y - m_y);
1225 return m_datamanager->writablePixel(x - m_x, y - m_y);
1231 if(m_selection && m_selection != this)
1232 m_selection->setX(x);
1238 if(m_selection && m_selection != this)
1239 m_selection->setY(y);
1245 m_datamanager->readBytes(data, x - m_x, y - m_y, w, h);
1250 m_datamanager->writeBytes( data, x - m_x, y - m_y, w, h);
1254KisDataManagerSP KisPaintDevice::dataManager() const
1256 return m_datamanager;
1262 m_exifInfo = new KisExifInfo();
1266void KisPaintDevice::runBackgroundFilters()
1268 if ( m_lock ) return;
1270 KisTransaction * cmd = new KisTransaction( "Running autofilters", this);
1273 if (!m_longRunningFilters.isEmpty()) {
1274 TQValueList<KisFilter*>::iterator it;
1275 TQValueList<KisFilter*>::iterator end = m_longRunningFilters.end();
1276 for (it = m_longRunningFilters.begin(); it != end; ++it) {
1277 (*it)->process( this, this, 0, rc);
1280 if (cmd && undoAdapter()) undoAdapter()->addCommand(cmd);
1282 if (m_parentLayer) m_parentLayer->setDirty(rc);
1285#include "kis_paint_device.moc"
A colorspace is the definition of a certain color model in Chalk.
virtual KisID id() const =0 Chalk definition for use in .kra files and internally: unchanging name + i18n'able description.
A KisColor describes a color in a certain colorspace.
void setColor(TQ_UINT8 *data, KisColorSpace *colorSpace=0) Replace the existing color data, and colorspace with the specified data.
TQ_UINT8 * data() const For easy memcpy'ing etc.
KisDataManager defines the interface that modules responsible for storing and retrieving data must in...
The pixel iterators are high level iterarators.
Chalk has a large number of extensible resources.
Abstract class that represents the concept of a Layer in Chalk.
A paint device contains the actual pixel data and offers methods to read and write pixels.
void mirrorX() Mirror the device along the X axis.
KisImage * image() const Return the image that contains this paint device, or 0 if it is not part of an image.
virtual TQImage convertToTQImage(KisProfile *dstProfile, TQ_INT32 x, TQ_INT32 y, TQ_INT32 w, TQ_INT32 h, float exposure=0.0f) Create an RGBA TQImage from a rectangle in the paint device.
KisRandomSubAccessorPixel createRandomSubAccessor() This function create a random accessor which can easily access to sub pixel values.
KisRectIteratorPixel createRectIterator(TQ_INT32 left, TQ_INT32 top, TQ_INT32 w, TQ_INT32 h, bool writable) This function return an iterator which points to the first pixel of an rectangle.
KisPaintDevice(KisColorSpace *colorSpace, const char *name=0) Create a new paint device with the specified colorspace.
TQ_INT32 rowStride(TQ_INT32 x, TQ_INT32 y) Get the row stride at pixel (x, y).
virtual void writeBytes(const TQ_UINT8 *data, TQ_INT32 x, TQ_INT32 y, TQ_INT32 w, TQ_INT32 h) Copy the bytes in data into the rect specified by x, y, w, h.
KisVLineIteratorPixel createVLineIterator(TQ_INT32 x, TQ_INT32 y, TQ_INT32 h, bool writable) This function return an iterator which points to the first pixel of a vertical line.
virtual bool read(KoStore *store) Fill this paint device with the pixels from the specified file store.
KisLayer * parentLayer() const Returns the KisLayer that contains this paint device, or 0 if this is not part of a layer.
virtual void clear() Complete erase the current paint device.
TDE_DEPRECATED const TQ_UINT8 * pixel(TQ_INT32 x, TQ_INT32 y) Get a read-only pointer to pixel (x, y).
virtual void readBytes(TQ_UINT8 *data, TQ_INT32 x, TQ_INT32 y, TQ_INT32 w, TQ_INT32 h) Read the bytes representing the rectangle described by x, y, w, h into data.
virtual void setProfile(KisProfile *profile) Changes the profile of the colorspace of this paint device to the given profile.
void deselect() Deselect the selection for this paintdevice.
KisColor colorAt(TQ_INT32 x, TQ_INT32 y) Return the KisColor of the pixel at x,y.
KisExifInfo * exifInfo() Return the exifInfo associated with this layer.
KisSelectionSP selection() Get the current selection or create one if this paintdevice hasn't got a selection yet.
void setParentLayer(KisLayer *parentLayer) Set the KisLayer that contains this paint device, or 0 if this is not part of a layer.
void clearSelection() Clear the selected pixels from the paint device.
void addSelection(KisSelectionSP selection) Adds the specified selection to the currently active selection for this paintdevice.
bool selectionDeselected() Whether the previous selection was deselected.
TQ_INT32 getX() const The X offset of the paint device.
virtual void convertTo(KisColorSpace *dstColorSpace, TQ_INT32 renderingIntent=INTENT_PERCEPTUAL) Converts the paint device to a different colorspace.
TQ_INT32 numContiguousRows(TQ_INT32 y, TQ_INT32 minX, TQ_INT32 maxX) Get the number of contiguous rows starting at y, valid for all values of x between minX and maxX.
TQ_INT32 getY() const The Y offset of the paint device.
virtual KNamedCommand * moveCommand(TQ_INT32 x, TQ_INT32 y) Move the paint device to the specified location and make it possible to undo the move.
TDE_DEPRECATED TQ_UINT8 * writablePixel(TQ_INT32 x, TQ_INT32 y) Get a read-write pointer to pixel (x, y).
virtual void setDirty() Set the parent layer completely dirty, if this paint device has one.
virtual void convertFromTQImage(const TQImage &img, const TQString &srcProfileName, TQ_INT32 offsetX=0, TQ_INT32 offsetY=0) Fill this paint device with the data from img; starting at (offsetX, offsetY).
void crop(TQ_INT32 x, TQ_INT32 y, TQ_INT32 w, TQ_INT32 h) Cut the paint device down to the specified rect.
KisPaintDeviceSP createThumbnailDevice(TQ_INT32 w, TQ_INT32 h) Creates a paint device thumbnail of the paint device, retaining the aspect ratio.
void reselect() Reinstates the old selection.
bool extentIsValid() const XXX: This should be a temporay hack, awaiting a proper fix.
virtual TQ_INT32 pixelSize() const Return the number of bytes a pixel takes.
void setX(TQ_INT32 x) Return the X offset of the paint device.
virtual bool write(KoStore *store) Write the pixels of this paint device into the specified file store.
virtual void move(TQ_INT32 x, TQ_INT32 y) Moves the device to these new coordinates (so no incremental move or so).
void applySelectionMask(KisSelectionSP mask) Apply a mask to the image data, i.e.
void mirrorY() Mirror the device along the Y axis.
KisSelectionSP setSelection(KisSelectionSP selection) Sets the selection of this paint device to the new selection, returns the old selection,...
void setY(TQ_INT32 y) Return the Y offset of the paint device.
KisHLineIteratorPixel createHLineIterator(TQ_INT32 x, TQ_INT32 y, TQ_INT32 w, bool writable) This function return an iterator which points to the first pixel of a horizontal line.
KisRandomAccessorPixel createRandomAccessor(TQ_INT32 x, TQ_INT32 y, bool writable) This function creates a random accessor which allow to randomly access any pixels on the paint device...
void emitSelectionChanged() Notify the owning image that the current selection has changed.
bool setPixel(TQ_INT32 x, TQ_INT32 y, const TQColor &c, TQ_UINT8 opacity) Set the specified pixel to the specified color.
bool hasSelection() Whether there is a valid selection for this paintdevice.
void setExtentIsValid(bool isValid) Convience method for the above.
virtual void extent(TQ_INT32 &x, TQ_INT32 &y, TQ_INT32 &w, TQ_INT32 &h) const Retrieve the bounds of the paint device.
TQ_INT32 numContiguousColumns(TQ_INT32 x, TQ_INT32 minY, TQ_INT32 maxY) Get the number of contiguous columns starting at x, valid for all values of y between minY and maxY.
virtual void exactBounds(TQ_INT32 &x, TQ_INT32 &y, TQ_INT32 &w, TQ_INT32 &h) const Get the exact bounds of this paint device.
void subtractSelection(KisSelectionSP selection) Subtracts the specified selection from the currently active selection for this paindevice.
void setData(KisDataManagerSP data, KisColorSpace *colorSpace) Replace the pixel data, color strategy, and profile.
virtual TQImage createThumbnail(TQ_INT32 maxw, TQ_INT32 maxh) Creates a thumbnail of the paint device, retaining the aspect ratio.
void fill(TQ_INT32 x, TQ_INT32 y, TQ_INT32 w, TQ_INT32 h, const TQ_UINT8 *fillPixel) Fill the given rectangle with the given pixel.
KisPainter contains the graphics primitives necessary to draw on a KisPaintDevice.
KCommand * end() Finish painting on the current device.
void bitBlt(TQ_INT32 dx, TQ_INT32 dy, const KisCompositeOp &op, KisPaintDeviceSP src, TQ_INT32 sx, TQ_INT32 sy, TQ_INT32 sw, TQ_INT32 sh) Blast the specified region from src onto the current paint device.
KisSelection contains a byte-map representation of a layer, where the value of a byte signifies wheth...
|