本文整理汇总了Golang中github.com/mattn/go-gtk/glib.ObjectFromNative函数的典型用法代码示例。如果您正苦于以下问题:Golang ObjectFromNative函数的具体用法?Golang ObjectFromNative怎么用?Golang ObjectFromNative使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了ObjectFromNative函数的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Golang代码示例。
示例1: GetPixbuf
func (v Loader) GetPixbuf() *Pixbuf {
gpixbuf := C.gdk_pixbuf_loader_get_pixbuf(v.GPixbufLoader)
return &Pixbuf{
GdkPixbuf: &GdkPixbuf{gpixbuf},
GObject: glib.ObjectFromNative(unsafe.Pointer(gpixbuf)),
}
}
示例2: RotateSimple
func RotateSimple(p *Pixbuf, angle PixbufRotation) *Pixbuf {
gpixbuf := C.gdk_pixbuf_rotate_simple(p.GPixbuf, C.GdkPixbufRotation(angle))
return &Pixbuf{
GdkPixbuf: &GdkPixbuf{gpixbuf},
GObject: glib.ObjectFromNative(unsafe.Pointer(gpixbuf)),
}
}
示例3: Flip
func Flip(p *Pixbuf, horizontal bool) *Pixbuf {
gpixbuf := C.gdk_pixbuf_flip(p.GPixbuf, gbool(horizontal))
return &Pixbuf{
GdkPixbuf: &GdkPixbuf{gpixbuf},
GObject: glib.ObjectFromNative(unsafe.Pointer(gpixbuf)),
}
}
示例4: ScaleSimple
func ScaleSimple(p *Pixbuf, width, height int, interp InterpType) *Pixbuf {
gpixbuf := C.gdk_pixbuf_scale_simple(p.GPixbuf, C.int(width), C.int(height), C.GdkInterpType(interp))
return &Pixbuf{
GdkPixbuf: &GdkPixbuf{gpixbuf},
GObject: glib.ObjectFromNative(unsafe.Pointer(gpixbuf)),
}
}
示例5: NewPixbufFromXpmData
func NewPixbufFromXpmData(data **byte) (*Pixbuf, *glib.Error) {
var err *C.GError
gpixbuf := C.gdk_pixbuf_new_from_xpm_data(
(**C.char)(unsafe.Pointer(data)),
)
if err != nil {
return nil, glib.ErrorFromNative(unsafe.Pointer(err))
}
return &Pixbuf{
GdkPixbuf: &GdkPixbuf{gpixbuf},
GObject: glib.ObjectFromNative(unsafe.Pointer(gpixbuf)),
}, nil
}
示例6: NewPixbufFromFileAtScale
func NewPixbufFromFileAtScale(filename string, width, height int, preserve_aspect_ratio bool) (*Pixbuf, *glib.Error) {
var err *C.GError
ptr := C.CString(filename)
defer cfree(ptr)
gpixbuf := C.gdk_pixbuf_new_from_file_at_scale(ptr, C.int(width), C.int(height), gbool(preserve_aspect_ratio), &err)
if err != nil {
return nil, glib.ErrorFromNative(unsafe.Pointer(err))
}
return &Pixbuf{
GdkPixbuf: &GdkPixbuf{gpixbuf},
GObject: glib.ObjectFromNative(unsafe.Pointer(gpixbuf)),
}, nil
}
示例7: NewPixbufFromFile
func NewPixbufFromFile(filename string) (*Pixbuf, *glib.Error) {
var err *C.GError
ptr := C.CString(filename)
defer cfree(ptr)
gpixbuf := C.gdk_pixbuf_new_from_file(ptr, &err)
if err != nil {
return nil, glib.ErrorFromNative(unsafe.Pointer(err))
}
return &Pixbuf{
GdkPixbuf: &GdkPixbuf{gpixbuf},
GObject: glib.ObjectFromNative(unsafe.Pointer(gpixbuf)),
}, nil
}
示例8: NewPixbuf
// File Loading
// GdkPixbuf * gdk_pixbuf_new (GdkColorspace colorspace, gboolean has_alpha, int bits_per_sample, int width, int height);
func NewPixbuf(colorspace Colorspace, hasAlpha bool, bitsPerSample, width, height int) *Pixbuf {
gpixbuf := C.gdk_pixbuf_new(
C.GdkColorspace(colorspace),
gbool(hasAlpha),
C.int(bitsPerSample),
C.int(width),
C.int(height),
)
return &Pixbuf{
GdkPixbuf: &GdkPixbuf{gpixbuf},
GObject: glib.ObjectFromNative(unsafe.Pointer(gpixbuf)),
}
}
示例9: NewFromFileAtSize
func NewFromFileAtSize(path string, imgW int, imgH int) (pixbuf *Pixbuf, err **glib.Error) {
var error *C.GError
ptr := C.CString(path)
defer C.free_string(ptr)
gpixbuf := C.gdk_pixbuf_new_from_file_at_size(ptr, C.int(imgW), C.int(imgH), &error)
pixbuf = &Pixbuf{
GPixbuf: gpixbuf,
GObject: glib.ObjectFromNative(unsafe.Pointer(gpixbuf)),
}
if err != nil && error != nil {
*err = glib.ErrorFromNative(unsafe.Pointer(error))
}
return
}
示例10: Scale
func Scale(p *Pixbuf, x, y, width, height int, offsetX, offsetY, scaleX, scaleY float64, interp InterpType) *Pixbuf {
var gpixbuf *C.GdkPixbuf
C.gdk_pixbuf_scale(
p.GPixbuf,
gpixbuf,
C.int(x), C.int(y),
C.int(width), C.int(height),
C.double(offsetX), C.double(offsetY),
C.double(scaleX), C.double(scaleY),
C.GdkInterpType(interp))
return &Pixbuf{
GdkPixbuf: &GdkPixbuf{gpixbuf},
GObject: glib.ObjectFromNative(unsafe.Pointer(gpixbuf)),
}
}
示例11: NewFromFileAtSize
func NewFromFileAtSize(filename string, width, heigth int) (*Pixbuf, *glib.Error) {
var error *C.GError
ptr := C.CString(filename)
defer cfree(ptr)
gpixbuf := C.gdk_pixbuf_new_from_file_at_size(ptr, C.int(width), C.int(heigth), &error)
if error != nil {
err := glib.ErrorFromNative(unsafe.Pointer(error))
return nil, err
}
pixbuf := &Pixbuf{
GPixbuf: gpixbuf,
GObject: glib.ObjectFromNative(unsafe.Pointer(gpixbuf)),
}
return pixbuf, nil
}