[Digikam-devel] extragear/graphics/digikam
Gilles Caulier
caulier.gilles at free.fr
Wed Dec 14 12:00:53 GMT 2005
SVN commit 488426 by cgilles:
Digikam from trunk :
- Removing old image histogram constructor.
- Copy selection from IE work with 16 bits image. You can copy and paste image selection from IE to Krita. data are converted to 8 bits because 16 bits isn't supported by clipboard.
- blended histogram on IE canvas no support 16 bits images
CCMAIL: digikam-devel at kde.org
M +0 -6 libs/histogram/imagehistogram.cpp
M +0 -3 libs/histogram/imagehistogram.h
M +26 -25 utilities/imageeditor/canvas/canvas.cpp
--- trunk/extragear/graphics/digikam/libs/histogram/imagehistogram.cpp #488425:488426
@@ -57,12 +57,6 @@
setup(i_data, i_w, i_h, i_sixteenBits, parent);
}
-ImageHistogram::ImageHistogram(uint *i_data, uint i_w, uint i_h, QObject *parent)
- : QThread()
-{
- setup((uchar*)i_data, i_w, i_h, false, parent);
-}
-
void ImageHistogram::setup(uchar *i_data, uint i_w, uint i_h, bool i_sixteenBits, QObject *parent)
{
m_imageData = i_data;
--- trunk/extragear/graphics/digikam/libs/histogram/imagehistogram.h #488425:488426
@@ -80,9 +80,6 @@
public:
- // FIXME : remove this cpnstructor when all digiKam core will be ported to DImg.
- ImageHistogram(uint *i_data, uint i_w, uint i_h, QObject *parent=0);
-
ImageHistogram(uchar *i_data, uint i_w, uint i_h, bool i_sixteenBits, QObject *parent=0);
ImageHistogram(const DImg& image, QObject *parent=0);
--- trunk/extragear/graphics/digikam/utilities/imageeditor/canvas/canvas.cpp #488425:488426
@@ -276,13 +276,14 @@
p.fillRect(QRect(0, 0, wWidth, wHeight), QBrush(qRgba(0xff, 0xff, 0xff, 127)));
- // logic stolen from histogramwidget.c
+ // logic stolen from histogramwidget.cpp
+
for (x = 0 ; x < wWidth ; ++x)
{
double value = 0.0;
int i, j;
- i = (x * 256) / wWidth;
+ i = (x * histogram->getHistogramSegment()) / wWidth;
j = i + 1;
do
@@ -301,19 +302,20 @@
QColor hiscolor;
- switch (type) {
- case ImageHistogram::RedChannel:
- hiscolor = qRgba(0xFF, 0, 0, 127);
- break;
- case ImageHistogram::GreenChannel:
- hiscolor = qRgba(0, 0xFF, 0, 127);
- break;
- case ImageHistogram::BlueChannel:
- hiscolor = qRgba(0, 0, 0xFF, 127);
- break;
- default:
- hiscolor = qRgba(0, 0, 0, 127);
- break;
+ switch (type)
+ {
+ case ImageHistogram::RedChannel:
+ hiscolor = qRgba(0xFF, 0, 0, 127);
+ break;
+ case ImageHistogram::GreenChannel:
+ hiscolor = qRgba(0, 0xFF, 0, 127);
+ break;
+ case ImageHistogram::BlueChannel:
+ hiscolor = qRgba(0, 0, 0xFF, 127);
+ break;
+ default:
+ hiscolor = qRgba(0, 0, 0, 127);
+ break;
}
p.setPen(QPen::QPen(hiscolor, 1, Qt::SolidLine));
@@ -520,11 +522,13 @@
d->imageHistogram = 0;
}
- if (d->imageHistogram == 0) {
+ if (d->imageHistogram == 0)
+ {
d->histogramReady = false;
- d->imageHistogram = new ImageHistogram(d->im->getData(),
+ d->imageHistogram = new ImageHistogram(d->im->getImage(),
d->im->origWidth(),
d->im->origHeight(),
+ d->im->sixteenBit(),
this);
// paint busy
drawHistogramPixmapBusy();
@@ -1428,15 +1432,12 @@
return;
QApplication::setOverrideCursor (Qt::waitCursor);
- uint* data = d->im->getSelectedData();
-
- QImage selImg;
- selImg.create(w, h, 32);
- memcpy(selImg.bits(), data, selImg.numBytes());
-
+ uchar* data = d->im->getImageSelection();
+ DImg selDImg = DImg(w, h, d->im->sixteenBit(), d->im->hasAlpha(), data);
+ delete [] data;
+
+ QImage selImg = selDImg.copyQImage();
QApplication::clipboard()->setData(new QImageDrag(selImg), QClipboard::Clipboard);
-
- delete [] data;
QApplication::restoreOverrideCursor ();
}
More information about the Digikam-devel
mailing list