2024-08-25 04:08:24 +00:00
|
|
|
#include <QColor>
|
|
|
|
#include <QColormap>
|
|
|
|
#include <QList>
|
2024-10-16 05:07:56 +00:00
|
|
|
#include <qcolormap.h>
|
2024-08-29 07:01:51 +00:00
|
|
|
#include "gen_qcolormap.h"
|
2024-09-14 22:29:05 +00:00
|
|
|
#include "_cgo_export.h"
|
2024-08-25 04:08:24 +00:00
|
|
|
|
|
|
|
QColormap* QColormap_new(QColormap* colormap) {
|
|
|
|
return new QColormap(*colormap);
|
|
|
|
}
|
|
|
|
|
|
|
|
void QColormap_Initialize() {
|
|
|
|
QColormap::initialize();
|
|
|
|
}
|
|
|
|
|
|
|
|
void QColormap_Cleanup() {
|
|
|
|
QColormap::cleanup();
|
|
|
|
}
|
|
|
|
|
|
|
|
QColormap* QColormap_Instance() {
|
2024-09-17 06:29:11 +00:00
|
|
|
return new QColormap(QColormap::instance());
|
2024-08-25 04:08:24 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void QColormap_OperatorAssign(QColormap* self, QColormap* colormap) {
|
|
|
|
self->operator=(*colormap);
|
|
|
|
}
|
|
|
|
|
2024-09-18 00:12:02 +00:00
|
|
|
int QColormap_Mode(const QColormap* self) {
|
2024-09-14 22:29:05 +00:00
|
|
|
QColormap::Mode _ret = self->mode();
|
2024-09-18 00:12:02 +00:00
|
|
|
return static_cast<int>(_ret);
|
2024-08-29 07:01:51 +00:00
|
|
|
}
|
|
|
|
|
2024-09-11 05:41:09 +00:00
|
|
|
int QColormap_Depth(const QColormap* self) {
|
|
|
|
return self->depth();
|
2024-08-25 04:08:24 +00:00
|
|
|
}
|
|
|
|
|
2024-09-11 05:41:09 +00:00
|
|
|
int QColormap_Size(const QColormap* self) {
|
|
|
|
return self->size();
|
2024-08-25 04:08:24 +00:00
|
|
|
}
|
|
|
|
|
2024-09-11 05:41:09 +00:00
|
|
|
unsigned int QColormap_Pixel(const QColormap* self, QColor* color) {
|
2024-09-18 00:12:02 +00:00
|
|
|
uint _ret = self->pixel(*color);
|
|
|
|
return static_cast<unsigned int>(_ret);
|
2024-08-25 04:08:24 +00:00
|
|
|
}
|
|
|
|
|
2024-09-11 05:41:09 +00:00
|
|
|
QColor* QColormap_ColorAt(const QColormap* self, unsigned int pixel) {
|
2024-09-17 06:29:11 +00:00
|
|
|
return new QColor(self->colorAt(static_cast<uint>(pixel)));
|
2024-08-25 04:08:24 +00:00
|
|
|
}
|
|
|
|
|
2024-09-14 22:29:05 +00:00
|
|
|
struct miqt_array* QColormap_Colormap(const QColormap* self) {
|
|
|
|
const QVector<QColor> _ret = self->colormap();
|
2024-09-17 06:29:11 +00:00
|
|
|
// Convert QList<> from C++ memory to manually-managed C memory
|
|
|
|
QColor** _arr = static_cast<QColor**>(malloc(sizeof(QColor*) * _ret.length()));
|
2024-09-14 22:29:05 +00:00
|
|
|
for (size_t i = 0, e = _ret.length(); i < e; ++i) {
|
|
|
|
_arr[i] = new QColor(_ret[i]);
|
2024-08-25 04:08:24 +00:00
|
|
|
}
|
2024-09-14 22:29:05 +00:00
|
|
|
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;
|
2024-08-25 04:08:24 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
QColormap* QColormap_Instance1(int screen) {
|
2024-09-17 06:29:11 +00:00
|
|
|
return new QColormap(QColormap::instance(static_cast<int>(screen)));
|
2024-08-25 04:08:24 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void QColormap_Delete(QColormap* self) {
|
|
|
|
delete self;
|
|
|
|
}
|
|
|
|
|