예제 #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
파일: gdkpixbuf.go 프로젝트: hauke96/go-gtk
// 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)),
	}
}
예제 #3
0
package gdkpixbuf

/*
#include <gdk-pixbuf/gdk-pixbuf.h>
#include <gdk-pixbuf/gdk-pixdata.h>
#include <stdlib.h>
*/
import "C"

var (
	// Colorspace
	COLORSPACE_RGB = C.GdkColorspace(C.GDK_COLORSPACE_RGB)

	// InterpType
	INTERP_NEAREST  = C.GdkInterpType(C.GDK_INTERP_NEAREST)
	INTERP_TILES    = C.GdkInterpType(C.GDK_INTERP_TILES)
	INTERP_BILINEAR = C.GdkInterpType(C.GDK_INTERP_BILINEAR)
	INTERP_HYPER    = C.GdkInterpType(C.GDK_INTERP_HYPER)

	// PixbufAlphaMode
	PIXBUF_ALPHA_BILEVEL = C.GdkPixbufAlphaMode(C.GDK_PIXBUF_ALPHA_BILEVEL)
	PIXBUF_ALPHA_FULL    = C.GdkPixbufAlphaMode(C.GDK_PIXBUF_ALPHA_FULL)

	// PixbufError
	PIXBUF_ERROR_CORRUPT_IMAGE         = C.GdkPixbufError(C.GDK_PIXBUF_ERROR_CORRUPT_IMAGE)
	PIXBUF_ERROR_INSUFFICIENT_MEMORY   = C.GdkPixbufError(C.GDK_PIXBUF_ERROR_INSUFFICIENT_MEMORY)
	PIXBUF_ERROR_BAD_OPTION            = C.GdkPixbufError(C.GDK_PIXBUF_ERROR_BAD_OPTION)
	PIXBUF_ERROR_UNKNOWN_TYPE          = C.GdkPixbufError(C.GDK_PIXBUF_ERROR_UNKNOWN_TYPE)
	PIXBUF_ERROR_UNSUPPORTED_OPERATION = C.GdkPixbufError(C.GDK_PIXBUF_ERROR_UNSUPPORTED_OPERATION)
	PIXBUF_ERROR_FAILED                = C.GdkPixbufError(C.GDK_PIXBUF_ERROR_FAILED)