miqt/qt/gen_qcolormap.go

128 lines
2.8 KiB
Go
Raw Normal View History

package qt
/*
#include "gen_qcolormap.h"
#include <stdlib.h>
*/
import "C"
import (
"runtime"
"unsafe"
)
2024-09-04 06:54:22 +00:00
type QColormap__Mode int
const (
2024-09-20 07:13:26 +00:00
QColormap__Direct QColormap__Mode = 0
QColormap__Indexed QColormap__Mode = 1
QColormap__Gray QColormap__Mode = 2
2024-09-04 06:54:22 +00:00
)
type QColormap struct {
h *C.QColormap
}
func (this *QColormap) cPointer() *C.QColormap {
if this == nil {
return nil
}
return this.h
}
func newQColormap(h *C.QColormap) *QColormap {
2024-09-01 02:23:55 +00:00
if h == nil {
return nil
}
return &QColormap{h: h}
}
func newQColormap_U(h unsafe.Pointer) *QColormap {
return newQColormap((*C.QColormap)(h))
}
// NewQColormap constructs a new QColormap object.
func NewQColormap(colormap *QColormap) *QColormap {
ret := C.QColormap_new(colormap.cPointer())
return newQColormap(ret)
}
func QColormap_Initialize() {
C.QColormap_Initialize()
}
func QColormap_Cleanup() {
C.QColormap_Cleanup()
}
func QColormap_Instance() *QColormap {
_ret := C.QColormap_Instance()
_goptr := newQColormap(_ret)
_goptr.GoGC() // Qt uses pass-by-value semantics for this type. Mimic with finalizer
return _goptr
}
func (this *QColormap) OperatorAssign(colormap *QColormap) {
C.QColormap_OperatorAssign(this.h, colormap.cPointer())
}
2024-09-04 06:54:22 +00:00
func (this *QColormap) Mode() QColormap__Mode {
return (QColormap__Mode)(C.QColormap_Mode(this.h))
2024-08-29 07:01:51 +00:00
}
func (this *QColormap) Depth() int {
return (int)(C.QColormap_Depth(this.h))
}
func (this *QColormap) Size() int {
return (int)(C.QColormap_Size(this.h))
}
func (this *QColormap) Pixel(color *QColor) uint {
return (uint)(C.QColormap_Pixel(this.h, color.cPointer()))
}
func (this *QColormap) ColorAt(pixel uint) *QColor {
_ret := C.QColormap_ColorAt(this.h, (C.uint)(pixel))
_goptr := newQColor(_ret)
_goptr.GoGC() // Qt uses pass-by-value semantics for this type. Mimic with finalizer
return _goptr
}
func (this *QColormap) Colormap() []QColor {
var _ma *C.struct_miqt_array = C.QColormap_Colormap(this.h)
_ret := make([]QColor, int(_ma.len))
_outCast := (*[0xffff]*C.QColor)(unsafe.Pointer(_ma.data)) // hey ya
for i := 0; i < int(_ma.len); i++ {
_vv_ret := _outCast[i]
_vv_goptr := newQColor(_vv_ret)
_vv_goptr.GoGC() // Qt uses pass-by-value semantics for this type. Mimic with finalizer
_ret[i] = *_vv_goptr
}
C.free(unsafe.Pointer(_ma))
return _ret
}
func QColormap_Instance1(screen int) *QColormap {
_ret := C.QColormap_Instance1((C.int)(screen))
_goptr := newQColormap(_ret)
_goptr.GoGC() // Qt uses pass-by-value semantics for this type. Mimic with finalizer
return _goptr
}
// Delete this object from C++ memory.
func (this *QColormap) Delete() {
C.QColormap_Delete(this.h)
}
// 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 *QColormap) GoGC() {
runtime.SetFinalizer(this, func(this *QColormap) {
this.Delete()
runtime.KeepAlive(this.h)
})
}