Texture

open class Texture : GLibObject.Object, TextureProtocol

The Texture type acts as a reference-counted owner of an underlying GdkTexture instance. It provides the methods that can operate on this data type through TextureProtocol conformance. Use Texture as a strong reference or owner of a GdkTexture instance.

GdkTexture is the basic element used to refer to pixel data.

It is primarily meant for pixel data that will not change over multiple frames, and will be used for a long time.

There are various ways to create GdkTexture objects from a GdkPixbuf, or a Cairo surface, or other pixel data.

The ownership of the pixel data is transferred to the GdkTexture instance; you can only make a copy of it, via [methodGdk.Texture.download].

GdkTexture is an immutable object: That means you cannot change anything about it other than increasing the reference count via g_object_ref().

  • Designated initialiser from the underlying `C` data type.
    

    This creates an instance without performing an unbalanced retain i.e., ownership is transferred to the Texture instance.

    Declaration

    Swift

    @inlinable
    public init(_ op: UnsafeMutablePointer<GdkTexture>)

    Parameters

    op

    pointer to the underlying object

  • Designated initialiser from a constant pointer to the underlying C data type. This creates an instance without performing an unbalanced retain i.e., ownership is transferred to the Texture instance.

    Declaration

    Swift

    @inlinable
    public init(_ op: UnsafePointer<GdkTexture>)

    Parameters

    op

    pointer to the underlying object

  • Optional initialiser from a non-mutating gpointer to the underlying C data type. This creates an instance without performing an unbalanced retain i.e., ownership is transferred to the Texture instance.

    Declaration

    Swift

    @inlinable
    override public init!(gpointer op: gpointer?)

    Parameters

    op

    gpointer to the underlying object

  • Optional initialiser from a non-mutating gconstpointer to the underlying C data type. This creates an instance without performing an unbalanced retain i.e., ownership is transferred to the Texture instance.

    Declaration

    Swift

    @inlinable
    override public init!(gconstpointer op: gconstpointer?)

    Parameters

    op

    pointer to the underlying object

  • Optional initialiser from a constant pointer to the underlying C data type. This creates an instance without performing an unbalanced retain i.e., ownership is transferred to the Texture instance.

    Declaration

    Swift

    @inlinable
    public init!(_ op: UnsafePointer<GdkTexture>?)

    Parameters

    op

    pointer to the underlying object

  • Optional initialiser from the underlying C data type. This creates an instance without performing an unbalanced retain i.e., ownership is transferred to the Texture instance.

    Declaration

    Swift

    @inlinable
    public init!(_ op: UnsafeMutablePointer<GdkTexture>?)

    Parameters

    op

    pointer to the underlying object

  • Designated initialiser from the underlying C data type. Will retain GdkTexture. i.e., ownership is transferred to the Texture instance.

    Declaration

    Swift

    @inlinable
    public init(retaining op: UnsafeMutablePointer<GdkTexture>)

    Parameters

    op

    pointer to the underlying object

  • Reference intialiser for a related type that implements TextureProtocol Will retain GdkTexture.

    Declaration

    Swift

    @inlinable
    public init<T>(texture other: T) where T : TextureProtocol

    Parameters

    other

    an instance of a related type that implements TextureProtocol

  • Unsafe typed initialiser. Do not use unless you know the underlying data type the pointer points to conforms to TextureProtocol.

    Declaration

    Swift

    @inlinable
    override public init<T>(cPointer p: UnsafeMutablePointer<T>)

    Parameters

    cPointer

    pointer to the underlying object

  • Unsafe typed, retaining initialiser. Do not use unless you know the underlying data type the pointer points to conforms to TextureProtocol.

    Declaration

    Swift

    @inlinable
    override public init<T>(retainingCPointer cPointer: UnsafeMutablePointer<T>)

    Parameters

    cPointer

    pointer to the underlying object

  • Unsafe untyped initialiser. Do not use unless you know the underlying data type the pointer points to conforms to TextureProtocol.

    Declaration

    Swift

    @inlinable
    override public init(raw p: UnsafeRawPointer)

    Parameters

    p

    raw pointer to the underlying object

  • Unsafe untyped, retaining initialiser. Do not use unless you know the underlying data type the pointer points to conforms to TextureProtocol.

    Declaration

    Swift

    @inlinable
    override public init(retainingRaw raw: UnsafeRawPointer)
  • Unsafe untyped initialiser. Do not use unless you know the underlying data type the pointer points to conforms to TextureProtocol.

    Declaration

    Swift

    @inlinable
    public required init(raw p: UnsafeMutableRawPointer)

    Parameters

    p

    mutable raw pointer to the underlying object

  • Unsafe untyped, retaining initialiser. Do not use unless you know the underlying data type the pointer points to conforms to TextureProtocol.

    Declaration

    Swift

    @inlinable
    required public init(retainingRaw raw: UnsafeMutableRawPointer)

    Parameters

    raw

    mutable raw pointer to the underlying object

  • Unsafe untyped initialiser. Do not use unless you know the underlying data type the pointer points to conforms to TextureProtocol.

    Declaration

    Swift

    @inlinable
    override public init(opaquePointer p: OpaquePointer)

    Parameters

    p

    opaque pointer to the underlying object

  • Unsafe untyped, retaining initialiser. Do not use unless you know the underlying data type the pointer points to conforms to TextureProtocol.

    Declaration

    Swift

    @inlinable
    override public init(retainingOpaquePointer p: OpaquePointer)

    Parameters

    p

    opaque pointer to the underlying object

  • Creates a new texture object representing the GdkPixbuf.

    Declaration

    Swift

    @inlinable
    public init<PixbufT>(pixbuf: PixbufT) where PixbufT : PixbufProtocol
  • Creates a new texture by loading an image from a file.

    The file format is detected automatically. The supported formats are PNG and JPEG, though more formats might be available.

    If nil is returned, then error will be set.

    Declaration

    Swift

    @inlinable
    public init<FileT>(file: FileT) throws where FileT : FileProtocol
  • Creates a new texture by loading an image from a resource.

    The file format is detected automatically. The supported formats are PNG and JPEG, though more formats might be available.

    It is a fatal error if resource_path does not specify a valid image resource and the program will abort if that happens. If you are unsure about the validity of a resource, use [ctorGdk.Texture.new_from_file] to load it.

    Declaration

    Swift

    @inlinable
    public init(resource resourcePath: UnsafePointer<CChar>!)
  • Creates a new texture object representing the GdkPixbuf.

    Declaration

    Swift

    @inlinable
    public static func newFor<PixbufT>(pixbuf: PixbufT) -> Texture! where PixbufT : PixbufProtocol
  • Creates a new texture by loading an image from a file.

    The file format is detected automatically. The supported formats are PNG and JPEG, though more formats might be available.

    If nil is returned, then error will be set.

    Declaration

    Swift

    @inlinable
    public static func newFrom<FileT>(file: FileT) throws -> Texture! where FileT : FileProtocol
  • Creates a new texture by loading an image from a resource.

    The file format is detected automatically. The supported formats are PNG and JPEG, though more formats might be available.

    It is a fatal error if resource_path does not specify a valid image resource and the program will abort if that happens. If you are unsure about the validity of a resource, use [ctorGdk.Texture.new_from_file] to load it.

    Declaration

    Swift

    @inlinable
    public static func newFrom(resource resourcePath: UnsafePointer<CChar>!) -> Texture!