Beispiel #1
0
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)),
	}
}
Beispiel #2
0
// ScaleSimple is a wrapper around gdk_pixbuf_scale_simple().
func (v *Pixbuf) ScaleSimple(width, height int, interp InterpType) (*Pixbuf, error) {
	c := C.gdk_pixbuf_scale_simple(v.Native(), C.int(width), C.int(height), C.GdkInterpType(interp))
	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
}
Beispiel #3
0
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)),
	}
}
Beispiel #4
0
// Scale is a wrapper around gdk_pixbuf_scale().
func (v *Pixbuf) Scale(dst *Pixbuf, x, y, width, height int, offsetX, offsetY, scaleX, scaleY float64, interp InterpType) {
	C.gdk_pixbuf_scale(v.Native(), dst.Native(), 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))
}
Beispiel #5
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)