// Generated by scripts/generate.mjs from bindings/api.mjs. Do not edit.

///|
#external
pub type Source

///|
#module("@mizchi/three-mbt/constructors")
pub extern "js" fn Source::Source() -> Source = "source"

///|
#module("@mizchi/three-mbt/material-edit")
pub extern "js" fn Source::from_rgba(
  data : Bytes,
  width : Int,
  height : Int,
) -> Source = "sourceRGBA"

///|
#module("@mizchi/three-mbt/material-edit")
pub extern "js" fn Source::from_canvas(canvas : Canvas) -> Source = "sourceCanvas"

///|
pub extern "js" fn Source::uuid(self : Source) -> String =
  #| (self) => self.uuid

///|
pub extern "js" fn Source::version(self : Source) -> Int =
  #| (self) => self.version

///|
pub extern "js" fn Source::data_ready(self : Source) -> Bool =
  #| (self) => self.dataReady

///|
pub extern "js" fn Source::set_data_ready(self : Source, value : Bool) -> Unit =
  #| (self, value) => { self.dataReady = value; }

///|
pub extern "js" fn Source::get_size(self : Source, target : Vector3) -> Vector3 =
  #| (self, target) => self.getSize(target)

///|
pub extern "js" fn Source::mark_needs_update(self : Source) -> Unit =
  #| (self) => { self.needsUpdate = true; }

///|
extern "js" fn Source::ffi_rgba_bytes(self : Source) -> Nullable[Bytes] =
  #| (self) => self.data?.data instanceof Uint8Array ? self.data.data.slice() : null

///|
pub fn Source::rgba_bytes(self : Source) -> Bytes? {
  self.ffi_rgba_bytes().to_option()
}