amaze.misc.resources¶
Handles image generation, loading and conversion Qt <-> numpy conversion
Module Attributes
Environment variable to set to disable file caching |
Functions
Returns a plain arrow |
|
|
List of all programmatically drawn signs |
Where to look for cached built-ins |
|
|
Clear the image cache |
Where to look for custom images |
|
Returns the default sign shape |
|
Returns the default lightness of a sign |
|
Returns the default size at which a built-in sign will be generated |
|
Returns the default sign shape for signaling an error |
|
|
Return the image associated with given sign in the requested size |
|
Returns the path under which the image is cached for this specific resolution |
|
List of all possible sign shapes, including both built-ins and those found in |
Returns whether resources file caching is disabled |
|
|
Returns images in numpy format (array) for all provided signs, with the requested resolution |
|
Converts a QImage into a numpy array |
|
Returns images in Qt format (QImage) for all provided signs, with the requested resolution |
Triggers an update of the lists of available signs (builtin and custom) |
|
Image format for the cached and custom resources |
|
Where to look for sign images and where to cache built-ins |
Classes
|
Describe a specific kind of Sign (clue, lure, trap) with a name and a lightness value. |
|
What kind of information the related sign provides |
- amaze.misc.resources.NO_FILE_CACHE = 'KGD_AMAZE_NOCACHE'¶
Environment variable to set to disable file caching
- amaze.misc.resources.no_file_cache() bool[source]¶
Returns whether resources file caching is disabled
- amaze.misc.resources.default_size()[source]¶
Returns the default size at which a built-in sign will be generated
- class amaze.misc.resources.SignType(value)[source]¶
What kind of information the related sign provides
- CLUE = 'Clue'¶
Helpful sign. Shows the correct direction in an intersection
- LURE = 'Lure'¶
Unhelpful sign. Points to random direction along the path
- TRAP = 'Trap'¶
Deceitful sign. Shows the wrong direction in an intersection
- class amaze.misc.resources.Sign(name: str = 'arrow', value: float = 0.5)[source]¶
Describe a specific kind of Sign (clue, lure, trap) with a name and a lightness value. Shape is derived either as a built-in function or as an image file
- amaze.misc.resources.resources_path()[source]¶
Where to look for sign images and where to cache built-ins
- amaze.misc.resources.resources_format() str[source]¶
Image format for the cached and custom resources
- amaze.misc.resources.clear_cache(verbose=False, files=True)[source]¶
Clear the image cache
- Parameters:
verbose – Whether to print what has been cleared
files – Whether to also clear the cached files
- amaze.misc.resources.rebuild_signs_database()[source]¶
Triggers an update of the lists of available signs (builtin and custom)
- amaze.misc.resources.names()[source]¶
List of all possible sign shapes, including both built-ins and those found in
resources_path()
- amaze.misc.resources.image(sign: Sign, size: int) QImage[source]¶
Return the image associated with given sign in the requested size
- Raises:
ValueError – If the size is invalid (lower than 3)
- amaze.misc.resources.image_cached_path(sign: Sign, size: int) Path[source]¶
Returns the path under which the image is cached for this specific resolution
- amaze.misc.resources.qt_images( ) List[List[QImage]][source]¶
Returns images in Qt format (QImage) for all provided signs, with the requested resolution
- amaze.misc.resources.np_images( ) List[List[ndarray]][source]¶
Returns images in numpy format (array) for all provided signs, with the requested resolution