|
|
|
@ -32,8 +32,8 @@
|
|
|
|
|
// on embedded, we do not compress image data. Rationale: by mapping
|
|
|
|
|
// the ready-only data directly into memory we are both faster and
|
|
|
|
|
// more memory efficient
|
|
|
|
|
#if (TQT_VERSION < 0x030100 || defined(Q_WS_QWS)) && !defined(QT_NO_IMAGE_COLLECTION_COMPRESSION)
|
|
|
|
|
#define QT_NO_IMAGE_COLLECTION_COMPRESSION
|
|
|
|
|
#if (TQT_VERSION < 0x030100 || defined(Q_WS_QWS)) && !defined(TQT_NO_IMAGE_COLLECTION_COMPRESSION)
|
|
|
|
|
#define TQT_NO_IMAGE_COLLECTION_COMPRESSION
|
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
struct EmbedImage
|
|
|
|
@ -45,7 +45,7 @@ struct EmbedImage
|
|
|
|
|
TQString name;
|
|
|
|
|
TQString cname;
|
|
|
|
|
bool alpha;
|
|
|
|
|
#ifndef QT_NO_IMAGE_COLLECTION_COMPRESSION
|
|
|
|
|
#ifndef TQT_NO_IMAGE_COLLECTION_COMPRESSION
|
|
|
|
|
ulong compressed;
|
|
|
|
|
#endif
|
|
|
|
|
};
|
|
|
|
@ -66,7 +66,7 @@ static TQString convertToCIdentifier( const char *s )
|
|
|
|
|
|
|
|
|
|
static ulong embedData( TQTextStream& out, const uchar* input, int nbytes )
|
|
|
|
|
{
|
|
|
|
|
#ifndef QT_NO_IMAGE_COLLECTION_COMPRESSION
|
|
|
|
|
#ifndef TQT_NO_IMAGE_COLLECTION_COMPRESSION
|
|
|
|
|
TQByteArray bazip( tqCompress( input, nbytes ) );
|
|
|
|
|
uint len = bazip.size();
|
|
|
|
|
#else
|
|
|
|
@ -84,7 +84,7 @@ static ulong embedData( TQTextStream& out, const uchar* input, int nbytes )
|
|
|
|
|
s.truncate( 0 );
|
|
|
|
|
}
|
|
|
|
|
uint v = (uchar)
|
|
|
|
|
#ifndef QT_NO_IMAGE_COLLECTION_COMPRESSION
|
|
|
|
|
#ifndef TQT_NO_IMAGE_COLLECTION_COMPRESSION
|
|
|
|
|
bazip
|
|
|
|
|
#else
|
|
|
|
|
input
|
|
|
|
@ -136,7 +136,7 @@ void Uic::embed( TQTextStream& out, const char* project, const TQStringList& ima
|
|
|
|
|
out << "\n";
|
|
|
|
|
out << "\n";
|
|
|
|
|
out << "from python_tqt.qt import TQImage, TQMimeSourceFactory";
|
|
|
|
|
#ifndef QT_NO_IMAGE_COLLECTION_COMPRESSION
|
|
|
|
|
#ifndef TQT_NO_IMAGE_COLLECTION_COMPRESSION
|
|
|
|
|
out << ", tqUncompress";
|
|
|
|
|
#endif
|
|
|
|
|
out << "\n";
|
|
|
|
@ -171,7 +171,7 @@ void Uic::embed( TQTextStream& out, const char* project, const TQStringList& ima
|
|
|
|
|
img = img.convertBitOrder(TQImage::BigEndian);
|
|
|
|
|
out << s.sprintf( "%s_data =",
|
|
|
|
|
(const char *)e->cname );
|
|
|
|
|
#ifndef QT_NO_IMAGE_COLLECTION_COMPRESSION
|
|
|
|
|
#ifndef TQT_NO_IMAGE_COLLECTION_COMPRESSION
|
|
|
|
|
e->compressed =
|
|
|
|
|
#endif
|
|
|
|
|
embedData( out, img.bits(), img.numBytes() );
|
|
|
|
@ -194,7 +194,7 @@ void Uic::embed( TQTextStream& out, const char* project, const TQStringList& ima
|
|
|
|
|
<< e->height << ","
|
|
|
|
|
<< e->depth << ","
|
|
|
|
|
<< e->cname << "_data,"
|
|
|
|
|
#ifndef QT_NO_IMAGE_COLLECTION_COMPRESSION
|
|
|
|
|
#ifndef TQT_NO_IMAGE_COLLECTION_COMPRESSION
|
|
|
|
|
<< e->compressed << ","
|
|
|
|
|
#endif
|
|
|
|
|
<< e->numColors << ",";
|
|
|
|
@ -218,7 +218,7 @@ void Uic::embed( TQTextStream& out, const char* project, const TQStringList& ima
|
|
|
|
|
++indent;
|
|
|
|
|
out << indent << "global embed_image_vec\n";
|
|
|
|
|
out << "\n";
|
|
|
|
|
#ifndef QT_NO_IMAGE_COLLECTION_COMPRESSION
|
|
|
|
|
#ifndef TQT_NO_IMAGE_COLLECTION_COMPRESSION
|
|
|
|
|
out << indent << "for (w,h,depth,data,comp,nrCol,colTab,alpha,iname) in embed_image_vec:" << endl;
|
|
|
|
|
#else
|
|
|
|
|
out << indent << "for (w,h,depth,data,nrCol,colTab,alpha,iname) in embed_image_vec:" << endl;
|
|
|
|
@ -226,7 +226,7 @@ void Uic::embed( TQTextStream& out, const char* project, const TQStringList& ima
|
|
|
|
|
++indent;
|
|
|
|
|
out << indent << "if iname == str(name):" << endl;
|
|
|
|
|
++indent;
|
|
|
|
|
#ifndef QT_NO_IMAGE_COLLECTION_COMPRESSION
|
|
|
|
|
#ifndef TQT_NO_IMAGE_COLLECTION_COMPRESSION
|
|
|
|
|
// Keep the data object alive until we have a deep copy of the image.
|
|
|
|
|
out << indent << "data = tqUncompress(data).data()\n";
|
|
|
|
|
#endif
|
|
|
|
|