rute 0.0.4

UI library implemented on top of Qt
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
// This file is auto-generated by rute_gen. DO NOT EDIT
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

#include "../rute_base.h"
#include "../rute_manual.h"
#include <QImage>
#include "image_ffi.h"

///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

static void image_swap(struct RUBase* self_c, struct RUBase* other) {
    WRImage* qt_value = (WRImage*)self_c;
    qt_value->swap(*((QImage*)other));
}

///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

static bool image_is_null(struct RUBase* self_c) {
    WRImage* qt_value = (WRImage*)self_c;
    auto ret_value = qt_value->isNull();
    return ret_value;
}

///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

static int image_dev_type(struct RUBase* self_c) {
    WRImage* qt_value = (WRImage*)self_c;
    auto ret_value = qt_value->devType();
    return ret_value;
}

///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

static void image_detach(struct RUBase* self_c) {
    WRImage* qt_value = (WRImage*)self_c;
    qt_value->detach();
}

///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

static bool image_is_detached(struct RUBase* self_c) {
    WRImage* qt_value = (WRImage*)self_c;
    auto ret_value = qt_value->isDetached();
    return ret_value;
}

///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

static struct RUImage image_copy(struct RUBase* self_c, struct RUBase* rect) {
    WRImage* qt_value = (WRImage*)self_c;
    auto ret_value = qt_value->copy(*((QRect*)rect));
    WRImage* new_val = new WRImage();
    *new_val = ret_value;
    struct RUImage ctl;
    ctl.qt_data = (struct RUBase*)new_val;
    ctl.host_data = (struct RUBase*)s_host_data_lookup[(void*)new_val];
    ctl.all_funcs = &s_image_all_funcs;
    return ctl;
}

///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

static struct RUImage image_copy_2(struct RUBase* self_c, int x, int y, int w, int h) {
    WRImage* qt_value = (WRImage*)self_c;
    auto ret_value = qt_value->copy(x, y, w, h);
    WRImage* new_val = new WRImage();
    *new_val = ret_value;
    struct RUImage ctl;
    ctl.qt_data = (struct RUBase*)new_val;
    ctl.host_data = (struct RUBase*)s_host_data_lookup[(void*)new_val];
    ctl.all_funcs = &s_image_all_funcs;
    return ctl;
}

///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

static int image_format(struct RUBase* self_c) {
    WRImage* qt_value = (WRImage*)self_c;
    auto ret_value = qt_value->format();
    return s_format_lookup[(int)ret_value];
}

///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

static struct RUImage image_convert_to_format(struct RUBase* self_c, int f, int flags) {
    WRImage* qt_value = (WRImage*)self_c;
    auto ret_value = qt_value->convertToFormat((QImage::Format)s_format_lookup[f], (Qt::ImageConversionFlags)s_image_conversion_flags_lookup[flags]);
    WRImage* new_val = new WRImage();
    *new_val = ret_value;
    struct RUImage ctl;
    ctl.qt_data = (struct RUBase*)new_val;
    ctl.host_data = (struct RUBase*)s_host_data_lookup[(void*)new_val];
    ctl.all_funcs = &s_image_all_funcs;
    return ctl;
}

///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

static struct RUImage image_convert_to_format_2(struct RUBase* self_c, int f, int flags) {
    WRImage* qt_value = (WRImage*)self_c;
    auto ret_value = qt_value->convertToFormat((QImage::Format)s_format_lookup[f], (Qt::ImageConversionFlags)s_image_conversion_flags_lookup[flags]);
    WRImage* new_val = new WRImage();
    *new_val = ret_value;
    struct RUImage ctl;
    ctl.qt_data = (struct RUBase*)new_val;
    ctl.host_data = (struct RUBase*)s_host_data_lookup[(void*)new_val];
    ctl.all_funcs = &s_image_all_funcs;
    return ctl;
}

///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

static bool image_reinterpret_as_format(struct RUBase* self_c, int f) {
    WRImage* qt_value = (WRImage*)self_c;
    auto ret_value = qt_value->reinterpretAsFormat((QImage::Format)s_format_lookup[f]);
    return ret_value;
}

///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

