示例#1
0
文件: gdk.go 项目: raichu/gotk3
// PixbufNew is a wrapper around gdk_pixbuf_new().
func PixbufNew(colorspace Colorspace, hasAlpha bool, bitsPerSample, width, height int) (*Pixbuf, error) {
	c := C.gdk_pixbuf_new(C.GdkColorspace(colorspace), gbool(hasAlpha),
		C.int(bitsPerSample), C.int(width), C.int(height))
	if c == nil {
		return nil, nilPtrErr
	}
	obj := &glib.Object{glib.ToGObject(unsafe.Pointer(c))}
	p := &Pixbuf{obj}
	runtime.SetFinalizer(obj, (*glib.Object).Unref)
	return p, nil
}
示例#2
0
func PixbufNew(colorspace int, has_alpha bool, bits_per_sample C.int, width C.int, height C.int) (_go__return__ Pixbuf) {
	var _return_ *C.GdkPixbuf
	_cgo_has_alpha_ := (C.gboolean)(C.FALSE)
	if has_alpha {
		_cgo_has_alpha_ = (C.gboolean)(C.TRUE)
	}
	_cgo_colorspace_ := (C.GdkColorspace)(colorspace)
	_return_ = C.gdk_pixbuf_new(_cgo_colorspace_, _cgo_has_alpha_, bits_per_sample, width, height)
	_go__return__ = ToPixbuf(unsafe.Pointer(_return_))
	return
}
/*
Creates a new #GdkPixbuf structure and allocates a buffer for it.  The
buffer has an optimal rowstride.  Note that the buffer is not cleared;
you will have to fill it completely yourself.
*/
func PixbufNew(colorspace C.GdkColorspace, has_alpha bool, bits_per_sample int, width int, height int) (return__ *Pixbuf) {
	__cgo__has_alpha := C.gboolean(0)
	if has_alpha {
		__cgo__has_alpha = C.gboolean(1)
	}
	var __cgo__return__ interface{}
	__cgo__return__ = C.gdk_pixbuf_new(colorspace, __cgo__has_alpha, C.int(bits_per_sample), C.int(width), C.int(height))
	if __cgo__return__ != nil {
		return__ = NewPixbufFromCPointer(unsafe.Pointer(reflect.ValueOf(__cgo__return__).Pointer()))
	}
	return
}
示例#4
0
// 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)),
	}
}