// GENERATED — DO NOT EDIT
///|
/// [Upstream documentation](https://docs.gtk.org/gdk4/class.Texture.html).
pub type Texture
///|
pub(open) trait ITexture {
fn as_texture(Self) -> Texture
fn download(Self, FixedArray[UInt], UInt64) -> Unit = _
fn get_format(Self) -> MemoryFormat = _
fn get_height(Self) -> Int = _
fn get_width(Self) -> Int = _
fn save_to_png(Self, String) -> Bool = _
fn save_to_png_bytes(Self) -> Bytes = _
fn save_to_tiff(Self, String) -> Bool = _
fn save_to_tiff_bytes(Self) -> Bytes = _
}
///|
pub impl ITexture for Texture with fn as_texture(self) {
self
}
///|
#borrow(bytes, error)
extern "c" fn moonbit_gdk_texture_new_from_bytes(
bytes : Bytes,
error : Ref[@glib.Nullable[@glib.Error_]],
) -> Texture = "moonbit_gdk_texture_new_from_bytes"
///|
/// [Upstream documentation](https://docs.gtk.org/gdk4/ctor.Texture.new_from_bytes.html).
pub fn Texture::new_from_bytes(bytes : Bytes) -> Texture raise @glib.Error_ {
let error_ : Ref[@glib.Nullable[@glib.Error_]] = Ref(@glib.Nullable::null())
let result = moonbit_gdk_texture_new_from_bytes(bytes, error_)
match error_.val.to_option() {
Some(e) => raise e
None => result
}
}
///|
#borrow(path, error)
extern "c" fn moonbit_gdk_texture_new_from_filename(
path : Bytes,
error : Ref[@glib.Nullable[@glib.Error_]],
) -> Texture = "moonbit_gdk_texture_new_from_filename"
///|
/// [Upstream documentation](https://docs.gtk.org/gdk4/ctor.Texture.new_from_filename.html).
pub fn Texture::new_from_filename(path : String) -> Texture raise @glib.Error_ {
let error_ : Ref[@glib.Nullable[@glib.Error_]] = Ref(@glib.Nullable::null())
let result = moonbit_gdk_texture_new_from_filename(
@encoding/utf8.encode(path),
error_,
)
match error_.val.to_option() {
Some(e) => raise e
None => result
}
}
///|
#borrow(resource_path)
extern "c" fn moonbit_gdk_texture_new_from_resource(
resource_path : Bytes,
) -> Texture = "moonbit_gdk_texture_new_from_resource"
///|
/// [Upstream documentation](https://docs.gtk.org/gdk4/ctor.Texture.new_from_resource.html).
pub fn Texture::new_from_resource(resource_path : String) -> Texture {
moonbit_gdk_texture_new_from_resource(@encoding/utf8.encode(resource_path))
}
///|
#borrow(self_, data)
extern "c" fn moonbit_gdk_texture_download(
self_ : Texture,
data : Ref[FixedArray[UInt]],
stride : UInt64,
) = "moonbit_gdk_texture_download"
///|
/// [Upstream documentation](https://docs.gtk.org/gdk4/method.Texture.download.html).
pub fn Texture::download(
self : Texture,
data : FixedArray[UInt],
stride : UInt64,
) -> Unit {
let data_ref : Ref[FixedArray[UInt]] = Ref(data)
moonbit_gdk_texture_download(self, data_ref, stride)
}
///|
/// [Upstream documentation](https://docs.gtk.org/gdk4/method.Texture.get_format.html).
#borrow(self)
pub extern "c" fn Texture::get_format(self : Texture) -> MemoryFormat = "moonbit_gdk_texture_get_format"
///|
/// [Upstream documentation](https://docs.gtk.org/gdk4/method.Texture.get_height.html).
#borrow(self)
pub extern "c" fn Texture::get_height(self : Texture) -> Int = "moonbit_gdk_texture_get_height"
///|
/// [Upstream documentation](https://docs.gtk.org/gdk4/method.Texture.get_width.html).
#borrow(self)
pub extern "c" fn Texture::get_width(self : Texture) -> Int = "moonbit_gdk_texture_get_width"
///|
#borrow(self_, filename)
extern "c" fn moonbit_gdk_texture_save_to_png(
self_ : Texture,
filename : Bytes,
) -> Bool = "moonbit_gdk_texture_save_to_png"
///|
/// [Upstream documentation](https://docs.gtk.org/gdk4/method.Texture.save_to_png.html).
pub fn Texture::save_to_png(self : Texture, filename : String) -> Bool {
moonbit_gdk_texture_save_to_png(self, @encoding/utf8.encode(filename))
}
///|
/// [Upstream documentation](https://docs.gtk.org/gdk4/method.Texture.save_to_png_bytes.html).
#borrow(self)
pub extern "c" fn Texture::save_to_png_bytes(self : Texture) -> Bytes = "moonbit_gdk_texture_save_to_png_bytes"
///|
#borrow(self_, filename)
extern "c" fn moonbit_gdk_texture_save_to_tiff(
self_ : Texture,
filename : Bytes,
) -> Bool = "moonbit_gdk_texture_save_to_tiff"
///|
/// [Upstream documentation](https://docs.gtk.org/gdk4/method.Texture.save_to_tiff.html).
pub fn Texture::save_to_tiff(self : Texture, filename : String) -> Bool {
moonbit_gdk_texture_save_to_tiff(self, @encoding/utf8.encode(filename))
}
///|
/// [Upstream documentation](https://docs.gtk.org/gdk4/method.Texture.save_to_tiff_bytes.html).
#borrow(self)
pub extern "c" fn Texture::save_to_tiff_bytes(self : Texture) -> Bytes = "moonbit_gdk_texture_save_to_tiff_bytes"
///|
impl ITexture with fn download(self, data, stride) -> Unit {
self.as_texture().download(data, stride)
}
///|
impl ITexture with fn get_format(self) -> MemoryFormat {
self.as_texture().get_format()
}
///|
impl ITexture with fn get_height(self) -> Int {
self.as_texture().get_height()
}
///|
impl ITexture with fn get_width(self) -> Int {
self.as_texture().get_width()
}
///|
impl ITexture with fn save_to_png(self, filename) -> Bool {
self.as_texture().save_to_png(filename)
}
///|
impl ITexture with fn save_to_png_bytes(self) -> Bytes {
self.as_texture().save_to_png_bytes()
}
///|
impl ITexture with fn save_to_tiff(self, filename) -> Bool {
self.as_texture().save_to_tiff(filename)
}
///|
impl ITexture with fn save_to_tiff_bytes(self) -> Bytes {
self.as_texture().save_to_tiff_bytes()
}
///|
pub fn Texture::as_gobject_object(self : Texture) -> @gobject.Object = "%identity"
///|
pub impl @gobject.IObject for Texture with fn as_object(self) {
self.as_gobject_object()
}
///|
pub fn Texture::as_paintable(self : Texture) -> Paintable = "%identity"
///|
pub impl IPaintable for Texture with fn as_paintable(self) {
self.as_paintable()
}