PixbufProtocol

public protocol PixbufProtocol : LoadableIconProtocol, ObjectProtocol

A pixel buffer.

GdkPixbuf contains information about an image’s pixel data, its color space, bits per sample, width and height, and the rowstride (the number of bytes between the start of one row and the start of the next).

Creating new GdkPixbuf

The most basic way to create a pixbuf is to wrap an existing pixel buffer with a [classGdkPixbuf.Pixbuf] instance. You can use the [ctorGdkPixbuf.Pixbuf.new_from_data``] function to do this.

Every time you create a new GdkPixbuf instance for some data, you will need to specify the destroy notification function that will be called when the data buffer needs to be freed; this will happen when a GdkPixbuf is finalized by the reference counting functions. If you have a chunk of static data compiled into your application, you can pass in NULL as the destroy notification function so that the data will not be freed.

The [ctorGdkPixbuf.Pixbuf.new] constructor function can be used as a convenience to create a pixbuf with an empty buffer; this is equivalent to allocating a data buffer usingmalloc()and then wrapping it withgdk_pixbuf_new_from_data(). Thegdk_pixbuf_new()“ function will compute an optimal rowstride so that rendering can be performed with an efficient algorithm.

As a special case, you can use the [ctorGdkPixbuf.Pixbuf.new_from_xpm_data”] function to create a pixbuf from inline XPM image data.

You can also copy an existing pixbuf with the [methodPixbuf.copy] function. This is not the same as just acquiring a reference to the old pixbuf instance: the copy function will actually duplicate the pixel data in memory and create a new [classPixbuf] instance for it.

Reference counting

GdkPixbuf structures are reference counted. This means that an application can share a single pixbuf among many parts of the code. When a piece of the program needs to use a pixbuf, it should acquire a reference to it by calling g_object_ref(); when it no longer needs the pixbuf, it should release the reference it acquired by calling g_object_unref(). The resources associated with a GdkPixbuf will be freed when its reference count drops to zero. Newly-created GdkPixbuf instances start with a reference count of one.

Image Data

Image data in a pixbuf is stored in memory in an uncompressed, packed format. Rows in the image are stored top to bottom, and in each row pixels are stored from left to right.

There may be padding at the end of a row.

The “rowstride” value of a pixbuf, as returned by [methodGdkPixbuf.Pixbuf.get_rowstride``], indicates the number of bytes between rows.

NOTE: If you are copying raw pixbuf data with memcpy() note that the last row in the pixbuf may not be as wide as the full rowstride, but rather just as wide as the pixel data needs to be; that is: it is unsafe to do memcpy (dest, pixels, rowstride * height) to copy a whole pixbuf. Use [methodGdkPixbuf.Pixbuf.copy] instead, or compute the width in bytes of the last row as:

last_row = width * ((n_channels * bits_per_sample + 7) / 8);

The same rule applies when iterating over each row of a GdkPixbuf pixels array.

The following code illustrates a simple put_pixel() function for RGB pixbufs with 8 bits per channel with an alpha channel.

static void
put_pixel (GdkPixbuf *pixbuf,
           int x,
       int y,
       guchar red,
       guchar green,
       guchar blue,
       guchar alpha)
{
  int n_channels = gdk_pixbuf_get_n_channels (pixbuf);

  // Ensure that the pixbuf is valid
  g_assert (gdk_pixbuf_get_colorspace (pixbuf) == GDK_COLORSPACE_RGB);
  g_assert (gdk_pixbuf_get_bits_per_sample (pixbuf) == 8);
  g_assert (gdk_pixbuf_get_has_alpha (pixbuf));
  g_assert (n_channels == 4);

  int width = gdk_pixbuf_get_width (pixbuf);
  int height = gdk_pixbuf_get_height (pixbuf);

  // Ensure that the coordinates are in a valid range
  g_assert (x >= 0 && x < width);
  g_assert (y >= 0 && y < height);

  int rowstride = gdk_pixbuf_get_rowstride (pixbuf);

  // The pixel buffer in the GdkPixbuf instance
  guchar *pixels = gdk_pixbuf_get_pixels (pixbuf);

  // The pixel we wish to modify
  guchar *p = pixels + y * rowstride + x * n_channels;
  p[0] = red;
  p[1] = green;
  p[2] = blue;
  p[3] = alpha;
}

