Gridarta Editor
net.sf.gridarta.model.face.CollectedFaceProvider Class Reference

Implementation of FaceProvider which reads images from the collected PNG archive. More...

+ Inheritance diagram for net.sf.gridarta.model.face.CollectedFaceProvider:
+ Collaboration diagram for net.sf.gridarta.model.face.CollectedFaceProvider:

Public Member Functions

void addInfo (@NotNull final String faceName, final int pos, final int size)
 Report position and size of a face for loading it later. More...
 
 CollectedFaceProvider (final File file) throws FileNotFoundException
 Creates a new instance. More...
 
 CollectedFaceProvider (final String fileName) throws FileNotFoundException
 Creates a new instance. More...
 
- Public Member Functions inherited from net.sf.gridarta.model.face.AbstractFaceProvider
ImageIcon getImageIconForFacename (@NotNull final String faceName, final long stretch)
 Get an image from this FaceProvider. More...
 
void reload ()
 Reload faces. More...
 

Protected Member Functions

ImageIcon createImage (@NotNull final String faceName, final long stretch)
 
- Protected Member Functions inherited from net.sf.gridarta.model.face.AbstractFaceProvider
abstract ImageIcon createImage (@NotNull String faceName, long stretch)
 Create an image not found in the cache. More...
 

Private Attributes

final RandomAccessFile file
 The file to read from. More...
 
final Map< String, Long > positions = new HashMap<>()
 The icon position and size are stored here. More...
 

Detailed Description

Implementation of FaceProvider which reads images from the collected PNG archive.

Author
Christian Hujer
Todo:

Construction of this class should succeed even in case the face file is unavailable.

Move parsing of the face files to this class, so the faces can be easily reloaded while the application is running.

Definition at line 42 of file CollectedFaceProvider.java.

Constructor & Destructor Documentation

◆ CollectedFaceProvider() [1/2]

net.sf.gridarta.model.face.CollectedFaceProvider.CollectedFaceProvider ( final File  file) throws FileNotFoundException

Creates a new instance.

Parameters
filefile where icons are found
Exceptions
FileNotFoundExceptionin case the File wasn't found

Definition at line 61 of file CollectedFaceProvider.java.

◆ CollectedFaceProvider() [2/2]

net.sf.gridarta.model.face.CollectedFaceProvider.CollectedFaceProvider ( final String  fileName) throws FileNotFoundException

Creates a new instance.

Parameters
fileNamename of file where icons are found
Exceptions
FileNotFoundExceptionin case the File with name
fileName
wasn't found

Definition at line 71 of file CollectedFaceProvider.java.

Member Function Documentation

◆ addInfo()

void net.sf.gridarta.model.face.CollectedFaceProvider.addInfo ( @NotNull final String  faceName,
final int  pos,
final int  size 
)

Report position and size of a face for loading it later.

Parameters
faceNameface name to get image for, excluding path and ending
posposition of image
sizeSize of image

Definition at line 81 of file CollectedFaceProvider.java.

Referenced by net.sf.gridarta.model.face.DefaultFaceObjects.loadFacesCollection().

+ Here is the caller graph for this function:

◆ createImage()

ImageIcon net.sf.gridarta.model.face.CollectedFaceProvider.createImage ( @NotNull final String  faceName,
final long  stretch 
)
protected

Definition at line 87 of file CollectedFaceProvider.java.

Member Data Documentation

◆ file

final RandomAccessFile net.sf.gridarta.model.face.CollectedFaceProvider.file
private

The file to read from.

Definition at line 54 of file CollectedFaceProvider.java.

◆ positions

final Map<String, Long> net.sf.gridarta.model.face.CollectedFaceProvider.positions = new HashMap<>()
private

The icon position and size are stored here.

The value is a long with the high-int being the position and the low-int being the size.

Definition at line 48 of file CollectedFaceProvider.java.


The documentation for this class was generated from the following file: