const class gfx::Image

sys::Obj
  gfx::Image

@Js
@Serializable { simple=true }

Source

Image represents a graphical image.

dispose

Void dispose()

Source

Free any operating system resources used by this image. Dispose is required if this image has been used in an operation such as FWT onPaint which allocated a system resource to represent this instance.

equals

virtual override Bool equals(Obj? that)

Source

Equality is based on uri.

file

const File? file

Source

The file referenced by this image's uri. This field is null if this image represents a buffered image in memory.

fromStr

static new fromStr(Str uri, Bool checked := true)

Source

Convenience for make(uri.toUri, checked).

hash

virtual override Int hash()

Source

Return uri.hash.

make

static new make(Uri uri, Bool checked := true)

Source

Convenience for makeFile to create an image which is loaded from the file referenced by Uri.get.

makeFile

static new makeFile(File f, Bool checked := true)

Source

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

static new makePainted(Size size, |Graphics| f)

Source

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

Image resize(Size size)

Source

Resize this image into a new image. Also see Graphics.copyImage.

size

Size size()

Source

Get the size of the image or 0,0 if not loaded yet.

toStr

virtual override Str toStr()

Source

Return uri.toStr.

uri

const Uri uri

Source

The uri which identifies this image. If this image maps to an image file, then this is the file's uri.

write

Void write(MimeType type, OutStream out)

Source

Write this image to the output stream as the given as a mime type. The following mime types are supported:

  • image/png
  • image/jpeg
  • image/gif