summaryrefslogtreecommitdiff
authoralwin <alwin>2005-03-22 22:15:50 (UTC)
committer alwin <alwin>2005-03-22 22:15:50 (UTC)
commit31035d399edaaaff64976705fd44468b6357c863 (patch) (unidiff)
treecd32f1d5c23de21a924b5bd8bb7d43fadf160e3e
parent0b1f73644d33291b3a03d347dc5be3167126b652 (diff)
downloadopie-31035d399edaaaff64976705fd44468b6357c863.zip
opie-31035d399edaaaff64976705fd44468b6357c863.tar.gz
opie-31035d399edaaaff64976705fd44468b6357c863.tar.bz2
added missing interface methods for a generic imagedisplay (display
brightness) apps using that OImageScrollview must rebuild! this will be the last change of interface for a long time
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--libopie2/opiemm/oimagescrollview.cpp107
-rw-r--r--libopie2/opiemm/oimagescrollview.h16
2 files changed, 123 insertions, 0 deletions
diff --git a/libopie2/opiemm/oimagescrollview.cpp b/libopie2/opiemm/oimagescrollview.cpp
index 37a1ad5..58a9748 100644
--- a/libopie2/opiemm/oimagescrollview.cpp
+++ b/libopie2/opiemm/oimagescrollview.cpp
@@ -1,475 +1,582 @@
1#include "oimagescrollview.h" 1#include "oimagescrollview.h"
2 2
3#include <opie2/oimagezoomer.h> 3#include <opie2/oimagezoomer.h>
4#include <opie2/odebug.h> 4#include <opie2/odebug.h>
5#include <opie2/oapplication.h> 5#include <opie2/oapplication.h>
6#include <opie2/owait.h> 6#include <opie2/owait.h>
7#include <opie2/opieexif.h> 7#include <opie2/opieexif.h>
8 8
9#include <qimage.h> 9#include <qimage.h>
10#include <qlayout.h> 10#include <qlayout.h>
11 11
12/* for usage with the bitset */ 12/* for usage with the bitset */
13#define AUTO_SCALE 0 13#define AUTO_SCALE 0
14#define AUTO_ROTATE 1 14#define AUTO_ROTATE 1
15#define SHOW_ZOOMER 2 15#define SHOW_ZOOMER 2
16#define FIRST_RESIZE_DONE 3 16#define FIRST_RESIZE_DONE 3
17#define IMAGE_IS_JPEG 4 17#define IMAGE_IS_JPEG 4
18#define IMAGE_SCALED_LOADED 5 18#define IMAGE_SCALED_LOADED 5
19 19
20#define SCROLLVIEW_BITSET_SIZE 6 20#define SCROLLVIEW_BITSET_SIZE 6
21 21
22namespace Opie { 22namespace Opie {
23namespace MM { 23namespace MM {
24OImageScrollView::OImageScrollView( QWidget* parent, const char* name, WFlags f ) 24OImageScrollView::OImageScrollView( QWidget* parent, const char* name, WFlags f )
25 :QScrollView(parent,name,f|Qt::WRepaintNoErase ),_image_data(),_original_data(), 25 :QScrollView(parent,name,f|Qt::WRepaintNoErase ),_image_data(),_original_data(),
26 m_states(SCROLLVIEW_BITSET_SIZE),m_lastName("") 26 m_states(SCROLLVIEW_BITSET_SIZE),m_lastName("")
27{ 27{
28 _zoomer = 0; 28 _zoomer = 0;
29 m_states[AUTO_SCALE]=true; 29 m_states[AUTO_SCALE]=true;
30 m_states[AUTO_ROTATE]=true; 30 m_states[AUTO_ROTATE]=true;
31 m_states[FIRST_RESIZE_DONE]=false; 31 m_states[FIRST_RESIZE_DONE]=false;
32 m_states[IMAGE_IS_JPEG]=false; 32 m_states[IMAGE_IS_JPEG]=false;
33 m_states[IMAGE_SCALED_LOADED]=false; 33 m_states[IMAGE_SCALED_LOADED]=false;
34 m_states[SHOW_ZOOMER]=true; 34 m_states[SHOW_ZOOMER]=true;
35 _newImage = true;
35 init(); 36 init();
36} 37}
37 38
38OImageScrollView::OImageScrollView (const QImage&img, QWidget * parent, const char * name, WFlags f,bool always_scale,bool rfit) 39OImageScrollView::OImageScrollView (const QImage&img, QWidget * parent, const char * name, WFlags f,bool always_scale,bool rfit)
39 :QScrollView(parent,name,f|Qt::WRepaintNoErase),_image_data(),_original_data(img), 40 :QScrollView(parent,name,f|Qt::WRepaintNoErase),_image_data(),_original_data(img),
40 m_states(SCROLLVIEW_BITSET_SIZE),m_lastName("") 41 m_states(SCROLLVIEW_BITSET_SIZE),m_lastName("")
41{ 42{
42 _zoomer = 0; 43 _zoomer = 0;
43 m_states[AUTO_SCALE]=always_scale; 44 m_states[AUTO_SCALE]=always_scale;
44 m_states[AUTO_ROTATE]=rfit; 45 m_states[AUTO_ROTATE]=rfit;
45 m_states[FIRST_RESIZE_DONE]=false; 46 m_states[FIRST_RESIZE_DONE]=false;
46 m_states[IMAGE_IS_JPEG]=false; 47 m_states[IMAGE_IS_JPEG]=false;
47 m_states[IMAGE_SCALED_LOADED]=false; 48 m_states[IMAGE_SCALED_LOADED]=false;
48 m_states[SHOW_ZOOMER]=true; 49 m_states[SHOW_ZOOMER]=true;
49 _original_data.convertDepth(QPixmap::defaultDepth()); 50 _original_data.convertDepth(QPixmap::defaultDepth());
50 _original_data.setAlphaBuffer(false); 51 _original_data.setAlphaBuffer(false);
52 _newImage = true;
51 init(); 53 init();
52} 54}
53 55
54OImageScrollView::OImageScrollView (const QString&img, QWidget * parent, const char * name, WFlags f,bool always_scale,bool rfit) 56OImageScrollView::OImageScrollView (const QString&img, QWidget * parent, const char * name, WFlags f,bool always_scale,bool rfit)
55 :QScrollView(parent,name,f|Qt::WRepaintNoErase),_image_data(),_original_data(),m_states(SCROLLVIEW_BITSET_SIZE),m_lastName("") 57 :QScrollView(parent,name,f|Qt::WRepaintNoErase),_image_data(),_original_data(),m_states(SCROLLVIEW_BITSET_SIZE),m_lastName("")
56{ 58{
57 _zoomer = 0; 59 _zoomer = 0;
58 m_states.resize(SCROLLVIEW_BITSET_SIZE); 60 m_states.resize(SCROLLVIEW_BITSET_SIZE);
59 m_states[AUTO_SCALE]=always_scale; 61 m_states[AUTO_SCALE]=always_scale;
60 m_states[AUTO_ROTATE]=rfit; 62 m_states[AUTO_ROTATE]=rfit;
61 m_states[FIRST_RESIZE_DONE]=false; 63 m_states[FIRST_RESIZE_DONE]=false;
62 m_states[IMAGE_IS_JPEG]=false; 64 m_states[IMAGE_IS_JPEG]=false;
63 m_states[IMAGE_SCALED_LOADED]=false; 65 m_states[IMAGE_SCALED_LOADED]=false;
64 m_states[SHOW_ZOOMER]=true; 66 m_states[SHOW_ZOOMER]=true;
67 _newImage = true;
65 init(); 68 init();
66 setImage(img); 69 setImage(img);
67} 70}
68 71
69void OImageScrollView::setImage(const QImage&img) 72void OImageScrollView::setImage(const QImage&img)
70{ 73{
71 _image_data = QImage(); 74 _image_data = QImage();
72 _original_data=img; 75 _original_data=img;
73 _original_data.convertDepth(QPixmap::defaultDepth()); 76 _original_data.convertDepth(QPixmap::defaultDepth());
74 _original_data.setAlphaBuffer(false); 77 _original_data.setAlphaBuffer(false);
75 m_lastName = ""; 78 m_lastName = "";
76 setImageIsJpeg(false); 79 setImageIsJpeg(false);
77 setImageScaledLoaded(false); 80 setImageScaledLoaded(false);
81 _newImage = true;
78 if (FirstResizeDone()) { 82 if (FirstResizeDone()) {
79 generateImage(); 83 generateImage();
80 } 84 }
81} 85}
82 86
83void OImageScrollView::loadJpeg(bool interncall) 87void OImageScrollView::loadJpeg(bool interncall)
84{ 88{
85 if (m_lastName.isEmpty()) return; 89 if (m_lastName.isEmpty()) return;
86 QImageIO iio( m_lastName, 0l ); 90 QImageIO iio( m_lastName, 0l );
87 QString param; 91 QString param;
88 bool real_load = false; 92 bool real_load = false;
93 _newImage = true;
89 if (AutoScale()) { 94 if (AutoScale()) {
90 if (!interncall) { 95 if (!interncall) {
91 ExifData xf; 96 ExifData xf;
92 bool scanned = xf.scan(m_lastName); 97 bool scanned = xf.scan(m_lastName);
93 int wid, hei; 98 int wid, hei;
94 wid = QApplication::desktop()->width(); 99 wid = QApplication::desktop()->width();
95 hei = QApplication::desktop()->height(); 100 hei = QApplication::desktop()->height();
96 if (hei>wid) { 101 if (hei>wid) {
97 wid = hei; 102 wid = hei;
98 } else { 103 } else {
99 hei = wid; 104 hei = wid;
100 } 105 }
101 if ( (scanned && (wid<xf.getWidth()||hei<xf.getHeight()))||!scanned ) { 106 if ( (scanned && (wid<xf.getWidth()||hei<xf.getHeight()))||!scanned ) {
102 param = QString( "Fast Shrink( 3 ) Scale( %1, %2, ScaleMin)" ).arg( wid ).arg( hei ); 107 param = QString( "Fast Shrink( 3 ) Scale( %1, %2, ScaleMin)" ).arg( wid ).arg( hei );
103 odebug << "Load jpeg scaled \"" << param << "\"" << oendl; 108 odebug << "Load jpeg scaled \"" << param << "\"" << oendl;
104 iio.setParameters(param.latin1()); 109 iio.setParameters(param.latin1());
105 setImageScaledLoaded(true); 110 setImageScaledLoaded(true);
106 } 111 }
107 112
108 real_load = true; 113 real_load = true;
109 } 114 }
110 } else { 115 } else {
111 if (ImageScaledLoaded()||!interncall) { 116 if (ImageScaledLoaded()||!interncall) {
112 odebug << "Load jpeg unscaled" << oendl; 117 odebug << "Load jpeg unscaled" << oendl;
113 real_load = true; 118 real_load = true;
114 } 119 }
115 setImageScaledLoaded(false); 120 setImageScaledLoaded(false);
116 } 121 }
117 if (real_load) { 122 if (real_load) {
118 _original_data = iio.read() ? iio.image() : QImage(); 123 _original_data = iio.read() ? iio.image() : QImage();
119 } 124 }
120} 125}
121 126
122void OImageScrollView::setImage( const QString& path ) { 127void OImageScrollView::setImage( const QString& path ) {
123 odebug << "load new image " << oendl; 128 odebug << "load new image " << oendl;
124 if (m_lastName == path) return; 129 if (m_lastName == path) return;
125 m_lastName = path; 130 m_lastName = path;
131 _newImage = true;
126 _original_data = QImage(); 132 _original_data = QImage();
127 QString itype = QImage::imageFormat(m_lastName); 133 QString itype = QImage::imageFormat(m_lastName);
128 odebug << "Image type = " << itype << oendl; 134 odebug << "Image type = " << itype << oendl;
129 if (itype == "JPEG") { 135 if (itype == "JPEG") {
130 setImageIsJpeg(true); 136 setImageIsJpeg(true);
131 loadJpeg(); 137 loadJpeg();
132 } else { 138 } else {
133 setImageIsJpeg(false); 139 setImageIsJpeg(false);
134 _original_data.load(path); 140 _original_data.load(path);
135 _original_data.convertDepth(QPixmap::defaultDepth()); 141 _original_data.convertDepth(QPixmap::defaultDepth());
136 _original_data.setAlphaBuffer(false); 142 _original_data.setAlphaBuffer(false);
137 } 143 }
138 _image_data = QImage(); 144 _image_data = QImage();
139 if (FirstResizeDone()) { 145 if (FirstResizeDone()) {
140 generateImage(); 146 generateImage();
141 if (isVisible()) viewport()->repaint(true); 147 if (isVisible()) viewport()->repaint(true);
142 } 148 }
143} 149}
144 150
145/* should be called every time the QImage changed it content */ 151/* should be called every time the QImage changed it content */
146void OImageScrollView::init() 152void OImageScrollView::init()
147{ 153{
148 odebug << "init " << oendl; 154 odebug << "init " << oendl;
149 155
150 /* 156 /*
151 * create the zoomer 157 * create the zoomer
152 * and connect ther various signals 158 * and connect ther various signals
153 */ 159 */
154 _zoomer = new Opie::MM::OImageZoomer( this, "The Zoomer" ); 160 _zoomer = new Opie::MM::OImageZoomer( this, "The Zoomer" );
155 connect(_zoomer, SIGNAL( zoomAreaRel(int,int)), 161 connect(_zoomer, SIGNAL( zoomAreaRel(int,int)),
156 this, SLOT(scrollBy(int,int)) ); 162 this, SLOT(scrollBy(int,int)) );
157 connect(_zoomer, SIGNAL( zoomArea(int,int)), 163 connect(_zoomer, SIGNAL( zoomArea(int,int)),
158 this, SLOT(center(int,int)) ); 164 this, SLOT(center(int,int)) );
159 connect(this,SIGNAL(contentsMoving(int,int)), 165 connect(this,SIGNAL(contentsMoving(int,int)),
160 _zoomer, (SLOT(setVisiblePoint(int,int))) ); 166 _zoomer, (SLOT(setVisiblePoint(int,int))) );
161 connect(this,SIGNAL(imageSizeChanged(const QSize&)), 167 connect(this,SIGNAL(imageSizeChanged(const QSize&)),
162 _zoomer, SLOT(setImageSize(const QSize&)) ); 168 _zoomer, SLOT(setImageSize(const QSize&)) );
163 connect(this,SIGNAL(viewportSizeChanged(const QSize&)), 169 connect(this,SIGNAL(viewportSizeChanged(const QSize&)),
164 _zoomer, SLOT(setViewPortSize(const QSize&)) ); 170 _zoomer, SLOT(setViewPortSize(const QSize&)) );
165 171
166 setBackgroundColor(white); 172 setBackgroundColor(white);
167 setFocusPolicy(QWidget::StrongFocus); 173 setFocusPolicy(QWidget::StrongFocus);
168 setImageScaledLoaded(false); 174 setImageScaledLoaded(false);
169 setImageIsJpeg(false); 175 setImageIsJpeg(false);
170 if (FirstResizeDone()) { 176 if (FirstResizeDone()) {
171 m_last_rot = Rotate0; 177 m_last_rot = Rotate0;
172 generateImage(); 178 generateImage();
173 } else if (_original_data.size().isValid()) { 179 } else if (_original_data.size().isValid()) {
174 if (image_fit_into(_original_data.size()) || !ShowZoomer()) _zoomer->hide(); 180 if (image_fit_into(_original_data.size()) || !ShowZoomer()) _zoomer->hide();
175 resizeContents(_original_data.width(),_original_data.height()); 181 resizeContents(_original_data.width(),_original_data.height());
176 } 182 }
183 _intensity = 0;
177} 184}
178 185
179void OImageScrollView::setAutoRotate(bool how) 186void OImageScrollView::setAutoRotate(bool how)
180{ 187{
181 /* to avoid double repaints */ 188 /* to avoid double repaints */
182 if (AutoRotate() != how) { 189 if (AutoRotate() != how) {
183 m_states.setBit(AUTO_ROTATE,how); 190 m_states.setBit(AUTO_ROTATE,how);
184 _image_data = QImage(); 191 _image_data = QImage();
185 generateImage(); 192 generateImage();
186 } 193 }
187} 194}
188 195
189bool OImageScrollView::AutoRotate()const 196bool OImageScrollView::AutoRotate()const
190{ 197{
191 return m_states.testBit(AUTO_ROTATE); 198 return m_states.testBit(AUTO_ROTATE);
192} 199}
193 200
194void OImageScrollView::setAutoScaleRotate(bool scale, bool rotate) 201void OImageScrollView::setAutoScaleRotate(bool scale, bool rotate)
195{ 202{
196 m_states.setBit(AUTO_ROTATE,rotate); 203 m_states.setBit(AUTO_ROTATE,rotate);
197 setAutoScale(scale); 204 setAutoScale(scale);
198} 205}
199 206
200void OImageScrollView::setAutoScale(bool how) 207void OImageScrollView::setAutoScale(bool how)
201{ 208{
202 m_states.setBit(AUTO_SCALE,how); 209 m_states.setBit(AUTO_SCALE,how);
203 _image_data = QImage(); 210 _image_data = QImage();
204 if (ImageIsJpeg() && how == false && ImageScaledLoaded()==true) { 211 if (ImageIsJpeg() && how == false && ImageScaledLoaded()==true) {
205 loadJpeg(true); 212 loadJpeg(true);
206 } 213 }
207 generateImage(); 214 generateImage();
208} 215}
209 216
210bool OImageScrollView::AutoScale()const 217bool OImageScrollView::AutoScale()const
211{ 218{
212 return m_states.testBit(AUTO_SCALE); 219 return m_states.testBit(AUTO_SCALE);
213} 220}
214 221
215OImageScrollView::~OImageScrollView() 222OImageScrollView::~OImageScrollView()
216{ 223{
217} 224}
218 225
219void OImageScrollView::rescaleImage(int w, int h) 226void OImageScrollView::rescaleImage(int w, int h)
220{ 227{
221 if (_image_data.width()==w && _image_data.height()==h) { 228 if (_image_data.width()==w && _image_data.height()==h) {
222 return; 229 return;
223 } 230 }
224 double hs = (double)h / (double)_image_data.height() ; 231 double hs = (double)h / (double)_image_data.height() ;
225 double ws = (double)w / (double)_image_data.width() ; 232 double ws = (double)w / (double)_image_data.width() ;
226 double scaleFactor = (hs > ws) ? ws : hs; 233 double scaleFactor = (hs > ws) ? ws : hs;
227 int smoothW = (int)(scaleFactor * _image_data.width()); 234 int smoothW = (int)(scaleFactor * _image_data.width());
228 int smoothH = (int)(scaleFactor * _image_data.height()); 235 int smoothH = (int)(scaleFactor * _image_data.height());
229 _image_data = _image_data.smoothScale(smoothW,smoothH); 236 _image_data = _image_data.smoothScale(smoothW,smoothH);
230} 237}
231 238
232void OImageScrollView::rotate_into_data(Rotation r) 239void OImageScrollView::rotate_into_data(Rotation r)
233{ 240{
234 /* realy - we must do this that way, 'cause when acting direct on _image_data the app will 241 /* realy - we must do this that way, 'cause when acting direct on _image_data the app will
235 segfault :( */ 242 segfault :( */
236 QImage dest; 243 QImage dest;
237 int x, y; 244 int x, y;
238 if ( _original_data.depth() > 8 ) 245 if ( _original_data.depth() > 8 )
239 { 246 {
240 unsigned int *srcData, *destData; 247 unsigned int *srcData, *destData;
241 switch ( r ) 248 switch ( r )
242 { 249 {
243 case Rotate90: 250 case Rotate90:
244 dest.create(_original_data.height(), _original_data.width(), _original_data.depth()); 251 dest.create(_original_data.height(), _original_data.width(), _original_data.depth());
245 for ( y=0; y < _original_data.height(); ++y ) 252 for ( y=0; y < _original_data.height(); ++y )
246 { 253 {
247 srcData = (unsigned int *)_original_data.scanLine(y); 254 srcData = (unsigned int *)_original_data.scanLine(y);
248 for ( x=0; x < _original_data.width(); ++x ) 255 for ( x=0; x < _original_data.width(); ++x )
249 { 256 {
250 destData = (unsigned int *)dest.scanLine(x); 257 destData = (unsigned int *)dest.scanLine(x);
251 destData[_original_data.height()-y-1] = srcData[x]; 258 destData[_original_data.height()-y-1] = srcData[x];
252 } 259 }
253 } 260 }
254 break; 261 break;
255 case Rotate180: 262 case Rotate180:
256 dest.create(_original_data.width(), _original_data.height(), _original_data.depth()); 263 dest.create(_original_data.width(), _original_data.height(), _original_data.depth());
257 for ( y=0; y < _original_data.height(); ++y ) 264 for ( y=0; y < _original_data.height(); ++y )
258 { 265 {
259 srcData = (unsigned int *)_original_data.scanLine(y); 266 srcData = (unsigned int *)_original_data.scanLine(y);
260 destData = (unsigned int *)dest.scanLine(_original_data.height()-y-1); 267 destData = (unsigned int *)dest.scanLine(_original_data.height()-y-1);
261 for ( x=0; x < _original_data.width(); ++x ) 268 for ( x=0; x < _original_data.width(); ++x )
262 destData[_original_data.width()-x-1] = srcData[x]; 269 destData[_original_data.width()-x-1] = srcData[x];
263 } 270 }
264 break; 271 break;
265 case Rotate270: 272 case Rotate270:
266 dest.create(_original_data.height(), _original_data.width(), _original_data.depth()); 273 dest.create(_original_data.height(), _original_data.width(), _original_data.depth());
267 for ( y=0; y < _original_data.height(); ++y ) 274 for ( y=0; y < _original_data.height(); ++y )
268 { 275 {
269 srcData = (unsigned int *)_original_data.scanLine(y); 276 srcData = (unsigned int *)_original_data.scanLine(y);
270 for ( x=0; x < _original_data.width(); ++x ) 277 for ( x=0; x < _original_data.width(); ++x )
271 { 278 {
272 destData = (unsigned int *)dest.scanLine(_original_data.width()-x-1); 279 destData = (unsigned int *)dest.scanLine(_original_data.width()-x-1);
273 destData[y] = srcData[x]; 280 destData[y] = srcData[x];
274 } 281 }
275 } 282 }
276 break; 283 break;
277 default: 284 default:
278 dest = _original_data; 285 dest = _original_data;
279 break; 286 break;
280 } 287 }
281 } 288 }
282 else 289 else
283 { 290 {
284 unsigned char *srcData, *destData; 291 unsigned char *srcData, *destData;
285 unsigned int *srcTable, *destTable; 292 unsigned int *srcTable, *destTable;
286 switch ( r ) 293 switch ( r )
287 { 294 {
288 case Rotate90: 295 case Rotate90:
289 dest.create(_original_data.height(), _original_data.width(), _original_data.depth()); 296 dest.create(_original_data.height(), _original_data.width(), _original_data.depth());
290 dest.setNumColors(_original_data.numColors()); 297 dest.setNumColors(_original_data.numColors());
291 srcTable = (unsigned int *)_original_data.colorTable(); 298 srcTable = (unsigned int *)_original_data.colorTable();
292 destTable = (unsigned int *)dest.colorTable(); 299 destTable = (unsigned int *)dest.colorTable();
293 for ( x=0; x < _original_data.numColors(); ++x ) 300 for ( x=0; x < _original_data.numColors(); ++x )
294 destTable[x] = srcTable[x]; 301 destTable[x] = srcTable[x];
295 for ( y=0; y < _original_data.height(); ++y ) 302 for ( y=0; y < _original_data.height(); ++y )
296 { 303 {
297 srcData = (unsigned char *)_original_data.scanLine(y); 304 srcData = (unsigned char *)_original_data.scanLine(y);
298 for ( x=0; x < _original_data.width(); ++x ) 305 for ( x=0; x < _original_data.width(); ++x )
299 { 306 {
300 destData = (unsigned char *)dest.scanLine(x); 307 destData = (unsigned char *)dest.scanLine(x);
301 destData[_original_data.height()-y-1] = srcData[x]; 308 destData[_original_data.height()-y-1] = srcData[x];
302 } 309 }
303 } 310 }
304 break; 311 break;
305 case Rotate180: 312 case Rotate180:
306 dest.create(_original_data.width(), _original_data.height(), _original_data.depth()); 313 dest.create(_original_data.width(), _original_data.height(), _original_data.depth());
307 dest.setNumColors(_original_data.numColors()); 314 dest.setNumColors(_original_data.numColors());
308 srcTable = (unsigned int *)_original_data.colorTable(); 315 srcTable = (unsigned int *)_original_data.colorTable();
309 destTable = (unsigned int *)dest.colorTable(); 316 destTable = (unsigned int *)dest.colorTable();
310 for ( x=0; x < _original_data.numColors(); ++x ) 317 for ( x=0; x < _original_data.numColors(); ++x )
311 destTable[x] = srcTable[x]; 318 destTable[x] = srcTable[x];
312 for ( y=0; y < _original_data.height(); ++y ) 319 for ( y=0; y < _original_data.height(); ++y )
313 { 320 {
314 srcData = (unsigned char *)_original_data.scanLine(y); 321 srcData = (unsigned char *)_original_data.scanLine(y);
315 destData = (unsigned char *)dest.scanLine(_original_data.height()-y-1); 322 destData = (unsigned char *)dest.scanLine(_original_data.height()-y-1);
316 for ( x=0; x < _original_data.width(); ++x ) 323 for ( x=0; x < _original_data.width(); ++x )
317 destData[_original_data.width()-x-1] = srcData[x]; 324 destData[_original_data.width()-x-1] = srcData[x];
318 } 325 }
319 break; 326 break;
320 case Rotate270: 327 case Rotate270:
321 dest.create(_original_data.height(), _original_data.width(), _original_data.depth()); 328 dest.create(_original_data.height(), _original_data.width(), _original_data.depth());
322 dest.setNumColors(_original_data.numColors()); 329 dest.setNumColors(_original_data.numColors());
323 srcTable = (unsigned int *)_original_data.colorTable(); 330 srcTable = (unsigned int *)_original_data.colorTable();
324 destTable = (unsigned int *)dest.colorTable(); 331 destTable = (unsigned int *)dest.colorTable();
325 for ( x=0; x < _original_data.numColors(); ++x ) 332 for ( x=0; x < _original_data.numColors(); ++x )
326 destTable[x] = srcTable[x]; 333 destTable[x] = srcTable[x];
327 for ( y=0; y < _original_data.height(); ++y ) 334 for ( y=0; y < _original_data.height(); ++y )
328 { 335 {
329 srcData = (unsigned char *)_original_data.scanLine(y); 336 srcData = (unsigned char *)_original_data.scanLine(y);
330 for ( x=0; x < _original_data.width(); ++x ) 337 for ( x=0; x < _original_data.width(); ++x )
331 { 338 {
332 destData = (unsigned char *)dest.scanLine(_original_data.width()-x-1); 339 destData = (unsigned char *)dest.scanLine(_original_data.width()-x-1);
333 destData[y] = srcData[x]; 340 destData[y] = srcData[x];
334 } 341 }
335 } 342 }
336 break; 343 break;
337 default: 344 default:
338 dest = _original_data; 345 dest = _original_data;
339 break; 346 break;
340 } 347 }
341 348
342 } 349 }
350 _newImage = true;
343 _image_data = dest; 351 _image_data = dest;
344} 352}
345 353
354void OImageScrollView::apply_gamma(int aValue)
355{
356 if (!_image_data.size().isValid()) return;
357 float percent = ((float)aValue/100);
358 odebug << "Apply gamma " << percent << oendl;
359 int pixels = _image_data.depth()>8?_image_data.width()*_image_data.height() : _image_data.numColors();
360 int segColors = _image_data.depth() > 8 ? 256 : _image_data.numColors();
361 unsigned char *segTbl = new unsigned char[segColors];
362 bool brighten = (percent >= 0);
363 if ( percent < 0 )
364 percent = -percent;
365
366 unsigned int *data = _image_data.depth() > 8 ? (unsigned int *)_image_data.bits() :
367 (unsigned int *)_image_data.colorTable();
368
369
370 if (brighten) {
371 for ( int i=0; i < segColors; ++i )
372 {
373 int tmp = (int)(i*percent);
374 if ( tmp > 255 )
375 tmp = 255;
376 segTbl[i] = tmp;
377 }
378 } else {
379 for ( int i=0; i < segColors; ++i )
380 {
381 int tmp = (int)(i*percent);
382 if ( tmp < 0 )
383 tmp = 0;
384 segTbl[i] = tmp;
385 }
386 }
387 if (brighten) {
388 for ( int i=0; i < pixels; ++i )
389 {
390 int r = qRed(data[i]);
391 int g = qGreen(data[i]);
392 int b = qBlue(data[i]);
393 int a = qAlpha(data[i]);
394 r = r + segTbl[r] > 255 ? 255 : r + segTbl[r];
395 g = g + segTbl[g] > 255 ? 255 : g + segTbl[g];
396 b = b + segTbl[b] > 255 ? 255 : b + segTbl[b];
397 data[i] = qRgba(r, g, b,a);
398 }
399 } else {
400 for ( int i=0; i < pixels; ++i )
401 {
402 int r = qRed(data[i]);
403 int g = qGreen(data[i]);
404 int b = qBlue(data[i]);
405 int a = qAlpha(data[i]);
406 r = r - segTbl[r] < 0 ? 0 : r - segTbl[r];
407 g = g - segTbl[g] < 0 ? 0 : g - segTbl[g];
408 b = b - segTbl[b] < 0 ? 0 : b - segTbl[b];
409 data[i] = qRgba(r, g, b, a);
410 }
411 }
412 delete [] segTbl;
413}
414
415const int OImageScrollView::Intensity()const
416{
417 return _intensity;
418}
419
420int OImageScrollView::setIntensity(int value,bool reload)
421{
422 int oldi = _intensity;
423 _intensity = value;
424 if (!_pdata.size().isValid()) {
425 return _intensity;
426 }
427
428 if (!reload) {
429 _image_data = _pdata.convertToImage();
430 apply_gamma(_intensity-oldi);
431 _pdata.convertFromImage(_image_data);
432 /*
433 * invalidate
434 */
435 _image_data=QImage();
436 if (isVisible()) {
437 updateContents(contentsX(),contentsY(),width(),height());
438 }
439 } else {
440 _newImage = true;
441 generateImage();
442 }
443 return _intensity;
444}
445
346void OImageScrollView::generateImage() 446void OImageScrollView::generateImage()
347{ 447{
348 Rotation r = Rotate0; 448 Rotation r = Rotate0;
349 _pdata = QPixmap(); 449 _pdata = QPixmap();
350 if (_original_data.isNull()) { 450 if (_original_data.isNull()) {
351 emit imageSizeChanged( _image_data.size() ); 451 emit imageSizeChanged( _image_data.size() );
352 if (_zoomer) _zoomer->setImage( _image_data ); 452 if (_zoomer) _zoomer->setImage( _image_data );
353 return; 453 return;
354 } 454 }
355 if (width()>height()&&_original_data.width()<_original_data.height() || 455 if (width()>height()&&_original_data.width()<_original_data.height() ||
356 width()<height()&&_original_data.width()>_original_data.height()) { 456 width()<height()&&_original_data.width()>_original_data.height()) {
357 if (AutoRotate()) r = Rotate90; 457 if (AutoRotate()) r = Rotate90;
358 } 458 }
359 459
360 int twidth,theight; 460 int twidth,theight;
361 odebug << " r = " << r << oendl; 461 odebug << " r = " << r << oendl;
362 if (AutoScale() && (_original_data.width()>width() || _original_data.height() > height()) ) { 462 if (AutoScale() && (_original_data.width()>width() || _original_data.height() > height()) ) {
363 if (!_image_data.size().isValid()||width()>_image_data.width()||height()>_image_data.height()) { 463 if (!_image_data.size().isValid()||width()>_image_data.width()||height()>_image_data.height()) {
364 odebug << "Rescaling data" << oendl; 464 odebug << "Rescaling data" << oendl;
365 if (r==Rotate0) { 465 if (r==Rotate0) {
366 _image_data = _original_data; 466 _image_data = _original_data;
367 } else { 467 } else {
368 rotate_into_data(r); 468 rotate_into_data(r);
369 } 469 }
470 _newImage = true;
370 } 471 }
371 rescaleImage(width(),height()); 472 rescaleImage(width(),height());
372 } else if (!FirstResizeDone()||r!=m_last_rot||_image_data.width()==0) { 473 } else if (!FirstResizeDone()||r!=m_last_rot||_image_data.width()==0) {
373 if (r==Rotate0) { 474 if (r==Rotate0) {
374 _image_data = _original_data; 475 _image_data = _original_data;
375 } else { 476 } else {
376 rotate_into_data(r); 477 rotate_into_data(r);
377 } 478 }
378 m_last_rot = r; 479 m_last_rot = r;
379 } 480 }
481
482 if (_newImage) {
483 apply_gamma(_intensity);
484 _newImage = false;
485 }
486
380 _pdata.convertFromImage(_image_data); 487 _pdata.convertFromImage(_image_data);
381 twidth = _image_data.width(); 488 twidth = _image_data.width();
382 theight = _image_data.height(); 489 theight = _image_data.height();
383 490
384 /* 491 /*
385 * update the zoomer 492 * update the zoomer
386 */ 493 */
387 check_zoomer(); 494 check_zoomer();
388 emit imageSizeChanged( _image_data.size() ); 495 emit imageSizeChanged( _image_data.size() );
389 rescaleImage( 128, 128 ); 496 rescaleImage( 128, 128 );
390 resizeContents(twidth,theight); 497 resizeContents(twidth,theight);
391 /* 498 /*
392 * move scrollbar 499 * move scrollbar
393 */ 500 */
394 if (_zoomer) { 501 if (_zoomer) {
395 _zoomer->setGeometry( viewport()->width()-_image_data.width()/2, viewport()->height()-_image_data.height()/2, 502 _zoomer->setGeometry( viewport()->width()-_image_data.width()/2, viewport()->height()-_image_data.height()/2,
396 _image_data.width()/2, _image_data.height()/2 ); 503 _image_data.width()/2, _image_data.height()/2 );
397 _zoomer->setImage( _image_data ); 504 _zoomer->setImage( _image_data );
398 } 505 }
399 /* 506 /*
400 * invalidate 507 * invalidate
401 */ 508 */
402 _image_data=QImage(); 509 _image_data=QImage();
403 if (isVisible()) { 510 if (isVisible()) {
404 updateContents(contentsX(),contentsY(),width(),height()); 511 updateContents(contentsX(),contentsY(),width(),height());
405 } 512 }
406} 513}
407 514
408void OImageScrollView::resizeEvent(QResizeEvent * e) 515void OImageScrollView::resizeEvent(QResizeEvent * e)
409{ 516{
410 odebug << "OImageScrollView resizeEvent (" << e->size() << " - " << e->oldSize() << oendl; 517 odebug << "OImageScrollView resizeEvent (" << e->size() << " - " << e->oldSize() << oendl;
411 QScrollView::resizeEvent(e); 518 QScrollView::resizeEvent(e);
412 if (e->oldSize()==e->size()||!isUpdatesEnabled ()) return; 519 if (e->oldSize()==e->size()||!isUpdatesEnabled ()) return;
413 generateImage(); 520 generateImage();
414 setFirstResizeDone(true); 521 setFirstResizeDone(true);
415 emit viewportSizeChanged( viewport()->size() ); 522 emit viewportSizeChanged( viewport()->size() );
416 523
417} 524}
418 525
419void OImageScrollView::keyPressEvent(QKeyEvent * e) 526void OImageScrollView::keyPressEvent(QKeyEvent * e)
420{ 527{
421 if (!e) return; 528 if (!e) return;
422 int dx = horizontalScrollBar()->lineStep(); 529 int dx = horizontalScrollBar()->lineStep();
423 int dy = verticalScrollBar()->lineStep(); 530 int dy = verticalScrollBar()->lineStep();
424 if (e->key()==Qt::Key_Right) { 531 if (e->key()==Qt::Key_Right) {
425 scrollBy(dx,0); 532 scrollBy(dx,0);
426 e->accept(); 533 e->accept();
427 } else if (e->key()==Qt::Key_Left) { 534 } else if (e->key()==Qt::Key_Left) {
428 scrollBy(0-dx,0); 535 scrollBy(0-dx,0);
429 e->accept(); 536 e->accept();
430 } else if (e->key()==Qt::Key_Up) { 537 } else if (e->key()==Qt::Key_Up) {
431 scrollBy(0,0-dy); 538 scrollBy(0,0-dy);
432 e->accept(); 539 e->accept();
433 } else if (e->key()==Qt::Key_Down) { 540 } else if (e->key()==Qt::Key_Down) {
434 scrollBy(0,dy); 541 scrollBy(0,dy);
435 e->accept(); 542 e->accept();
436 } else { 543 } else {
437 e->ignore(); 544 e->ignore();
438 } 545 }
439 QScrollView::keyPressEvent(e); 546 QScrollView::keyPressEvent(e);
440} 547}
441 548
442void OImageScrollView::drawContents(QPainter * p, int clipx, int clipy, int clipw, int cliph) 549void OImageScrollView::drawContents(QPainter * p, int clipx, int clipy, int clipw, int cliph)
443{ 550{
444 if (!_pdata.size().isValid()) { 551 if (!_pdata.size().isValid()) {
445 p->fillRect(clipx,clipy,clipw,cliph, backgroundColor()); 552 p->fillRect(clipx,clipy,clipw,cliph, backgroundColor());
446 return; 553 return;
447 } 554 }
448 555
449 int w = clipw; 556 int w = clipw;
450 int h = cliph; 557 int h = cliph;
451 int x = clipx; 558 int x = clipx;
452 int y = clipy; 559 int y = clipy;
453 bool erase = false; 560 bool erase = false;
454 561
455 if (w>_pdata.width()) { 562 if (w>_pdata.width()) {
456 w = _pdata.width()-x; 563 w = _pdata.width()-x;
457 erase=true; 564 erase=true;
458 } 565 }
459 if (h>_pdata.height()) { 566 if (h>_pdata.height()) {
460 h = _pdata.height()-y; 567 h = _pdata.height()-y;
461 erase=true; 568 erase=true;
462 } 569 }
463 if (!erase && (clipy+cliph>_pdata.height()||clipx+clipw>_pdata.width())) { 570 if (!erase && (clipy+cliph>_pdata.height()||clipx+clipw>_pdata.width())) {
464 erase = true; 571 erase = true;
465 } 572 }
466 if (erase||_original_data.hasAlphaBuffer()) { 573 if (erase||_original_data.hasAlphaBuffer()) {
467 p->fillRect(clipx,clipy,clipw,cliph, backgroundColor()); 574 p->fillRect(clipx,clipy,clipw,cliph, backgroundColor());
468 } 575 }
469 if (w>0 && h>0&&x<_pdata.width()&&y<_pdata.height()) { 576 if (w>0 && h>0&&x<_pdata.width()&&y<_pdata.height()) {
470 p->drawPixmap(clipx,clipy,_pdata,x,y,w,h); 577 p->drawPixmap(clipx,clipy,_pdata,x,y,w,h);
471 } 578 }
472} 579}
473 580
474/* using the real geometry points and not the translated points is wanted! */ 581/* using the real geometry points and not the translated points is wanted! */
475void OImageScrollView::viewportMouseMoveEvent(QMouseEvent* e) 582void OImageScrollView::viewportMouseMoveEvent(QMouseEvent* e)
diff --git a/libopie2/opiemm/oimagescrollview.h b/libopie2/opiemm/oimagescrollview.h
index 01a2d56..11964fd 100644
--- a/libopie2/opiemm/oimagescrollview.h
+++ b/libopie2/opiemm/oimagescrollview.h
@@ -28,166 +28,182 @@ class OImageScrollView:public QScrollView
28{ 28{
29 Q_OBJECT 29 Q_OBJECT
30public: 30public:
31 enum Rotation { 31 enum Rotation {
32 Rotate0, 32 Rotate0,
33 Rotate90, 33 Rotate90,
34 Rotate180, 34 Rotate180,
35 Rotate270 35 Rotate270
36 }; 36 };
37 37
38 /** 38 /**
39 * Standard constructor 39 * Standard constructor
40 * @param parent the parent widget 40 * @param parent the parent widget
41 * @param name the name of the widget 41 * @param name the name of the widget
42 * @param fl widget flags. The flag Qt::WRepaintNoErase will be always set. 42 * @param fl widget flags. The flag Qt::WRepaintNoErase will be always set.
43 */ 43 */
44 OImageScrollView( QWidget* parent, const char* name = 0, WFlags fl = 0 ); 44 OImageScrollView( QWidget* parent, const char* name = 0, WFlags fl = 0 );
45 /** 45 /**
46 * constructor 46 * constructor
47 * @param aImage QImage object to display 47 * @param aImage QImage object to display
48 * @param parent the parent widget 48 * @param parent the parent widget
49 * @param name the name of the widget 49 * @param name the name of the widget
50 * @param fl widget flags. The flag Qt::WRepaintNoErase will be always set. 50 * @param fl widget flags. The flag Qt::WRepaintNoErase will be always set.
51 * @param always_scale if the image should be scaled into the display 51 * @param always_scale if the image should be scaled into the display
52 * @param rfit the image will be rotated to fit 52 * @param rfit the image will be rotated to fit
53 */ 53 */
54 OImageScrollView (const QImage&aImage, QWidget * parent=0, const char * name=0, WFlags f=0,bool always_scale=false,bool rfit=false ); 54 OImageScrollView (const QImage&aImage, QWidget * parent=0, const char * name=0, WFlags f=0,bool always_scale=false,bool rfit=false );
55 /** 55 /**
56 * constructor 56 * constructor
57 * @param aFile image file to display 57 * @param aFile image file to display
58 * @param parent the parent widget 58 * @param parent the parent widget
59 * @param name the name of the widget 59 * @param name the name of the widget
60 * @param fl widget flags. The flag Qt::WRepaintNoErase will be always set. 60 * @param fl widget flags. The flag Qt::WRepaintNoErase will be always set.
61 * @param always_scale if the image should be scaled into the display 61 * @param always_scale if the image should be scaled into the display
62 * @param rfit the image will be rotated to fit 62 * @param rfit the image will be rotated to fit
63 */ 63 */
64 OImageScrollView (const QString&aFile, QWidget * parent=0, const char * name=0, WFlags f=0,bool always_scale=false,bool rfit=false ); 64 OImageScrollView (const QString&aFile, QWidget * parent=0, const char * name=0, WFlags f=0,bool always_scale=false,bool rfit=false );
65 virtual ~OImageScrollView(); 65 virtual ~OImageScrollView();
66 66
67 /** 67 /**
68 * sets the WDestructiveClose flag to the view 68 * sets the WDestructiveClose flag to the view
69 */ 69 */
70 virtual void setDestructiveClose(); 70 virtual void setDestructiveClose();
71 71
72 /** 72 /**
73 * set if the image should be rotate to best fit 73 * set if the image should be rotate to best fit
74 * and repaint it if set to a new value. 74 * and repaint it if set to a new value.
75 * 75 *
76 * Be carefull - autorating real large images cost time! 76 * Be carefull - autorating real large images cost time!
77 * @param how if true then autorotate otherwise not 77 * @param how if true then autorotate otherwise not
78 */ 78 */
79 virtual void setAutoRotate(bool how); 79 virtual void setAutoRotate(bool how);
80 /** 80 /**
81 * set if the image should be scaled to the size of the viewport if larger(!) 81 * set if the image should be scaled to the size of the viewport if larger(!)
82 * 82 *
83 * if autoscaling is set when loading a jpeg image, it will use a feature of 83 * if autoscaling is set when loading a jpeg image, it will use a feature of
84 * jpeg lib to load the image scaled to display size. If switch of later the 84 * jpeg lib to load the image scaled to display size. If switch of later the
85 * image will reloaded. 85 * image will reloaded.
86 * 86 *
87 * @param how true - display image scaled down otherwise not 87 * @param how true - display image scaled down otherwise not
88 */ 88 */
89 virtual void setAutoScale(bool how); 89 virtual void setAutoScale(bool how);
90 /** 90 /**
91 * set if the image should be scaled to the size of the viewport if larger(!) 91 * set if the image should be scaled to the size of the viewport if larger(!)
92 * and/or rotate to best fit. You avoid double repainting when you want to switch 92 * and/or rotate to best fit. You avoid double repainting when you want to switch
93 * booth values. 93 * booth values.
94 * 94 *
95 * if autoscaling is set when loading a jpeg image, it will use a feature of 95 * if autoscaling is set when loading a jpeg image, it will use a feature of
96 * jpeg lib to load the image scaled to display size. If switch of later the 96 * jpeg lib to load the image scaled to display size. If switch of later the
97 * image will reloaded. 97 * image will reloaded.
98 * 98 *
99 * @param scale true - display image scaled down otherwise not 99 * @param scale true - display image scaled down otherwise not
100 * @param rotate true - the image will rotate for best fit 100 * @param rotate true - the image will rotate for best fit
101 */ 101 */
102 virtual void setAutoScaleRotate(bool scale, bool rotate); 102 virtual void setAutoScaleRotate(bool scale, bool rotate);
103 /** 103 /**
104 * set if there should be displayed a small zoomer widget at the right bottom of 104 * set if there should be displayed a small zoomer widget at the right bottom of
105 * the view when the image is larger than the viewport. 105 * the view when the image is larger than the viewport.
106 * 106 *
107 * @param how true - display zoomer 107 * @param how true - display zoomer
108 */ 108 */
109 virtual void setShowZoomer(bool how); 109 virtual void setShowZoomer(bool how);
110 110
111 /** 111 /**
112 * return the current value of the autorotate flag. 112 * return the current value of the autorotate flag.
113 */ 113 */
114 virtual bool AutoRotate()const; 114 virtual bool AutoRotate()const;
115 /** 115 /**
116 * return the current value of the autoscale flag. 116 * return the current value of the autoscale flag.
117 */ 117 */
118 virtual bool AutoScale()const; 118 virtual bool AutoScale()const;
119 /** 119 /**
120 * return the current value of the show zoomer flag. 120 * return the current value of the show zoomer flag.
121 */ 121 */
122 virtual bool ShowZoomer()const; 122 virtual bool ShowZoomer()const;
123 123
124 /**
125 * set a display intensity
126 * @param value the intensity value, will calcuated to a percent value (value/100)
127 * @param reload should the real image recalculated complete or just work on current display.
128 * @return the new intensity
129 */
130 virtual int setIntensity(int value,bool reload=false);
131 /**
132 * return the current display intensity
133 */
134 virtual const int Intensity()const;
135
136
124public slots: 137public slots:
125 /** 138 /**
126 * Displays a new image, calculations will made immediately. 139 * Displays a new image, calculations will made immediately.
127 * 140 *
128 * @param aImage the image to display 141 * @param aImage the image to display
129 */ 142 */
130 virtual void setImage(const QImage&aImage); 143 virtual void setImage(const QImage&aImage);
131 /** 144 /**
132 * Displays a new image, calculations will made immediately. 145 * Displays a new image, calculations will made immediately.
133 * 146 *
134 * @param path the image to display 147 * @param path the image to display
135 */ 148 */
136 virtual void setImage( const QString& path ); 149 virtual void setImage( const QString& path );
137 150
138 151
139signals: 152signals:
140 /** 153 /**
141 * emitted when the display image size has changed. 154 * emitted when the display image size has changed.
142 */ 155 */
143 void imageSizeChanged( const QSize& ); 156 void imageSizeChanged( const QSize& );
144 /** 157 /**
145 * emitted when the size of the viewport has changed, eg. in resizeEvent of 158 * emitted when the size of the viewport has changed, eg. in resizeEvent of
146 * the view. 159 * the view.
147 * 160 *
148 * @see QWidget::resizeEvent 161 * @see QWidget::resizeEvent
149 */ 162 */
150 void viewportSizeChanged( const QSize& ); 163 void viewportSizeChanged( const QSize& );
151 164
152protected: 165protected:
153 virtual void drawContents ( QPainter * p, int clipx, int clipy, int clipw, int cliph ); 166 virtual void drawContents ( QPainter * p, int clipx, int clipy, int clipw, int cliph );
154 void init(); 167 void init();
155 168
156 Opie::MM::OImageZoomer *_zoomer; 169 Opie::MM::OImageZoomer *_zoomer;
157 QImage _image_data; 170 QImage _image_data;
158 QImage _original_data; 171 QImage _original_data;
159 QPixmap _pdata; 172 QPixmap _pdata;
173 int _intensity;
174 bool _newImage;
160 175
161 int _mouseStartPosX,_mouseStartPosY; 176 int _mouseStartPosX,_mouseStartPosY;
162 177
163 QBitArray m_states; 178 QBitArray m_states;
164 179
165 Rotation m_last_rot; 180 Rotation m_last_rot;
166 QString m_lastName; 181 QString m_lastName;
167 virtual void rescaleImage(int w, int h); 182 virtual void rescaleImage(int w, int h);
168 183
169 virtual void rotate_into_data(Rotation r); 184 virtual void rotate_into_data(Rotation r);
170 virtual void generateImage(); 185 virtual void generateImage();
171 virtual void loadJpeg(bool interncall = false); 186 virtual void loadJpeg(bool interncall = false);
172 bool image_fit_into(const QSize&s); 187 bool image_fit_into(const QSize&s);
173 void check_zoomer(); 188 void check_zoomer();
174 189
175 /* internal bitset manipulation */ 190 /* internal bitset manipulation */
176 virtual bool ImageIsJpeg()const; 191 virtual bool ImageIsJpeg()const;
177 virtual void setImageIsJpeg(bool how); 192 virtual void setImageIsJpeg(bool how);
178 virtual bool ImageScaledLoaded()const; 193 virtual bool ImageScaledLoaded()const;
179 virtual void setImageScaledLoaded(bool how); 194 virtual void setImageScaledLoaded(bool how);
180 virtual bool FirstResizeDone()const; 195 virtual bool FirstResizeDone()const;
181 virtual void setFirstResizeDone(bool how); 196 virtual void setFirstResizeDone(bool how);
197 virtual void apply_gamma(int aValue);
182 198
183protected slots: 199protected slots:
184 virtual void viewportMouseMoveEvent(QMouseEvent* e); 200 virtual void viewportMouseMoveEvent(QMouseEvent* e);
185 virtual void contentsMousePressEvent ( QMouseEvent * e); 201 virtual void contentsMousePressEvent ( QMouseEvent * e);
186 virtual void resizeEvent(QResizeEvent * e); 202 virtual void resizeEvent(QResizeEvent * e);
187 virtual void keyPressEvent(QKeyEvent * e); 203 virtual void keyPressEvent(QKeyEvent * e);
188}; 204};
189 205
190} 206}
191} 207}
192 208
193#endif 209#endif