miqt/qt/gen_qcolormap.go

129 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 (
QColormap__Mode__Direct QColormap__Mode = 0
QColormap__Mode__Indexed QColormap__Mode = 1
QColormap__Mode__Gray QColormap__Mode = 2
)
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 {
_ret := C.QColormap_Mode(this.h)
return (QColormap__Mode)(_ret)
2024-08-29 07:01:51 +00:00
}
func (this *QColormap) Depth() int {
_ret := C.QColormap_Depth(this.h)
return (int)(_ret)
}
func (this *QColormap) Size() int {
_ret := C.QColormap_Size(this.h)
return (int)(_ret)
}
func (this *QColormap) Pixel(color *QColor) uint {
_ret := C.QColormap_Pixel(this.h, color.cPointer())
return (uint)(_ret)
}
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)) // mrs jackson
for i := 0; i < int(_ma.len); i++ {
_ret[i] = *newQColor(_outCast[i])
}
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)
})
}