2024-08-25 04:08:24 +00:00
|
|
|
#include <QByteArray>
|
|
|
|
#include <QIODevice>
|
|
|
|
#include <QImage>
|
|
|
|
#include <QImageIOHandler>
|
|
|
|
#include <QImageIOPlugin>
|
|
|
|
#include <QMetaObject>
|
|
|
|
#include <QRect>
|
|
|
|
#include <QString>
|
2024-08-29 07:01:51 +00:00
|
|
|
#include <QByteArray>
|
|
|
|
#include <cstring>
|
|
|
|
#include <QVariant>
|
|
|
|
#include "qimageiohandler.h"
|
2024-08-25 04:08:24 +00:00
|
|
|
|
2024-08-29 07:01:51 +00:00
|
|
|
#include "gen_qimageiohandler.h"
|
2024-08-25 04:08:24 +00:00
|
|
|
|
|
|
|
extern "C" {
|
|
|
|
extern void miqt_exec_callback(void* cb, int argc, void* argv);
|
|
|
|
}
|
|
|
|
|
|
|
|
void QImageIOHandler_SetDevice(QImageIOHandler* self, QIODevice* device) {
|
|
|
|
self->setDevice(device);
|
|
|
|
}
|
|
|
|
|
|
|
|
QIODevice* QImageIOHandler_Device(QImageIOHandler* self) {
|
2024-08-29 07:01:51 +00:00
|
|
|
return const_cast<const QImageIOHandler*>(self)->device();
|
2024-08-25 04:08:24 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void QImageIOHandler_SetFormat(QImageIOHandler* self, QByteArray* format) {
|
|
|
|
self->setFormat(*format);
|
|
|
|
}
|
|
|
|
|
|
|
|
void QImageIOHandler_SetFormatWithFormat(QImageIOHandler* self, QByteArray* format) {
|
2024-08-29 07:01:51 +00:00
|
|
|
const_cast<const QImageIOHandler*>(self)->setFormat(*format);
|
2024-08-25 04:08:24 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
QByteArray* QImageIOHandler_Format(QImageIOHandler* self) {
|
2024-08-29 07:01:51 +00:00
|
|
|
QByteArray ret = const_cast<const QImageIOHandler*>(self)->format();
|
2024-08-25 04:08:24 +00:00
|
|
|
// Copy-construct value returned type into heap-allocated copy
|
|
|
|
return static_cast<QByteArray*>(new QByteArray(ret));
|
|
|
|
}
|
|
|
|
|
|
|
|
QByteArray* QImageIOHandler_Name(QImageIOHandler* self) {
|
2024-08-29 07:01:51 +00:00
|
|
|
QByteArray ret = const_cast<const QImageIOHandler*>(self)->name();
|
2024-08-25 04:08:24 +00:00
|
|
|
// Copy-construct value returned type into heap-allocated copy
|
|
|
|
return static_cast<QByteArray*>(new QByteArray(ret));
|
|
|
|
}
|
|
|
|
|
|
|
|
bool QImageIOHandler_CanRead(QImageIOHandler* self) {
|
2024-08-29 07:01:51 +00:00
|
|
|
return const_cast<const QImageIOHandler*>(self)->canRead();
|
2024-08-25 04:08:24 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
bool QImageIOHandler_Read(QImageIOHandler* self, QImage* image) {
|
|
|
|
return self->read(image);
|
|
|
|
}
|
|
|
|
|
|
|
|
bool QImageIOHandler_Write(QImageIOHandler* self, QImage* image) {
|
|
|
|
return self->write(*image);
|
|
|
|
}
|
|
|
|
|
2024-08-29 07:01:51 +00:00
|
|
|
QVariant* QImageIOHandler_Option(QImageIOHandler* self, uintptr_t option) {
|
|
|
|
QVariant ret = const_cast<const QImageIOHandler*>(self)->option(static_cast<QImageIOHandler::ImageOption>(option));
|
|
|
|
// Copy-construct value returned type into heap-allocated copy
|
|
|
|
return static_cast<QVariant*>(new QVariant(ret));
|
|
|
|
}
|
|
|
|
|
|
|
|
void QImageIOHandler_SetOption(QImageIOHandler* self, uintptr_t option, QVariant* value) {
|
|
|
|
self->setOption(static_cast<QImageIOHandler::ImageOption>(option), *value);
|
|
|
|
}
|
|
|
|
|
|
|
|
bool QImageIOHandler_SupportsOption(QImageIOHandler* self, uintptr_t option) {
|
|
|
|
return const_cast<const QImageIOHandler*>(self)->supportsOption(static_cast<QImageIOHandler::ImageOption>(option));
|
|
|
|
}
|
|
|
|
|
2024-08-25 04:08:24 +00:00
|
|
|
bool QImageIOHandler_JumpToNextImage(QImageIOHandler* self) {
|
|
|
|
return self->jumpToNextImage();
|
|
|
|
}
|
|
|
|
|
|
|
|
bool QImageIOHandler_JumpToImage(QImageIOHandler* self, int imageNumber) {
|
|
|
|
return self->jumpToImage(static_cast<int>(imageNumber));
|
|
|
|
}
|
|
|
|
|
|
|
|
int QImageIOHandler_LoopCount(QImageIOHandler* self) {
|
2024-08-29 07:01:51 +00:00
|
|
|
return const_cast<const QImageIOHandler*>(self)->loopCount();
|
2024-08-25 04:08:24 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
int QImageIOHandler_ImageCount(QImageIOHandler* self) {
|
2024-08-29 07:01:51 +00:00
|
|
|
return const_cast<const QImageIOHandler*>(self)->imageCount();
|
2024-08-25 04:08:24 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
int QImageIOHandler_NextImageDelay(QImageIOHandler* self) {
|
2024-08-29 07:01:51 +00:00
|
|
|
return const_cast<const QImageIOHandler*>(self)->nextImageDelay();
|
2024-08-25 04:08:24 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
int QImageIOHandler_CurrentImageNumber(QImageIOHandler* self) {
|
2024-08-29 07:01:51 +00:00
|
|
|
return const_cast<const QImageIOHandler*>(self)->currentImageNumber();
|
2024-08-25 04:08:24 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
QRect* QImageIOHandler_CurrentImageRect(QImageIOHandler* self) {
|
2024-08-29 07:01:51 +00:00
|
|
|
QRect ret = const_cast<const QImageIOHandler*>(self)->currentImageRect();
|
2024-08-25 04:08:24 +00:00
|
|
|
// Copy-construct value returned type into heap-allocated copy
|
|
|
|
return static_cast<QRect*>(new QRect(ret));
|
|
|
|
}
|
|
|
|
|
|
|
|
void QImageIOHandler_Delete(QImageIOHandler* self) {
|
|
|
|
delete self;
|
|
|
|
}
|
|
|
|
|
|
|
|
QMetaObject* QImageIOPlugin_MetaObject(QImageIOPlugin* self) {
|
2024-08-29 07:01:51 +00:00
|
|
|
return (QMetaObject*) const_cast<const QImageIOPlugin*>(self)->metaObject();
|
2024-08-25 04:08:24 +00:00
|
|
|
}
|
|
|
|
|
2024-08-29 07:01:51 +00:00
|
|
|
void QImageIOPlugin_Tr(const char* s, char** _out, int* _out_Strlen) {
|
2024-08-25 04:08:24 +00:00
|
|
|
QString ret = QImageIOPlugin::tr(s);
|
|
|
|
// Convert QString from UTF-16 in C++ RAII memory to UTF-8 in manually-managed C memory
|
|
|
|
QByteArray b = ret.toUtf8();
|
|
|
|
*_out = static_cast<char*>(malloc(b.length()));
|
|
|
|
memcpy(*_out, b.data(), b.length());
|
|
|
|
*_out_Strlen = b.length();
|
|
|
|
}
|
|
|
|
|
2024-08-29 07:01:51 +00:00
|
|
|
void QImageIOPlugin_TrUtf8(const char* s, char** _out, int* _out_Strlen) {
|
2024-08-25 04:08:24 +00:00
|
|
|
QString ret = QImageIOPlugin::trUtf8(s);
|
|
|
|
// Convert QString from UTF-16 in C++ RAII memory to UTF-8 in manually-managed C memory
|
|
|
|
QByteArray b = ret.toUtf8();
|
|
|
|
*_out = static_cast<char*>(malloc(b.length()));
|
|
|
|
memcpy(*_out, b.data(), b.length());
|
|
|
|
*_out_Strlen = b.length();
|
|
|
|
}
|
|
|
|
|
2024-08-29 07:01:51 +00:00
|
|
|
int QImageIOPlugin_Capabilities(QImageIOPlugin* self, QIODevice* device, QByteArray* format) {
|
|
|
|
QImageIOPlugin::Capabilities ret = const_cast<const QImageIOPlugin*>(self)->capabilities(device, *format);
|
|
|
|
return static_cast<int>(ret);
|
|
|
|
}
|
|
|
|
|
2024-08-25 04:08:24 +00:00
|
|
|
QImageIOHandler* QImageIOPlugin_Create(QImageIOPlugin* self, QIODevice* device) {
|
2024-08-29 07:01:51 +00:00
|
|
|
return const_cast<const QImageIOPlugin*>(self)->create(device);
|
2024-08-25 04:08:24 +00:00
|
|
|
}
|
|
|
|
|
2024-08-29 07:01:51 +00:00
|
|
|
void QImageIOPlugin_Tr2(const char* s, const char* c, char** _out, int* _out_Strlen) {
|
2024-08-25 04:08:24 +00:00
|
|
|
QString ret = QImageIOPlugin::tr(s, c);
|
|
|
|
// Convert QString from UTF-16 in C++ RAII memory to UTF-8 in manually-managed C memory
|
|
|
|
QByteArray b = ret.toUtf8();
|
|
|
|
*_out = static_cast<char*>(malloc(b.length()));
|
|
|
|
memcpy(*_out, b.data(), b.length());
|
|
|
|
*_out_Strlen = b.length();
|
|
|
|
}
|
|
|
|
|
2024-08-29 07:01:51 +00:00
|
|
|
void QImageIOPlugin_Tr3(const char* s, const char* c, int n, char** _out, int* _out_Strlen) {
|
2024-08-25 04:08:24 +00:00
|
|
|
QString ret = QImageIOPlugin::tr(s, c, static_cast<int>(n));
|
|
|
|
// Convert QString from UTF-16 in C++ RAII memory to UTF-8 in manually-managed C memory
|
|
|
|
QByteArray b = ret.toUtf8();
|
|
|
|
*_out = static_cast<char*>(malloc(b.length()));
|
|
|
|
memcpy(*_out, b.data(), b.length());
|
|
|
|
*_out_Strlen = b.length();
|
|
|
|
}
|
|
|
|
|
2024-08-29 07:01:51 +00:00
|
|
|
void QImageIOPlugin_TrUtf82(const char* s, const char* c, char** _out, int* _out_Strlen) {
|
2024-08-25 04:08:24 +00:00
|
|
|
QString ret = QImageIOPlugin::trUtf8(s, c);
|
|
|
|
// Convert QString from UTF-16 in C++ RAII memory to UTF-8 in manually-managed C memory
|
|
|
|
QByteArray b = ret.toUtf8();
|
|
|
|
*_out = static_cast<char*>(malloc(b.length()));
|
|
|
|
memcpy(*_out, b.data(), b.length());
|
|
|
|
*_out_Strlen = b.length();
|
|
|
|
}
|
|
|
|
|
2024-08-29 07:01:51 +00:00
|
|
|
void QImageIOPlugin_TrUtf83(const char* s, const char* c, int n, char** _out, int* _out_Strlen) {
|
2024-08-25 04:08:24 +00:00
|
|
|
QString ret = QImageIOPlugin::trUtf8(s, c, static_cast<int>(n));
|
|
|
|
// Convert QString from UTF-16 in C++ RAII memory to UTF-8 in manually-managed C memory
|
|
|
|
QByteArray b = ret.toUtf8();
|
|
|
|
*_out = static_cast<char*>(malloc(b.length()));
|
|
|
|
memcpy(*_out, b.data(), b.length());
|
|
|
|
*_out_Strlen = b.length();
|
|
|
|
}
|
|
|
|
|
|
|
|
QImageIOHandler* QImageIOPlugin_Create2(QImageIOPlugin* self, QIODevice* device, QByteArray* format) {
|
2024-09-07 03:31:00 +00:00
|
|
|
return const_cast<const QImageIOPlugin*>(self)->create(device, *format);
|
2024-08-25 04:08:24 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void QImageIOPlugin_Delete(QImageIOPlugin* self) {
|
|
|
|
delete self;
|
|
|
|
}
|
|
|
|
|