static int image_width(struct RUBase* self_c) {
    WRImage* qt_value = (WRImage*)self_c;
    auto ret_value = qt_value->width();
    return ret_value;
}

///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

static int image_height(struct RUBase* self_c) {
    WRImage* qt_value = (WRImage*)self_c;
    auto ret_value = qt_value->height();
    return ret_value;
}

///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

static struct RUSize image_size(struct RUBase* self_c) {
    WRImage* qt_value = (WRImage*)self_c;
    auto ret_value = qt_value->size();
    WRSize* new_val = new WRSize();
    *new_val = ret_value;
    struct RUSize ctl;
    ctl.qt_data = (struct RUBase*)new_val;
    ctl.host_data = (struct RUBase*)s_host_data_lookup[(void*)new_val];
    ctl.all_funcs = &s_size_all_funcs;
    return ctl;
}

///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

static struct RURect image_rect(struct RUBase* self_c) {
    WRImage* qt_value = (WRImage*)self_c;
    auto ret_value = qt_value->rect();
    WRRect* new_val = new WRRect();
    *new_val = ret_value;
    struct RURect ctl;
    ctl.qt_data = (struct RUBase*)new_val;
    ctl.host_data = (struct RUBase*)s_host_data_lookup[(void*)new_val];
    ctl.all_funcs = &s_rect_all_funcs;
    return ctl;
}

///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

static int image_depth(struct RUBase* self_c) {
    WRImage* qt_value = (WRImage*)self_c;
    auto ret_value = qt_value->depth();
    return ret_value;
}

///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

static int image_color_count(struct RUBase* self_c) {
    WRImage* qt_value = (WRImage*)self_c;
    auto ret_value = qt_value->colorCount();
    return ret_value;
}

///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

static int image_bit_plane_count(struct RUBase* self_c) {
    WRImage* qt_value = (WRImage*)self_c;
    auto ret_value = qt_value->bitPlaneCount();
    return ret_value;
}

///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

static void image_set_color_count(struct RUBase* self_c, int arg0) {
    WRImage* qt_value = (WRImage*)self_c;
    qt_value->setColorCount(arg0);
}

///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

static bool image_all_gray(struct RUBase* self_c) {
    WRImage* qt_value = (WRImage*)self_c;
    auto ret_value = qt_value->allGray();
    return ret_value;
}

///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

static bool image_is_grayscale(struct RUBase* self_c) {
    WRImage* qt_value = (WRImage*)self_c;
    auto ret_value = qt_value->isGrayscale();
    return ret_value;
}

///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

static int image_byte_count(struct RUBase* self_c) {
    WRImage* qt_value = (WRImage*)self_c;
    auto ret_value = qt_value->byteCount();
    return ret_value;
}

///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

static int image_bytes_per_line(struct RUBase* self_c) {
    WRImage* qt_value = (WRImage*)self_c;
    auto ret_value = qt_value->bytesPerLine();
    return ret_value;
}

///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

static bool image_valid(struct RUBase* self_c, int x, int y) {
    WRImage* qt_value = (WRImage*)self_c;
    auto ret_value = qt_value->valid(x, y);
    return ret_value;
}

///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

static bool image_valid_2(struct RUBase* self_c, struct RUBase* pt) {
    WRImage* qt_value = (WRImage*)self_c;
    auto ret_value = qt_value->valid(*((QPoint*)pt));
    return ret_value;
}

///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

static int image_pixel_index(struct RUBase* self_c, int x, int y) {
    WRImage* qt_value = (WRImage*)self_c;
    auto ret_value = qt_value->pixelIndex(x, y);
    return ret_value;
}

///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

static int image_pixel_index_2(struct RUBase* self_c, struct RUBase* pt) {
    WRImage* qt_value = (WRImage*)self_c;
    auto ret_value = qt_value->pixelIndex(*((QPoint*)pt));
    return ret_value;
}

///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

static void image_set_pixel(struct RUBase* self_c, int x, int y, uint32_t index_or_rgb) {
    WRImage* qt_value = (WRImage*)self_c;
    qt_value->setPixel(x, y, index_or_rgb);
}

///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

static void image_set_pixel_2(struct RUBase* self_c, struct RUBase* pt, uint32_t index_or_rgb) {
    WRImage* qt_value = (WRImage*)self_c;
    qt_value->setPixel(*((QPoint*)pt), index_or_rgb);
}