Loading images

The GdkPixBuf class provides a simple mechanism for loading an image from a file in synchronous and asynchronous fashion.

For GUI applications, it is recommended to use the asynchronous stream API to avoid blocking the control flow of the application.

Additionally, GdkPixbuf provides the [classGdkPixbuf.PixbufLoader`] API for progressive image loading.

Saving images

The GdkPixbuf class provides methods for saving image data in a number of file formats. The formatted data can be written to a file or to a memory buffer. GdkPixbuf can also call a user-defined callback on the data, which allows to e.g. write the image to a socket or store it in a database.

The PixbufProtocol protocol exposes the methods and properties of an underlying GdkPixbuf instance. The default implementation of these can be found in the protocol extension below. For a concrete class that implements these methods and properties, see Pixbuf. Alternatively, use PixbufRef as a lighweight, unowned reference if you already have an instance you just want to use.

  • ptr

    Untyped pointer to the underlying GdkPixbuf instance.

    Declaration

    Swift

    var ptr: UnsafeMutableRawPointer! { get }
  • pixbuf_ptr Default implementation

    Typed pointer to the underlying GdkPixbuf instance.

    Default Implementation

    Return the stored, untyped pointer as a typed pointer to the GdkPixbuf instance.

    Declaration

    Swift

    var pixbuf_ptr: UnsafeMutablePointer<GdkPixbuf>! { get }
  • Required Initialiser for types conforming to PixbufProtocol

    Declaration

    Swift

    init(raw: UnsafeMutableRawPointer)

Pixbuf Class

  • Bind a PixbufPropertyName source property to a given target object.

    Declaration

    Swift

    @discardableResult
    @inlinable
    func bind<Q, T>(property source_property: PixbufPropertyName, to target: T, _ target_property: Q, flags f: BindingFlags = .default, transformFrom transform_from: @escaping GLibObject.ValueTransformer = { $0.transform(destValue: $1) }, transformTo transform_to: @escaping GLibObject.ValueTransformer = { $0.transform(destValue: $1) }) -> BindingRef! where Q : PropertyNameProtocol, T : ObjectProtocol

    Parameters

    source_property

    the source property to bind

    target

    the target object to bind to

    target_property

    the target property to bind to

    flags

    the flags to pass to the Binding

    transform_from

    ValueTransformer to use for forward transformation

    transform_to

    ValueTransformer to use for backwards transformation

    Return Value

    binding reference or nil in case of an error

  • get(property:) Extension method

    Get the value of a Pixbuf property

    Declaration

    Swift

    @inlinable
    func get(property: PixbufPropertyName) -> GLibObject.Value

    Parameters

    property

    the property to get the value for

    Return Value

    the value of the named property

  • set(property:value:) Extension method

    Set the value of a Pixbuf property. Note that this will only have an effect on properties that are writable and not construct-only!

    Declaration

    Swift

    @inlinable
    func set(property: PixbufPropertyName, value v: GLibObject.Value)

    Parameters

    property

    the property to get the value for

    Return Value

    the value of the named property

Pixbuf Class: PixbufProtocol extension (methods and fields)

  • 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 the (r, g, b) arguments will be assigned zero opacity. That is, if you pass (255, 255, 255) for the substitute color, all white pixels will become fully transparent.

    If substitute_color is FALSE, then the (r, g, b) arguments will be ignored.

    Declaration

    Swift

    @inlinable
    func addAlpha(substituteColor: Bool, r: guchar, g: guchar, b: guchar) -> GdkPixBuf.PixbufRef!
  • applyEmbeddedOrientation() Extension method

    Takes an existing pixbuf and checks for the presence of an associated “orientation” option.

    The orientation option 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.

    Declaration

    Swift

    @inlinable
    func applyEmbeddedOrientation() -> GdkPixBuf.PixbufRef!
  • 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 alpha blended 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.

    Declaration

    Swift

    @inlinable
    func composite<PixbufT>(dest: PixbufT, destX: Int, destY: Int, destWidth: Int, destHeight: Int, offsetX: CDouble, offsetY: CDouble, scaleX: CDouble, scaleY: CDouble, interpType: GdkInterpType, overallAlpha: Int) where PixbufT : PixbufProtocol
  • 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 alpha blends 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.

    If the source image has no alpha channel, and overall_alpha is 255, a fast path is used which omits the alpha blending and just performs the scaling.

    See gdk_pixbuf_composite_color_simple() for a simpler variant of this function suitable for many tasks.

    Declaration

    Swift

    @inlinable
    func compositeColor<PixbufT>(dest: PixbufT, destX: Int, destY: Int, destWidth: Int, destHeight: Int, offsetX: CDouble, offsetY: CDouble, scaleX: CDouble, scaleY: CDouble, interpType: GdkInterpType, overallAlpha: Int, checkX: Int, checkY: Int, checkSize: Int, color1: guint32, color2: guint32) where PixbufT : PixbufProtocol
  • Creates a new pixbuf by scaling src to dest_width x dest_height and alpha blending the result with a checkboard of colors color1 and color2.

    Declaration

    Swift

    @inlinable
    func compositeColorSimple(destWidth: Int, destHeight: Int, interpType: GdkInterpType, overallAlpha: Int, checkSize: Int, color1: guint32, color2: guint32) -> GdkPixBuf.PixbufRef!
  • copy() Extension method

    Creates a new GdkPixbuf with a copy of the information in the specified pixbuf.

    Note that this does not copy the options set on the original GdkPixbuf, use gdk_pixbuf_copy_options() for this.

    Declaration

    Swift

    @inlinable
    func copy() -> GdkPixBuf.PixbufRef!
  • 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.

    Declaration

    Swift

    @inlinable
    func copyArea<PixbufT>(srcX: Int, srcY: Int, width: Int, height: Int, destPixbuf: PixbufT, destX: Int, destY: Int) where PixbufT : PixbufProtocol
  • copyOptions(destPixbuf:) Extension method

    Copies the key/value pair options attached to a GdkPixbuf to another GdkPixbuf.

    This is useful to keep original metadata after having manipulated a file. However be careful to remove metadata which you’ve already applied, such as the “orientation” option after rotating the image.

    Declaration

    Swift

    @inlinable
    func copyOptions<PixbufT>(destPixbuf: PixbufT) -> Bool where PixbufT : PixbufProtocol
  • fill(pixel:) Extension method

    Clears a pixbuf to the given RGBA value, converting the RGBA value into the pixbuf’s pixel format.

    The alpha component will be ignored if the pixbuf doesn’t have an alpha channel.

    Declaration

    Swift

    @inlinable
    func fill(pixel: guint32)
  • flip(horizontal:) Extension method

    Flips a pixbuf horizontally or vertically and returns the result in a new pixbuf.

    Declaration

    Swift

    @inlinable
    func flip(horizontal: Bool) -> GdkPixBuf.PixbufRef!
  • getBitsPerSample() Extension method

    Queries the number of bits per color sample in a pixbuf.

    Declaration

    Swift

    @inlinable
    func getBitsPerSample() -> Int
  • getByteLength() Extension method

    Returns the length of the pixel data, in bytes.

    Declaration

    Swift

    @inlinable
    func getByteLength() -> Int
  • getColorspace() Extension method

    Queries the color space of a pixbuf.

    Declaration

    Swift

    @inlinable
    func getColorspace() -> GdkColorspace
  • getHasAlpha() Extension method

    Queries whether a pixbuf has an alpha channel (opacity information).

    Declaration

    Swift

    @inlinable
    func getHasAlpha() -> Bool
  • getHeight() Extension method

    Queries the height of a pixbuf.

    Declaration

    Swift

    @inlinable
    func getHeight() -> Int
  • getNChannels() Extension method

    Queries the number of channels of a pixbuf.

    Declaration

    Swift

    @inlinable
    func getNChannels() -> Int
  • getOption(key:) Extension method

    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). Since 2.32, the TIFF loader sets the “multipage” option string to “yes” when a multi-page TIFF is loaded. Since 2.32 the JPEG and PNG loaders set “x-dpi” and “y-dpi” if the file contains image density information in dots per inch. Since 2.36.6, the JPEG loader sets the “comment” option with the comment EXIF tag.

    Declaration

    Swift

    @inlinable
    func getOption(key: UnsafePointer<gchar>!) -> String!
  • getOptions() Extension method

    Returns a GHashTable with a list of all the options that may have been attached to the pixbuf when it was loaded, or that may have been attached by another function using [methodGdkPixbuf.Pixbuf.set_option].

    Declaration

    Swift

    @inlinable
    func getOptions() -> GLib.HashTableRef!
  • getPixels() Extension method

    Queries a pointer to the pixel data of a pixbuf.

    This function will cause an implicit copy of the pixbuf data if the pixbuf was created from read-only data.

    Please see the section on image data for information about how the pixel data is stored in memory.

    Declaration

    Swift

    @inlinable
    func getPixels() -> String!
  • getPixelsWith(length:) Extension method

    Queries a pointer to the pixel data of a pixbuf.

    This function will cause an implicit copy of the pixbuf data if the pixbuf was created from read-only data.

    Please see the section on image data for information about how the pixel data is stored in memory.

    Declaration

    Swift

    @inlinable
    func getPixelsWith(length: UnsafeMutablePointer<guint>!) -> String!
  • getRowstride() Extension method

    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.

    Declaration

    Swift

    @inlinable
    func getRowstride() -> Int
  • getWidth() Extension method

    Queries the width of a pixbuf.

    Declaration

    Swift

    @inlinable
    func getWidth() -> Int
  • 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.

    Declaration

    Swift

    @inlinable
    func newSubpixbuf(srcX: Int, srcY: Int, width: Int, height: Int) -> GdkPixBuf.PixbufRef!
  • readPixelBytes() Extension method

    Provides a GBytes buffer containing the raw pixel data; the 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.

    Declaration

    Swift

    @inlinable
    func readPixelBytes() -> GLib.BytesRef!
  • readPixels() Extension method

    Provides a read-only pointer to the raw pixel data.

    This function allows skipping the implicit copy that must be made if gdk_pixbuf_get_pixels() is called on a read-only pixbuf.

    Declaration

    Swift

    @inlinable
    func readPixels() -> UnsafePointer<guint8>!
  • ref() Extension method

    Adds a reference to a pixbuf.

    ref is deprecated: Use g_object_ref().

    Declaration

    Swift

    @available(*, deprecated)
    @discardableResult
    @inlinable
    func ref() -> GdkPixBuf.PixbufRef!
  • removeOption(key:) Extension method

    Removes the key/value pair option attached to a GdkPixbuf.

    Declaration

    Swift

    @inlinable
    func removeOption(key: UnsafePointer<gchar>!) -> Bool
  • rotateSimple(angle:) Extension method

    Rotates a pixbuf by a multiple of 90 degrees, and returns the result in a new pixbuf.

    If angle is 0, this function will return a copy of src.

    Declaration

    Swift

    @inlinable
    func rotateSimple(angle: GdkPixbufRotation) -> GdkPixBuf.PixbufRef!
  • Modifies saturation and optionally pixelates src, placing the result in dest.

    The src and dest pixbufs must have the same image format, size, and rowstride.

    The src and dest arguments 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.

    Declaration

    Swift

    @inlinable
    func saturateAndPixelate<PixbufT>(dest: PixbufT, saturation: Double, pixelate: Bool) where PixbufT : PixbufProtocol
  • Vector version of gdk_pixbuf_save_to_buffer().

    Saves pixbuf to a new buffer in format type, which is currently “jpeg”, “tiff”, “png”, “ico” or “bmp”.

    See [methodGdkPixbuf.Pixbuf.save_to_buffer] for more details.

    Declaration

    Swift

    @inlinable
    func saveToBufferv(buffer: UnsafeMutablePointer<UnsafeMutablePointer<gchar>?>!, bufferSize: UnsafeMutablePointer<gsize>!, type: UnsafePointer<CChar>!, optionKeys: UnsafeMutablePointer<UnsafeMutablePointer<CChar>?>! = nil, optionValues: UnsafeMutablePointer<UnsafeMutablePointer<CChar>?>! = nil) throws -> Bool
  • Vector version of gdk_pixbuf_save_to_callback().

    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 [methodGdkPixbuf.Pixbuf.save_to_callback] for more details.

    Declaration

    Swift

    @inlinable
    func saveToCallbackv(saveFunc: GdkPixbufSaveFunc?, userData: gpointer? = nil, type: UnsafePointer<CChar>!, optionKeys: UnsafeMutablePointer<UnsafeMutablePointer<CChar>?>! = nil, optionValues: UnsafeMutablePointer<UnsafeMutablePointer<CChar>?>! = nil) throws -> Bool
  • Saves pixbuf to an output stream.

    Supported file formats are currently “jpeg”, “tiff”, “png”, “ico” or “bmp”.

    See [methodGdkPixbuf.Pixbuf.save_to_stream] for more details.

    Declaration

    Swift

    @inlinable
    func saveToStreamv<GioOutputStreamT>(stream: GioOutputStreamT, type: UnsafePointer<CChar>!, optionKeys: UnsafeMutablePointer<UnsafeMutablePointer<CChar>?>! = nil, optionValues: UnsafeMutablePointer<UnsafeMutablePointer<CChar>?>! = nil, cancellable: GIO.CancellableRef? = nil) throws -> Bool where GioOutputStreamT : OutputStreamProtocol
  • Saves pixbuf to an output stream.

    Supported file formats are currently “jpeg”, “tiff”, “png”, “ico” or “bmp”.

    See [methodGdkPixbuf.Pixbuf.save_to_stream] for more details.

    Declaration

    Swift

    @inlinable
    func saveToStreamv<GioCancellableT, GioOutputStreamT>(stream: GioOutputStreamT, type: UnsafePointer<CChar>!, optionKeys: UnsafeMutablePointer<UnsafeMutablePointer<CChar>?>! = nil, optionValues: UnsafeMutablePointer<UnsafeMutablePointer<CChar>?>! = nil, cancellable: GioCancellableT?) throws -> Bool where GioCancellableT : CancellableProtocol, GioOutputStreamT : OutputStreamProtocol
  • Saves pixbuf to an output stream asynchronously.

    For more details see gdk_pixbuf_save_to_streamv(), which is the synchronous version of this function.

    When the operation is finished, callback will be called in the main thread.

    You can then call gdk_pixbuf_save_to_stream_finish() to get the result of the operation.

    Declaration

    Swift

    @inlinable
    func saveToStreamvAsync<GioOutputStreamT>(stream: GioOutputStreamT, type: UnsafePointer<gchar>!, optionKeys: UnsafeMutablePointer<UnsafeMutablePointer<gchar>?>! = nil, optionValues: UnsafeMutablePointer<UnsafeMutablePointer<gchar>?>! = nil, cancellable: GIO.CancellableRef? = nil, callback: GAsyncReadyCallback? = nil, userData: gpointer? = nil) where GioOutputStreamT : OutputStreamProtocol
  • Saves pixbuf to an output stream asynchronously.

    For more details see gdk_pixbuf_save_to_streamv(), which is the synchronous version of this function.

    When the operation is finished, callback will be called in the main thread.

    You can then call gdk_pixbuf_save_to_stream_finish() to get the result of the operation.

    Declaration

    Swift

    @inlinable
    func saveToStreamvAsync<GioCancellableT, GioOutputStreamT>(stream: GioOutputStreamT, type: UnsafePointer<gchar>!, optionKeys: UnsafeMutablePointer<UnsafeMutablePointer<gchar>?>! = nil, optionValues: UnsafeMutablePointer<UnsafeMutablePointer<gchar>?>! = nil, cancellable: GioCancellableT?, callback: GAsyncReadyCallback? = nil, userData: gpointer? = nil) where GioCancellableT : CancellableProtocol, GioOutputStreamT : OutputStreamProtocol
  • Vector version of gdk_pixbuf_save().

    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 [methodGdkPixbuf.Pixbuf.save] for more details.

    Declaration

    Swift

    @inlinable
    func savev(filename: UnsafePointer<CChar>!, type: UnsafePointer<CChar>!, optionKeys: UnsafeMutablePointer<UnsafeMutablePointer<CChar>?>! = nil, optionValues: UnsafeMutablePointer<UnsafeMutablePointer<CChar>?>! = nil) throws -> Bool
  • 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.

    Declaration

    Swift

    @inlinable
    func scale<PixbufT>(dest: PixbufT, destX: Int, destY: Int, destWidth: Int, destHeight: Int, offsetX: CDouble, offsetY: CDouble, scaleX: CDouble, scaleY: CDouble, interpType: GdkInterpType) where PixbufT : PixbufProtocol
  • Create a new pixbuf containing a copy of src scaled to dest_width x dest_height.

    This function leaves src unaffected.

    The 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 [methodGdkPixbuf.Pixbuf.new_subpixbuf].

    If dest_width and dest_height are equal to the width and height of src, this function will return an unscaled copy of src.

    For more complicated scaling/alpha blending see [methodGdkPixbuf.Pixbuf.scale] and [methodGdkPixbuf.Pixbuf.composite].

    Declaration

    Swift

    @inlinable
    func scaleSimple(destWidth: Int, destHeight: Int, interpType: GdkInterpType) -> GdkPixBuf.PixbufRef!
  • setOption(key:value:) Extension method

    Attaches a key/value pair as an option to a GdkPixbuf.

    If key already exists in the list of options attached to the pixbuf, the new value is ignored and FALSE is returned.

    Declaration

    Swift

    @inlinable
    func setOption(key: UnsafePointer<gchar>!, value: UnsafePointer<gchar>!) -> Bool
  • unref() Extension method

    Removes a reference from a pixbuf.

    unref is deprecated: Use g_object_unref().

    Declaration

    Swift

    @available(*, deprecated)
    @inlinable
    func unref()
  • bitsPerSample Extension method

    Queries the number of bits per color sample in a pixbuf.

    Declaration

    Swift

    @inlinable
    var bitsPerSample: Int { get }
  • byteLength Extension method

    Returns the length of the pixel data, in bytes.

    Declaration

    Swift

    @inlinable
    var byteLength: Int { get }
  • colorspace Extension method

    The color space of the pixbuf.

    Currently, only GDK_COLORSPACE_RGB is supported.

    Declaration

    Swift

    @inlinable
    var colorspace: GdkColorspace { get }
  • hasAlpha Extension method

    Queries whether a pixbuf has an alpha channel (opacity information).

    Declaration

    Swift

    @inlinable
    var hasAlpha: Bool { get }
  • height Extension method

    The number of rows of the pixbuf.

    Declaration

    Swift

    @inlinable
    var height: Int { get }
  • nChannels Extension method

    Queries the number of channels of a pixbuf.

    Declaration

    Swift

    @inlinable
    var nChannels: Int { get }
  • options Extension method

    Returns a GHashTable with a list of all the options that may have been attached to the pixbuf when it was loaded, or that may have been attached by another function using [methodGdkPixbuf.Pixbuf.set_option].

    Declaration

    Swift

    @inlinable
    var options: GLib.HashTableRef! { get }
  • pixels Extension method

    A pointer to the pixel data of the pixbuf.

    Declaration

    Swift

    @inlinable
    var pixels: String! { get }
  • rowstride Extension method

    The number of bytes between the start of a row and the start of the next row.

    This number must (obviously) be at least as large as the width of the pixbuf.

    Declaration

    Swift

    @inlinable
    var rowstride: Int { get }
  • width Extension method

    The number of columns of the pixbuf.

    Declaration

    Swift

    @inlinable
    var width: Int { get }