[Digikam-devel] extragear/graphics
Gilles Caulier
caulier.gilles at free.fr
Wed Jul 27 12:15:22 BST 2005
SVN commit 439184 by cgilles:
digiKam Hot Pixels Tool :
Second stage : display the hot pixels on pan icon widget.
A screenshot :
http://digikam3rdparty.free.fr/HotPixelRemovalTool-Alpha.png
CCMAIL: digikam-devel at kde.org, ugarro at telefonica.net
M +21 -2 digikam/libs/widgets/imagepaniconwidget.cpp
M +26 -15 digikam/libs/widgets/imagepaniconwidget.h
M +0 -1 digikam/libs/widgets/imagepannelwidget.cpp
M +7 -2 digikam/libs/widgets/imagepannelwidget.h
M +19 -0 digikamimageplugins/hotpixels/imageeffect_hotpixels.cpp
--- trunk/extragear/graphics/digikam/libs/widgets/imagepaniconwidget.cpp #439183:439184
@@ -141,11 +141,30 @@
{
// Drawing background and image.
m_pixmap->fill(colorGroup().background());
- m_iface->paint(m_pixmap, m_rect.x(), m_rect.y(),
- m_rect.width(), m_rect.height());
+ m_iface->paint(m_pixmap, m_rect.x(), m_rect.y(), m_rect.width(), m_rect.height());
QPainter p(m_pixmap);
+
+ // Drawing HighLighted points.
+ if (!hightlightPoints.isEmpty())
+ {
+ QPoint pt;
+
+ for (uint i = 0 ; i < hightlightPoints.count() ; i++)
+ {
+ pt = hightlightPoints.point(i);
+ p.setPen(QPen(Qt::black, 1, Qt::SolidLine));
+ p.drawLine(pt.x(), pt.y()-1, pt.x(), pt.y()+1);
+ p.drawLine(pt.x()-1, pt.y(), pt.x()+1, pt.y());
+ p.setPen(QPen(Qt::white, 1, Qt::SolidLine));
+ p.drawPoint(pt.x()-1, pt.y()-1);
+ p.drawPoint(pt.x()+1, pt.y()+1);
+ p.drawPoint(pt.x()-1, pt.y()+1);
+ p.drawPoint(pt.x()+1, pt.y()-1);
+ }
+ }
+
// Drawing selection border
p.setPen(QPen(Qt::red, 2, Qt::SolidLine));
p.drawRect(m_localRegionSelection);
--- trunk/extragear/graphics/digikam/libs/widgets/imagepaniconwidget.h #439183:439184
@@ -25,9 +25,10 @@
#include <qwidget.h>
#include <qrect.h>
+#include <qsize.h>
+#include <qpixmap.h>
+#include <qpointarray.h>
-class QPixmap;
-
namespace Digikam
{
@@ -46,6 +47,14 @@
QRect getRegionSelection(void);
void setCenterSelection(void);
+ QSize getPreviewSize(void){ return QSize::QSize(m_w, m_h); };
+ void setHighLightPoints(QPointArray pointsList)
+ {
+ hightlightPoints = pointsList;
+ updatePixmap();
+ repaint(false);
+ };
+
signals:
// Used with ImagePreview widget.
@@ -68,24 +77,26 @@
private:
- int m_separateView;
+ int m_separateView;
- uint *m_data;
- int m_w;
- int m_h;
+ uint *m_data;
+ int m_w;
+ int m_h;
- int m_xpos;
- int m_ypos;
+ int m_xpos;
+ int m_ypos;
- bool m_moveSelection;
+ bool m_moveSelection;
- QRect m_rect;
- QRect m_regionSelection; // Original size image selection.
- QRect m_localRegionSelection; // Thumbnail size selection.
+ QRect m_rect;
+ QRect m_regionSelection; // Original size image selection.
+ QRect m_localRegionSelection; // Thumbnail size selection.
- QPixmap* m_pixmap;
-
- ImageIface *m_iface;
+ QPixmap *m_pixmap;
+
+ QPointArray hightlightPoints;
+
+ ImageIface *m_iface;
private:
--- trunk/extragear/graphics/digikam/libs/widgets/imagepannelwidget.cpp #439183:439184
@@ -46,7 +46,6 @@
// Local includes.
#include "imageregionwidget.h"
-#include "imagepaniconwidget.h"
#include "imagepannelwidget.h"
namespace Digikam
--- trunk/extragear/graphics/digikam/libs/widgets/imagepannelwidget.h #439183:439184
@@ -26,10 +26,13 @@
#include <qwidget.h>
#include <qimage.h>
#include <qrect.h>
+#include <qsize.h>
#include <qlayout.h>
+#include <qpixmap.h>
// Local includes
+#include "imagepaniconwidget.h"
#include "digikam_export.h"
class QHButtonGroup;
@@ -40,7 +43,6 @@
{
class ImageRegionWidget;
-class ImagePanIconWidget;
class DIGIKAM_EXPORT ImagePannelWidget : public QWidget
{
@@ -76,8 +78,11 @@
void setUserAreaWidget(QWidget *w, bool separator=true);
- KProgress *progressBar(void) { return m_progressBar; };
+ KProgress *progressBar(void) { return m_progressBar; };
+ QSize getPanIconPreviewSize(void) { return m_imagePanIconWidget->getPreviewSize(); };
+ void setPanIconHighLightPoints(QPointArray pt) { m_imagePanIconWidget->setHighLightPoints(pt); };
+
public slots:
// Set the top/Left conner clip position.
--- trunk/extragear/graphics/digikamimageplugins/hotpixels/imageeffect_hotpixels.cpp #439183:439184
@@ -27,6 +27,7 @@
#include <qlabel.h>
#include <qlayout.h>
#include <qwhatsthis.h>
+#include <qpointarray.h>
// KDE includes.
@@ -239,6 +240,24 @@
void ImageEffect_HotPixels::slotBlackFrame(QValueList<HotPixel> hpList)
{
m_hotPixelsList = hpList;
+
+ Digikam::ImageIface iface(0, 0);
+ int orgW = iface.originalWidth();
+ int orgH = iface.originalHeight();
+ QSize panIconSize = m_imagePreviewWidget->getPanIconPreviewSize();
+ QPointArray pointList(m_hotPixelsList.size());
+ QValueList <HotPixel>::Iterator it;
+ int i = 0;
+
+ for (it = m_hotPixelsList.begin() ; it != m_hotPixelsList.end() ; ++it, i++)
+ {
+ pointList.setPoint(i, (*it).rect.center());
+ pointList.setPoint(i, (int)(pointList.point(i).x() * (float)(panIconSize.width())/(float)orgW),
+ (int)(pointList.point(i).y() * (float)(panIconSize.height())/(float)orgH) );
+ }
+
+ m_imagePreviewWidget->setPanIconHighLightPoints(pointList);
+
slotEffect();
}
More information about the Digikam-devel
mailing list