///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

static struct RUColor image_pixel_color(struct RUBase* self_c, int x, int y) {
    WRImage* qt_value = (WRImage*)self_c;
    auto ret_value = qt_value->pixelColor(x, y);
    WRColor* new_val = new WRColor();
    *new_val = ret_value;
    struct RUColor ctl;
    ctl.qt_data = (struct RUBase*)new_val;
    ctl.host_data = (struct RUBase*)s_host_data_lookup[(void*)new_val];
    ctl.all_funcs = &s_color_all_funcs;
    return ctl;
}

///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

static struct RUColor image_pixel_color_2(struct RUBase* self_c, struct RUBase* pt) {
    WRImage* qt_value = (WRImage*)self_c;
    auto ret_value = qt_value->pixelColor(*((QPoint*)pt));
    WRColor* new_val = new WRColor();
    *new_val = ret_value;
    struct RUColor ctl;
    ctl.qt_data = (struct RUBase*)new_val;
    ctl.host_data = (struct RUBase*)s_host_data_lookup[(void*)new_val];
    ctl.all_funcs = &s_color_all_funcs;
    return ctl;
}

///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

static void image_set_pixel_color(struct RUBase* self_c, int x, int y, struct RUBase* c) {
    WRImage* qt_value = (WRImage*)self_c;
    qt_value->setPixelColor(x, y, *((QColor*)c));
}

///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

static void image_set_pixel_color_2(struct RUBase* self_c, struct RUBase* pt, struct RUBase* c) {
    WRImage* qt_value = (WRImage*)self_c;
    qt_value->setPixelColor(*((QPoint*)pt), *((QColor*)c));
}

///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

static float image_device_pixel_ratio(struct RUBase* self_c) {
    WRImage* qt_value = (WRImage*)self_c;
    auto ret_value = qt_value->devicePixelRatio();
    return ret_value;
}

///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

static void image_set_device_pixel_ratio(struct RUBase* self_c, float scale_factor) {
    WRImage* qt_value = (WRImage*)self_c;
    qt_value->setDevicePixelRatio(scale_factor);
}

///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

static void image_fill(struct RUBase* self_c, uint32_t pixel) {
    WRImage* qt_value = (WRImage*)self_c;
    qt_value->fill(pixel);
}

///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

static void image_fill_2(struct RUBase* self_c, struct RUBase* color) {
    WRImage* qt_value = (WRImage*)self_c;
    qt_value->fill(*((QColor*)color));
}

///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

static void image_fill_3(struct RUBase* self_c, int color) {
    WRImage* qt_value = (WRImage*)self_c;
    qt_value->fill((Qt::GlobalColor)s_global_color_lookup[color]);
}

///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

static bool image_has_alpha_channel(struct RUBase* self_c) {
    WRImage* qt_value = (WRImage*)self_c;
    auto ret_value = qt_value->hasAlphaChannel();
    return ret_value;
}

///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

static void image_set_alpha_channel(struct RUBase* self_c, struct RUBase* alpha_channel) {
    WRImage* qt_value = (WRImage*)self_c;
    qt_value->setAlphaChannel(*((QImage*)alpha_channel));
}

///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

static struct RUImage image_alpha_channel(struct RUBase* self_c) {
    WRImage* qt_value = (WRImage*)self_c;
    auto ret_value = qt_value->alphaChannel();
    WRImage* new_val = new WRImage();
    *new_val = ret_value;
    struct RUImage ctl;
    ctl.qt_data = (struct RUBase*)new_val;
    ctl.host_data = (struct RUBase*)s_host_data_lookup[(void*)new_val];
    ctl.all_funcs = &s_image_all_funcs;
    return ctl;
}

///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

static struct RUImage image_create_alpha_mask(struct RUBase* self_c, int flags) {
    WRImage* qt_value = (WRImage*)self_c;
    auto ret_value = qt_value->createAlphaMask((Qt::ImageConversionFlags)s_image_conversion_flags_lookup[flags]);
    WRImage* new_val = new WRImage();
    *new_val = ret_value;
    struct RUImage ctl;
    ctl.qt_data = (struct RUBase*)new_val;
    ctl.host_data = (struct RUBase*)s_host_data_lookup[(void*)new_val];
    ctl.all_funcs = &s_image_all_funcs;
    return ctl;
}

