SVN commit 523066 by cgilles:
digikam from trunk : Preparing code for 0.9.1-beta1 : Removing old methods from image editor core about image data management available to all image plugins CCMAIL: [hidden email] M +0 -95 canvas/dimginterface.cpp M +0 -11 canvas/dimginterface.h M +0 -101 editor/imageiface.cpp M +1 -11 editor/imageiface.h --- trunk/extragear/graphics/digikam/utilities/imageeditor/canvas/dimginterface.cpp #523065:523066 @@ -979,101 +979,6 @@ return d->filename.section( '/', -1 ); } -// ----------------------------------------------------------------------------------- -// FIXME Remove methods below when all image plugins will be ported to DImg - -uint* DImgInterface::getData() -{ - if (!d->image.isNull()) - { - return ( (uint*)d->image.bits() ); - } - else - { - kdWarning() << k_funcinfo << "d->image is NULL" << endl; - return 0; - } -} - -void DImgInterface::putData(const QString &caller, uint* data, int w, int h) -{ - d->undoMan->addAction(new UndoActionIrreversible(this, caller)); - putData(data, w, h); -} - -void DImgInterface::putData(uint* data, int w, int h) -{ - if (d->image.isNull()) - return; - - if (w != -1 && h != -1) - { - // New image size ! - - DImg im( w, h, (uchar*)data, d->image.sixteenBit() ); - d->image = im.copy(); - - d->origWidth = im.width(); - d->origHeight = im.height(); - } - else - { - // New image data size = original data size ! - - uchar* ptr = d->image.bits(); - memcpy(ptr, (uchar*)data, d->origWidth * d->origHeight * d->image.bytesDepth()); - } - - setModified(); -} - -uint* DImgInterface::getSelectedData() -{ - if (!d->selW || !d->selH) - return 0; - - if (!d->image.isNull()) - { - DImg im = d->image.copy(d->selX, d->selY, d->selW, d->selH); - - uchar *data = new uchar[im.width() * im.height() * im.bytesDepth()]; - memcpy (data, im.bits(), im.width() * im.height() * im.bytesDepth()); - - return (uint *)data; - } - - return 0; -} - -void DImgInterface::putSelectedData(uint* data, bool saveUndo) -{ - if (!data || d->image.isNull()) - return; - - if (saveUndo) - d->undoMan->addAction(new UndoActionIrreversible(this)); - - uchar *ptr = d->image.bits(); - uchar *pptr; - uchar *dptr = (uchar*)data; - - - for (int j = d->selY; j < (d->selY + d->selH); j++) - { - pptr = &ptr[ j * d->origWidth * d->image.bytesDepth() ] + - d->selX * d->image.bytesDepth(); - - for (int i = 0; i < d->selW*d->image.bytesDepth() ; i++) - { - *(pptr++) = *(dptr++); - } - } - - setModified(); -} - - - } // namespace Digikam #include "dimginterface.moc" --- trunk/extragear/graphics/digikam/utilities/imageeditor/canvas/dimginterface.h #523065:523066 @@ -165,17 +165,6 @@ static DImgInterface *m_instance; DImgInterfacePrivate *d; - -// ----------------------------------------------------------------------------- -// FIXME : remove these methods when all image plugins will be ported to DImg. - -public: - uint* getData(); - void putData(uint* data, int w, int h); - void putData(const QString &caller, uint* data, int w, int h); - uint* getSelectedData(); - void putSelectedData(uint* data, bool saveUndo=true); - }; } // namespace Digikam --- trunk/extragear/graphics/digikam/utilities/imageeditor/editor/imageiface.cpp #523065:523066 @@ -354,106 +354,5 @@ return DImgInterface::instance()->getEmbeddedICC(); } -// ----------------------------------------------------------------------------------- -// FIXME Remove methods below when all image plugins will be ported to DImg - -uint* ImageIface::getPreviewData() -{ - if (!d->previewData) - { - uchar* ptr = DImgInterface::instance()->getImage(); - int w = DImgInterface::instance()->origWidth(); - int h = DImgInterface::instance()->origHeight(); - bool hasAlpha = DImgInterface::instance()->hasAlpha(); - bool sixteenBit = DImgInterface::instance()->sixteenBit(); - - if (!ptr || !w || !h) - return 0; - - DImg im(w, h, sixteenBit, hasAlpha, ptr); - QSize sz(im.width(), im.height()); - sz.scale(d->constrainWidth, d->constrainHeight, QSize::ScaleMin); - - d->image = im.smoothScale(sz.width(), sz.height()); - d->previewWidth = d->image.width(); - d->previewHeight = d->image.height(); - - d->previewData = new uchar[d->image.numBytes()]; - memcpy(d->previewData, d->image.bits(), d->image.numBytes()); - - d->qmask.resize(d->previewWidth, d->previewHeight); - d->qpix.resize(d->previewWidth, d->previewHeight); - } - - int size = d->previewWidth*d->previewHeight*d->image.bytesDepth(); - uchar* data = new uchar[size]; - memcpy(data, d->previewData, size); - - return (uint*)data; -} - -void ImageIface::putPreviewData(uint* data) -{ - if (!data) - return; - - uchar* origData = d->image.bits(); - int w = d->image.width(); - int h = d->image.height(); - int bd = d->image.bytesDepth(); - - memcpy(origData, data, w * h * bd); -} - -uint* ImageIface::getOriginalData() -{ - uint *ptr = DImgInterface::instance()->getData(); - int w = DImgInterface::instance()->origWidth(); - int h = DImgInterface::instance()->origHeight(); - int bd = DImgInterface::instance()->bytesDepth(); - - if (!ptr || !w || !h) - return 0; - - uchar *origData = new uchar[w * h * bd]; - memcpy(origData, ptr, w * h * bd); - - return (uint*)origData; -} - -uint* ImageIface::setPreviewSize(int w, int h) -{ - if (d->previewData) - delete [] d->previewData; - - d->previewData = 0; - d->constrainWidth = w; - d->constrainHeight = h; - - return (getPreviewData()); -} - -void ImageIface::putOriginalData(const QString &caller, uint* data, int w, int h) -{ - if (!data) - return; - - DImgInterface::instance()->putData(caller, data, w, h); -} - -void ImageIface::putSelectedData(uint* data) -{ - if (!data) - return; - - DImgInterface::instance()->putSelectedData(data); -} - -uint* ImageIface::getSelectedData() -{ - return DImgInterface::instance()->getSelectedData(); -} - - } // namespace Digikam --- trunk/extragear/graphics/digikam/utilities/imageeditor/editor/imageiface.h #523065:523066 @@ -78,7 +78,7 @@ bool originalHasAlpha(); QByteArray getEmbeddedICCFromOriginalImage(); - /** Standard methods to get preview informations.*/ + /** Standard methods to get/set preview informations.*/ int previewWidth(); int previewHeight(); bool previewHasAlpha(); @@ -101,16 +101,6 @@ void paint(QPaintDevice* device, int x, int y, int w, int h); - // FIXME : remove these methods when all image plugins will be ported to DImg. - uint* getPreviewData(); - uint* getOriginalData(); - uint* getSelectedData(); - - void putPreviewData(uint* data); - void putOriginalData(const QString &caller, uint* data, int w=-1, int h=-1); - void putSelectedData(uint* data); - uint* setPreviewSize(int w, int h); - private: ImageIfacePriv* d; _______________________________________________ Digikam-devel mailing list [hidden email] https://mail.kde.org/mailman/listinfo/digikam-devel |
Free forum by Nabble | Edit this page |