Documentation ¶
Index ¶
- Variables
- func PixbufErrorQuark() (return__ C.GQuark)
- type IsPixbuf
- type IsPixbufAnimation
- type IsPixbufAnimationIter
- type IsPixbufLoader
- type IsPixbufSimpleAnim
- type Pixbuf
- func NewPixbufFromCPointer(p unsafe.Pointer) *Pixbuf
- func PixbufNew(colorspace C.GdkColorspace, has_alpha bool, bits_per_sample int, width int, ...) (return__ *Pixbuf)
- func PixbufNewFromBytes(data *C.GBytes, colorspace C.GdkColorspace, has_alpha bool, ...) (return__ *Pixbuf)
- func PixbufNewFromData(data []byte, colorspace C.GdkColorspace, has_alpha bool, bits_per_sample int, ...) (return__ *Pixbuf)
- func PixbufNewFromFile(filename string) (return__ *Pixbuf, __err__ error)
- func PixbufNewFromFileAtScale(filename string, width int, height int, preserve_aspect_ratio bool) (return__ *Pixbuf, __err__ error)
- func PixbufNewFromFileAtSize(filename string, width int, height int) (return__ *Pixbuf, __err__ error)
- func PixbufNewFromInline(data_length int, data []byte, copy_pixels bool) (return__ *Pixbuf, __err__ error)
- func PixbufNewFromResource(resource_path string) (return__ *Pixbuf, __err__ error)
- func PixbufNewFromResourceAtScale(resource_path string, width int, height int, preserve_aspect_ratio bool) (return__ *Pixbuf, __err__ error)
- func PixbufNewFromStream(stream *C.GInputStream, cancellable *C.GCancellable) (return__ *Pixbuf, __err__ error)
- func PixbufNewFromStreamAtScale(stream *C.GInputStream, width int, height int, preserve_aspect_ratio bool, ...) (return__ *Pixbuf, __err__ error)
- func PixbufNewFromStreamFinish(async_result *C.GAsyncResult) (return__ *Pixbuf, __err__ error)
- func PixbufNewFromXpmData(data []string) (return__ *Pixbuf)
- type PixbufAnimation
- func NewPixbufAnimationFromCPointer(p unsafe.Pointer) *PixbufAnimation
- func PixbufAnimationNewFromFile(filename string) (return__ *PixbufAnimation, __err__ error)
- func PixbufAnimationNewFromResource(resource_path string) (return__ *PixbufAnimation, __err__ error)
- func PixbufAnimationNewFromStream(stream *C.GInputStream, cancellable *C.GCancellable) (return__ *PixbufAnimation, __err__ error)
- func PixbufAnimationNewFromStreamFinish(async_result *C.GAsyncResult) (return__ *PixbufAnimation, __err__ error)
- type PixbufAnimationIter
- type PixbufFormat
- type PixbufLoader
- type PixbufSimpleAnim
- type Pixdata
- type TraitPixbuf
- func (self *TraitPixbuf) AddAlpha(substitute_color bool, r uint8, g uint8, b uint8) (return__ *Pixbuf)
- func (self *TraitPixbuf) ApplyEmbeddedOrientation() (return__ *Pixbuf)
- func (self *TraitPixbuf) Composite(dest IsPixbuf, dest_x int, dest_y int, dest_width int, dest_height int, ...)
- func (self *TraitPixbuf) CompositeColor(dest IsPixbuf, dest_x int, dest_y int, dest_width int, dest_height int, ...)
- func (self *TraitPixbuf) CompositeColorSimple(dest_width int, dest_height int, interp_type C.GdkInterpType, ...) (return__ *Pixbuf)
- func (self *TraitPixbuf) Copy() (return__ *Pixbuf)
- func (self *TraitPixbuf) CopyArea(src_x int, src_y int, width int, height int, dest_pixbuf IsPixbuf, dest_x int, ...)
- func (self *TraitPixbuf) Fill(pixel uint32)
- func (self *TraitPixbuf) Flip(horizontal bool) (return__ *Pixbuf)
- func (self *TraitPixbuf) GetBitsPerSample() (return__ int)
- func (self *TraitPixbuf) GetByteLength() (return__ int64)
- func (self *TraitPixbuf) GetColorspace() (return__ C.GdkColorspace)
- func (self *TraitPixbuf) GetHasAlpha() (return__ bool)
- func (self *TraitPixbuf) GetHeight() (return__ int)
- func (self *TraitPixbuf) GetNChannels() (return__ int)
- func (self *TraitPixbuf) GetOption(key string) (return__ string)
- func (self *TraitPixbuf) GetPixbufPointer() *C.GdkPixbuf
- func (self *TraitPixbuf) GetPixels() (return__ *C.guchar)
- func (self *TraitPixbuf) GetPixelsWithLength() (length uint, return__ []byte)
- func (self *TraitPixbuf) GetRowstride() (return__ int)
- func (self *TraitPixbuf) GetWidth() (return__ int)
- func (self *TraitPixbuf) NewSubpixbuf(src_x int, src_y int, width int, height int) (return__ *Pixbuf)
- func (self *TraitPixbuf) ReadPixelBytes() (return__ *C.GBytes)
- func (self *TraitPixbuf) ReadPixels() (return__ *C.guint8)
- func (self *TraitPixbuf) RotateSimple(angle C.GdkPixbufRotation) (return__ *Pixbuf)
- func (self *TraitPixbuf) SaturateAndPixelate(dest IsPixbuf, saturation float32, pixelate bool)
- func (self *TraitPixbuf) SaveToBufferv(type_ string, option_keys []string, option_values []string) (buffer []byte, buffer_size int64, return__ bool, __err__ error)
- func (self *TraitPixbuf) SaveToCallbackv(save_func C.GdkPixbufSaveFunc, user_data unsafe.Pointer, type_ string, ...) (return__ bool, __err__ error)
- func (self *TraitPixbuf) Savev(filename string, type_ string, option_keys []string, option_values []string) (return__ bool, __err__ error)
- func (self *TraitPixbuf) Scale(dest IsPixbuf, dest_x int, dest_y int, dest_width int, dest_height int, ...)
- func (self *TraitPixbuf) ScaleSimple(dest_width int, dest_height int, interp_type C.GdkInterpType) (return__ *Pixbuf)
- type TraitPixbufAnimation
- func (self *TraitPixbufAnimation) GetHeight() (return__ int)
- func (self *TraitPixbufAnimation) GetIter(start_time *C.GTimeVal) (return__ *PixbufAnimationIter)
- func (self *TraitPixbufAnimation) GetPixbufAnimationPointer() *C.GdkPixbufAnimation
- func (self *TraitPixbufAnimation) GetStaticImage() (return__ *Pixbuf)
- func (self *TraitPixbufAnimation) GetWidth() (return__ int)
- func (self *TraitPixbufAnimation) IsStaticImage() (return__ bool)
- type TraitPixbufAnimationIter
- func (self *TraitPixbufAnimationIter) Advance(current_time *C.GTimeVal) (return__ bool)
- func (self *TraitPixbufAnimationIter) GetDelayTime() (return__ int)
- func (self *TraitPixbufAnimationIter) GetPixbuf() (return__ *Pixbuf)
- func (self *TraitPixbufAnimationIter) GetPixbufAnimationIterPointer() *C.GdkPixbufAnimationIter
- func (self *TraitPixbufAnimationIter) OnCurrentlyLoadingFrame() (return__ bool)
- type TraitPixbufLoader
- func (self *TraitPixbufLoader) Close() (return__ bool, __err__ error)
- func (self *TraitPixbufLoader) GetAnimation() (return__ *PixbufAnimation)
- func (self *TraitPixbufLoader) GetFormat() (return__ *C.GdkPixbufFormat)
- func (self *TraitPixbufLoader) GetPixbuf() (return__ *Pixbuf)
- func (self *TraitPixbufLoader) GetPixbufLoaderPointer() *C.GdkPixbufLoader
- func (self *TraitPixbufLoader) SetSize(width int, height int)
- func (self *TraitPixbufLoader) Write(buf []byte, count int64) (return__ bool, __err__ error)
- func (self *TraitPixbufLoader) WriteBytes(buffer *C.GBytes) (return__ bool, __err__ error)
- type TraitPixbufSimpleAnim
Constants ¶
This section is empty.
Variables ¶
var ( PIXBUF_FEATURES_H = C.__GDK_PIXBUF_FEATURES_H PIXBUF_MAGIC_NUMBER = C.__GDK_PIXBUF_MAGIC_NUMBER PIXBUF_MAJOR = C.__GDK_PIXBUF_MAJOR PIXBUF_MICRO = C.__GDK_PIXBUF_MICRO PIXBUF_MINOR = C.__GDK_PIXBUF_MINOR PIXBUF_VERSION = C.__GDK_PIXBUF_VERSION PIXDATA_HEADER_LENGTH = C.__GDK_PIXDATA_HEADER_LENGTH )
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) // PixbufRotation PIXBUF_ROTATE_NONE = C.GdkPixbufRotation(C.GDK_PIXBUF_ROTATE_NONE) PIXBUF_ROTATE_COUNTERCLOCKWISE = C.GdkPixbufRotation(C.GDK_PIXBUF_ROTATE_COUNTERCLOCKWISE) PIXBUF_ROTATE_UPSIDEDOWN = C.GdkPixbufRotation(C.GDK_PIXBUF_ROTATE_UPSIDEDOWN) PIXBUF_ROTATE_CLOCKWISE = C.GdkPixbufRotation(C.GDK_PIXBUF_ROTATE_CLOCKWISE) )
var ( // PixdataDumpType PIXDATA_DUMP_PIXDATA_STREAM = C.GdkPixdataDumpType(C.GDK_PIXDATA_DUMP_PIXDATA_STREAM) PIXDATA_DUMP_PIXDATA_STRUCT = C.GdkPixdataDumpType(C.GDK_PIXDATA_DUMP_PIXDATA_STRUCT) PIXDATA_DUMP_MACROS = C.GdkPixdataDumpType(C.GDK_PIXDATA_DUMP_MACROS) PIXDATA_DUMP_GTYPES = C.GdkPixdataDumpType(C.GDK_PIXDATA_DUMP_GTYPES) PIXDATA_DUMP_CTYPES = C.GdkPixdataDumpType(C.GDK_PIXDATA_DUMP_CTYPES) PIXDATA_DUMP_STATIC = C.GdkPixdataDumpType(C.GDK_PIXDATA_DUMP_STATIC) PIXDATA_DUMP_CONST = C.GdkPixdataDumpType(C.GDK_PIXDATA_DUMP_CONST) PIXDATA_DUMP_RLE_DECODER = C.GdkPixdataDumpType(C.GDK_PIXDATA_DUMP_RLE_DECODER) // PixdataType PIXDATA_COLOR_TYPE_RGB = C.GdkPixdataType(C.GDK_PIXDATA_COLOR_TYPE_RGB) PIXDATA_COLOR_TYPE_RGBA = C.GdkPixdataType(C.GDK_PIXDATA_COLOR_TYPE_RGBA) PIXDATA_COLOR_TYPE_MASK = C.GdkPixdataType(C.GDK_PIXDATA_COLOR_TYPE_MASK) PIXDATA_SAMPLE_WIDTH_8 = C.GdkPixdataType(C.GDK_PIXDATA_SAMPLE_WIDTH_8) PIXDATA_SAMPLE_WIDTH_MASK = C.GdkPixdataType(C.GDK_PIXDATA_SAMPLE_WIDTH_MASK) PIXDATA_ENCODING_RAW = C.GdkPixdataType(C.GDK_PIXDATA_ENCODING_RAW) PIXDATA_ENCODING_RLE = C.GdkPixdataType(C.GDK_PIXDATA_ENCODING_RLE) PIXDATA_ENCODING_MASK = C.GdkPixdataType(C.GDK_PIXDATA_ENCODING_MASK) )
var UnusedFix_ bool
Functions ¶
func PixbufErrorQuark ¶
Types ¶
type IsPixbufAnimation ¶
type IsPixbufAnimation interface {
GetPixbufAnimationPointer() *C.GdkPixbufAnimation
}
type IsPixbufAnimationIter ¶
type IsPixbufAnimationIter interface {
GetPixbufAnimationIterPointer() *C.GdkPixbufAnimationIter
}
type IsPixbufLoader ¶
type IsPixbufLoader interface {
GetPixbufLoaderPointer() *C.GdkPixbufLoader
}
type IsPixbufSimpleAnim ¶
type IsPixbufSimpleAnim interface {
GetPixbufSimpleAnimPointer() *C.GdkPixbufSimpleAnim
}
type Pixbuf ¶
type Pixbuf struct { *TraitPixbuf *gobject.TraitObject CPointer unsafe.Pointer }
func NewPixbufFromCPointer ¶
func PixbufNew ¶
func PixbufNew(colorspace C.GdkColorspace, has_alpha bool, bits_per_sample int, width int, height int) (return__ *Pixbuf)
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 PixbufNewFromBytes ¶
func PixbufNewFromBytes(data *C.GBytes, colorspace C.GdkColorspace, has_alpha bool, bits_per_sample int, width int, height int, rowstride int) (return__ *Pixbuf)
Creates a new #GdkPixbuf out of in-memory readonly image data. Currently only RGB images with 8 bits per sample are supported. This is the #GBytes variant of gdk_pixbuf_new_from_data().
func PixbufNewFromData ¶
func PixbufNewFromData(data []byte, colorspace C.GdkColorspace, has_alpha bool, bits_per_sample int, width int, height int, rowstride int, destroy_fn C.GdkPixbufDestroyNotify, destroy_fn_data unsafe.Pointer) (return__ *Pixbuf)
Creates a new #GdkPixbuf out of in-memory image data. Currently only RGB images with 8 bits per sample are supported.
Since you are providing a pre-allocated pixel buffer, you must also specify a way to free that data. This is done with a function of type #GdkPixbufDestroyNotify. When a pixbuf created with is finalized, your destroy notification function will be called, and it is its responsibility to free the pixel array.
See also gdk_pixbuf_new_from_bytes().
func PixbufNewFromFile ¶
Creates a new pixbuf by loading an image from a file. The file format is detected automatically. If %NULL is returned, then @error will be set. Possible errors are in the #GDK_PIXBUF_ERROR and #G_FILE_ERROR domains.
func PixbufNewFromFileAtScale ¶
func PixbufNewFromFileAtScale(filename string, width int, height int, preserve_aspect_ratio bool) (return__ *Pixbuf, __err__ error)
Creates a new pixbuf by loading an image from a file. The file format is detected automatically. If %NULL is returned, then @error will be set. Possible errors are in the #GDK_PIXBUF_ERROR and #G_FILE_ERROR domains. The image will be scaled to fit in the requested size, optionally preserving the image's aspect ratio.
When preserving the aspect ratio, a @width of -1 will cause the image to be scaled to the exact given height, and a @height of -1 will cause the image to be scaled to the exact given width. When not preserving aspect ratio, a @width or @height of -1 means to not scale the image at all in that dimension. Negative values for @width and @height are allowed since 2.8.
func PixbufNewFromFileAtSize ¶
func PixbufNewFromFileAtSize(filename string, width int, height int) (return__ *Pixbuf, __err__ error)
Creates a new pixbuf by loading an image from a file. The file format is detected automatically. If %NULL is returned, then @error will be set. Possible errors are in the #GDK_PIXBUF_ERROR and #G_FILE_ERROR domains.
The image will be scaled to fit in the requested size, preserving the image's aspect ratio. Note that the returned pixbuf may be smaller than @width x @height, if the aspect ratio requires it. To load and image at the requested size, regardless of aspect ratio, use gdk_pixbuf_new_from_file_at_scale().
func PixbufNewFromInline ¶
func PixbufNewFromInline(data_length int, data []byte, copy_pixels bool) (return__ *Pixbuf, __err__ error)
Create a #GdkPixbuf from a flat representation that is suitable for storing as inline data in a program. This is useful if you want to ship a program with images, but don't want to depend on any external files.
gdk-pixbuf ships with a program called [gdk-pixbuf-csource][gdk-pixbuf-csource], which allows for conversion of #GdkPixbufs into such a inline representation. In almost all cases, you should pass the `--raw` option to `gdk-pixbuf-csource`. A sample invocation would be:
|[
gdk-pixbuf-csource --raw --name=myimage_inline myimage.png
]|
For the typical case where the inline pixbuf is read-only static data, you don't need to copy the pixel data unless you intend to write to it, so you can pass %FALSE for @copy_pixels. (If you pass `--rle` to `gdk-pixbuf-csource`, a copy will be made even if @copy_pixels is %FALSE, so using this option is generally a bad idea.)
If you create a pixbuf from const inline data compiled into your program, it's probably safe to ignore errors and disable length checks, since things will always succeed: |[ pixbuf = gdk_pixbuf_new_from_inline (-1, myimage_inline, FALSE, NULL); ]|
For non-const inline data, you could get out of memory. For untrusted inline data located at runtime, you could have corrupt inline data in addition.
func PixbufNewFromResource ¶
Creates a new pixbuf by loading an image from an resource.
The file format is detected automatically. If %NULL is returned, then @error will be set.
func PixbufNewFromResourceAtScale ¶
func PixbufNewFromResourceAtScale(resource_path string, width int, height int, preserve_aspect_ratio bool) (return__ *Pixbuf, __err__ error)
Creates a new pixbuf by loading an image from an resource.
The file format is detected automatically. If %NULL is returned, then @error will be set.
The image will be scaled to fit in the requested size, optionally preserving the image's aspect ratio. When preserving the aspect ratio, a @width of -1 will cause the image to be scaled to the exact given height, and a @height of -1 will cause the image to be scaled to the exact given width. When not preserving aspect ratio, a @width or @height of -1 means to not scale the image at all in that dimension.
The stream is not closed.
func PixbufNewFromStream ¶
func PixbufNewFromStream(stream *C.GInputStream, cancellable *C.GCancellable) (return__ *Pixbuf, __err__ error)
Creates a new pixbuf by loading an image from an input stream.
The file format is detected automatically. If %NULL is returned, then @error will be set. The @cancellable can be used to abort the operation from another thread. If the operation was cancelled, the error %G_IO_ERROR_CANCELLED will be returned. Other possible errors are in the #GDK_PIXBUF_ERROR and %G_IO_ERROR domains.
The stream is not closed.
func PixbufNewFromStreamAtScale ¶
func PixbufNewFromStreamAtScale(stream *C.GInputStream, width int, height int, preserve_aspect_ratio bool, cancellable *C.GCancellable) (return__ *Pixbuf, __err__ error)
Creates a new pixbuf by loading an image from an input stream.
The file format is detected automatically. If %NULL is returned, then @error will be set. The @cancellable can be used to abort the operation from another thread. If the operation was cancelled, the error %G_IO_ERROR_CANCELLED will be returned. Other possible errors are in the #GDK_PIXBUF_ERROR and %G_IO_ERROR domains.
The image will be scaled to fit in the requested size, optionally preserving the image's aspect ratio.
When preserving the aspect ratio, a @width of -1 will cause the image to be scaled to the exact given height, and a @height of -1 will cause the image to be scaled to the exact given width. If both @width and @height are given, this function will behave as if the smaller of the two values is passed as -1.
When not preserving aspect ratio, a @width or @height of -1 means to not scale the image at all in that dimension.
The stream is not closed.
func PixbufNewFromStreamFinish ¶
func PixbufNewFromStreamFinish(async_result *C.GAsyncResult) (return__ *Pixbuf, __err__ error)
Finishes an asynchronous pixbuf creation operation started with gdk_pixbuf_new_from_stream_async().
func PixbufNewFromXpmData ¶
Creates a new pixbuf by parsing XPM data in memory. This data is commonly the result of including an XPM file into a program's C source.
type PixbufAnimation ¶
type PixbufAnimation struct { *TraitPixbufAnimation *gobject.TraitObject CPointer unsafe.Pointer }
func NewPixbufAnimationFromCPointer ¶
func NewPixbufAnimationFromCPointer(p unsafe.Pointer) *PixbufAnimation
func PixbufAnimationNewFromFile ¶
func PixbufAnimationNewFromFile(filename string) (return__ *PixbufAnimation, __err__ error)
Creates a new animation by loading it from a file. The file format is detected automatically. If the file's format does not support multi-frame images, then an animation with a single frame will be created. Possible errors are in the #GDK_PIXBUF_ERROR and #G_FILE_ERROR domains.
func PixbufAnimationNewFromResource ¶
func PixbufAnimationNewFromResource(resource_path string) (return__ *PixbufAnimation, __err__ error)
Creates a new pixbuf animation by loading an image from an resource.
The file format is detected automatically. If %NULL is returned, then @error will be set.
func PixbufAnimationNewFromStream ¶
func PixbufAnimationNewFromStream(stream *C.GInputStream, cancellable *C.GCancellable) (return__ *PixbufAnimation, __err__ error)
Creates a new animation by loading it from an input stream.
The file format is detected automatically. If %NULL is returned, then @error will be set. The @cancellable can be used to abort the operation from another thread. If the operation was cancelled, the error %G_IO_ERROR_CANCELLED will be returned. Other possible errors are in the #GDK_PIXBUF_ERROR and %G_IO_ERROR domains.
The stream is not closed.
func PixbufAnimationNewFromStreamFinish ¶
func PixbufAnimationNewFromStreamFinish(async_result *C.GAsyncResult) (return__ *PixbufAnimation, __err__ error)
Finishes an asynchronous pixbuf animation creation operation started with gdk_pixbuf_animation_new_from_stream_async().
type PixbufAnimationIter ¶
type PixbufAnimationIter struct { *TraitPixbufAnimationIter *gobject.TraitObject CPointer unsafe.Pointer }
func NewPixbufAnimationIterFromCPointer ¶
func NewPixbufAnimationIterFromCPointer(p unsafe.Pointer) *PixbufAnimationIter
type PixbufFormat ¶
type PixbufFormat C.GdkPixbufFormat
type PixbufLoader ¶
type PixbufLoader struct { *TraitPixbufLoader *gobject.TraitObject CPointer unsafe.Pointer }
func NewPixbufLoaderFromCPointer ¶
func NewPixbufLoaderFromCPointer(p unsafe.Pointer) *PixbufLoader
func PixbufLoaderNew ¶
func PixbufLoaderNew() (return__ *PixbufLoader)
Creates a new pixbuf loader object.
func PixbufLoaderNewWithMimeType ¶
func PixbufLoaderNewWithMimeType(mime_type string) (return__ *PixbufLoader, __err__ error)
Creates a new pixbuf loader object that always attempts to parse image data as if it were an image of mime type @mime_type, instead of identifying the type automatically. Useful if you want an error if the image isn't the expected mime type, for loading image formats that can't be reliably identified by looking at the data, or if the user manually forces a specific mime type.
The list of supported mime types depends on what image loaders are installed, but typically "image/png", "image/jpeg", "image/gif", "image/tiff" and "image/x-xpixmap" are among the supported mime types. To obtain the full list of supported mime types, call gdk_pixbuf_format_get_mime_types() on each of the #GdkPixbufFormat structs returned by gdk_pixbuf_get_formats().
func PixbufLoaderNewWithType ¶
func PixbufLoaderNewWithType(image_type string) (return__ *PixbufLoader, __err__ error)
Creates a new pixbuf loader object that always attempts to parse image data as if it were an image of type @image_type, instead of identifying the type automatically. Useful if you want an error if the image isn't the expected type, for loading image formats that can't be reliably identified by looking at the data, or if the user manually forces a specific type.
The list of supported image formats depends on what image loaders are installed, but typically "png", "jpeg", "gif", "tiff" and "xpm" are among the supported formats. To obtain the full list of supported image formats, call gdk_pixbuf_format_get_name() on each of the #GdkPixbufFormat structs returned by gdk_pixbuf_get_formats().
type PixbufSimpleAnim ¶
type PixbufSimpleAnim struct { *TraitPixbufSimpleAnim *TraitPixbufAnimation *gobject.TraitObject CPointer unsafe.Pointer }
func NewPixbufSimpleAnimFromCPointer ¶
func NewPixbufSimpleAnimFromCPointer(p unsafe.Pointer) *PixbufSimpleAnim
func PixbufSimpleAnimNew ¶
func PixbufSimpleAnimNew(width int, height int, rate float32) (return__ *PixbufSimpleAnim)
Creates a new, empty animation.
type Pixdata ¶
type Pixdata C.GdkPixdata
type TraitPixbuf ¶
func NewTraitPixbuf ¶
func NewTraitPixbuf(p unsafe.Pointer) *TraitPixbuf
func (*TraitPixbuf) AddAlpha ¶
func (self *TraitPixbuf) AddAlpha(substitute_color bool, r uint8, g uint8, b uint8) (return__ *Pixbuf)
Takes an existing pixbuf and adds an alpha channel to it. If the existing pixbuf already had an alpha channel, the channel values are copied from the original; otherwise, the alpha channel is initialized to 255 (full opacity).
If @substitute_color is %TRUE, then the color specified by (@r, @g, @b) will be assigned zero opacity. That is, if you pass (255, 255, 255) for the substitute color, all white pixels will become fully transparent.
func (*TraitPixbuf) ApplyEmbeddedOrientation ¶
func (self *TraitPixbuf) ApplyEmbeddedOrientation() (return__ *Pixbuf)
Takes an existing pixbuf and checks for the presence of an associated "orientation" option, which may be provided by the jpeg loader (which reads the exif orientation tag) or the tiff loader (which reads the tiff orientation tag, and compensates it for the partial transforms performed by libtiff). If an orientation option/tag is present, the appropriate transform will be performed so that the pixbuf is oriented correctly.
func (*TraitPixbuf) Composite ¶
func (self *TraitPixbuf) Composite(dest IsPixbuf, dest_x int, dest_y int, dest_width int, dest_height int, offset_x float64, offset_y float64, scale_x float64, scale_y float64, interp_type C.GdkInterpType, overall_alpha int)
Creates a transformation of the source image @src by scaling by @scale_x and @scale_y then translating by @offset_x and @offset_y. This gives an image in the coordinates of the destination pixbuf. The rectangle (@dest_x, @dest_y, @dest_width, @dest_height) is then composited onto the corresponding rectangle of the original destination image.
When the destination rectangle contains parts not in the source image, the data at the edges of the source image is replicated to infinity.
![](composite.png)
func (*TraitPixbuf) CompositeColor ¶
func (self *TraitPixbuf) CompositeColor(dest IsPixbuf, dest_x int, dest_y int, dest_width int, dest_height int, offset_x float64, offset_y float64, scale_x float64, scale_y float64, interp_type C.GdkInterpType, overall_alpha int, check_x int, check_y int, check_size int, color1 uint32, color2 uint32)
Creates a transformation of the source image @src by scaling by @scale_x and @scale_y then translating by @offset_x and @offset_y, then composites the rectangle (@dest_x ,@dest_y, @dest_width, @dest_height) of the resulting image with a checkboard of the colors @color1 and @color2 and renders it onto the destination image.
See gdk_pixbuf_composite_color_simple() for a simpler variant of this function suitable for many tasks.
func (*TraitPixbuf) CompositeColorSimple ¶
func (self *TraitPixbuf) CompositeColorSimple(dest_width int, dest_height int, interp_type C.GdkInterpType, overall_alpha int, check_size int, color1 uint32, color2 uint32) (return__ *Pixbuf)
Creates a new #GdkPixbuf by scaling @src to @dest_width x @dest_height and compositing the result with a checkboard of colors @color1 and @color2.
func (*TraitPixbuf) Copy ¶
func (self *TraitPixbuf) Copy() (return__ *Pixbuf)
Creates a new #GdkPixbuf with a copy of the information in the specified @pixbuf.
func (*TraitPixbuf) CopyArea ¶
func (self *TraitPixbuf) CopyArea(src_x int, src_y int, width int, height int, dest_pixbuf IsPixbuf, dest_x int, dest_y int)
Copies a rectangular area from @src_pixbuf to @dest_pixbuf. Conversion of pixbuf formats is done automatically.
If the source rectangle overlaps the destination rectangle on the same pixbuf, it will be overwritten during the copy operation. Therefore, you can not use this function to scroll a pixbuf.
func (*TraitPixbuf) Fill ¶
func (self *TraitPixbuf) Fill(pixel uint32)
Clears a pixbuf to the given RGBA value, converting the RGBA value into the pixbuf's pixel format. The alpha will be ignored if the pixbuf doesn't have an alpha channel.
func (*TraitPixbuf) Flip ¶
func (self *TraitPixbuf) Flip(horizontal bool) (return__ *Pixbuf)
Flips a pixbuf horizontally or vertically and returns the result in a new pixbuf.
func (*TraitPixbuf) GetBitsPerSample ¶
func (self *TraitPixbuf) GetBitsPerSample() (return__ int)
Queries the number of bits per color sample in a pixbuf.
func (*TraitPixbuf) GetByteLength ¶
func (self *TraitPixbuf) GetByteLength() (return__ int64)
Returns the length of the pixel data, in bytes.
func (*TraitPixbuf) GetColorspace ¶
func (self *TraitPixbuf) GetColorspace() (return__ C.GdkColorspace)
Queries the color space of a pixbuf.
func (*TraitPixbuf) GetHasAlpha ¶
func (self *TraitPixbuf) GetHasAlpha() (return__ bool)
Queries whether a pixbuf has an alpha channel (opacity information).
func (*TraitPixbuf) GetHeight ¶
func (self *TraitPixbuf) GetHeight() (return__ int)
Queries the height of a pixbuf.
func (*TraitPixbuf) GetNChannels ¶
func (self *TraitPixbuf) GetNChannels() (return__ int)
Queries the number of channels of a pixbuf.
func (*TraitPixbuf) GetOption ¶
func (self *TraitPixbuf) GetOption(key string) (return__ string)
Looks up @key in the list of options that may have been attached to the @pixbuf when it was loaded, or that may have been attached by another function using gdk_pixbuf_set_option().
For instance, the ANI loader provides "Title" and "Artist" options. The ICO, XBM, and XPM loaders provide "x_hot" and "y_hot" hot-spot options for cursor definitions. The PNG loader provides the tEXt ancillary chunk key/value pairs as options. Since 2.12, the TIFF and JPEG loaders return an "orientation" option string that corresponds to the embedded TIFF/Exif orientation tag (if present).
func (*TraitPixbuf) GetPixbufPointer ¶
func (self *TraitPixbuf) GetPixbufPointer() *C.GdkPixbuf
func (*TraitPixbuf) GetPixels ¶
func (self *TraitPixbuf) GetPixels() (return__ *C.guchar)
Queries a pointer to the pixel data of a pixbuf.
func (*TraitPixbuf) GetPixelsWithLength ¶
func (self *TraitPixbuf) GetPixelsWithLength() (length uint, return__ []byte)
Queries a pointer to the pixel data of a pixbuf.
func (*TraitPixbuf) GetRowstride ¶
func (self *TraitPixbuf) GetRowstride() (return__ int)
Queries the rowstride of a pixbuf, which is the number of bytes between the start of a row and the start of the next row.
func (*TraitPixbuf) GetWidth ¶
func (self *TraitPixbuf) GetWidth() (return__ int)
Queries the width of a pixbuf.
func (*TraitPixbuf) NewSubpixbuf ¶
func (self *TraitPixbuf) NewSubpixbuf(src_x int, src_y int, width int, height int) (return__ *Pixbuf)
Creates a new pixbuf which represents a sub-region of @src_pixbuf. The new pixbuf shares its pixels with the original pixbuf, so writing to one affects both. The new pixbuf holds a reference to @src_pixbuf, so @src_pixbuf will not be finalized until the new pixbuf is finalized.
Note that if @src_pixbuf is read-only, this function will force it to be mutable.
func (*TraitPixbuf) ReadPixelBytes ¶
func (self *TraitPixbuf) ReadPixelBytes() (return__ *C.GBytes)
func (*TraitPixbuf) ReadPixels ¶
func (self *TraitPixbuf) ReadPixels() (return__ *C.guint8)
Returns a read-only pointer to the raw pixel data; must not be modified. This function allows skipping the implicit copy that must be made if gdk_pixbuf_get_pixels() is called on a read-only pixbuf.
func (*TraitPixbuf) RotateSimple ¶
func (self *TraitPixbuf) RotateSimple(angle C.GdkPixbufRotation) (return__ *Pixbuf)
Rotates a pixbuf by a multiple of 90 degrees, and returns the result in a new pixbuf.
func (*TraitPixbuf) SaturateAndPixelate ¶
func (self *TraitPixbuf) SaturateAndPixelate(dest IsPixbuf, saturation float32, pixelate bool)
Modifies saturation and optionally pixelates @src, placing the result in @dest. @src and @dest may be the same pixbuf with no ill effects. If @saturation is 1.0 then saturation is not changed. If it's less than 1.0, saturation is reduced (the image turns toward grayscale); if greater than 1.0, saturation is increased (the image gets more vivid colors). If @pixelate is %TRUE, then pixels are faded in a checkerboard pattern to create a pixelated image. @src and @dest must have the same image format, size, and rowstride.
func (*TraitPixbuf) SaveToBufferv ¶
func (self *TraitPixbuf) SaveToBufferv(type_ string, option_keys []string, option_values []string) (buffer []byte, buffer_size int64, return__ bool, __err__ error)
Saves pixbuf to a new buffer in format @type, which is currently "jpeg", "tiff", "png", "ico" or "bmp". See gdk_pixbuf_save_to_buffer() for more details.
func (*TraitPixbuf) SaveToCallbackv ¶
func (self *TraitPixbuf) SaveToCallbackv(save_func C.GdkPixbufSaveFunc, user_data unsafe.Pointer, type_ string, option_keys []string, option_values []string) (return__ bool, __err__ error)
Saves pixbuf to a callback in format @type, which is currently "jpeg", "png", "tiff", "ico" or "bmp". If @error is set, %FALSE will be returned. See gdk_pixbuf_save_to_callback () for more details.
func (*TraitPixbuf) Savev ¶
func (self *TraitPixbuf) Savev(filename string, type_ string, option_keys []string, option_values []string) (return__ bool, __err__ error)
Saves pixbuf to a file in @type, which is currently "jpeg", "png", "tiff", "ico" or "bmp". If @error is set, %FALSE will be returned. See gdk_pixbuf_save () for more details.
func (*TraitPixbuf) Scale ¶
func (self *TraitPixbuf) Scale(dest IsPixbuf, dest_x int, dest_y int, dest_width int, dest_height int, offset_x float64, offset_y float64, scale_x float64, scale_y float64, interp_type C.GdkInterpType)
Creates a transformation of the source image @src by scaling by @scale_x and @scale_y then translating by @offset_x and @offset_y, then renders the rectangle (@dest_x, @dest_y, @dest_width, @dest_height) of the resulting image onto the destination image replacing the previous contents.
Try to use gdk_pixbuf_scale_simple() first, this function is the industrial-strength power tool you can fall back to if gdk_pixbuf_scale_simple() isn't powerful enough.
If the source rectangle overlaps the destination rectangle on the same pixbuf, it will be overwritten during the scaling which results in rendering artifacts.
func (*TraitPixbuf) ScaleSimple ¶
func (self *TraitPixbuf) ScaleSimple(dest_width int, dest_height int, interp_type C.GdkInterpType) (return__ *Pixbuf)
Create a new #GdkPixbuf containing a copy of @src scaled to @dest_width x @dest_height. Leaves @src unaffected. @interp_type should be #GDK_INTERP_NEAREST if you want maximum speed (but when scaling down #GDK_INTERP_NEAREST is usually unusably ugly). The default @interp_type should be #GDK_INTERP_BILINEAR which offers reasonable quality and speed.
You can scale a sub-portion of @src by creating a sub-pixbuf pointing into @src; see gdk_pixbuf_new_subpixbuf().
For more complicated scaling/compositing see gdk_pixbuf_scale() and gdk_pixbuf_composite().
type TraitPixbufAnimation ¶
type TraitPixbufAnimation struct{ CPointer *C.GdkPixbufAnimation }
func NewTraitPixbufAnimation ¶
func NewTraitPixbufAnimation(p unsafe.Pointer) *TraitPixbufAnimation
func (*TraitPixbufAnimation) GetHeight ¶
func (self *TraitPixbufAnimation) GetHeight() (return__ int)
Queries the height of the bounding box of a pixbuf animation.
func (*TraitPixbufAnimation) GetIter ¶
func (self *TraitPixbufAnimation) GetIter(start_time *C.GTimeVal) (return__ *PixbufAnimationIter)
Get an iterator for displaying an animation. The iterator provides the frames that should be displayed at a given time. It should be freed after use with g_object_unref().
@start_time would normally come from g_get_current_time(), and marks the beginning of animation playback. After creating an iterator, you should immediately display the pixbuf returned by gdk_pixbuf_animation_iter_get_pixbuf(). Then, you should install a timeout (with g_timeout_add()) or by some other mechanism ensure that you'll update the image after gdk_pixbuf_animation_iter_get_delay_time() milliseconds. Each time the image is updated, you should reinstall the timeout with the new, possibly-changed delay time.
As a shortcut, if @start_time is %NULL, the result of g_get_current_time() will be used automatically.
To update the image (i.e. possibly change the result of gdk_pixbuf_animation_iter_get_pixbuf() to a new frame of the animation), call gdk_pixbuf_animation_iter_advance().
If you're using #GdkPixbufLoader, in addition to updating the image after the delay time, you should also update it whenever you receive the area_updated signal and gdk_pixbuf_animation_iter_on_currently_loading_frame() returns %TRUE. In this case, the frame currently being fed into the loader has received new data, so needs to be refreshed. The delay time for a frame may also be modified after an area_updated signal, for example if the delay time for a frame is encoded in the data after the frame itself. So your timeout should be reinstalled after any area_updated signal.
A delay time of -1 is possible, indicating "infinite."
func (*TraitPixbufAnimation) GetPixbufAnimationPointer ¶
func (self *TraitPixbufAnimation) GetPixbufAnimationPointer() *C.GdkPixbufAnimation
func (*TraitPixbufAnimation) GetStaticImage ¶
func (self *TraitPixbufAnimation) GetStaticImage() (return__ *Pixbuf)
If an animation is really just a plain image (has only one frame), this function returns that image. If the animation is an animation, this function returns a reasonable thing to display as a static unanimated image, which might be the first frame, or something more sophisticated. If an animation hasn't loaded any frames yet, this function will return %NULL.
func (*TraitPixbufAnimation) GetWidth ¶
func (self *TraitPixbufAnimation) GetWidth() (return__ int)
Queries the width of the bounding box of a pixbuf animation.
func (*TraitPixbufAnimation) IsStaticImage ¶
func (self *TraitPixbufAnimation) IsStaticImage() (return__ bool)
If you load a file with gdk_pixbuf_animation_new_from_file() and it turns out to be a plain, unanimated image, then this function will return %TRUE. Use gdk_pixbuf_animation_get_static_image() to retrieve the image.
type TraitPixbufAnimationIter ¶
type TraitPixbufAnimationIter struct{ CPointer *C.GdkPixbufAnimationIter }
func NewTraitPixbufAnimationIter ¶
func NewTraitPixbufAnimationIter(p unsafe.Pointer) *TraitPixbufAnimationIter
func (*TraitPixbufAnimationIter) Advance ¶
func (self *TraitPixbufAnimationIter) Advance(current_time *C.GTimeVal) (return__ bool)
Possibly advances an animation to a new frame. Chooses the frame based on the start time passed to gdk_pixbuf_animation_get_iter().
@current_time would normally come from g_get_current_time(), and must be greater than or equal to the time passed to gdk_pixbuf_animation_get_iter(), and must increase or remain unchanged each time gdk_pixbuf_animation_iter_get_pixbuf() is called. That is, you can't go backward in time; animations only play forward.
As a shortcut, pass %NULL for the current time and g_get_current_time() will be invoked on your behalf. So you only need to explicitly pass @current_time if you're doing something odd like playing the animation at double speed.
If this function returns %FALSE, there's no need to update the animation display, assuming the display had been rendered prior to advancing; if %TRUE, you need to call gdk_pixbuf_animation_iter_get_pixbuf() and update the display with the new pixbuf.
func (*TraitPixbufAnimationIter) GetDelayTime ¶
func (self *TraitPixbufAnimationIter) GetDelayTime() (return__ int)
Gets the number of milliseconds the current pixbuf should be displayed, or -1 if the current pixbuf should be displayed forever. g_timeout_add() conveniently takes a timeout in milliseconds, so you can use a timeout to schedule the next update.
func (*TraitPixbufAnimationIter) GetPixbuf ¶
func (self *TraitPixbufAnimationIter) GetPixbuf() (return__ *Pixbuf)
Gets the current pixbuf which should be displayed; the pixbuf might not be the same size as the animation itself (gdk_pixbuf_animation_get_width(), gdk_pixbuf_animation_get_height()). This pixbuf should be displayed for gdk_pixbuf_animation_iter_get_delay_time() milliseconds. The caller of this function does not own a reference to the returned pixbuf; the returned pixbuf will become invalid when the iterator advances to the next frame, which may happen anytime you call gdk_pixbuf_animation_iter_advance(). Copy the pixbuf to keep it (don't just add a reference), as it may get recycled as you advance the iterator.
func (*TraitPixbufAnimationIter) GetPixbufAnimationIterPointer ¶
func (self *TraitPixbufAnimationIter) GetPixbufAnimationIterPointer() *C.GdkPixbufAnimationIter
func (*TraitPixbufAnimationIter) OnCurrentlyLoadingFrame ¶
func (self *TraitPixbufAnimationIter) OnCurrentlyLoadingFrame() (return__ bool)
Used to determine how to respond to the area_updated signal on #GdkPixbufLoader when loading an animation. area_updated is emitted for an area of the frame currently streaming in to the loader. So if you're on the currently loading frame, you need to redraw the screen for the updated area.
type TraitPixbufLoader ¶
type TraitPixbufLoader struct{ CPointer *C.GdkPixbufLoader }
func NewTraitPixbufLoader ¶
func NewTraitPixbufLoader(p unsafe.Pointer) *TraitPixbufLoader
func (*TraitPixbufLoader) Close ¶
func (self *TraitPixbufLoader) Close() (return__ bool, __err__ error)
Informs a pixbuf loader that no further writes with gdk_pixbuf_loader_write() will occur, so that it can free its internal loading structures. Also, tries to parse any data that hasn't yet been parsed; if the remaining data is partial or corrupt, an error will be returned. If %FALSE is returned, @error will be set to an error from the #GDK_PIXBUF_ERROR or #G_FILE_ERROR domains. If you're just cancelling a load rather than expecting it to be finished, passing %NULL for @error to ignore it is reasonable.
Remember that this does not unref the loader, so if you plan not to use it anymore, please g_object_unref() it.
func (*TraitPixbufLoader) GetAnimation ¶
func (self *TraitPixbufLoader) GetAnimation() (return__ *PixbufAnimation)
Queries the #GdkPixbufAnimation that a pixbuf loader is currently creating. In general it only makes sense to call this function after the "area-prepared" signal has been emitted by the loader. If the loader doesn't have enough bytes yet (hasn't emitted the "area-prepared" signal) this function will return %NULL.
func (*TraitPixbufLoader) GetFormat ¶
func (self *TraitPixbufLoader) GetFormat() (return__ *C.GdkPixbufFormat)
Obtains the available information about the format of the currently loading image file.
func (*TraitPixbufLoader) GetPixbuf ¶
func (self *TraitPixbufLoader) GetPixbuf() (return__ *Pixbuf)
Queries the #GdkPixbuf that a pixbuf loader is currently creating. In general it only makes sense to call this function after the "area-prepared" signal has been emitted by the loader; this means that enough data has been read to know the size of the image that will be allocated. If the loader has not received enough data via gdk_pixbuf_loader_write(), then this function returns %NULL. The returned pixbuf will be the same in all future calls to the loader, so simply calling g_object_ref() should be sufficient to continue using it. Additionally, if the loader is an animation, it will return the "static image" of the animation (see gdk_pixbuf_animation_get_static_image()).
func (*TraitPixbufLoader) GetPixbufLoaderPointer ¶
func (self *TraitPixbufLoader) GetPixbufLoaderPointer() *C.GdkPixbufLoader
func (*TraitPixbufLoader) SetSize ¶
func (self *TraitPixbufLoader) SetSize(width int, height int)
Causes the image to be scaled while it is loaded. The desired image size can be determined relative to the original size of the image by calling gdk_pixbuf_loader_set_size() from a signal handler for the ::size-prepared signal.
Attempts to set the desired image size are ignored after the emission of the ::size-prepared signal.
func (*TraitPixbufLoader) Write ¶
func (self *TraitPixbufLoader) Write(buf []byte, count int64) (return__ bool, __err__ error)
This will cause a pixbuf loader to parse the next @count bytes of an image. It will return %TRUE if the data was loaded successfully, and %FALSE if an error occurred. In the latter case, the loader will be closed, and will not accept further writes. If %FALSE is returned, @error will be set to an error from the #GDK_PIXBUF_ERROR or #G_FILE_ERROR domains.
func (*TraitPixbufLoader) WriteBytes ¶
func (self *TraitPixbufLoader) WriteBytes(buffer *C.GBytes) (return__ bool, __err__ error)
This will cause a pixbuf loader to parse a buffer inside a #GBytes for an image. It will return %TRUE if the data was loaded successfully, and %FALSE if an error occurred. In the latter case, the loader will be closed, and will not accept further writes. If %FALSE is returned, @error will be set to an error from the #GDK_PIXBUF_ERROR or #G_FILE_ERROR domains.
See also: gdk_pixbuf_loader_write()
type TraitPixbufSimpleAnim ¶
type TraitPixbufSimpleAnim struct{ CPointer *C.GdkPixbufSimpleAnim }
func NewTraitPixbufSimpleAnim ¶
func NewTraitPixbufSimpleAnim(p unsafe.Pointer) *TraitPixbufSimpleAnim
func (*TraitPixbufSimpleAnim) AddFrame ¶
func (self *TraitPixbufSimpleAnim) AddFrame(pixbuf IsPixbuf)
Adds a new frame to @animation. The @pixbuf must have the dimensions specified when the animation was constructed.
func (*TraitPixbufSimpleAnim) GetLoop ¶
func (self *TraitPixbufSimpleAnim) GetLoop() (return__ bool)
Gets whether @animation should loop indefinitely when it reaches the end.
func (*TraitPixbufSimpleAnim) GetPixbufSimpleAnimPointer ¶
func (self *TraitPixbufSimpleAnim) GetPixbufSimpleAnimPointer() *C.GdkPixbufSimpleAnim
func (*TraitPixbufSimpleAnim) SetLoop ¶
func (self *TraitPixbufSimpleAnim) SetLoop(loop bool)
Sets whether @animation should loop indefinitely when it reaches the end.