2024-08-25 04:08:24 +00:00
|
|
|
#include <QByteArray>
|
|
|
|
#include <QIODevice>
|
|
|
|
#include <QImage>
|
|
|
|
#include <QImageWriter>
|
|
|
|
#include <QList>
|
|
|
|
#include <QString>
|
2024-08-29 07:01:51 +00:00
|
|
|
#include <QByteArray>
|
|
|
|
#include <cstring>
|
|
|
|
#include "qimagewriter.h"
|
2024-08-25 04:08:24 +00:00
|
|
|
|
2024-08-29 07:01:51 +00:00
|
|
|
#include "gen_qimagewriter.h"
|
2024-08-25 04:08:24 +00:00
|
|
|
|
|
|
|
extern "C" {
|
|
|
|
extern void miqt_exec_callback(void* cb, int argc, void* argv);
|
|
|
|
}
|
|
|
|
|
|
|
|
QImageWriter* QImageWriter_new() {
|
|
|
|
return new QImageWriter();
|
|
|
|
}
|
|
|
|
|
|
|
|
QImageWriter* QImageWriter_new2(QIODevice* device, QByteArray* format) {
|
|
|
|
return new QImageWriter(device, *format);
|
|
|
|
}
|
|
|
|
|
|
|
|
QImageWriter* QImageWriter_new3(const char* fileName, size_t fileName_Strlen) {
|
|
|
|
QString fileName_QString = QString::fromUtf8(fileName, fileName_Strlen);
|
|
|
|
return new QImageWriter(fileName_QString);
|
|
|
|
}
|
|
|
|
|
|
|
|
QImageWriter* QImageWriter_new4(const char* fileName, size_t fileName_Strlen, QByteArray* format) {
|
|
|
|
QString fileName_QString = QString::fromUtf8(fileName, fileName_Strlen);
|
|
|
|
return new QImageWriter(fileName_QString, *format);
|
|
|
|
}
|
|
|
|
|
2024-08-29 07:01:51 +00:00
|
|
|
void QImageWriter_Tr(const char* sourceText, char** _out, int* _out_Strlen) {
|
2024-08-25 04:08:24 +00:00
|
|
|
QString ret = QImageWriter::tr(sourceText);
|
|
|
|
// 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 QImageWriter_TrUtf8(const char* sourceText, char** _out, int* _out_Strlen) {
|
2024-08-25 04:08:24 +00:00
|
|
|
QString ret = QImageWriter::trUtf8(sourceText);
|
|
|
|
// 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();
|
|
|
|
}
|
|
|
|
|
|
|
|
void QImageWriter_SetFormat(QImageWriter* self, QByteArray* format) {
|
|
|
|
self->setFormat(*format);
|
|
|
|
}
|
|
|
|
|
|
|
|
QByteArray* QImageWriter_Format(QImageWriter* self) {
|
2024-08-29 07:01:51 +00:00
|
|
|
QByteArray ret = const_cast<const QImageWriter*>(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));
|
|
|
|
}
|
|
|
|
|
|
|
|
void QImageWriter_SetDevice(QImageWriter* self, QIODevice* device) {
|
|
|
|
self->setDevice(device);
|
|
|
|
}
|
|
|
|
|
|
|
|
QIODevice* QImageWriter_Device(QImageWriter* self) {
|
2024-08-29 07:01:51 +00:00
|
|
|
return const_cast<const QImageWriter*>(self)->device();
|
2024-08-25 04:08:24 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void QImageWriter_SetFileName(QImageWriter* self, const char* fileName, size_t fileName_Strlen) {
|
|
|
|
QString fileName_QString = QString::fromUtf8(fileName, fileName_Strlen);
|
|
|
|
self->setFileName(fileName_QString);
|
|
|
|
}
|
|
|
|
|
|
|
|
void QImageWriter_FileName(QImageWriter* self, char** _out, int* _out_Strlen) {
|
2024-08-29 07:01:51 +00:00
|
|
|
QString ret = const_cast<const QImageWriter*>(self)->fileName();
|
2024-08-25 04:08:24 +00:00
|
|
|
// 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();
|
|
|
|
}
|
|
|
|
|
|
|
|
void QImageWriter_SetQuality(QImageWriter* self, int quality) {
|
|
|
|
self->setQuality(static_cast<int>(quality));
|
|
|
|
}
|
|
|
|
|
|
|
|
int QImageWriter_Quality(QImageWriter* self) {
|
2024-08-29 07:01:51 +00:00
|
|
|
return const_cast<const QImageWriter*>(self)->quality();
|
2024-08-25 04:08:24 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void QImageWriter_SetCompression(QImageWriter* self, int compression) {
|
|
|
|
self->setCompression(static_cast<int>(compression));
|
|
|
|
}
|
|
|
|
|
|
|
|
int QImageWriter_Compression(QImageWriter* self) {
|
2024-08-29 07:01:51 +00:00
|
|
|
return const_cast<const QImageWriter*>(self)->compression();
|
2024-08-25 04:08:24 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void QImageWriter_SetGamma(QImageWriter* self, float gamma) {
|
|
|
|
self->setGamma(static_cast<float>(gamma));
|
|
|
|
}
|
|
|
|
|
|
|
|
float QImageWriter_Gamma(QImageWriter* self) {
|
2024-08-29 07:01:51 +00:00
|
|
|
return const_cast<const QImageWriter*>(self)->gamma();
|
2024-08-25 04:08:24 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void QImageWriter_SetSubType(QImageWriter* self, QByteArray* typeVal) {
|
|
|
|
self->setSubType(*typeVal);
|
|
|
|
}
|
|
|
|
|
|
|
|
QByteArray* QImageWriter_SubType(QImageWriter* self) {
|
2024-08-29 07:01:51 +00:00
|
|
|
QByteArray ret = const_cast<const QImageWriter*>(self)->subType();
|
2024-08-25 04:08:24 +00:00
|
|
|
// Copy-construct value returned type into heap-allocated copy
|
|
|
|
return static_cast<QByteArray*>(new QByteArray(ret));
|
|
|
|
}
|
|
|
|
|
|
|
|
void QImageWriter_SupportedSubTypes(QImageWriter* self, QByteArray*** _out, size_t* _out_len) {
|
2024-08-29 07:01:51 +00:00
|
|
|
QList<QByteArray> ret = const_cast<const QImageWriter*>(self)->supportedSubTypes();
|
2024-08-25 04:08:24 +00:00
|
|
|
// Convert QList<> from C++ memory to manually-managed C memory of copy-constructed pointers
|
|
|
|
QByteArray** __out = static_cast<QByteArray**>(malloc(sizeof(QByteArray**) * ret.length()));
|
|
|
|
for (size_t i = 0, e = ret.length(); i < e; ++i) {
|
|
|
|
__out[i] = new QByteArray(ret[i]);
|
|
|
|
}
|
|
|
|
*_out = __out;
|
|
|
|
*_out_len = ret.length();
|
|
|
|
}
|
|
|
|
|
|
|
|
void QImageWriter_SetOptimizedWrite(QImageWriter* self, bool optimize) {
|
|
|
|
self->setOptimizedWrite(optimize);
|
|
|
|
}
|
|
|
|
|
|
|
|
bool QImageWriter_OptimizedWrite(QImageWriter* self) {
|
2024-08-29 07:01:51 +00:00
|
|
|
return const_cast<const QImageWriter*>(self)->optimizedWrite();
|
2024-08-25 04:08:24 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void QImageWriter_SetProgressiveScanWrite(QImageWriter* self, bool progressive) {
|
|
|
|
self->setProgressiveScanWrite(progressive);
|
|
|
|
}
|
|
|
|
|
|
|
|
bool QImageWriter_ProgressiveScanWrite(QImageWriter* self) {
|
2024-08-29 07:01:51 +00:00
|
|
|
return const_cast<const QImageWriter*>(self)->progressiveScanWrite();
|
|
|
|
}
|
|
|
|
|
|
|
|
int QImageWriter_Transformation(QImageWriter* self) {
|
|
|
|
QImageIOHandler::Transformations ret = const_cast<const QImageWriter*>(self)->transformation();
|
|
|
|
return static_cast<int>(ret);
|
|
|
|
}
|
|
|
|
|
|
|
|
void QImageWriter_SetTransformation(QImageWriter* self, int orientation) {
|
|
|
|
self->setTransformation(static_cast<QImageIOHandler::Transformations>(orientation));
|
2024-08-25 04:08:24 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void QImageWriter_SetDescription(QImageWriter* self, const char* description, size_t description_Strlen) {
|
|
|
|
QString description_QString = QString::fromUtf8(description, description_Strlen);
|
|
|
|
self->setDescription(description_QString);
|
|
|
|
}
|
|
|
|
|
|
|
|
void QImageWriter_Description(QImageWriter* self, char** _out, int* _out_Strlen) {
|
2024-08-29 07:01:51 +00:00
|
|
|
QString ret = const_cast<const QImageWriter*>(self)->description();
|
2024-08-25 04:08:24 +00:00
|
|
|
// 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();
|
|
|
|
}
|
|
|
|
|
|
|
|
void QImageWriter_SetText(QImageWriter* self, const char* key, size_t key_Strlen, const char* text, size_t text_Strlen) {
|
|
|
|
QString key_QString = QString::fromUtf8(key, key_Strlen);
|
|
|
|
QString text_QString = QString::fromUtf8(text, text_Strlen);
|
|
|
|
self->setText(key_QString, text_QString);
|
|
|
|
}
|
|
|
|
|
|
|
|
bool QImageWriter_CanWrite(QImageWriter* self) {
|
2024-08-29 07:01:51 +00:00
|
|
|
return const_cast<const QImageWriter*>(self)->canWrite();
|
2024-08-25 04:08:24 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
bool QImageWriter_Write(QImageWriter* self, QImage* image) {
|
|
|
|
return self->write(*image);
|
|
|
|
}
|
|
|
|
|
2024-08-29 07:01:51 +00:00
|
|
|
uintptr_t QImageWriter_Error(QImageWriter* self) {
|
|
|
|
QImageWriter::ImageWriterError ret = const_cast<const QImageWriter*>(self)->error();
|
|
|
|
return static_cast<uintptr_t>(ret);
|
|
|
|
}
|
|
|
|
|
2024-08-25 04:08:24 +00:00
|
|
|
void QImageWriter_ErrorString(QImageWriter* self, char** _out, int* _out_Strlen) {
|
2024-08-29 07:01:51 +00:00
|
|
|
QString ret = const_cast<const QImageWriter*>(self)->errorString();
|
2024-08-25 04:08:24 +00:00
|
|
|
// 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
|
|
|
bool QImageWriter_SupportsOption(QImageWriter* self, uintptr_t option) {
|
|
|
|
return const_cast<const QImageWriter*>(self)->supportsOption(static_cast<QImageIOHandler::ImageOption>(option));
|
|
|
|
}
|
|
|
|
|
2024-08-25 04:08:24 +00:00
|
|
|
void QImageWriter_SupportedImageFormats(QByteArray*** _out, size_t* _out_len) {
|
|
|
|
QList<QByteArray> ret = QImageWriter::supportedImageFormats();
|
|
|
|
// Convert QList<> from C++ memory to manually-managed C memory of copy-constructed pointers
|
|
|
|
QByteArray** __out = static_cast<QByteArray**>(malloc(sizeof(QByteArray**) * ret.length()));
|
|
|
|
for (size_t i = 0, e = ret.length(); i < e; ++i) {
|
|
|
|
__out[i] = new QByteArray(ret[i]);
|
|
|
|
}
|
|
|
|
*_out = __out;
|
|
|
|
*_out_len = ret.length();
|
|
|
|
}
|
|
|
|
|
|
|
|
void QImageWriter_SupportedMimeTypes(QByteArray*** _out, size_t* _out_len) {
|
|
|
|
QList<QByteArray> ret = QImageWriter::supportedMimeTypes();
|
|
|
|
// Convert QList<> from C++ memory to manually-managed C memory of copy-constructed pointers
|
|
|
|
QByteArray** __out = static_cast<QByteArray**>(malloc(sizeof(QByteArray**) * ret.length()));
|
|
|
|
for (size_t i = 0, e = ret.length(); i < e; ++i) {
|
|
|
|
__out[i] = new QByteArray(ret[i]);
|
|
|
|
}
|
|
|
|
*_out = __out;
|
|
|
|
*_out_len = ret.length();
|
|
|
|
}
|
|
|
|
|
|
|
|
void QImageWriter_ImageFormatsForMimeType(QByteArray* mimeType, QByteArray*** _out, size_t* _out_len) {
|
|
|
|
QList<QByteArray> ret = QImageWriter::imageFormatsForMimeType(*mimeType);
|
|
|
|
// Convert QList<> from C++ memory to manually-managed C memory of copy-constructed pointers
|
|
|
|
QByteArray** __out = static_cast<QByteArray**>(malloc(sizeof(QByteArray**) * ret.length()));
|
|
|
|
for (size_t i = 0, e = ret.length(); i < e; ++i) {
|
|
|
|
__out[i] = new QByteArray(ret[i]);
|
|
|
|
}
|
|
|
|
*_out = __out;
|
|
|
|
*_out_len = ret.length();
|
|
|
|
}
|
|
|
|
|
2024-08-29 07:01:51 +00:00
|
|
|
void QImageWriter_Tr2(const char* sourceText, const char* disambiguation, char** _out, int* _out_Strlen) {
|
2024-08-25 04:08:24 +00:00
|
|
|
QString ret = QImageWriter::tr(sourceText, disambiguation);
|
|
|
|
// 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 QImageWriter_Tr3(const char* sourceText, const char* disambiguation, int n, char** _out, int* _out_Strlen) {
|
2024-08-25 04:08:24 +00:00
|
|
|
QString ret = QImageWriter::tr(sourceText, disambiguation, 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 QImageWriter_TrUtf82(const char* sourceText, const char* disambiguation, char** _out, int* _out_Strlen) {
|
2024-08-25 04:08:24 +00:00
|
|
|
QString ret = QImageWriter::trUtf8(sourceText, disambiguation);
|
|
|
|
// 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 QImageWriter_TrUtf83(const char* sourceText, const char* disambiguation, int n, char** _out, int* _out_Strlen) {
|
2024-08-25 04:08:24 +00:00
|
|
|
QString ret = QImageWriter::trUtf8(sourceText, disambiguation, 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();
|
|
|
|
}
|
|
|
|
|
|
|
|
void QImageWriter_Delete(QImageWriter* self) {
|
|
|
|
delete self;
|
|
|
|
}
|
|
|
|
|