const class gfx::Image
sys::Obj gfx::Image
@Js@Serializable { simple=true }
Image represents a graphical image.
- equals
-
virtual override Bool equals(Obj? that)Equality is based on uri.
- file
-
const File? fileThe file referenced by this image's uri. This field is null if this image represents a buffered image in memory.
- fromStr
-
const static Image? fromStr(Str uri, Bool checked := true)Convenience for
make(uri.toUri, checked). - hash
-
virtual override Int hash()Return
uri.hash. - make
-
const static Image? make(Uri uri, Bool checked := true)Convenience for
makeFileto create an image which is loaded from the file referenced byUri.get. - makeFile
-
const static Image? makeFile(File f, Bool checked := true)Create an image to load from file. If checked is true and the file doesn't exist then throw an exception. If checked is false then return null. The supported file formats are based on the target graphics environment, but typically include PNG, GIF, and JPEG.
Note: since the image is loaded asynchronously upon demand, there is no guarantee that the file actually stores a valid image once this method completes successfully. Completion of this method is based only on file existence.
- makePainted
-
const static Image makePainted(Size size, |Graphics| f)Create a new image which is painted by the given function.
Example:
Image.makePainted(Size(100, 100)) |g| { g.brush = Color.green g.fillRect(0, 0, 100, 100) } - resize
-
Resize this image into a new image. Also see
Graphics.copyImage. Note: this method doesn't support transparency correctly yet. - size
-
Size size()Get the size of the image or 0,0 if not loaded yet.
- toStr
-
virtual override Str toStr()Return
uri.toStr. - uri
-
const Uri uriThe uri which identifies this image. If this image maps to an image file, then this is the file's uri.