///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

static struct RUImage image_create_heuristic_mask(struct RUBase* self_c, bool clip_tight) {
    WRImage* qt_value = (WRImage*)self_c;
    auto ret_value = qt_value->createHeuristicMask(clip_tight);
    WRImage* new_val = new WRImage();
    *new_val = ret_value;
    struct RUImage ctl;
    ctl.qt_data = (struct RUBase*)new_val;
    ctl.host_data = (struct RUBase*)s_host_data_lookup[(void*)new_val];
    ctl.all_funcs = &s_image_all_funcs;
    return ctl;
}

///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

static struct RUImage image_scaled(struct RUBase* self_c, int w, int h, int aspect_mode, int mode) {
    WRImage* qt_value = (WRImage*)self_c;
    auto ret_value = qt_value->scaled(w, h, (Qt::AspectRatioMode)s_aspect_ratio_mode_lookup[aspect_mode], (Qt::TransformationMode)s_transformation_mode_lookup[mode]);
    WRImage* new_val = new WRImage();
    *new_val = ret_value;
    struct RUImage ctl;
    ctl.qt_data = (struct RUBase*)new_val;
    ctl.host_data = (struct RUBase*)s_host_data_lookup[(void*)new_val];
    ctl.all_funcs = &s_image_all_funcs;
    return ctl;
}

///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

static struct RUImage image_scaled_2(struct RUBase* self_c, struct RUBase* s, int aspect_mode, int mode) {
    WRImage* qt_value = (WRImage*)self_c;
    auto ret_value = qt_value->scaled(*((QSize*)s), (Qt::AspectRatioMode)s_aspect_ratio_mode_lookup[aspect_mode], (Qt::TransformationMode)s_transformation_mode_lookup[mode]);
    WRImage* new_val = new WRImage();
    *new_val = ret_value;
    struct RUImage ctl;
    ctl.qt_data = (struct RUBase*)new_val;
    ctl.host_data = (struct RUBase*)s_host_data_lookup[(void*)new_val];
    ctl.all_funcs = &s_image_all_funcs;
    return ctl;
}

///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

static struct RUImage image_scaled_to_width(struct RUBase* self_c, int w, int mode) {
    WRImage* qt_value = (WRImage*)self_c;
    auto ret_value = qt_value->scaledToWidth(w, (Qt::TransformationMode)s_transformation_mode_lookup[mode]);
    WRImage* new_val = new WRImage();
    *new_val = ret_value;
    struct RUImage ctl;
    ctl.qt_data = (struct RUBase*)new_val;
    ctl.host_data = (struct RUBase*)s_host_data_lookup[(void*)new_val];
    ctl.all_funcs = &s_image_all_funcs;
    return ctl;
}

///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

static struct RUImage image_scaled_to_height(struct RUBase* self_c, int h, int mode) {
    WRImage* qt_value = (WRImage*)self_c;
    auto ret_value = qt_value->scaledToHeight(h, (Qt::TransformationMode)s_transformation_mode_lookup[mode]);
    WRImage* new_val = new WRImage();
    *new_val = ret_value;
    struct RUImage ctl;
    ctl.qt_data = (struct RUBase*)new_val;
    ctl.host_data = (struct RUBase*)s_host_data_lookup[(void*)new_val];
    ctl.all_funcs = &s_image_all_funcs;
    return ctl;
}

///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

static struct RUImage image_mirrored(struct RUBase* self_c, bool horizontally, bool vertically) {
    WRImage* qt_value = (WRImage*)self_c;
    auto ret_value = qt_value->mirrored(horizontally, vertically);
    WRImage* new_val = new WRImage();
    *new_val = ret_value;
    struct RUImage ctl;
    ctl.qt_data = (struct RUBase*)new_val;
    ctl.host_data = (struct RUBase*)s_host_data_lookup[(void*)new_val];
    ctl.all_funcs = &s_image_all_funcs;
    return ctl;
}

///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

