 |
Gridarta Editor
|
Go to the documentation of this file.
20 package net.sf.gridarta.model.face;
22 import java.awt.image.ImageFilter;
23 import java.awt.image.RGBImageFilter;
24 import java.util.Collection;
25 import java.util.concurrent.CopyOnWriteArrayList;
26 import javax.swing.GrayFilter;
27 import javax.swing.ImageIcon;
36 import org.jetbrains.annotations.NotNull;
37 import org.jetbrains.annotations.Nullable;
106 private static final ImageFilter
GRID_FILTER =
new RGBImageFilter() {
112 public int filterRGB(
final int x,
final int y,
final int rgb) {
118 public RGBImageFilter clone() {
119 return (RGBImageFilter) super.clone();
218 faceProvider.reload();
222 faceObjectProvidersListener.facesReloaded();
253 throw new IllegalStateException(
"normal face provider is unset");
256 final boolean[] undefinedArchetype =
new boolean[1];
261 undefinedArchetype[0] = archetype.isUndefinedArchetype();
266 undefinedArchetype[0] = gameObject.hasUndefinedArchetype();
281 return getFace(gameObject.getFaceObjName(), gameObject.hasUndefinedArchetype(),
ALPHA,
ALPHA, 0);
293 throw new IllegalStateException(
"normal face provider is unset");
332 if (hasUndefinedArchetype) {
336 if (faceName ==
null) {
341 if (faceObject ==
null) {
352 faceProvider = singleFaceProvider;
356 final String effectiveFaceName = alternativeFaceName !=
null && singleFaceProvider ==
doubleFaceProvider ? alternativeFaceName : faceName;
Class to filter images by simply applying a boolean OR operation.
This interface represents a lazy loader that provides images on demand.
static final ImageFilter GREEN_FILTER
The filter to make images green.
FaceProvider normalFaceProvider
The face provider for normal faces.
Base package of all Gridarta classes.
final Collection< FaceObjectProvidersListener > faceObjectProvidersListeners
The FaceObjectProvidersListeners to notify about changes.
boolean isDouble()
Return whether this face is a double face.
static final String SQUARE_NO_FACE
E get(@NotNull String objectName)
Gets a AbstractNamedObject.
void setParent(@Nullable final FaceProvider parent)
Sets a new provider as parent.
static final FilterFaceProvider GRAY
The face provider for GRAY faces.
ImageIcon getStretched(@NotNull final GameObject<?, ?, ?> gameObject, final long stretch)
Returns the stretched face for a GameObject as an {}.
static final int BLUE_MASK
The mask for selecting the blue bits.
static final int RED_MASK
The mask for selecting the red bits.
Provider for faces of GameObjects and Archetypes.
Reflects a game object (object on a map).
static final ImageFilter GRID_FILTER
The filter using a full alpha grid instead of alpha blending.
void setNormal(@NotNull final FaceProvider normalFaceProvider)
Sets the normal FaceProvider.
void addFaceObjectProvidersListener(@NotNull final FaceObjectProvidersListener listener)
Adds a FaceObjectProvidersListener to be notified about changes.
static final int GREEN_MASK
The mask for selecting the green bits.
static final ImageFilter RED_FILTER
The filter to make images red.
An ImageFilter that produces double faces: the source image is drawn twice with a vertical shift.
static final FilterFaceProvider ALPHA
The face provider for alpha faces.
FaceObjectProviders(final int doubleFaceOffset, @NotNull final FaceObjects faceObjects, @NotNull final ResourceIcons resourceIcons)
Creates a new instance.
static final FilterFaceProvider BLUE
The face provider for blue faces.
final FilterFaceProvider doubleAlphaFaceProvider
The face provider for transparent double faces.
An ImageFilter that produces stretched faces.
GameObjects are the objects based on Archetypes found on maps.
void removeFaceObjectProvidersListener(@NotNull final FaceObjectProvidersListener listener)
Removes a FaceObjectProvidersListener to be notified about changes.
final FilterFaceProvider stretchedFaceProvider
The face provider for stretched floor faces.
static final int GRAY_PERCENTAGE
The gray level for gray-scaled images; 100=darkest gray, 0=lightest gray.
static final FilterFaceProvider GREEN
The face provider for green faces.
A FilterFaceProvider provides modified versions of icons provided by another FaceProvider by applying...
static final ImageFilter ALPHA_FILTER
The singleton AlphaImageFilter instance for creating transparent images.
Interface for MapArchObjects.
static final FilterFaceProvider GRID
The face provider for grid faces.
FaceObjects is a container for FaceObjects.
public< G extends GameObject< G, A, R >, A extends MapArchObject< A >, R extends Archetype< G, A, R > > ImageIcon getFace(@NotNull final BaseObject< G, A, R, ?> baseObject)
Returns the face of a BaseObject as an ImageIcon.
Classes for handling data that is organized in a tree.
ImageIcon getTrans(@NotNull final GameObject<?, ?, ?> gameObject)
Returns the transparent face for a GameObject as an {}.
static final int RED_GREEN_BLUE_MASK
The mask for selecting the red, green, and blue bits.
static final String SQUARE_UNKNOWN
ImageIcon getResourceIcon(@NotNull final String iconName)
Returns the image icon for the given icon name.
void reloadAll()
Reloads all providers provided by this FaceObjects.
Common interface for FaceObject.
static final FilterFaceProvider RED
The face provider for red faces.
void reload()
Reload faces.
final ResourceIcons resourceIcons
The ResourceIcons for creating icons.
static final ImageFilter GRAY_FILTER
The filter to make gray-scaled images.
Interface for listeners interested in FaceObjectProviders related events.
ImageIcon getTransDouble(@NotNull final GameObject<?, ?, ?> gameObject)
Returns the transparent double face for a GameObject as an {}.
ImageIcon getDisplayIcon(@NotNull final NamedObject namedObject)
Returns the display icon for a NamedObject.
Creates ImageIcon instances from resources.
static final ImageFilter BLUE_FILTER
The filter to make images blue.
ImageIcon getFace(@Nullable final String faceName, final boolean hasUndefinedArchetype, @NotNull final FaceProvider singleFaceProvider, @NotNull final FaceProvider doubleFaceProvider, final long stretch)
Returns the ImageIcon of a face with a certain face name.
ImageIcon getDouble(@NotNull final GameObject<?, ?, ?> gameObject)
Returns the double face for a GameObject as an {}.
String getAlternativeFaceName()
Returns the alternative face name for image.a.nnn faces.
final FaceObjects faceObjects
The FaceObjects instance for looking up face names.
Utility class holding the singleton AlphaImageFilter instance.
final FilterFaceProvider doubleFaceProvider
The face provider for double faces.
ImageIcon getImageIconForFacename(@NotNull String faceName, long stretch)
Get an image from this FaceProvider.
static final String SQUARE_NO_ARCH
ImageIcon getImageIconForFacename(@NotNull final String faceObjName)
Returns the ImageIcon for a given face object name.