Eneboo - Documentación para desarrolladores
|
00001 /*************************************************************************** 00002 AQSImage_p.h 00003 ------------------- 00004 begin : 22/02/2011 00005 copyright : (C) 2003-2011 by InfoSiAL S.L. 00006 email : mail@infosial.com 00007 ***************************************************************************/ 00008 /*************************************************************************** 00009 * This program is free software; you can redistribute it and/or modify * 00010 * it under the terms of the GNU General Public License as published by * 00011 * the Free Software Foundation; version 2 of the License. * 00012 ***************************************************************************/ 00013 /*************************************************************************** 00014 Este programa es software libre. Puede redistribuirlo y/o modificarlo 00015 bajo los términos de la Licencia Pública General de GNU en su 00016 versión 2, publicada por la Free Software Foundation. 00017 ***************************************************************************/ 00018 00019 #ifndef AQSIMAGE_P_H_ 00020 #define AQSIMAGE_P_H_ 00021 00022 #include "AQSWMatrix_p.h" 00023 #include "AQSByteArray_p.h" 00024 #include "AQSIODevice_p.h" 00025 #include <qimage.h> 00026 00027 // @AQ_PTR_INDIRECTION@ 00028 00029 class AQSImage : public AQSVoidPtr 00030 { 00031 Q_OBJECT 00032 00033 Q_PROPERTY(QImage toVariant READ toVariant); 00034 00035 AQ_DECLARE_AQS_VOID(Image, VoidPtr); 00036 00037 public: 00038 QImage toVariant() const { 00039 if (!o_) 00040 return QImage(); 00041 return *o_; 00042 } 00043 00044 protected: 00045 void specializedInternalFinish() { 00046 if (!wrap_) 00047 delete o_; 00048 } 00049 00050 //@AQ_BEGIN_DEF_PUB_SLOTS@ 00051 public slots: 00052 QImage *copy() const; 00053 QImage *copy(int, int, int, int, int = 0) const; 00054 QImage *copy(const QRect &) const; 00055 bool isNull() const; 00056 int width() const; 00057 int height() const; 00058 QSize size() const; 00059 QRect rect() const; 00060 int depth() const; 00061 int numColors() const; 00062 uint bitOrder() const; 00063 QRgb color(int) const; 00064 void setColor(int, QRgb); 00065 void setNumColors(int); 00066 bool hasAlphaBuffer() const; 00067 void setAlphaBuffer(bool); 00068 bool allGray() const; 00069 bool isGrayscale() const; 00070 int numBytes() const; 00071 int bytesPerLine() const; 00072 bool create(int, int, int, int = 0, uint = QImage::IgnoreEndian); 00073 bool create(const QSize &, int, int = 0, uint = QImage::IgnoreEndian); 00074 void reset(); 00075 void fill(uint); 00076 void invertPixels(bool = TRUE); 00077 QImage *convertDepth(int) const; 00078 QImage *convertDepthWithPalette(int, QRgb *, int, int = 0) const; 00079 QImage *convertDepth(int, int) const; 00080 QImage *convertBitOrder(uint) const; 00081 QImage *smoothScale(int, int, uint = QImage::ScaleFree) const; 00082 QImage *smoothScale(const QSize &, uint = QImage::ScaleFree) const; 00083 QImage *scale(int, int, uint = QImage::ScaleFree) const; 00084 QImage *scale(const QSize &, uint = QImage::ScaleFree) const; 00085 QImage *scaleWidth(int) const; 00086 QImage *scaleHeight(int) const; 00087 QImage *xForm(QWMatrix *) const; 00088 QImage *xForm(AQSWMatrix *) const; 00089 QImage *createAlphaMask(int = 0) const; 00090 QImage *createHeuristicMask(bool = TRUE) const; 00091 QImage *mirror() const; 00092 QImage *mirror(bool, bool) const; 00093 QImage *swapRGB() const; 00094 bool loadFromData(QByteArray *, const char* = 0); 00095 bool loadFromData(AQSByteArray *, const char* = 0); 00096 bool save(QIODevice *, const char *, int = -1) const; 00097 bool save(AQSIODevice *, const char *, int = -1) const; 00098 bool load(const QString &, const char* = 0); 00099 bool save(const QString &, const char *, int = -1) const; 00100 bool valid(int, int) const; 00101 int pixelIndex(int, int) const; 00102 QRgb pixel(int, int) const; 00103 void setPixel(int, int, uint); 00104 int dotsPerMeterX() const; 00105 int dotsPerMeterY() const; 00106 void setDotsPerMeterX(int); 00107 void setDotsPerMeterY(int); 00108 QPoint offset() const; 00109 void setOffset(const QPoint &); 00110 QStringList textLanguages() const; 00111 QStringList textKeys() const; 00112 QString text(const char *, const char* = 0) const; 00113 void setText(const char *, const char *, const QString &); 00114 00115 protected: 00116 static void *construct(const QSArgumentList &args) { 00117 QMap<int, QStringList> candidates; 00118 candidates[0].append(QString::null); 00119 candidates[3].append(QString::fromLatin1("int,int,int")); 00120 candidates[4].append(QString::fromLatin1("int,int,int,int")); 00121 candidates[5].append(QString::fromLatin1("int,int,int,int,QImage::Endian")); 00122 candidates[2].append(QString::fromLatin1("QSize,int")); 00123 candidates[3].append(QString::fromLatin1("QSize,int,int")); 00124 candidates[4].append(QString::fromLatin1("QSize,int,int,QImage::Endian")); 00125 candidates[1].append(QString::fromLatin1("QString")); 00126 candidates[2].append(QString::fromLatin1("QString,QString")); 00127 candidates[1].append(QString::fromLatin1("QByteArray*")); 00128 candidates[1].append(QString::fromLatin1("QImage*")); 00129 QString sgt(castArgsSignature(args, candidates)); 00130 if (sgt.isEmpty()) 00131 return new QImage; 00132 if (sgt == QString::fromLatin1("int,int,int")) 00133 return new QImage(args[0].variant().toInt(), 00134 args[1].variant().toInt(), 00135 args[2].variant().toInt()); 00136 if (sgt == QString::fromLatin1("int,int,int,int")) 00137 return new QImage(args[0].variant().toInt(), 00138 args[1].variant().toInt(), 00139 args[2].variant().toInt(), 00140 args[3].variant().toInt()); 00141 if (sgt == QString::fromLatin1("int,int,int,int,QImage::Endian")) 00142 return new QImage(args[0].variant().toInt(), 00143 args[1].variant().toInt(), 00144 args[2].variant().toInt(), 00145 args[3].variant().toInt(), 00146 static_cast<QImage::Endian>(args[4].variant().toUInt())); 00147 if (sgt == QString::fromLatin1("QSize,int")) 00148 return new QImage(*(argValue<QSize *>(args[0])), 00149 args[1].variant().toInt()); 00150 if (sgt == QString::fromLatin1("QSize,int,int")) 00151 return new QImage(*(argValue<QSize *>(args[0])), 00152 args[1].variant().toInt(), 00153 args[2].variant().toInt()); 00154 if (sgt == QString::fromLatin1("QSize,int,int,QImage::Endian")) 00155 return new QImage(*(argValue<QSize *>(args[0])), 00156 args[1].variant().toInt(), 00157 args[2].variant().toInt(), 00158 static_cast<QImage::Endian>(args[3].variant().toUInt())); 00159 if (sgt == QString::fromLatin1("QString")) 00160 return new QImage(*(argValue<QString *>(args[0]))); 00161 if (sgt == QString::fromLatin1("QString,QString")) 00162 return new QImage(*(argValue<QString *>(args[0])), 00163 *(argValue<QString *>(args[1]))); 00164 if (sgt == QString::fromLatin1("QByteArray*")) 00165 return new QImage(*argValue<QByteArray *>(args[0])); 00166 if (sgt == QString::fromLatin1("QImage*")) 00167 return new QImage(*argValue<QImage *>(args[0])); 00168 return 0; 00169 } 00170 00171 public: 00172 static QMap<int, QStringList> candidateConstructors() { 00173 QMap<int, QStringList> candidates; 00174 candidates[0].append(QString::null); 00175 candidates[3].append(QString::fromLatin1("int,int,int")); 00176 candidates[4].append(QString::fromLatin1("int,int,int,int")); 00177 candidates[5].append(QString::fromLatin1("int,int,int,int,QImage::Endian")); 00178 candidates[2].append(QString::fromLatin1("QSize,int")); 00179 candidates[3].append(QString::fromLatin1("QSize,int,int")); 00180 candidates[4].append(QString::fromLatin1("QSize,int,int,QImage::Endian")); 00181 candidates[1].append(QString::fromLatin1("QString")); 00182 candidates[2].append(QString::fromLatin1("QString,QString")); 00183 candidates[1].append(QString::fromLatin1("QByteArray*")); 00184 candidates[1].append(QString::fromLatin1("QImage*")); 00185 return candidates; 00186 } 00187 //@AQ_END_DEF_PUB_SLOTS@ 00188 }; 00189 00190 //@AQ_BEGIN_IMP_PUB_SLOTS@ 00191 inline QImage *AQSImage::copy() const 00192 { 00193 AQ_CALL_RET_PTR(copy(), QImage); 00194 } 00195 inline QImage *AQSImage::copy(int arg0, int arg1, int arg2, int arg3, int arg4) const 00196 { 00197 AQ_CALL_RET_PTR(copy(arg0, arg1, arg2, arg3, arg4), QImage); 00198 } 00199 inline QImage *AQSImage::copy(const QRect &arg0) const 00200 { 00201 AQ_CALL_RET_PTR(copy(arg0), QImage); 00202 } 00203 inline bool AQSImage::isNull() const 00204 { 00205 AQ_CALL_RET_V(isNull(), bool); 00206 } 00207 inline int AQSImage::width() const 00208 { 00209 AQ_CALL_RET_V(width(), int); 00210 } 00211 inline int AQSImage::height() const 00212 { 00213 AQ_CALL_RET_V(height(), int); 00214 } 00215 inline QSize AQSImage::size() const 00216 { 00217 AQ_CALL_RET_V(size(), QSize); 00218 } 00219 inline QRect AQSImage::rect() const 00220 { 00221 AQ_CALL_RET_V(rect(), QRect); 00222 } 00223 inline int AQSImage::depth() const 00224 { 00225 AQ_CALL_RET_V(depth(), int); 00226 } 00227 inline int AQSImage::numColors() const 00228 { 00229 AQ_CALL_RET_V(numColors(), int); 00230 } 00231 inline uint AQSImage::bitOrder() const 00232 { 00233 AQ_CALL_RET_V(bitOrder(), uint); 00234 } 00235 inline QRgb AQSImage::color(int arg0) const 00236 { 00237 AQ_CALL_RET_V(color(arg0), QRgb); 00238 } 00239 inline void AQSImage::setColor(int arg0, QRgb arg1) 00240 { 00241 AQ_CALL_VOID(setColor(arg0, arg1)); 00242 } 00243 inline void AQSImage::setNumColors(int arg0) 00244 { 00245 AQ_CALL_VOID(setNumColors(arg0)); 00246 } 00247 inline bool AQSImage::hasAlphaBuffer() const 00248 { 00249 AQ_CALL_RET_V(hasAlphaBuffer(), bool); 00250 } 00251 inline void AQSImage::setAlphaBuffer(bool arg0) 00252 { 00253 AQ_CALL_VOID(setAlphaBuffer(arg0)); 00254 } 00255 inline bool AQSImage::allGray() const 00256 { 00257 AQ_CALL_RET_V(allGray(), bool); 00258 } 00259 inline bool AQSImage::isGrayscale() const 00260 { 00261 AQ_CALL_RET_V(isGrayscale(), bool); 00262 } 00263 inline int AQSImage::numBytes() const 00264 { 00265 AQ_CALL_RET_V(numBytes(), int); 00266 } 00267 inline int AQSImage::bytesPerLine() const 00268 { 00269 AQ_CALL_RET_V(bytesPerLine(), int); 00270 } 00271 inline bool AQSImage::create(int arg0, int arg1, int arg2, int arg3, uint arg4) 00272 { 00273 AQ_CALL_RET_V(create(arg0, arg1, arg2, arg3, static_cast<QImage::Endian>(arg4)), bool); 00274 } 00275 inline bool AQSImage::create(const QSize &arg0, int arg1, int arg2, uint arg3) 00276 { 00277 AQ_CALL_RET_V(create(arg0, arg1, arg2, static_cast<QImage::Endian>(arg3)), bool); 00278 } 00279 inline void AQSImage::reset() 00280 { 00281 AQ_CALL_VOID(reset()); 00282 } 00283 inline void AQSImage::fill(uint arg0) 00284 { 00285 AQ_CALL_VOID(fill(arg0)); 00286 } 00287 inline void AQSImage::invertPixels(bool arg0) 00288 { 00289 AQ_CALL_VOID(invertPixels(arg0)); 00290 } 00291 inline QImage *AQSImage::convertDepth(int arg0) const 00292 { 00293 AQ_CALL_RET_PTR(convertDepth(arg0), QImage); 00294 } 00295 inline QImage *AQSImage::convertDepthWithPalette(int arg0, QRgb *arg1, int arg2, int arg3) const 00296 { 00297 AQ_CALL_RET_PTR(convertDepthWithPalette(arg0, arg1, arg2, arg3), QImage); 00298 } 00299 inline QImage *AQSImage::convertDepth(int arg0, int arg1) const 00300 { 00301 AQ_CALL_RET_PTR(convertDepth(arg0, arg1), QImage); 00302 } 00303 inline QImage *AQSImage::convertBitOrder(uint arg0) const 00304 { 00305 AQ_CALL_RET_PTR(convertBitOrder(static_cast<QImage::Endian>(arg0)), QImage); 00306 } 00307 inline QImage *AQSImage::smoothScale(int arg0, int arg1, uint arg2) const 00308 { 00309 AQ_CALL_RET_PTR(smoothScale(arg0, arg1, static_cast<QImage::ScaleMode>(arg2)), QImage); 00310 } 00311 inline QImage *AQSImage::smoothScale(const QSize &arg0, uint arg1) const 00312 { 00313 AQ_CALL_RET_PTR(smoothScale(arg0, static_cast<QImage::ScaleMode>(arg1)), QImage); 00314 } 00315 inline QImage *AQSImage::scale(int arg0, int arg1, uint arg2) const 00316 { 00317 AQ_CALL_RET_PTR(scale(arg0, arg1, static_cast<QImage::ScaleMode>(arg2)), QImage); 00318 } 00319 inline QImage *AQSImage::scale(const QSize &arg0, uint arg1) const 00320 { 00321 AQ_CALL_RET_PTR(scale(arg0, static_cast<QImage::ScaleMode>(arg1)), QImage); 00322 } 00323 inline QImage *AQSImage::scaleWidth(int arg0) const 00324 { 00325 AQ_CALL_RET_PTR(scaleWidth(arg0), QImage); 00326 } 00327 inline QImage *AQSImage::scaleHeight(int arg0) const 00328 { 00329 AQ_CALL_RET_PTR(scaleHeight(arg0), QImage); 00330 } 00331 inline QImage *AQSImage::xForm(QWMatrix *arg0) const 00332 { 00333 AQ_CALL_RET_PTR(xForm(*arg0), QImage); 00334 } 00335 inline QImage *AQSImage::xForm(AQSWMatrix *arg0) const 00336 { 00337 AQ_CALL_RET_PTR(xForm(*arg0), QImage); 00338 } 00339 inline QImage *AQSImage::createAlphaMask(int arg0) const 00340 { 00341 AQ_CALL_RET_PTR(createAlphaMask(arg0), QImage); 00342 } 00343 inline QImage *AQSImage::createHeuristicMask(bool arg0) const 00344 { 00345 AQ_CALL_RET_PTR(createHeuristicMask(arg0), QImage); 00346 } 00347 inline QImage *AQSImage::mirror() const 00348 { 00349 AQ_CALL_RET_PTR(mirror(), QImage); 00350 } 00351 inline QImage *AQSImage::mirror(bool arg0, bool arg1) const 00352 { 00353 AQ_CALL_RET_PTR(mirror(arg0, arg1), QImage); 00354 } 00355 inline QImage *AQSImage::swapRGB() const 00356 { 00357 AQ_CALL_RET_PTR(swapRGB(), QImage); 00358 } 00359 inline bool AQSImage::loadFromData(QByteArray *arg0, const char *arg1) 00360 { 00361 AQ_CALL_RET_V(loadFromData(*arg0, arg1), bool); 00362 } 00363 inline bool AQSImage::loadFromData(AQSByteArray *arg0, const char *arg1) 00364 { 00365 AQ_CALL_RET_V(loadFromData(*arg0, arg1), bool); 00366 } 00367 inline bool AQSImage::save(QIODevice *arg0, const char *arg1, int arg2) const 00368 { 00369 AQ_CALL_RET_V(save(arg0, arg1, arg2), bool); 00370 } 00371 inline bool AQSImage::save(AQSIODevice *arg0, const char *arg1, int arg2) const 00372 { 00373 AQ_CALL_RET_V(save(*arg0, arg1, arg2), bool); 00374 } 00375 inline bool AQSImage::load(const QString &arg0, const char *arg1) 00376 { 00377 AQ_CALL_RET_V(load(arg0, arg1), bool); 00378 } 00379 inline bool AQSImage::save(const QString &arg0, const char *arg1, int arg2) const 00380 { 00381 AQ_CALL_RET_V(save(arg0, arg1, arg2), bool); 00382 } 00383 inline bool AQSImage::valid(int arg0, int arg1) const 00384 { 00385 AQ_CALL_RET_V(valid(arg0, arg1), bool); 00386 } 00387 inline int AQSImage::pixelIndex(int arg0, int arg1) const 00388 { 00389 AQ_CALL_RET_V(pixelIndex(arg0, arg1), int); 00390 } 00391 inline QRgb AQSImage::pixel(int arg0, int arg1) const 00392 { 00393 AQ_CALL_RET_V(pixel(arg0, arg1), QRgb); 00394 } 00395 inline void AQSImage::setPixel(int arg0, int arg1, uint arg2) 00396 { 00397 AQ_CALL_VOID(setPixel(arg0, arg1, arg2)); 00398 } 00399 inline int AQSImage::dotsPerMeterX() const 00400 { 00401 AQ_CALL_RET_V(dotsPerMeterX(), int); 00402 } 00403 inline int AQSImage::dotsPerMeterY() const 00404 { 00405 AQ_CALL_RET_V(dotsPerMeterY(), int); 00406 } 00407 inline void AQSImage::setDotsPerMeterX(int arg0) 00408 { 00409 AQ_CALL_VOID(setDotsPerMeterX(arg0)); 00410 } 00411 inline void AQSImage::setDotsPerMeterY(int arg0) 00412 { 00413 AQ_CALL_VOID(setDotsPerMeterY(arg0)); 00414 } 00415 inline QPoint AQSImage::offset() const 00416 { 00417 AQ_CALL_RET_V(offset(), QPoint); 00418 } 00419 inline void AQSImage::setOffset(const QPoint &arg0) 00420 { 00421 AQ_CALL_VOID(setOffset(arg0)); 00422 } 00423 inline QStringList AQSImage::textLanguages() const 00424 { 00425 AQ_CALL_RET_V(textLanguages(), QStringList); 00426 } 00427 inline QStringList AQSImage::textKeys() const 00428 { 00429 AQ_CALL_RET_V(textKeys(), QStringList); 00430 } 00431 inline QString AQSImage::text(const char *arg0, const char *arg1) const 00432 { 00433 AQ_CALL_RET_V(text(arg0, arg1), QString); 00434 } 00435 inline void AQSImage::setText(const char *arg0, const char *arg1, const QString &arg2) 00436 { 00437 AQ_CALL_VOID(setText(arg0, arg1, arg2)); 00438 } 00439 //@AQ_END_IMP_PUB_SLOTS@ 00440 00441 #endif /* AQSIMAGE_P_H_ */ 00442 // @AQSVOIDPTR@