2024-10-20 05:21:03 +00:00
|
|
|
package qt6
|
|
|
|
|
|
|
|
/*
|
|
|
|
|
|
|
|
#include "gen_qsurface.h"
|
|
|
|
#include <stdlib.h>
|
|
|
|
|
|
|
|
*/
|
|
|
|
import "C"
|
|
|
|
|
|
|
|
import (
|
|
|
|
"runtime"
|
|
|
|
"unsafe"
|
|
|
|
)
|
|
|
|
|
|
|
|
type QSurface__SurfaceClass int
|
|
|
|
|
|
|
|
const (
|
|
|
|
QSurface__Window QSurface__SurfaceClass = 0
|
|
|
|
QSurface__Offscreen QSurface__SurfaceClass = 1
|
|
|
|
)
|
|
|
|
|
|
|
|
type QSurface__SurfaceType int
|
|
|
|
|
|
|
|
const (
|
|
|
|
QSurface__RasterSurface QSurface__SurfaceType = 0
|
|
|
|
QSurface__OpenGLSurface QSurface__SurfaceType = 1
|
|
|
|
QSurface__RasterGLSurface QSurface__SurfaceType = 2
|
|
|
|
QSurface__OpenVGSurface QSurface__SurfaceType = 3
|
|
|
|
QSurface__VulkanSurface QSurface__SurfaceType = 4
|
|
|
|
QSurface__MetalSurface QSurface__SurfaceType = 5
|
|
|
|
QSurface__Direct3DSurface QSurface__SurfaceType = 6
|
|
|
|
)
|
|
|
|
|
|
|
|
type QSurface struct {
|
2024-11-19 06:29:06 +00:00
|
|
|
h *C.QSurface
|
|
|
|
isSubclass bool
|
2024-10-20 05:21:03 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
func (this *QSurface) cPointer() *C.QSurface {
|
|
|
|
if this == nil {
|
|
|
|
return nil
|
|
|
|
}
|
|
|
|
return this.h
|
|
|
|
}
|
|
|
|
|
|
|
|
func (this *QSurface) UnsafePointer() unsafe.Pointer {
|
|
|
|
if this == nil {
|
|
|
|
return nil
|
|
|
|
}
|
|
|
|
return unsafe.Pointer(this.h)
|
|
|
|
}
|
|
|
|
|
2024-11-19 06:29:06 +00:00
|
|
|
// newQSurface constructs the type using only CGO pointers.
|
2024-10-20 05:21:03 +00:00
|
|
|
func newQSurface(h *C.QSurface) *QSurface {
|
|
|
|
if h == nil {
|
|
|
|
return nil
|
|
|
|
}
|
2024-12-07 04:15:57 +00:00
|
|
|
|
2024-10-20 05:21:03 +00:00
|
|
|
return &QSurface{h: h}
|
|
|
|
}
|
|
|
|
|
2024-11-19 06:29:06 +00:00
|
|
|
// UnsafeNewQSurface constructs the type using only unsafe pointers.
|
2024-10-20 05:21:03 +00:00
|
|
|
func UnsafeNewQSurface(h unsafe.Pointer) *QSurface {
|
2024-12-07 04:15:57 +00:00
|
|
|
return newQSurface((*C.QSurface)(h))
|
2024-10-20 05:21:03 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
func (this *QSurface) SurfaceClass() QSurface__SurfaceClass {
|
|
|
|
return (QSurface__SurfaceClass)(C.QSurface_SurfaceClass(this.h))
|
|
|
|
}
|
|
|
|
|
|
|
|
func (this *QSurface) Format() *QSurfaceFormat {
|
2024-12-07 02:02:06 +00:00
|
|
|
_goptr := newQSurfaceFormat(C.QSurface_Format(this.h))
|
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 *QSurface) SurfaceType() QSurface__SurfaceType {
|
|
|
|
return (QSurface__SurfaceType)(C.QSurface_SurfaceType(this.h))
|
|
|
|
}
|
|
|
|
|
|
|
|
func (this *QSurface) SupportsOpenGL() bool {
|
|
|
|
return (bool)(C.QSurface_SupportsOpenGL(this.h))
|
|
|
|
}
|
|
|
|
|
|
|
|
func (this *QSurface) Size() *QSize {
|
2024-12-07 02:02:06 +00:00
|
|
|
_goptr := newQSize(C.QSurface_Size(this.h))
|
2024-10-20 05:21:03 +00:00
|
|
|
_goptr.GoGC() // Qt uses pass-by-value semantics for this type. Mimic with finalizer
|
|
|
|
return _goptr
|
|
|
|
}
|
|
|
|
|
|
|
|
// Delete this object from C++ memory.
|
|
|
|
func (this *QSurface) Delete() {
|
2024-11-19 06:29:06 +00:00
|
|
|
C.QSurface_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 *QSurface) GoGC() {
|
|
|
|
runtime.SetFinalizer(this, func(this *QSurface) {
|
|
|
|
this.Delete()
|
|
|
|
runtime.KeepAlive(this.h)
|
|
|
|
})
|
|
|
|
}
|