Picture$Typings extension

on

Properties

element HTMLElement?
Gets or sets the Picture's HTML element that provides some kind of visual image.
getter/setter pair
errorFunction ↔ void Function(Picture, Event)?
Gets or sets the function to call if an image set by #source fails to load. The arguments to this function are this Picture and the HTMLImageElement's "error" Event.
getter/setter pair
flip EnumValue
Gets or sets how the Picture is displayed: Either normally or with a Horizontal or Vertical flip or both.
getter/setter pair
imageAlignment Spot
Gets or sets the Spot to align the source image to, when the source image is smaller than the Picture. This is only relevant when the #imageStretch property value is not go.GraphObject.Fill.
getter/setter pair
imageStretch EnumValue
Gets or sets how the Picture's image is stretched within its bounding box. Some images will be a different aspect ratio than their given size or #desiredSize. This property will never change the size of the Picture itself, only the size of the image that is drawn in the Picture's #actualBounds.
getter/setter pair
naturalBounds Rect
This read-only property returns the natural size of this picture as determined by its source's width and height. The value is initially NaN x NaN until the picture has been measured. It will use the #element's naturalWidth and naturalHeight if available.
getter/setter pair
source String
Gets or sets the Picture's source URL, which can be any valid image (png, jpg, gif, etc) URL.
getter/setter pair
sourceCrossOrigin String Function(Picture)?
Gets or sets a function that returns a value for image.crossOrigin.
getter/setter pair
sourceRect Rect
Gets or sets the rectangular area of the source image that this picture should display. This is only common with sprite maps and image tables.
getter/setter pair
successFunction ↔ void Function(Picture, Event)?
Gets or sets the function to call when an image set by #source loads successfully. The arguments to this function are this Picture and the HTMLImageElement's "load" Event.
getter/setter pair

Methods

redraw() → void
Redraws a Picture, which can be useful if the backing #element is an HTML Canvas or HTML Video that has changed. This will not attempt to reload any image. If you need to do that, call #reloadSource.
reloadSource() → void
Attempts to reload a Picture#source image. This can be useful if the content on a server has changed, or was missing before. If a new image is loaded, this Picture may remeasure and/or redraw.