floodsim.view.util.resource
Members list
Type members
Classlikes
A generic cache for resources of type A indexed by keys of type K. This trait defines the core functionality for caching resources and retrieving them by key. Implementations determine how resources are stored and loaded.
A generic cache for resources of type A indexed by keys of type K. This trait defines the core functionality for caching resources and retrieving them by key. Implementations determine how resources are stored and loaded.
Type parameters
- A
-
the type of resources stored in the cache
- K
-
the type of keys used to identify resources
Attributes
- Companion
- object
- Supertypes
-
class Objecttrait Matchableclass Any
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.
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
- Supertypes
-
class Objecttrait Matchableclass Any
Companion object for ImageCache providing factory methods for common image types.
Companion object for ImageCache providing factory methods for common image types.
Attributes
- Companion
- class
- Supertypes
-
class Objecttrait Matchableclass Any
- Self type
-
ImageCache.type
Default ImageScaler using bilinear interpolation. Produces a new BufferedImage of type TYPE_INT_ARGB, preserving alpha.
Default ImageScaler using bilinear interpolation. Produces a new BufferedImage of type TYPE_INT_ARGB, preserving alpha.
Attributes
- Supertypes
-
class Objecttrait Matchableclass Any
- Self type
-
ImageScaler.type
Loads images from classpath resources based on a key-to-path mapping. Uses the current classloader to resolve mapping(key) into a resource stream and decodes it via ImageIO.read, returning detailed ResourceError values on failure. Error semantics:
Loads images from classpath resources based on a key-to-path mapping. Uses the current classloader to resolve mapping(key) into a resource stream and decodes it via ImageIO.read, returning detailed ResourceError values on failure. Error semantics:
- ResourceError.InvalidKey if the provided key is not present in the mapping
- ResourceError.NotFound if the classpath resource cannot be found
- ResourceError.Unreadable if the resource cannot be decoded as an image
Type parameters
- K
-
key type
Value parameters
- mapping
-
association between keys and classpath resource paths
Attributes
- Supertypes
Domain errors for resource loading.
Domain errors for resource loading.
- floodsim.view.util.resource.ResourceError.NotFound: the resource path could not be resolved on the classpath
- floodsim.view.util.resource.ResourceError.Unreadable: the resource exists but could not be decoded/read
- floodsim.view.util.resource.ResourceError.InvalidKey: the provided key has no mapping to a resource
Attributes
- Supertypes
-
trait Enumtrait Serializabletrait Producttrait Equalsclass Objecttrait Matchableclass AnyShow all
Type class for loading a value A given a key K. Implementations should be pure with respect to K and return deterministic LoadResult values for the same key (to benefit from caching).
Type class for loading a value A given a key K. Implementations should be pure with respect to K and return deterministic LoadResult values for the same key (to benefit from caching).
Attributes
- Supertypes
-
class Objecttrait Matchableclass Any
- Known subtypes
-
class PathBasedImageLoader[K]class ScaledImageLoader[K]
Composite key for addressing scaled images derived from a base key.
Composite key for addressing scaled images derived from a base key.
Value parameters
- height
-
target height in pixels
- original
-
the base image key
- width
-
target width in pixels
Attributes
- Supertypes
-
trait Serializabletrait Producttrait Equalsclass Objecttrait Matchableclass AnyShow all
Produces scaled images from a base cache of original images using an ImageScaler. On a cache miss, it:
Produces scaled images from a base cache of original images using an ImageScaler. On a cache miss, it:
- retrieves the base java.awt.image.BufferedImage from
baseCache - scales it using the in-scope ImageScaler
Type parameters
- K
-
base key type
Value parameters
- baseCache
-
cache providing base (unscaled) images
- scaler
-
the scaling strategy (inferred via given)
Attributes
- Supertypes
Types
Result of a loading operation: either an error or a loaded value.
Result of a loading operation: either an error or a loaded value.