gdk/gdk.go
func (v *Pixbuf) GetPixels() (channels []byte) {
	var length C.guint
	c := C.gdk_pixbuf_get_pixels_with_length(v.native(), &length)
	sliceHeader := (*reflect.SliceHeader)(unsafe.Pointer(&channels))
	sliceHeader.Data = uintptr(unsafe.Pointer(c))
	sliceHeader.Len = int(length)
	sliceHeader.Cap = int(length)

	// To make sure the slice doesn't outlive the Pixbuf, add a reference
	v.Ref()
	runtime.SetFinalizer(&channels, func(_ *[]byte) {
		v.Unref()
	})
	return
}
func (v *Pixbuf) GetPixels() (channels []byte) {
	var length C.guint
	c := C.gdk_pixbuf_get_pixels_with_length(v.native(), &length)
	sliceHeader := (*reflect.SliceHeader)(unsafe.Pointer(&channels))
	sliceHeader.Data = uintptr(unsafe.Pointer(c))
	sliceHeader.Len = int(length)
	sliceHeader.Cap = int(length)

	// To make sure the slice doesn't outlive the Pixbuf, add a reference
	v.Ref()
	runtime.SetFinalizer(&channels, func(_ *[]byte) {
		v.Unref()
	})
	return
}
func ( v * Pixbuf ) GetPixels ( ) ( channels [ ] byte ) { var length C . guint c := C . gdk_pixbuf_get_pixels_with_length ( v . native ( ) , & length ) sliceHeader := ( * reflect . SliceHeader ) ( unsafe . Pointer ( & channels ) ) sliceHeader . Data = uintptr ( unsafe . Pointer ( c ) ) sliceHeader . Len = int ( length ) sliceHeader . Cap = int ( length ) // To make sure the slice doesn't outlive the Pixbuf, add a reference v . Ref ( ) runtime . SetFinalizer ( & channels , func ( _ * [ ] byte ) { v . Unref ( ) } ) return }
// GetPixels is a wrapper around gdk_pixbuf_get_pixels_with_length().
// A Go slice is used to represent the underlying Pixbuf data array, one
// byte per channel.
GetPixels is a wrapper around gdk_pixbuf_get_pixels_with_length () . A Go slice is used to represent the underlying Pixbuf data array one byte per channel .