[7:14] (extern: com.aussom.aussomscript.AImage) extends: object
The 'Img' class wraps an HTML img element. Images can be loaded from a URL with setSrc(), or from an Aussom buffer containing encoded image bytes (JPEG, PNG, WebP, etc.) using setSrcFromBuffer(). Natural width and height are available after the image fires its "load" event.
Img ()
Creates an Img object.
A new Img object._init ()
getSrc ()
Gets the current image source URL.
A string with the URL, or an empty string if not set.setSrc (string Src)
Sets the image source URL.
Src is a string with the URL.this objectsetSrcFromBuffer (object Buf, string MimeType)
Sets the image source from an Aussom buffer containing encoded image bytes (JPEG, PNG, WebP, GIF, etc.). The buffer is converted to a base64 data URL and set as the image source.
Buf is a buffer with the encoded image bytes.MimeType is a string with the MIME type (e.g., "image/jpeg").this objectgetAlt ()
Gets the alt text for the image.
A string with the alt text.setAlt (string Alt)
Sets the alt text for the image.
Alt is a string with the alt text.this objectgetNaturalWidth ()
Gets the intrinsic width of the image in pixels. Available only after the "load" event fires.
An int with the natural width.getNaturalHeight ()
Gets the intrinsic height of the image in pixels. Available only after the "load" event fires.
An int with the natural height.addListener (string Event, callback Handler, object PassedArg = null)
Registers an event listener on the image element. Common event names include "load" and "error".
Event is a string with the event name.Handler is a callback invoked as Handler(eventName, passedArg).PassedArg is an optional value forwarded to the handler.this object