![]() |
VR-Forces 4.0.4 Class Documentation
|
00001 /******************************************************************************* 00002 ** Copyright (c) 2008 MAK Technologies, Inc. 00003 ** All rights reserved. 00004 *******************************************************************************/ 00005 /******************************************************************************* 00006 ** $RCSfile: largeImageReader.h,v $ $Revision: 1.4 $ $State: Exp $ 00007 *******************************************************************************/ 00008 00011 00012 #ifndef LARGEIMAGEREADER_H_ 00013 #define LARGEIMAGEREADER_H_ 00014 00015 #include "drawerqt/drawerqtDefines.h" 00016 #include <QtGui/QImageReader> 00017 #include <QtCore/QSize> 00018 #include <QtCore/QRect> 00019 00035 00036 class jpegClippedReader; 00037 00038 class DT_DLL_drawerqt DtLargeImageReader : public QImageReader 00039 { 00040 public: 00041 enum DtLargeImageFlags 00042 { 00043 DtKeepSize = 1, 00044 DtAutoFitLargeImage = 2 00045 }; 00046 00047 DtLargeImageReader(QIODevice *device, DtLargeImageFlags fl = DtAutoFitLargeImage, 00048 int stepSize = 2, const QByteArray &format = QByteArray()); 00049 DtLargeImageReader(const QString &fileName, DtLargeImageFlags fl = DtAutoFitLargeImage, 00050 int stepSize = 2, const QByteArray &format = QByteArray()); 00051 ~DtLargeImageReader(); 00052 00053 static bool canCreateImageOfSize(const QSize&, int imageDepth = 32); 00054 00055 void setImageSize(const QSize&); 00056 const QSize& imageSize() const; 00057 00058 void setStepSize(int); 00059 int stepSize() const; 00060 00063 virtual QImage read(); 00064 00069 virtual QSize imageSizeToUse(const QSize& expectedSize) const; 00070 00073 virtual QSize minimumImageSize(const QSize& basedOn, int stepSize = 2) const; 00074 00077 virtual QImage loadImage(const QSize& imageSize); 00078 00081 virtual QSize determineSize() const; 00082 00085 virtual QSize size() const; 00086 00088 virtual bool supportsOption(QImageIOHandler::ImageOption option) const; 00089 virtual QRect clipRect() const; 00090 virtual void setClipRect(const QRect&); 00091 00092 virtual bool isJpeg() const; 00093 00096 virtual QImage loadClippedImage(const QRect& clipRect, const QSize& outputSize); 00097 00099 virtual bool canImportImage() const; 00100 00101 protected: 00102 virtual QImage loadClippedJpeg(const QRect& clipRect, const QSize& outputSize); 00103 00104 protected: 00105 DtLargeImageFlags myFlags; 00106 QSize myImageSize; 00107 QRect myClipRect; 00108 int myStepSize; 00109 int myImageDepth; 00110 jpegClippedReader* myScaler; 00111 }; 00112 00113 inline void DtLargeImageReader::setStepSize(int i) 00114 { 00115 myStepSize = i; 00116 } 00117 00118 inline int DtLargeImageReader::stepSize() const 00119 { 00120 return myStepSize; 00121 } 00122 00123 inline void DtLargeImageReader::setImageSize(const QSize& sz) 00124 { 00125 myImageSize = sz; 00126 } 00127 00128 inline const QSize& DtLargeImageReader::imageSize() const 00129 { 00130 return myImageSize; 00131 } 00132 00133 #endif