.ico/cur plugin
-
Hello,
I need help, with my faculty project which is about to make plugin that will support ico/cur format (can read and save these types of formats, in C++). Unfortunality, this is the first time that facing the experience with qt creator and plugins, so I don't really know how to do my project. Did someone do something similar with my topic? I desparately need help:) -
Have a look at this introduction, it may help:
-
Google for the ico format specification. That will have all the details you need to read and write the format.
-
Another question is: can I use this function also in the case of .ico format (it is previously writen for raw format):
@bool IcoHandler::write(const QImage &image)
{
QImage result = image.convertToFormat(QImage::Format_RGB32);
QDataStream output(device());
quint32 width = result.width();
quint32 height = result.height();
output << width << height;
for (quint32 y = 0; y < height; ++y) {
QRgb *scanLine = (QRgb *)result.scanLine(y);
for (quint32 x = 0; x < width; ++x)
output << scanLine[x];
}
if ((width!=48 && height!=48) || (width!=32 && height!=32) || (width!=24 && height!=24) || (width!=16 && height!=16))
return false;return output.status() == QDataStream::Ok;}@
-
See "ico/cur file format":http://en.wikipedia.org/wiki/ICO_(file_format)#Outline
Edit: correct link is http://en.wikipedia.org/wiki/ICO_(file_format)#Outline
Maybe is a bug if link contains '#' character -
Faculties tend to have teachers which -- based on my experience -- are happy to help when asked specific questions.
How about taking an .ico, converting it to e.g. png using any graphics application. Then you can have Qt read the png and feed that into your write method. If the output is identical to the original .ico file, then you are done. For the read method you can do something similar: You read the orginal file, compare that to the png.