mirror of
https://github.com/mappu/miqt.git
synced 2024-12-23 01:18:37 +00:00
326 lines
9.8 KiB
C++
326 lines
9.8 KiB
C++
#include <QByteArray>
|
|
#include <QIODevice>
|
|
#include <QList>
|
|
#include <QPaintEngine>
|
|
#include <QPainter>
|
|
#include <QPicture>
|
|
#include <QPictureIO>
|
|
#include <QRect>
|
|
#include <QString>
|
|
#include <QByteArray>
|
|
#include <cstring>
|
|
#include <qpicture.h>
|
|
#include "gen_qpicture.h"
|
|
#include "_cgo_export.h"
|
|
|
|
QPicture* QPicture_new() {
|
|
return new QPicture();
|
|
}
|
|
|
|
QPicture* QPicture_new2(QPicture* param1) {
|
|
return new QPicture(*param1);
|
|
}
|
|
|
|
QPicture* QPicture_new3(int formatVersion) {
|
|
return new QPicture(static_cast<int>(formatVersion));
|
|
}
|
|
|
|
bool QPicture_IsNull(const QPicture* self) {
|
|
return self->isNull();
|
|
}
|
|
|
|
int QPicture_DevType(const QPicture* self) {
|
|
return self->devType();
|
|
}
|
|
|
|
unsigned int QPicture_Size(const QPicture* self) {
|
|
uint _ret = self->size();
|
|
return static_cast<unsigned int>(_ret);
|
|
}
|
|
|
|
const char* QPicture_Data(const QPicture* self) {
|
|
return (const char*) self->data();
|
|
}
|
|
|
|
void QPicture_SetData(QPicture* self, const char* data, unsigned int size) {
|
|
self->setData(data, static_cast<uint>(size));
|
|
}
|
|
|
|
bool QPicture_Play(QPicture* self, QPainter* p) {
|
|
return self->play(p);
|
|
}
|
|
|
|
bool QPicture_Load(QPicture* self, QIODevice* dev) {
|
|
return self->load(dev);
|
|
}
|
|
|
|
bool QPicture_LoadWithFileName(QPicture* self, struct miqt_string* fileName) {
|
|
QString fileName_QString = QString::fromUtf8(&fileName->data, fileName->len);
|
|
return self->load(fileName_QString);
|
|
}
|
|
|
|
bool QPicture_Save(QPicture* self, QIODevice* dev) {
|
|
return self->save(dev);
|
|
}
|
|
|
|
bool QPicture_SaveWithFileName(QPicture* self, struct miqt_string* fileName) {
|
|
QString fileName_QString = QString::fromUtf8(&fileName->data, fileName->len);
|
|
return self->save(fileName_QString);
|
|
}
|
|
|
|
QRect* QPicture_BoundingRect(const QPicture* self) {
|
|
return new QRect(self->boundingRect());
|
|
}
|
|
|
|
void QPicture_SetBoundingRect(QPicture* self, QRect* r) {
|
|
self->setBoundingRect(*r);
|
|
}
|
|
|
|
void QPicture_OperatorAssign(QPicture* self, QPicture* p) {
|
|
self->operator=(*p);
|
|
}
|
|
|
|
void QPicture_Swap(QPicture* self, QPicture* other) {
|
|
self->swap(*other);
|
|
}
|
|
|
|
void QPicture_Detach(QPicture* self) {
|
|
self->detach();
|
|
}
|
|
|
|
bool QPicture_IsDetached(const QPicture* self) {
|
|
return self->isDetached();
|
|
}
|
|
|
|
const char* QPicture_PictureFormat(struct miqt_string* fileName) {
|
|
QString fileName_QString = QString::fromUtf8(&fileName->data, fileName->len);
|
|
return (const char*) QPicture::pictureFormat(fileName_QString);
|
|
}
|
|
|
|
struct miqt_array* QPicture_InputFormats() {
|
|
QList<QByteArray> _ret = QPicture::inputFormats();
|
|
// Convert QList<> from C++ memory to manually-managed C memory
|
|
QByteArray** _arr = static_cast<QByteArray**>(malloc(sizeof(QByteArray*) * _ret.length()));
|
|
for (size_t i = 0, e = _ret.length(); i < e; ++i) {
|
|
_arr[i] = new QByteArray(_ret[i]);
|
|
}
|
|
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* QPicture_OutputFormats() {
|
|
QList<QByteArray> _ret = QPicture::outputFormats();
|
|
// Convert QList<> from C++ memory to manually-managed C memory
|
|
QByteArray** _arr = static_cast<QByteArray**>(malloc(sizeof(QByteArray*) * _ret.length()));
|
|
for (size_t i = 0, e = _ret.length(); i < e; ++i) {
|
|
_arr[i] = new QByteArray(_ret[i]);
|
|
}
|
|
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* QPicture_InputFormatList() {
|
|
QStringList _ret = QPicture::inputFormatList();
|
|
// 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();
|
|
_arr[i] = miqt_strdup(_lv_b.data(), _lv_b.length());
|
|
}
|
|
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* QPicture_OutputFormatList() {
|
|
QStringList _ret = QPicture::outputFormatList();
|
|
// 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();
|
|
_arr[i] = miqt_strdup(_lv_b.data(), _lv_b.length());
|
|
}
|
|
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;
|
|
}
|
|
|
|
QPaintEngine* QPicture_PaintEngine(const QPicture* self) {
|
|
return self->paintEngine();
|
|
}
|
|
|
|
bool QPicture_Load2(QPicture* self, QIODevice* dev, const char* format) {
|
|
return self->load(dev, format);
|
|
}
|
|
|
|
bool QPicture_Load22(QPicture* self, struct miqt_string* fileName, const char* format) {
|
|
QString fileName_QString = QString::fromUtf8(&fileName->data, fileName->len);
|
|
return self->load(fileName_QString, format);
|
|
}
|
|
|
|
bool QPicture_Save2(QPicture* self, QIODevice* dev, const char* format) {
|
|
return self->save(dev, format);
|
|
}
|
|
|
|
bool QPicture_Save22(QPicture* self, struct miqt_string* fileName, const char* format) {
|
|
QString fileName_QString = QString::fromUtf8(&fileName->data, fileName->len);
|
|
return self->save(fileName_QString, format);
|
|
}
|
|
|
|
void QPicture_Delete(QPicture* self) {
|
|
delete self;
|
|
}
|
|
|
|
QPictureIO* QPictureIO_new() {
|
|
return new QPictureIO();
|
|
}
|
|
|
|
QPictureIO* QPictureIO_new2(QIODevice* ioDevice, const char* format) {
|
|
return new QPictureIO(ioDevice, format);
|
|
}
|
|
|
|
QPictureIO* QPictureIO_new3(struct miqt_string* fileName, const char* format) {
|
|
QString fileName_QString = QString::fromUtf8(&fileName->data, fileName->len);
|
|
return new QPictureIO(fileName_QString, format);
|
|
}
|
|
|
|
QPicture* QPictureIO_Picture(const QPictureIO* self) {
|
|
const QPicture& _ret = self->picture();
|
|
// Cast returned reference into pointer
|
|
return const_cast<QPicture*>(&_ret);
|
|
}
|
|
|
|
int QPictureIO_Status(const QPictureIO* self) {
|
|
return self->status();
|
|
}
|
|
|
|
const char* QPictureIO_Format(const QPictureIO* self) {
|
|
return (const char*) self->format();
|
|
}
|
|
|
|
QIODevice* QPictureIO_IoDevice(const QPictureIO* self) {
|
|
return self->ioDevice();
|
|
}
|
|
|
|
struct miqt_string* QPictureIO_FileName(const QPictureIO* 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();
|
|
return miqt_strdup(_b.data(), _b.length());
|
|
}
|
|
|
|
int QPictureIO_Quality(const QPictureIO* self) {
|
|
return self->quality();
|
|
}
|
|
|
|
struct miqt_string* QPictureIO_Description(const QPictureIO* self) {
|
|
QString _ret = self->description();
|
|
// Convert QString from UTF-16 in C++ RAII memory to UTF-8 in manually-managed C memory
|
|
QByteArray _b = _ret.toUtf8();
|
|
return miqt_strdup(_b.data(), _b.length());
|
|
}
|
|
|
|
const char* QPictureIO_Parameters(const QPictureIO* self) {
|
|
return (const char*) self->parameters();
|
|
}
|
|
|
|
float QPictureIO_Gamma(const QPictureIO* self) {
|
|
return self->gamma();
|
|
}
|
|
|
|
void QPictureIO_SetPicture(QPictureIO* self, QPicture* picture) {
|
|
self->setPicture(*picture);
|
|
}
|
|
|
|
void QPictureIO_SetStatus(QPictureIO* self, int status) {
|
|
self->setStatus(static_cast<int>(status));
|
|
}
|
|
|
|
void QPictureIO_SetFormat(QPictureIO* self, const char* format) {
|
|
self->setFormat(format);
|
|
}
|
|
|
|
void QPictureIO_SetIODevice(QPictureIO* self, QIODevice* iODevice) {
|
|
self->setIODevice(iODevice);
|
|
}
|
|
|
|
void QPictureIO_SetFileName(QPictureIO* self, struct miqt_string* fileName) {
|
|
QString fileName_QString = QString::fromUtf8(&fileName->data, fileName->len);
|
|
self->setFileName(fileName_QString);
|
|
}
|
|
|
|
void QPictureIO_SetQuality(QPictureIO* self, int quality) {
|
|
self->setQuality(static_cast<int>(quality));
|
|
}
|
|
|
|
void QPictureIO_SetDescription(QPictureIO* self, struct miqt_string* description) {
|
|
QString description_QString = QString::fromUtf8(&description->data, description->len);
|
|
self->setDescription(description_QString);
|
|
}
|
|
|
|
void QPictureIO_SetParameters(QPictureIO* self, const char* parameters) {
|
|
self->setParameters(parameters);
|
|
}
|
|
|
|
void QPictureIO_SetGamma(QPictureIO* self, float gamma) {
|
|
self->setGamma(static_cast<float>(gamma));
|
|
}
|
|
|
|
bool QPictureIO_Read(QPictureIO* self) {
|
|
return self->read();
|
|
}
|
|
|
|
bool QPictureIO_Write(QPictureIO* self) {
|
|
return self->write();
|
|
}
|
|
|
|
QByteArray* QPictureIO_PictureFormat(struct miqt_string* fileName) {
|
|
QString fileName_QString = QString::fromUtf8(&fileName->data, fileName->len);
|
|
return new QByteArray(QPictureIO::pictureFormat(fileName_QString));
|
|
}
|
|
|
|
QByteArray* QPictureIO_PictureFormatWithQIODevice(QIODevice* param1) {
|
|
return new QByteArray(QPictureIO::pictureFormat(param1));
|
|
}
|
|
|
|
struct miqt_array* QPictureIO_InputFormats() {
|
|
QList<QByteArray> _ret = QPictureIO::inputFormats();
|
|
// Convert QList<> from C++ memory to manually-managed C memory
|
|
QByteArray** _arr = static_cast<QByteArray**>(malloc(sizeof(QByteArray*) * _ret.length()));
|
|
for (size_t i = 0, e = _ret.length(); i < e; ++i) {
|
|
_arr[i] = new QByteArray(_ret[i]);
|
|
}
|
|
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* QPictureIO_OutputFormats() {
|
|
QList<QByteArray> _ret = QPictureIO::outputFormats();
|
|
// Convert QList<> from C++ memory to manually-managed C memory
|
|
QByteArray** _arr = static_cast<QByteArray**>(malloc(sizeof(QByteArray*) * _ret.length()));
|
|
for (size_t i = 0, e = _ret.length(); i < e; ++i) {
|
|
_arr[i] = new QByteArray(_ret[i]);
|
|
}
|
|
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;
|
|
}
|
|
|
|
void QPictureIO_Delete(QPictureIO* self) {
|
|
delete self;
|
|
}
|
|
|