TextureRef

public struct TextureRef : TextureProtocol, GWeakCapturing

The TextureRef type acts as a lightweight Swift reference to an underlying GdkTexture instance. It exposes methods that can operate on this data type through TextureProtocol conformance. Use TextureRef only as an unowned reference to an existing 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().

  • ptr
    Untyped pointer to the underlying `GdkTexture` instance.
    

    For type-safe access, use the generated, typed pointer texture_ptr property instead.

    Declaration

    Swift

    public let ptr: UnsafeMutableRawPointer!

Texture Class

  • Designated initialiser from the underlying C data type

    Declaration

    Swift

    @inlinable
    init(_ p: UnsafeMutablePointer<GdkTexture>)
  • Designated initialiser from a constant pointer to the underlying C data type

    Declaration

    Swift

    @inlinable
    init(_ p: UnsafePointer<GdkTexture>)
  • Conditional initialiser from an optional pointer to the underlying C data type

    Declaration

    Swift

    @inlinable
    init!(_ maybePointer: UnsafeMutablePointer<GdkTexture>?)
  • Conditional initialiser from an optional, non-mutable pointer to the underlying C data type

    Declaration

    Swift

    @inlinable
    init!(_ maybePointer: UnsafePointer<GdkTexture>?)
  • Conditional initialiser from an optional gpointer

    Declaration

    Swift

    @inlinable
    init!(gpointer g: gpointer?)
  • Conditional initialiser from an optional, non-mutable gconstpointer

    Declaration

    Swift

    @inlinable
    init!(gconstpointer g: gconstpointer?)
  • Reference intialiser for a related type that implements TextureProtocol

    Declaration

    Swift

    @inlinable
    init<T>(_ other: T) where T : TextureProtocol
  • This factory is syntactic sugar for setting weak pointers wrapped in GWeak<T>

    Declaration

    Swift

    @inlinable
    static func unowned<T>(_ other: T) -> TextureRef where T : TextureProtocol
  • Unsafe typed initialiser. Do not use unless you know the underlying data type the pointer points to conforms to TextureProtocol.

    Declaration

    Swift

    @inlinable
    init<T>(cPointer: UnsafeMutablePointer<T>)
  • Unsafe typed initialiser. Do not use unless you know the underlying data type the pointer points to conforms to TextureProtocol.

    Declaration

    Swift

    @inlinable
    init<T>(constPointer: UnsafePointer<T>)
  • Unsafe untyped initialiser. Do not use unless you know the underlying data type the pointer points to conforms to TextureProtocol.

    Declaration

    Swift

    @inlinable
    init(mutating 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
    init(raw: UnsafeMutableRawPointer)
  • Unsafe untyped initialiser. Do not use unless you know the underlying data type the pointer points to conforms to TextureProtocol.

    Declaration

    Swift

    @inlinable
    init(opaquePointer: OpaquePointer)
  • Creates a new texture object representing the GdkPixbuf.

    Declaration

    Swift

    @inlinable
    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
    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
    init(resource resourcePath: UnsafePointer<CChar>!)
  • Creates a new texture object representing the GdkPixbuf.

    Declaration

    Swift

    @inlinable
    static func newFor<PixbufT>(pixbuf: PixbufT) -> TextureRef! 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
    static func newFrom<FileT>(file: FileT) throws -> TextureRef! 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
    static func newFrom(resource resourcePath: UnsafePointer<CChar>!) -> TextureRef!