
# 
# This file has been automatically generated by RaQt_maker V0.0.5.
# To modify and regenerate it, see the source code available here: 
#         https://github.com/yguillemot/RaQt_maker
# 

use NativeCall;
use Qt::QtWidgets::QtHelpers:ver<0.0.5>:auth<cpan:YGUILLEMO>:api<2>;
use Qt::QtWidgets::QtWrappers:ver<0.0.5>:auth<cpan:YGUILLEMO>:api<2>;
use Qt::QtWidgets::QColor:ver<0.0.5>:auth<cpan:YGUILLEMO>:api<2>;
use Qt::QtWidgets::QPaintDevice:ver<0.0.5>:auth<cpan:YGUILLEMO>:api<2>;
use Qt::QtWidgets::QtBase:ver<0.0.5>:auth<cpan:YGUILLEMO>:api<2>;



class QImage:ver<0.0.5>:auth<cpan:YGUILLEMO>:api<2>
    is QPaintDevice
    is export {

    enum Format (
        Format_Invalid => 0,
        Format_Mono => 1,
        Format_MonoLSB => 2,
        Format_Indexed8 => 3,
        Format_RGB32 => 4,
        Format_ARGB32 => 5,
        Format_ARGB32_Premultiplied => 6,
        Format_RGB16 => 7,
        Format_ARGB8565_Premultiplied => 8,
        Format_RGB666 => 9,
        Format_ARGB6666_Premultiplied => 10,
        Format_RGB555 => 11,
        Format_ARGB8555_Premultiplied => 12,
        Format_RGB888 => 13,
        Format_RGB444 => 14,
        Format_ARGB4444_Premultiplied => 15,
        Format_RGBX8888 => 16,
        Format_RGBA8888 => 17,
        Format_RGBA8888_Premultiplied => 18,
        Format_BGR30 => 19,
        Format_A2BGR30_Premultiplied => 20,
        Format_RGB30 => 21,
        Format_A2RGB30_Premultiplied => 22,
        Format_Alpha8 => 23,
        Format_Grayscale8 => 24,
        NImageFormats => 25,
    );

    multi sub ctor(QtBase $this, Int $width, Int $height, QImage::Format $format) {
        $this.address = QWQImageCtor_3($width, $height, $format);
        $this.ownedByRaku = True;
    }

    multi sub ctor(QtBase $this, NativeCall::Types::Pointer $p, Bool :$obr = False) {
        # Get access to a preexisting Qt object
        $this.address = $p;
        $this.ownedByRaku = $obr;
    }

    multi sub ctor(|capture) {
        note "QtWidgets ", ::?CLASS.^name,
             " ctor called with unsupported args";
        die "Bad args";
    }

    submethod new(|capture) {
        my QImage $rObj = self.bless;
        ctor($rObj, |capture);
        return $rObj;
    }

    submethod DESTROY {
        if self.ownedByRaku {
            QWQImageDtor(self.address);
            self.ownedByRaku = False;
        }
    }

    method width( --> Int)
    {
        my $result = QWQImagewidth(self.address);
        return $result;
    }

    method height( --> Int)
    {
        my $result = QWQImageheight(self.address);
        return $result;
    }

    multi method pixelColor(Int $x, Int $y --> QColor)
    {
        my $result = QWQImagepixelColor_1(self.address, $x, $y);
        my $result1 = QColor.new($result, obr => True);
        return $result1;
    }

    multi method fill(QColor $color)
    {
        my $a1 = $color.address;
        QWQImagefill_2(self.address, $a1);
    }

}


sub QWQImageCtor_3(int32, int32, int32)
    returns Pointer is native(&libwrapper) { * }

sub QWQImageDtor(Pointer)
    is native(&libwrapper) { * }

sub QWQImagewidth(Pointer)
    returns int32 is native(&libwrapper) { * }

sub QWQImageheight(Pointer)
    returns int32 is native(&libwrapper) { * }

sub QWQImagepixelColor_1(Pointer, int32, int32)
    returns Pointer is native(&libwrapper) { * }

sub QWQImagefill_2(Pointer, Pointer)
    is native(&libwrapper) { * }

