Fantom

 

const class

gfx::Image

sys::Obj
  gfx::Image

@Js
@Serializable { simple=true collection=false }

Image represents a graphical image.

Slots

equalsSource

override Bool equals(Obj? that)

Overrides sys::Obj.equals

Equality is based on uri.

fileSource

const File? file

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

fromStrSource

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

Convenience for make(uri.toUri, checked).

hashSource

override Int hash()

Overrides sys::Obj.hash

Return uri.hash.

makeSource

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

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

makeFileSource

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.

makeUriSource

@NoDoc
new makeUri(Uri uri, |This|? f := null)

Construct an image identified by the given URI. This constructor is used for subclasses and graphics toolkits. Developers should use make or makeFile.

resizeSource

Image resize(Size size)

Resize this image into a new image using GfxEnv.cur. Also see Graphics.copyImage. Note: this method doesn't support transparency correctly yet.

sizeSource

Size size()

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

toStrSource

override Str toStr()

Overrides sys::Obj.toStr

Return uri.toStr.

uriSource

const Uri uri

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