Class StandardMediaLoader
java.lang.Object
nl.colorize.multimedialib.renderer.java2d.StandardMediaLoader
- All Implemented Interfaces:
MediaLoader
- Direct Known Subclasses:
JFXMediaLoader
Uses APIs from the Java standard library to load media files: Java2D and ImageIO
for loading images, Java Sound for loading audio clips, and AWT for loading fonts.
These APIs are available on server and desktop platforms, but not on headless
server environments and not on Android.
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionbooleancontainsResourceFile(nl.colorize.util.ResourceFile file) Returns whether the specified resource file is available.protected FilegetApplicationDataFile(String appName) nl.colorize.util.SubscribableCollection<LoadStatus> Returns a buffer containing the load status of all media files that have been loaded by thisMediaLoader.loadApplicationData(String appName) Loads the application data for the application with the specified name.loadAudio(nl.colorize.util.ResourceFile file) Loads an audio clip from a file.Loads a TrueType or FreeType font so the renderer can use that font for text rendering.loadImage(nl.colorize.util.ResourceFile file) Loads an image from a file.loadModel(nl.colorize.util.ResourceFile file) Loads a polygon model from the specified file.loadText(nl.colorize.util.ResourceFile file) Loads a text-based resource file using UTF-8 encoding.protected nl.colorize.util.ResourceFilelocateFile(nl.colorize.util.ResourceFile location) Returns aResourceFilefor the resource file at the specified location.voidsaveApplicationData(String appName, Properties data) Saves the application data for the application with the specified name.Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface nl.colorize.multimedialib.renderer.MediaLoader
loadAtlas, loadDefaultFont, loadProperties, loadTextLines, loadTranslationBundle
-
Field Details
-
fontFamilies
-
fontCache
-
-
Constructor Details
-
StandardMediaLoader
public StandardMediaLoader()
-
-
Method Details
-
locateFile
protected nl.colorize.util.ResourceFile locateFile(nl.colorize.util.ResourceFile location) Returns aResourceFilefor the resource file at the specified location. The default implementation loads files from the classpath, subclasses can override this method to load files from alternative locations. -
loadImage
Description copied from interface:MediaLoaderLoads an image from a file. Images in JPEG and PNG format are supported by all renderers.- Specified by:
loadImagein interfaceMediaLoader
-
loadAudio
Description copied from interface:MediaLoaderLoads an audio clip from a file. MP3 files are supported by all renderers.- Specified by:
loadAudioin interfaceMediaLoader
-
loadFont
public FontFace loadFont(nl.colorize.util.ResourceFile file, String family, int size, ColorRGB color) Description copied from interface:MediaLoaderLoads a TrueType or FreeType font so the renderer can use that font for text rendering. This will return a font for the specified style, alternative styles can be derived from the returned font.- Specified by:
loadFontin interfaceMediaLoader
-
loadText
Description copied from interface:MediaLoaderLoads a text-based resource file using UTF-8 encoding.- Specified by:
loadTextin interfaceMediaLoader
-
loadModel
Description copied from interface:MediaLoaderLoads a polygon model from the specified file. Only the OBJ and GLTF format are guaranteed to be supported, though certain renderers may support additional file formats.- Specified by:
loadModelin interfaceMediaLoader
-
containsResourceFile
public boolean containsResourceFile(nl.colorize.util.ResourceFile file) Description copied from interface:MediaLoaderReturns whether the specified resource file is available.- Specified by:
containsResourceFilein interfaceMediaLoader
-
getApplicationDataFile
-
loadApplicationData
Description copied from interface:MediaLoaderLoads the application data for the application with the specified name. Application data is limited to key/value properties, as this type of data is supported by all platforms. Returns an emptyPropertieswhen no application data exists.- Specified by:
loadApplicationDatain interfaceMediaLoader
-
saveApplicationData
Description copied from interface:MediaLoaderSaves the application data for the application with the specified name. Application data is limited to key/value properties, as this type of data is supported by all platforms.- Specified by:
saveApplicationDatain interfaceMediaLoader
-
getLoadStatus
Description copied from interface:MediaLoaderReturns a buffer containing the load status of all media files that have been loaded by thisMediaLoader.- Specified by:
getLoadStatusin interfaceMediaLoader
-