1
/* ============================================================
3
* This file is a part of digiKam project
4
* http://www.digikam.org
7
* Description : a widget to draw an image clip region.
9
* Copyright (C) 2004-2011 by 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 IMAGEREGIONWIDGET_H
25
#define IMAGEREGIONWIDGET_H
29
#include <QtCore/QPoint>
30
#include <QtCore/QRect>
31
#include <QtCore/QEvent>
32
#include <QtGui/QPolygon>
33
#include <QtGui/QPixmap>
34
#include <QtGui/QResizeEvent>
35
#include <QtGui/QWheelEvent>
40
#include "previewwidget.h"
41
#include "digikam_export.h"
46
class DIGIKAM_EXPORT ImageRegionWidget : public PreviewWidget
52
ImageRegionWidget(QWidget* parent = 0);
55
/** To get target image region area to render.
57
QRect getOriginalImageRegionToRender() const;
59
/** To get target image region image to use for render operations
60
If the bool parameter is true a downscaled version of the image
61
region at screen resolution will be sent.
62
Should be use to increase preview speed for the effects whose
63
behaviour is a function of each pixel.
65
DImg getOriginalRegionImage(bool useDownscaledImage = false) const;
67
void setPreviewImage(const DImg& img);
69
void setCapturePointMode(bool b);
70
bool capturePointMode() const;
72
void setHighLightPoints(const QPolygon& pointsList);
73
void setCenterImageRegionPosition();
75
void ICCSettingsChanged();
76
void exposureSettingsChanged();
80
void signalOriginalClipFocusChanged();
81
void signalCapturedPointFromOriginal(const Digikam::DColor&, const QPoint&);
85
void slotPreviewModeChanged(int mode);
86
void slotOriginalImageRegionChanged(bool targetDone);
90
void slotZoomFactorChanged();
91
void slotPanIconSelectionMoved(const QRect& rect, bool targetDone);
92
void slotContentTakeFocus();
93
void slotContentLeaveFocus();
97
void setContentsPosition(int x, int y, bool targetDone);
99
/** To get image region including original or/and target area depending of separate view mode.
100
The region is given using not scaled image unit.
102
QRect getOriginalImageRegion() const;
104
QRect getLocalImageRegionToRender() const;
106
void backupPixmapRegion();
107
void restorePixmapRegion();
109
void enterEvent(QEvent*);
110
void leaveEvent(QEvent*);
111
void contentsMousePressEvent(QMouseEvent*);
112
void contentsMouseReleaseEvent(QMouseEvent*);
116
bool previewIsNull();
118
QImage previewToQImage() const;
120
void viewportPaintExtraData();
121
inline void paintPreview(QPixmap* pix, int sx, int sy, int sw, int sh);
123
void emitCapturedPointFromOriginal(const QPoint& pt);
127
class ImageRegionWidgetPriv;
128
ImageRegionWidgetPriv* const d;
131
} // namespace Digikam
133
#endif /* IMAGEREGIONWIDGET_H */