mirror of
https://github.com/mappu/miqt.git
synced 2024-12-23 01:18:37 +00:00
398 lines
13 KiB
C++
398 lines
13 KiB
C++
#include <QByteArray>
|
|
#include <QColor>
|
|
#include <QIODevice>
|
|
#include <QImage>
|
|
#include <QImageReader>
|
|
#include <QList>
|
|
#include <QRect>
|
|
#include <QSize>
|
|
#include <QString>
|
|
#include <QByteArray>
|
|
#include <cstring>
|
|
#include <qimagereader.h>
|
|
#include "gen_qimagereader.h"
|
|
#include "_cgo_export.h"
|
|
|
|
QImageReader* QImageReader_new() {
|
|
return new QImageReader();
|
|
}
|
|
|
|
QImageReader* QImageReader_new2(QIODevice* device) {
|
|
return new QImageReader(device);
|
|
}
|
|
|
|
QImageReader* QImageReader_new3(struct miqt_string fileName) {
|
|
QString fileName_QString = QString::fromUtf8(fileName.data, fileName.len);
|
|
return new QImageReader(fileName_QString);
|
|
}
|
|
|
|
QImageReader* QImageReader_new4(QIODevice* device, struct miqt_string format) {
|
|
QByteArray format_QByteArray(format.data, format.len);
|
|
return new QImageReader(device, format_QByteArray);
|
|
}
|
|
|
|
QImageReader* QImageReader_new5(struct miqt_string fileName, struct miqt_string format) {
|
|
QString fileName_QString = QString::fromUtf8(fileName.data, fileName.len);
|
|
QByteArray format_QByteArray(format.data, format.len);
|
|
return new QImageReader(fileName_QString, format_QByteArray);
|
|
}
|
|
|
|
struct miqt_string QImageReader_Tr(const char* sourceText) {
|
|
QString _ret = QImageReader::tr(sourceText);
|
|
// Convert QString from UTF-16 in C++ RAII memory to UTF-8 in manually-managed C memory
|
|
QByteArray _b = _ret.toUtf8();
|
|
struct miqt_string _ms;
|
|
_ms.len = _b.length();
|
|
_ms.data = static_cast<char*>(malloc(_ms.len));
|
|
memcpy(_ms.data, _b.data(), _ms.len);
|
|
return _ms;
|
|
}
|
|
|
|
void QImageReader_SetFormat(QImageReader* self, struct miqt_string format) {
|
|
QByteArray format_QByteArray(format.data, format.len);
|
|
self->setFormat(format_QByteArray);
|
|
}
|
|
|
|
struct miqt_string QImageReader_Format(const QImageReader* self) {
|
|
QByteArray _qb = self->format();
|
|
struct miqt_string _ms;
|
|
_ms.len = _qb.length();
|
|
_ms.data = static_cast<char*>(malloc(_ms.len));
|
|
memcpy(_ms.data, _qb.data(), _ms.len);
|
|
return _ms;
|
|
}
|
|
|
|
void QImageReader_SetAutoDetectImageFormat(QImageReader* self, bool enabled) {
|
|
self->setAutoDetectImageFormat(enabled);
|
|
}
|
|
|
|
bool QImageReader_AutoDetectImageFormat(const QImageReader* self) {
|
|
return self->autoDetectImageFormat();
|
|
}
|
|
|
|
void QImageReader_SetDecideFormatFromContent(QImageReader* self, bool ignored) {
|
|
self->setDecideFormatFromContent(ignored);
|
|
}
|
|
|
|
bool QImageReader_DecideFormatFromContent(const QImageReader* self) {
|
|
return self->decideFormatFromContent();
|
|
}
|
|
|
|
void QImageReader_SetDevice(QImageReader* self, QIODevice* device) {
|
|
self->setDevice(device);
|
|
}
|
|
|
|
QIODevice* QImageReader_Device(const QImageReader* self) {
|
|
return self->device();
|
|
}
|
|
|
|
void QImageReader_SetFileName(QImageReader* self, struct miqt_string fileName) {
|
|
QString fileName_QString = QString::fromUtf8(fileName.data, fileName.len);
|
|
self->setFileName(fileName_QString);
|
|
}
|
|
|
|
struct miqt_string QImageReader_FileName(const QImageReader* self) {
|
|
QString _ret = self->fileName();
|
|
// Convert QString from UTF-16 in C++ RAII memory to UTF-8 in manually-managed C memory
|
|
QByteArray _b = _ret.toUtf8();
|
|
struct miqt_string _ms;
|
|
_ms.len = _b.length();
|
|
_ms.data = static_cast<char*>(malloc(_ms.len));
|
|
memcpy(_ms.data, _b.data(), _ms.len);
|
|
return _ms;
|
|
}
|
|
|
|
QSize* QImageReader_Size(const QImageReader* self) {
|
|
return new QSize(self->size());
|
|
}
|
|
|
|
int QImageReader_ImageFormat(const QImageReader* self) {
|
|
QImage::Format _ret = self->imageFormat();
|
|
return static_cast<int>(_ret);
|
|
}
|
|
|
|
struct miqt_array* QImageReader_TextKeys(const QImageReader* self) {
|
|
QStringList _ret = self->textKeys();
|
|
// Convert QList<> from C++ memory to manually-managed C memory
|
|
struct miqt_string* _arr = static_cast<struct miqt_string*>(malloc(sizeof(struct miqt_string) * _ret.length()));
|
|
for (size_t i = 0, e = _ret.length(); i < e; ++i) {
|
|
QString _lv_ret = _ret[i];
|
|
// Convert QString from UTF-16 in C++ RAII memory to UTF-8 in manually-managed C memory
|
|
QByteArray _lv_b = _lv_ret.toUtf8();
|
|
struct miqt_string _lv_ms;
|
|
_lv_ms.len = _lv_b.length();
|
|
_lv_ms.data = static_cast<char*>(malloc(_lv_ms.len));
|
|
memcpy(_lv_ms.data, _lv_b.data(), _lv_ms.len);
|
|
_arr[i] = _lv_ms;
|
|
}
|
|
struct miqt_array* _out = static_cast<struct miqt_array*>(malloc(sizeof(struct miqt_array)));
|
|
_out->len = _ret.length();
|
|
_out->data = static_cast<void*>(_arr);
|
|
return _out;
|
|
}
|
|
|
|
struct miqt_string QImageReader_Text(const QImageReader* self, struct miqt_string key) {
|
|
QString key_QString = QString::fromUtf8(key.data, key.len);
|
|
QString _ret = self->text(key_QString);
|
|
// Convert QString from UTF-16 in C++ RAII memory to UTF-8 in manually-managed C memory
|
|
QByteArray _b = _ret.toUtf8();
|
|
struct miqt_string _ms;
|
|
_ms.len = _b.length();
|
|
_ms.data = static_cast<char*>(malloc(_ms.len));
|
|
memcpy(_ms.data, _b.data(), _ms.len);
|
|
return _ms;
|
|
}
|
|
|
|
void QImageReader_SetClipRect(QImageReader* self, QRect* rect) {
|
|
self->setClipRect(*rect);
|
|
}
|
|
|
|
QRect* QImageReader_ClipRect(const QImageReader* self) {
|
|
return new QRect(self->clipRect());
|
|
}
|
|
|
|
void QImageReader_SetScaledSize(QImageReader* self, QSize* size) {
|
|
self->setScaledSize(*size);
|
|
}
|
|
|
|
QSize* QImageReader_ScaledSize(const QImageReader* self) {
|
|
return new QSize(self->scaledSize());
|
|
}
|
|
|
|
void QImageReader_SetQuality(QImageReader* self, int quality) {
|
|
self->setQuality(static_cast<int>(quality));
|
|
}
|
|
|
|
int QImageReader_Quality(const QImageReader* self) {
|
|
return self->quality();
|
|
}
|
|
|
|
void QImageReader_SetScaledClipRect(QImageReader* self, QRect* rect) {
|
|
self->setScaledClipRect(*rect);
|
|
}
|
|
|
|
QRect* QImageReader_ScaledClipRect(const QImageReader* self) {
|
|
return new QRect(self->scaledClipRect());
|
|
}
|
|
|
|
void QImageReader_SetBackgroundColor(QImageReader* self, QColor* color) {
|
|
self->setBackgroundColor(*color);
|
|
}
|
|
|
|
QColor* QImageReader_BackgroundColor(const QImageReader* self) {
|
|
return new QColor(self->backgroundColor());
|
|
}
|
|
|
|
bool QImageReader_SupportsAnimation(const QImageReader* self) {
|
|
return self->supportsAnimation();
|
|
}
|
|
|
|
int QImageReader_Transformation(const QImageReader* self) {
|
|
QImageIOHandler::Transformations _ret = self->transformation();
|
|
return static_cast<int>(_ret);
|
|
}
|
|
|
|
void QImageReader_SetAutoTransform(QImageReader* self, bool enabled) {
|
|
self->setAutoTransform(enabled);
|
|
}
|
|
|
|
bool QImageReader_AutoTransform(const QImageReader* self) {
|
|
return self->autoTransform();
|
|
}
|
|
|
|
struct miqt_string QImageReader_SubType(const QImageReader* self) {
|
|
QByteArray _qb = self->subType();
|
|
struct miqt_string _ms;
|
|
_ms.len = _qb.length();
|
|
_ms.data = static_cast<char*>(malloc(_ms.len));
|
|
memcpy(_ms.data, _qb.data(), _ms.len);
|
|
return _ms;
|
|
}
|
|
|
|
struct miqt_array* QImageReader_SupportedSubTypes(const QImageReader* self) {
|
|
QList<QByteArray> _ret = self->supportedSubTypes();
|
|
// Convert QList<> from C++ memory to manually-managed C memory
|
|
struct miqt_string* _arr = static_cast<struct miqt_string*>(malloc(sizeof(struct miqt_string) * _ret.length()));
|
|
for (size_t i = 0, e = _ret.length(); i < e; ++i) {
|
|
QByteArray _lv_qb = _ret[i];
|
|
struct miqt_string _lv_ms;
|
|
_lv_ms.len = _lv_qb.length();
|
|
_lv_ms.data = static_cast<char*>(malloc(_lv_ms.len));
|
|
memcpy(_lv_ms.data, _lv_qb.data(), _lv_ms.len);
|
|
_arr[i] = _lv_ms;
|
|
}
|
|
struct miqt_array* _out = static_cast<struct miqt_array*>(malloc(sizeof(struct miqt_array)));
|
|
_out->len = _ret.length();
|
|
_out->data = static_cast<void*>(_arr);
|
|
return _out;
|
|
}
|
|
|
|
bool QImageReader_CanRead(const QImageReader* self) {
|
|
return self->canRead();
|
|
}
|
|
|
|
QImage* QImageReader_Read(QImageReader* self) {
|
|
return new QImage(self->read());
|
|
}
|
|
|
|
bool QImageReader_ReadWithImage(QImageReader* self, QImage* image) {
|
|
return self->read(image);
|
|
}
|
|
|
|
bool QImageReader_JumpToNextImage(QImageReader* self) {
|
|
return self->jumpToNextImage();
|
|
}
|
|
|
|
bool QImageReader_JumpToImage(QImageReader* self, int imageNumber) {
|
|
return self->jumpToImage(static_cast<int>(imageNumber));
|
|
}
|
|
|
|
int QImageReader_LoopCount(const QImageReader* self) {
|
|
return self->loopCount();
|
|
}
|
|
|
|
int QImageReader_ImageCount(const QImageReader* self) {
|
|
return self->imageCount();
|
|
}
|
|
|
|
int QImageReader_NextImageDelay(const QImageReader* self) {
|
|
return self->nextImageDelay();
|
|
}
|
|
|
|
int QImageReader_CurrentImageNumber(const QImageReader* self) {
|
|
return self->currentImageNumber();
|
|
}
|
|
|
|
QRect* QImageReader_CurrentImageRect(const QImageReader* self) {
|
|
return new QRect(self->currentImageRect());
|
|
}
|
|
|
|
int QImageReader_Error(const QImageReader* self) {
|
|
QImageReader::ImageReaderError _ret = self->error();
|
|
return static_cast<int>(_ret);
|
|
}
|
|
|
|
struct miqt_string QImageReader_ErrorString(const QImageReader* self) {
|
|
QString _ret = self->errorString();
|
|
// Convert QString from UTF-16 in C++ RAII memory to UTF-8 in manually-managed C memory
|
|
QByteArray _b = _ret.toUtf8();
|
|
struct miqt_string _ms;
|
|
_ms.len = _b.length();
|
|
_ms.data = static_cast<char*>(malloc(_ms.len));
|
|
memcpy(_ms.data, _b.data(), _ms.len);
|
|
return _ms;
|
|
}
|
|
|
|
bool QImageReader_SupportsOption(const QImageReader* self, int option) {
|
|
return self->supportsOption(static_cast<QImageIOHandler::ImageOption>(option));
|
|
}
|
|
|
|
struct miqt_string QImageReader_ImageFormatWithFileName(struct miqt_string fileName) {
|
|
QString fileName_QString = QString::fromUtf8(fileName.data, fileName.len);
|
|
QByteArray _qb = QImageReader::imageFormat(fileName_QString);
|
|
struct miqt_string _ms;
|
|
_ms.len = _qb.length();
|
|
_ms.data = static_cast<char*>(malloc(_ms.len));
|
|
memcpy(_ms.data, _qb.data(), _ms.len);
|
|
return _ms;
|
|
}
|
|
|
|
struct miqt_string QImageReader_ImageFormatWithDevice(QIODevice* device) {
|
|
QByteArray _qb = QImageReader::imageFormat(device);
|
|
struct miqt_string _ms;
|
|
_ms.len = _qb.length();
|
|
_ms.data = static_cast<char*>(malloc(_ms.len));
|
|
memcpy(_ms.data, _qb.data(), _ms.len);
|
|
return _ms;
|
|
}
|
|
|
|
struct miqt_array* QImageReader_SupportedImageFormats() {
|
|
QList<QByteArray> _ret = QImageReader::supportedImageFormats();
|
|
// Convert QList<> from C++ memory to manually-managed C memory
|
|
struct miqt_string* _arr = static_cast<struct miqt_string*>(malloc(sizeof(struct miqt_string) * _ret.length()));
|
|
for (size_t i = 0, e = _ret.length(); i < e; ++i) {
|
|
QByteArray _lv_qb = _ret[i];
|
|
struct miqt_string _lv_ms;
|
|
_lv_ms.len = _lv_qb.length();
|
|
_lv_ms.data = static_cast<char*>(malloc(_lv_ms.len));
|
|
memcpy(_lv_ms.data, _lv_qb.data(), _lv_ms.len);
|
|
_arr[i] = _lv_ms;
|
|
}
|
|
struct miqt_array* _out = static_cast<struct miqt_array*>(malloc(sizeof(struct miqt_array)));
|
|
_out->len = _ret.length();
|
|
_out->data = static_cast<void*>(_arr);
|
|
return _out;
|
|
}
|
|
|
|
struct miqt_array* QImageReader_SupportedMimeTypes() {
|
|
QList<QByteArray> _ret = QImageReader::supportedMimeTypes();
|
|
// Convert QList<> from C++ memory to manually-managed C memory
|
|
struct miqt_string* _arr = static_cast<struct miqt_string*>(malloc(sizeof(struct miqt_string) * _ret.length()));
|
|
for (size_t i = 0, e = _ret.length(); i < e; ++i) {
|
|
QByteArray _lv_qb = _ret[i];
|
|
struct miqt_string _lv_ms;
|
|
_lv_ms.len = _lv_qb.length();
|
|
_lv_ms.data = static_cast<char*>(malloc(_lv_ms.len));
|
|
memcpy(_lv_ms.data, _lv_qb.data(), _lv_ms.len);
|
|
_arr[i] = _lv_ms;
|
|
}
|
|
struct miqt_array* _out = static_cast<struct miqt_array*>(malloc(sizeof(struct miqt_array)));
|
|
_out->len = _ret.length();
|
|
_out->data = static_cast<void*>(_arr);
|
|
return _out;
|
|
}
|
|
|
|
struct miqt_array* QImageReader_ImageFormatsForMimeType(struct miqt_string mimeType) {
|
|
QByteArray mimeType_QByteArray(mimeType.data, mimeType.len);
|
|
QList<QByteArray> _ret = QImageReader::imageFormatsForMimeType(mimeType_QByteArray);
|
|
// Convert QList<> from C++ memory to manually-managed C memory
|
|
struct miqt_string* _arr = static_cast<struct miqt_string*>(malloc(sizeof(struct miqt_string) * _ret.length()));
|
|
for (size_t i = 0, e = _ret.length(); i < e; ++i) {
|
|
QByteArray _lv_qb = _ret[i];
|
|
struct miqt_string _lv_ms;
|
|
_lv_ms.len = _lv_qb.length();
|
|
_lv_ms.data = static_cast<char*>(malloc(_lv_ms.len));
|
|
memcpy(_lv_ms.data, _lv_qb.data(), _lv_ms.len);
|
|
_arr[i] = _lv_ms;
|
|
}
|
|
struct miqt_array* _out = static_cast<struct miqt_array*>(malloc(sizeof(struct miqt_array)));
|
|
_out->len = _ret.length();
|
|
_out->data = static_cast<void*>(_arr);
|
|
return _out;
|
|
}
|
|
|
|
int QImageReader_AllocationLimit() {
|
|
return QImageReader::allocationLimit();
|
|
}
|
|
|
|
void QImageReader_SetAllocationLimit(int mbLimit) {
|
|
QImageReader::setAllocationLimit(static_cast<int>(mbLimit));
|
|
}
|
|
|
|
struct miqt_string QImageReader_Tr2(const char* sourceText, const char* disambiguation) {
|
|
QString _ret = QImageReader::tr(sourceText, disambiguation);
|
|
// Convert QString from UTF-16 in C++ RAII memory to UTF-8 in manually-managed C memory
|
|
QByteArray _b = _ret.toUtf8();
|
|
struct miqt_string _ms;
|
|
_ms.len = _b.length();
|
|
_ms.data = static_cast<char*>(malloc(_ms.len));
|
|
memcpy(_ms.data, _b.data(), _ms.len);
|
|
return _ms;
|
|
}
|
|
|
|
struct miqt_string QImageReader_Tr3(const char* sourceText, const char* disambiguation, int n) {
|
|
QString _ret = QImageReader::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();
|
|
struct miqt_string _ms;
|
|
_ms.len = _b.length();
|
|
_ms.data = static_cast<char*>(malloc(_ms.len));
|
|
memcpy(_ms.data, _b.data(), _ms.len);
|
|
return _ms;
|
|
}
|
|
|
|
void QImageReader_Delete(QImageReader* self) {
|
|
delete self;
|
|
}
|
|
|