static struct RUImage image_mirrored_2(struct RUBase* self_c, bool horizontally, bool vertically) {
    WRImage* qt_value = (WRImage*)self_c;
    auto ret_value = qt_value->mirrored(horizontally, vertically);
    WRImage* new_val = new WRImage();
    *new_val = ret_value;
    struct RUImage ctl;
    ctl.qt_data = (struct RUBase*)new_val;
    ctl.host_data = (struct RUBase*)s_host_data_lookup[(void*)new_val];
    ctl.all_funcs = &s_image_all_funcs;
    return ctl;
}

///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

static struct RUImage image_rgb_swapped(struct RUBase* self_c) {
    WRImage* qt_value = (WRImage*)self_c;
    auto ret_value = qt_value->rgbSwapped();
    WRImage* new_val = new WRImage();
    *new_val = ret_value;
    struct RUImage ctl;
    ctl.qt_data = (struct RUBase*)new_val;
    ctl.host_data = (struct RUBase*)s_host_data_lookup[(void*)new_val];
    ctl.all_funcs = &s_image_all_funcs;
    return ctl;
}

///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

static struct RUImage image_rgb_swapped_2(struct RUBase* self_c) {
    WRImage* qt_value = (WRImage*)self_c;
    auto ret_value = qt_value->rgbSwapped();
    WRImage* new_val = new WRImage();
    *new_val = ret_value;
    struct RUImage ctl;
    ctl.qt_data = (struct RUBase*)new_val;
    ctl.host_data = (struct RUBase*)s_host_data_lookup[(void*)new_val];
    ctl.all_funcs = &s_image_all_funcs;
    return ctl;
}

///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

static void image_invert_pixels(struct RUBase* self_c, int arg0) {
    WRImage* qt_value = (WRImage*)self_c;
    qt_value->invertPixels((QImage::InvertMode)s_invert_mode_lookup[arg0]);
}

///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

static int64_t image_cache_key(struct RUBase* self_c) {
    WRImage* qt_value = (WRImage*)self_c;
    auto ret_value = qt_value->cacheKey();
    return ret_value;
}

///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

static struct RUPaintEngine image_paint_engine(struct RUBase* self_c) {
    WRImage* qt_value = (WRImage*)self_c;
    auto ret_value = qt_value->paintEngine();
    struct RUPaintEngine ctl;
    ctl.qt_data = (struct RUBase*)ret_value;
    ctl.host_data = (struct RUBase*)s_host_data_lookup[(void*)ret_value];
    ctl.all_funcs = &s_paint_engine_all_funcs;
    return ctl;
}

///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

static int image_dots_per_meter_x(struct RUBase* self_c) {
    WRImage* qt_value = (WRImage*)self_c;
    auto ret_value = qt_value->dotsPerMeterX();
    return ret_value;
}

///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

static int image_dots_per_meter_y(struct RUBase* self_c) {
    WRImage* qt_value = (WRImage*)self_c;
    auto ret_value = qt_value->dotsPerMeterY();
    return ret_value;
}

///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

static void image_set_dots_per_meter_x(struct RUBase* self_c, int arg0) {
    WRImage* qt_value = (WRImage*)self_c;
    qt_value->setDotsPerMeterX(arg0);
}

///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

static void image_set_dots_per_meter_y(struct RUBase* self_c, int arg0) {
    WRImage* qt_value = (WRImage*)self_c;
    qt_value->setDotsPerMeterY(arg0);
}

///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

static struct RUPoint image_offset(struct RUBase* self_c) {
    WRImage* qt_value = (WRImage*)self_c;
    auto ret_value = qt_value->offset();
    WRPoint* new_val = new WRPoint();
    *new_val = ret_value;
    struct RUPoint ctl;
    ctl.qt_data = (struct RUBase*)new_val;
    ctl.host_data = (struct RUBase*)s_host_data_lookup[(void*)new_val];
    ctl.all_funcs = &s_point_all_funcs;
    return ctl;
}

///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

static void image_set_offset(struct RUBase* self_c, struct RUBase* arg0) {
    WRImage* qt_value = (WRImage*)self_c;
    qt_value->setOffset(*((QPoint*)arg0));
}

///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

