miqt/qt6/gen_qbitmap.go

263 lines
7.4 KiB
Go
Raw Permalink Normal View History

2024-10-20 05:21:03 +00:00
package qt6
/*
#include "gen_qbitmap.h"
#include <stdlib.h>
*/
import "C"
import (
"runtime"
2024-11-19 06:29:06 +00:00
"runtime/cgo"
2024-10-20 05:21:03 +00:00
"unsafe"
)
type QBitmap struct {
2024-11-19 06:29:06 +00:00
h *C.QBitmap
isSubclass bool
2024-10-20 05:21:03 +00:00
*QPixmap
}
func (this *QBitmap) cPointer() *C.QBitmap {
if this == nil {
return nil
}
return this.h
}
func (this *QBitmap) UnsafePointer() unsafe.Pointer {
if this == nil {
return nil
}
return unsafe.Pointer(this.h)
}
2024-11-19 06:29:06 +00:00
// newQBitmap constructs the type using only CGO pointers.
2024-12-07 04:15:57 +00:00
func newQBitmap(h *C.QBitmap) *QBitmap {
2024-10-20 05:21:03 +00:00
if h == nil {
return nil
}
2024-12-07 04:15:57 +00:00
var outptr_QPixmap *C.QPixmap = nil
C.QBitmap_virtbase(h, &outptr_QPixmap)
2024-11-19 06:29:06 +00:00
return &QBitmap{h: h,
2024-12-07 04:15:57 +00:00
QPixmap: newQPixmap(outptr_QPixmap)}
2024-10-20 05:21:03 +00:00
}
2024-11-19 06:29:06 +00:00
// UnsafeNewQBitmap constructs the type using only unsafe pointers.
2024-12-07 04:15:57 +00:00
func UnsafeNewQBitmap(h unsafe.Pointer) *QBitmap {
return newQBitmap((*C.QBitmap)(h))
2024-10-20 05:21:03 +00:00
}
// NewQBitmap constructs a new QBitmap object.
func NewQBitmap() *QBitmap {
2024-11-19 06:29:06 +00:00
2024-12-07 04:15:57 +00:00
ret := newQBitmap(C.QBitmap_new())
2024-11-19 06:29:06 +00:00
ret.isSubclass = true
return ret
2024-10-20 05:21:03 +00:00
}
// NewQBitmap2 constructs a new QBitmap object.
func NewQBitmap2(param1 *QPixmap) *QBitmap {
2024-11-19 06:29:06 +00:00
2024-12-07 04:15:57 +00:00
ret := newQBitmap(C.QBitmap_new2(param1.cPointer()))
2024-11-19 06:29:06 +00:00
ret.isSubclass = true
return ret
2024-10-20 05:21:03 +00:00
}
// NewQBitmap3 constructs a new QBitmap object.
func NewQBitmap3(w int, h int) *QBitmap {
2024-11-19 06:29:06 +00:00
2024-12-07 04:15:57 +00:00
ret := newQBitmap(C.QBitmap_new3((C.int)(w), (C.int)(h)))
2024-11-19 06:29:06 +00:00
ret.isSubclass = true
return ret
2024-10-20 05:21:03 +00:00
}
// NewQBitmap4 constructs a new QBitmap object.
func NewQBitmap4(param1 *QSize) *QBitmap {
2024-11-19 06:29:06 +00:00
2024-12-07 04:15:57 +00:00
ret := newQBitmap(C.QBitmap_new4(param1.cPointer()))
2024-11-19 06:29:06 +00:00
ret.isSubclass = true
return ret
2024-10-20 05:21:03 +00:00
}
// NewQBitmap5 constructs a new QBitmap object.
func NewQBitmap5(fileName string) *QBitmap {
fileName_ms := C.struct_miqt_string{}
fileName_ms.data = C.CString(fileName)
fileName_ms.len = C.size_t(len(fileName))
defer C.free(unsafe.Pointer(fileName_ms.data))
2024-11-19 06:29:06 +00:00
2024-12-07 04:15:57 +00:00
ret := newQBitmap(C.QBitmap_new5(fileName_ms))
2024-11-19 06:29:06 +00:00
ret.isSubclass = true
return ret
2024-10-20 05:21:03 +00:00
}
// NewQBitmap6 constructs a new QBitmap object.
func NewQBitmap6(param1 *QBitmap) *QBitmap {
2024-11-19 06:29:06 +00:00
2024-12-07 04:15:57 +00:00
ret := newQBitmap(C.QBitmap_new6(param1.cPointer()))
2024-11-19 06:29:06 +00:00
ret.isSubclass = true
return ret
2024-10-20 05:21:03 +00:00
}
// NewQBitmap7 constructs a new QBitmap object.
func NewQBitmap7(fileName string, format string) *QBitmap {
fileName_ms := C.struct_miqt_string{}
fileName_ms.data = C.CString(fileName)
fileName_ms.len = C.size_t(len(fileName))
defer C.free(unsafe.Pointer(fileName_ms.data))
format_Cstring := C.CString(format)
defer C.free(unsafe.Pointer(format_Cstring))
2024-11-19 06:29:06 +00:00
2024-12-07 04:15:57 +00:00
ret := newQBitmap(C.QBitmap_new7(fileName_ms, format_Cstring))
2024-11-19 06:29:06 +00:00
ret.isSubclass = true
return ret
2024-10-20 05:21:03 +00:00
}
func (this *QBitmap) OperatorAssign(param1 *QPixmap) {
C.QBitmap_OperatorAssign(this.h, param1.cPointer())
}
func (this *QBitmap) Swap(other *QBitmap) {
C.QBitmap_Swap(this.h, other.cPointer())
}
func (this *QBitmap) Clear() {
C.QBitmap_Clear(this.h)
}
func QBitmap_FromImage(image *QImage) *QBitmap {
2024-12-07 04:15:57 +00:00
_goptr := newQBitmap(C.QBitmap_FromImage(image.cPointer()))
2024-10-20 05:21:03 +00:00
_goptr.GoGC() // Qt uses pass-by-value semantics for this type. Mimic with finalizer
return _goptr
}
func QBitmap_FromData(size *QSize, bits *byte) *QBitmap {
2024-12-07 04:15:57 +00:00
_goptr := newQBitmap(C.QBitmap_FromData(size.cPointer(), (*C.uchar)(unsafe.Pointer(bits))))
2024-10-20 05:21:03 +00:00
_goptr.GoGC() // Qt uses pass-by-value semantics for this type. Mimic with finalizer
return _goptr
}
func QBitmap_FromPixmap(pixmap *QPixmap) *QBitmap {
2024-12-07 04:15:57 +00:00
_goptr := newQBitmap(C.QBitmap_FromPixmap(pixmap.cPointer()))
2024-10-20 05:21:03 +00:00
_goptr.GoGC() // Qt uses pass-by-value semantics for this type. Mimic with finalizer
return _goptr
}
func (this *QBitmap) Transformed(matrix *QTransform) *QBitmap {
2024-12-07 04:15:57 +00:00
_goptr := newQBitmap(C.QBitmap_Transformed(this.h, matrix.cPointer()))
2024-10-20 05:21:03 +00:00
_goptr.GoGC() // Qt uses pass-by-value semantics for this type. Mimic with finalizer
return _goptr
}
func (this *QBitmap) OperatorAssignWithQBitmap(param1 *QBitmap) {
C.QBitmap_OperatorAssignWithQBitmap(this.h, param1.cPointer())
}
func QBitmap_FromImage2(image *QImage, flags ImageConversionFlag) *QBitmap {
2024-12-07 04:15:57 +00:00
_goptr := newQBitmap(C.QBitmap_FromImage2(image.cPointer(), (C.int)(flags)))
2024-10-20 05:21:03 +00:00
_goptr.GoGC() // Qt uses pass-by-value semantics for this type. Mimic with finalizer
return _goptr
}
func QBitmap_FromData3(size *QSize, bits *byte, monoFormat QImage__Format) *QBitmap {
2024-12-07 04:15:57 +00:00
_goptr := newQBitmap(C.QBitmap_FromData3(size.cPointer(), (*C.uchar)(unsafe.Pointer(bits)), (C.int)(monoFormat)))
2024-10-20 05:21:03 +00:00
_goptr.GoGC() // Qt uses pass-by-value semantics for this type. Mimic with finalizer
return _goptr
}
2024-11-19 06:29:06 +00:00
func (this *QBitmap) callVirtualBase_DevType() int {
return (int)(C.QBitmap_virtualbase_DevType(unsafe.Pointer(this.h)))
}
func (this *QBitmap) OnDevType(slot func(super func() int) int) {
if !this.isSubclass {
panic("miqt: can only override virtual methods for directly constructed types")
}
2024-11-19 06:29:06 +00:00
C.QBitmap_override_virtual_DevType(unsafe.Pointer(this.h), C.intptr_t(cgo.NewHandle(slot)))
}
//export miqt_exec_callback_QBitmap_DevType
func miqt_exec_callback_QBitmap_DevType(self *C.QBitmap, cb C.intptr_t) C.int {
gofunc, ok := cgo.Handle(cb).Value().(func(super func() int) int)
if !ok {
panic("miqt: callback of non-callback type (heap corruption?)")
}
virtualReturn := gofunc((&QBitmap{h: self}).callVirtualBase_DevType)
return (C.int)(virtualReturn)
}
func (this *QBitmap) callVirtualBase_PaintEngine() *QPaintEngine {
return newQPaintEngine(C.QBitmap_virtualbase_PaintEngine(unsafe.Pointer(this.h)))
2024-11-19 06:29:06 +00:00
}
func (this *QBitmap) OnPaintEngine(slot func(super func() *QPaintEngine) *QPaintEngine) {
if !this.isSubclass {
panic("miqt: can only override virtual methods for directly constructed types")
}
2024-11-19 06:29:06 +00:00
C.QBitmap_override_virtual_PaintEngine(unsafe.Pointer(this.h), C.intptr_t(cgo.NewHandle(slot)))
}
//export miqt_exec_callback_QBitmap_PaintEngine
func miqt_exec_callback_QBitmap_PaintEngine(self *C.QBitmap, cb C.intptr_t) *C.QPaintEngine {
gofunc, ok := cgo.Handle(cb).Value().(func(super func() *QPaintEngine) *QPaintEngine)
if !ok {
panic("miqt: callback of non-callback type (heap corruption?)")
}
virtualReturn := gofunc((&QBitmap{h: self}).callVirtualBase_PaintEngine)
return virtualReturn.cPointer()
}
func (this *QBitmap) callVirtualBase_Metric(param1 QPaintDevice__PaintDeviceMetric) int {
return (int)(C.QBitmap_virtualbase_Metric(unsafe.Pointer(this.h), (C.int)(param1)))
}
func (this *QBitmap) OnMetric(slot func(super func(param1 QPaintDevice__PaintDeviceMetric) int, param1 QPaintDevice__PaintDeviceMetric) int) {
if !this.isSubclass {
panic("miqt: can only override virtual methods for directly constructed types")
}
2024-11-19 06:29:06 +00:00
C.QBitmap_override_virtual_Metric(unsafe.Pointer(this.h), C.intptr_t(cgo.NewHandle(slot)))
}
//export miqt_exec_callback_QBitmap_Metric
func miqt_exec_callback_QBitmap_Metric(self *C.QBitmap, cb C.intptr_t, param1 C.int) C.int {
gofunc, ok := cgo.Handle(cb).Value().(func(super func(param1 QPaintDevice__PaintDeviceMetric) int, param1 QPaintDevice__PaintDeviceMetric) int)
if !ok {
panic("miqt: callback of non-callback type (heap corruption?)")
}
// Convert all CABI parameters to Go parameters
slotval1 := (QPaintDevice__PaintDeviceMetric)(param1)
virtualReturn := gofunc((&QBitmap{h: self}).callVirtualBase_Metric, slotval1)
return (C.int)(virtualReturn)
}
2024-10-20 05:21:03 +00:00
// Delete this object from C++ memory.
func (this *QBitmap) Delete() {
2024-11-19 06:29:06 +00:00
C.QBitmap_Delete(this.h, C.bool(this.isSubclass))
2024-10-20 05:21:03 +00:00
}
// GoGC adds a Go Finalizer to this pointer, so that it will be deleted
// from C++ memory once it is unreachable from Go memory.
func (this *QBitmap) GoGC() {
runtime.SetFinalizer(this, func(this *QBitmap) {
this.Delete()
runtime.KeepAlive(this.h)
})
}