7
7
* Description : image selection widget used by ratio crop tool.
9
9
* Copyright (C) 2007 by Jaromir Malenko <malenko at email.cz>
10
* Copyright (C) 2004-2007 by Gilles Caulier <caulier dot gilles at gmail dot com>
10
* Copyright (C) 2008 by Roberto Castagnola <roberto dot castagnola at gmail dot com>
11
* Copyright (C) 2004-2008 by Gilles Caulier <caulier dot gilles at gmail dot com>
12
13
* This program is free software; you can redistribute it
13
14
* and/or modify it under the terms of the GNU General
75
75
CenterImage // Center selection to the center of image.
78
// Proportion : Golden Ratio and Rule of Thirds. More information at this url:
78
// Proportion : Golden Ratio and Rule of Thirds. More information at this url:
79
79
// http://photoinf.com/General/Robert_Berdan/Composition_and_the_Elements_of_Visual_Design.htm
91
ImageSelectionWidget(int width, int height, QWidget *parent=0,
92
float aspectRatioValue=1.0, int aspectRatio=RATIO01X01,
93
int orient=Landscape, int guideLinesType=GuideNone);
91
ImageSelectionWidget(int width, int height, QWidget *parent=0,
92
int widthRatioValue=1, int heightRatioValue=1,
93
int aspectRatio=RATIO01X01, int orient=Landscape,
94
int guideLinesType=GuideNone);
94
95
~ImageSelectionWidget();
96
97
void setCenterSelection(int centerType=CenterImage);
99
100
void setSelectionWidth(int w);
100
101
void setSelectionHeight(int h);
101
102
void setSelectionOrientation(int orient);
103
void setPreciseCrop(bool precise);
102
104
void setAutoOrientation(bool orientation);
103
105
void setSelectionAspectRatioType(int aspectRatioType);
104
void setSelectionAspectRatioValue(float aspectRatioValue);
106
void setSelectionAspectRatioValue(int widthRatioValue, int heightRatioValue);
105
107
void setGoldenGuideTypes(bool drawGoldenSection, bool drawGoldenSpiralSection,
106
108
bool drawGoldenSpiral, bool drawGoldenTriangle,
107
109
bool flipHorGoldenGuide, bool flipVerGoldenGuide);
109
int getOriginalImageWidth(void);
110
int getOriginalImageHeight(void);
111
QRect getRegionSelection(void);
113
int getMinWidthRange(void);
114
int getMinHeightRange(void);
116
void resetSelection(void);
117
void maxAspectSelection(void);
111
int getOriginalImageWidth();
112
int getOriginalImageHeight();
113
QRect getRegionSelection();
115
int getMinWidthRange();
116
int getMinHeightRange();
117
int getMaxWidthRange();
118
int getMaxHeightRange();
122
bool preciseCropAvailable();
124
void resetSelection();
125
void maxAspectSelection();
119
127
Digikam::ImageIface* imageIface();
129
137
void signalSelectionMoved( QRect rect );
130
138
void signalSelectionChanged( QRect rect );
131
void signalSelectionWidthChanged( int newWidth );
132
void signalSelectionHeightChanged( int newHeight );
133
139
void signalSelectionOrientationChanged( int newOrientation );
140
146
void mouseMoveEvent ( QMouseEvent * e );
141
147
void resizeEvent(QResizeEvent * e);
145
void slotTimerDone(void);
149
151
// Recalculate the target selection position and emit 'signalSelectionMoved'.
150
void regionSelectionMoved( bool targetDone );
152
void regionSelectionMoved();
152
void regionSelectionChanged(bool targetDone);
153
void realToLocalRegion(bool updateSizeOnly=false);
154
void localToRealRegion(void);
155
void normalizeRegion(void);
156
void applyAspectRatio(bool WOrH, bool repaintWidget=true, bool updateChange=true);
157
void updatePixmap(void);
158
QPoint computeAspectRatio(QPoint pm, int coef=1);
159
QPoint opposite(void);
154
void regionSelectionChanged();
155
QPoint convertPoint(const QPoint pm, bool localToReal=true);
156
QPoint convertPoint(int x, int y, bool localToReal=true);
157
void normalizeRegion();
158
void reverseRatioValues();
159
int computePreciseSize(int size, int step);
160
void applyAspectRatio(bool useHeight, bool repaintWidget=true);
160
163
float distance(QPoint a, QPoint b);
161
164
void placeSelection(QPoint pm, bool symetric, QPoint center);
162
void setCursorResizing(void);
165
void setCursorResizing();