ImageCache

floodsim.view.util.resource.ImageCache
See theImageCache companion object
final class ImageCache[K]

A specialized cache for storing and managing images with scaling capabilities. This class maintains a mapping between keys and image paths, and provides functionality to retrieve scaled versions of images on demand.

Type parameters

K

the type of keys used to identify images

Value parameters

baseCache

the underlying cache for base images

mapping

the mapping between keys and image file paths

Attributes

Companion
object
Graph
Supertypes
class Object
trait Matchable
class Any

Members list

Value members

Concrete methods

def getScaledImage(key: K, width: Int, height: Int): Option[Image]

Retrieves a scaled version of an image identified by the given key. This method caches scaled images to avoid redundant scaling operations. If the requested scaled image is not in the cache, it loads the base image, scales it, and caches the result for future use.

Retrieves a scaled version of an image identified by the given key. This method caches scaled images to avoid redundant scaling operations. If the requested scaled image is not in the cache, it loads the base image, scales it, and caches the result for future use.

Value parameters

height

the desired height of the scaled image

key

the key identifying the image

width

the desired width of the scaled image

Attributes

Returns

some containing the scaled image if available, None otherwise