люди добрые христа ради помогите нужна операцияпытаюсь отконвертировать QImage в img_t, но img_load всегда возвращает IMG_ERR_FORMAT ("No appopriate codec could be found. The codec you require could be missing or corrupt, or the file could be corrupt.")
Пробовал QImage::Format_RGBA8888 перевести и в IMG_FMT_PKLE_ARGB8888 и в IMG_FMT_PKBE_ARGB8888, но даже простейший случай QImage::Format_Mono в IMG_FMT_MONO не работает. код приблизительно такой:
QImage testImage(300, 300, QImage::Format_Mono);
QPainter painter(&testImage);
painter.fillRect(0, 0, 300, 300,Qt::black);
img_lib_t ilib;
img_lib_attach(&ilib);
img_t img;
img.format = IMG_FMT_MONO;
img.w = testImage.width();
img.h = testImage.height();
img.flags = IMG_FORMAT | IMG_W | IMG_H;
io_stream_t *stream = io_open(IO_MEM, IO_READ, testImage.byteCount(), testImage.constBits());
int ret = img_load(ilib, stream , NULL, &img);
switch(ret) {
case IMG_ERR_OK:
printf("Success.\n");
break;
case IMG_ERR_MEM:
printf("Memory-allocation failure.\n");
break;
case IMG_ERR_FORMAT:
printf("No appopriate codec could be found. The codec you require could be missing or corrupt, or the file could be corrupt.\n");
break;
case IMG_ERR_NOSUPPORT:
printf("Output data not supported; the codec and application could not agree on an output format.\n");
break;
case IMG_ERR_NODATA:
printf("No frame data was present.\n");
break;
case IMG_ERR_CORRUPT:
printf("Invalid data encountered in the file, preventing the decode from proceeding. Some of the frame may be intact.\n");
break;
case IMG_ERR_TRUNC:
printf("Premature end of file encountered. Some of the frame may be intact.\n");
break;
case IMG_ERR_INTR:
printf("Decode was interrupted by application.\n");
break;
}
io_close(stream);
img_lib_detach(ilib);
что я делаю не так?