1
/* ============================================================
3
* This file is a part of digiKam project
4
* http://www.digikam.org
7
* Description : a widget to display an image with guides
9
* Copyright (C) 2004-2010 Gilles Caulier <caulier dot gilles at gmail dot com>
11
* This program is free software; you can redistribute it
12
* and/or modify it under the terms of the GNU General
13
* Public License as published by the Free Software Foundation;
14
* either version 2, or (at your option)
17
* This program is distributed in the hope that it will be useful,
18
* but WITHOUT ANY WARRANTY; without even the implied warranty of
19
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
20
* GNU General Public License for more details.
22
* ============================================================ */
24
#ifndef IMAGEGUIDEWIDGET_H
25
#define IMAGEGUIDEWIDGET_H
29
#include <QtGui/QWidget>
30
#include <QtGui/QColor>
31
#include <QtGui/QPixmap>
32
#include <QtGui/QResizeEvent>
33
#include <QtGui/QMouseEvent>
34
#include <QtGui/QPaintEvent>
35
#include <QtCore/QPoint>
36
#include <QtCore/QEvent>
37
#include <QtCore/QTimerEvent>
42
#include "digikam_export.h"
50
class DIGIKAM_EXPORT ImageGuideWidget : public QWidget
71
explicit ImageGuideWidget(QWidget* parent=0,
72
bool spotVisible=true, int guideMode=PickColorMode,
73
const QColor& guideColor=Qt::red, int guideSize=1,
74
bool blink=false, bool useImageSelection=false);
77
ImageIface* imageIface() const;
79
QPoint getSpotPosition();
80
DColor getSpotColor(int getColorFrom);
81
void setSpotVisible(bool spotVisible, bool blink=false);
83
void resetSpotPosition();
85
void setPoints(const QPolygon& p, bool drawLine=false);
88
void setPaintColor(const QColor& color);
89
void setEraseMode(bool erase);
90
void setMaskEnabled(bool enabled);
91
void setMaskPenSize(int size);
93
QImage getMask() const;
95
void ICCSettingsChanged();
96
void exposureSettingsChanged();
100
void slotChangeGuideColor(const QColor& color);
101
void slotChangeGuideSize(int size);
102
void slotPreviewModeChanged(int mode);
106
void spotPositionChangedFromOriginal(const Digikam::DColor& color, const QPoint& position);
107
void spotPositionChangedFromTarget(const Digikam::DColor& color, const QPoint& position);
108
void signalResized();
112
void paintEvent(QPaintEvent*);
113
void resizeEvent(QResizeEvent*);
114
void timerEvent(QTimerEvent*);
115
void mousePressEvent(QMouseEvent*);
116
void mouseReleaseEvent(QMouseEvent*);
117
void mouseMoveEvent(QMouseEvent*);
118
void enterEvent(QEvent*);
119
void leaveEvent(QEvent*);
121
void drawLineTo(const QPoint& endPoint);
122
void drawLineTo(int width, bool erase, const QColor& color, const QPoint& start, const QPoint& end);
123
QPoint translatePointPosition(QPoint& point);
124
void drawText(QPainter* p, const QPoint& corner, const QString& text);
125
void updateMaskCursor();
129
class ImageGuideWidgetPriv;
130
ImageGuideWidgetPriv* const d;
133
} // namespace Digikam
135
#endif /* IMAGEGUIDEWIDGET_H */