static const char* image_text(struct RUBase* self_c, const char* key) {
    WRImage* qt_value = (WRImage*)self_c;
    auto ret_value = qt_value->text(QString::fromUtf8(key));
    return q_string_to_const_char(ret_value);
}

///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

static void image_set_text(struct RUBase* self_c, const char* key, const char* value) {
    WRImage* qt_value = (WRImage*)self_c;
    qt_value->setText(QString::fromUtf8(key), QString::fromUtf8(value));
}

///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

static struct RUPixelFormat image_pixel_format(struct RUBase* self_c) {
    WRImage* qt_value = (WRImage*)self_c;
    auto ret_value = qt_value->pixelFormat();
    WRPixelFormat* new_val = new WRPixelFormat();
    *new_val = ret_value;
    struct RUPixelFormat ctl;
    ctl.qt_data = (struct RUBase*)new_val;
    ctl.host_data = (struct RUBase*)s_host_data_lookup[(void*)new_val];
    ctl.all_funcs = &s_pixel_format_all_funcs;
    return ctl;
}

///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

static struct RUPixelFormat image_to_pixel_format(struct RUBase* self_c, int format) {
    WRImage* qt_value = (WRImage*)self_c;
    auto ret_value = qt_value->toPixelFormat((QImage::Format)s_format_lookup[format]);
    WRPixelFormat* new_val = new WRPixelFormat();
    *new_val = ret_value;
    struct RUPixelFormat ctl;
    ctl.qt_data = (struct RUBase*)new_val;
    ctl.host_data = (struct RUBase*)s_host_data_lookup[(void*)new_val];
    ctl.all_funcs = &s_pixel_format_all_funcs;
    return ctl;
}

///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

static struct RUImage create_image(
    struct RUBase* priv_data,
    RUDeleteCallback delete_callback,
    void* private_user_data)
{
    auto ctl = generic_create_func_with_delete<struct RUImage, WRImage>(priv_data, delete_callback, private_user_data);
    ctl.all_funcs = &s_image_all_funcs;
    return ctl;
}

///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

static void destroy_image(struct RUBase* priv_data) {
    destroy_generic<WRImage>(priv_data);
}

///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

static struct RUImage get_image(struct RUBase* priv_data) {
    (void)priv_data;
    RUImage ctl;
    ctl.qt_data = nullptr;
    ctl.host_data = nullptr;
    ctl.all_funcs = &s_image_all_funcs;
    return ctl;
}

///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

struct RUImageFuncs s_image_funcs = {
    destroy_image,
    image_swap,
    image_is_null,
    image_dev_type,
    image_detach,
    image_is_detached,
    image_copy,
    image_copy_2,
    image_format,
    image_convert_to_format,
    image_convert_to_format_2,
    image_reinterpret_as_format,
    image_width,
    image_height,
    image_size,
    image_rect,
    image_depth,
    image_color_count,
    image_bit_plane_count,
    image_set_color_count,
    image_all_gray,
    image_is_grayscale,
    image_byte_count,
    image_bytes_per_line,
    image_valid,
    image_valid_2,
    image_pixel_index,
    image_pixel_index_2,
    image_set_pixel,
    image_set_pixel_2,
    image_pixel_color,
    image_pixel_color_2,
    image_set_pixel_color,
    image_set_pixel_color_2,
    image_device_pixel_ratio,
    image_set_device_pixel_ratio,
    image_fill,
    image_fill_2,
    image_fill_3,
    image_has_alpha_channel,
    image_set_alpha_channel,
    image_alpha_channel,
    image_create_alpha_mask,
    image_create_heuristic_mask,
    image_scaled,
    image_scaled_2,
    image_scaled_to_width,
    image_scaled_to_height,
    image_mirrored,
    image_mirrored_2,
    image_rgb_swapped,
    image_rgb_swapped_2,
    image_invert_pixels,
    image_cache_key,
    image_paint_engine,
    image_dots_per_meter_x,
    image_dots_per_meter_y,
    image_set_dots_per_meter_x,
    image_set_dots_per_meter_y,
    image_offset,
    image_set_offset,
    image_text,
    image_set_text,
    image_pixel_format,
    image_to_pixel_format,
};

///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

struct RUImageAllFuncs s_image_all_funcs = {
    &s_paint_device_funcs,
    &s_image_funcs,
};