Class ColorLayer
- All Implemented Interfaces:
IRenderable
- Direct Known Subclasses:
AmbientLight, StaticShadowLayer
Represents an abstract color layer that can be rendered and updated.
-
Constructor Summary
ConstructorsModifierConstructorDescriptionprotectedColorLayer(Environment env, Color color) Constructs a new ColorLayer with the specified environment and color. -
Method Summary
Modifier and TypeMethodDescriptionprotected abstract voidclearSection(Graphics2D g, Rectangle2D section) Clears a specific section of the layer.getColor()Gets the current color of the layer.protected EnvironmentGets the environment associated with this color layer.voidrender(Graphics2D g) Renders the visual contents of this instance onto the provided graphics context.protected abstract voidrenderSection(Graphics2D g, Rectangle2D section) Renders a specific section of the layer.voidsetAlpha(int ambientAlpha) Sets the alpha value of the current color.voidSets the color of the layer.voidupdateSection(Rectangle2D section) Updates a specific section of the layer.
-
Constructor Details
-
ColorLayer
Constructs a new ColorLayer with the specified environment and color.- Parameters:
env- The environment associated with this color layer.color- The initial color of the layer.
-
-
Method Details
-
render
Description copied from interface:IRenderableRenders the visual contents of this instance onto the provided graphics context.
If an
Entityimplements this interface, this method will be called right after the entity was rendered from the environment. Allowing for a custom rendering mechanism.This interface can be implemented in general by anything that should be rendered to the game's screen.
- Specified by:
renderin interfaceIRenderable- Parameters:
g- The current graphics object onto which this instance will render its visual contents.- See Also:
-
getColor
Gets the current color of the layer.- Returns:
- The current color of the layer.
-
setAlpha
public void setAlpha(int ambientAlpha) Sets the alpha value of the current color.- Parameters:
ambientAlpha- The alpha value to set, clamped between 0 and 255.
-
setColor
Sets the color of the layer.- Parameters:
color- The color to set. If null, the method returns without making changes.
-
updateSection
Updates a specific section of the layer.- Parameters:
section- The section of the layer to update.
-
renderSection
Renders a specific section of the layer.- Parameters:
g- The graphics context to use for rendering.section- The section of the layer to render.
-
clearSection
Clears a specific section of the layer.- Parameters:
g- The graphics context to use for clearing.section- The section of the layer to clear.
-
getEnvironment
Gets the environment associated with this color layer.- Returns:
- The environment associated with this color layer.
-