Ok now I get that far
array [
dict entry(
string "icon_data"
variant array [
variant int32 133
variant int32 135
variant int32 532
variant boolean true
variant int32 8
variant int32 4
variant array [
byte 137
byte 80
byte 78
byte 71
byte 13
byte 10
.......
array [
dict entry(
string "icon_data"
variant array [
variant int32 133
variant int32 135
variant int32 532
variant boolean true
variant int32 8
variant int32 4
variant array [
byte 137
byte 80
byte 78
byte 71
byte 13
byte 10
.......
To copy to clipboard, switch view to plain text mode
at least the beginning seams to be right
but I have no idea how to get the entry struct.
My current code is
QVariantMap Notify
::getImage(QString* path
){ QVariantMap out;
if(img.isNull())return out;
int width=img.width();
int height=img.height();
int rowstride=img.bytesPerLine();
bool hasAlpha=img.hasAlphaChannel();
int channels;
if(img.isGrayscale())
channels=1;
else{
channels =3;
if(hasAlpha)
channels=4;
}
int bitsPerSample=img.depth()/channels;
img.save( &buffer, "PNG" );
QVariantList o2;
o2<<width<<height<<rowstride<<hasAlpha<<bitsPerSample<<channels<<image;
out.insert("icon_data",o2);
return out;
}
QVariantMap Notify::getImage(QString* path){
QImage img(*path);
QVariantMap out;
if(img.isNull())return out;
int width=img.width();
int height=img.height();
int rowstride=img.bytesPerLine();
bool hasAlpha=img.hasAlphaChannel();
int channels;
if(img.isGrayscale())
channels=1;
else{
channels =3;
if(hasAlpha)
channels=4;
}
int bitsPerSample=img.depth()/channels;
QByteArray image;
QBuffer buffer(&image,NULL );
buffer.open( QBuffer::WriteOnly);
img.save( &buffer, "PNG" );
QVariantList o2;
o2<<width<<height<<rowstride<<hasAlpha<<bitsPerSample<<channels<<image;
out.insert("icon_data",o2);
return out;
}
To copy to clipboard, switch view to plain text mode
but instead of QVariantList for the body i have to use something different, but what?
Bookmarks