Class ImageEffect
- All Implemented Interfaces:
ITimeToLive, Comparable<ImageEffect>
- Direct Known Subclasses:
CreatureShadowImageEffect, OverlayPixelsImageEffect, RotationImageEffect, TransparencyImageEffect
Represents an abstract image effect that can be applied to a BufferedImage. Implements ITimeToLive and Comparable interfaces.
-
Constructor Summary
ConstructorsModifierConstructorDescriptionprotectedImageEffect(int ttl, String name) Constructs a new ImageEffect with the specified time-to-live and name.protectedImageEffect(String name) Constructs a new ImageEffect with the specified name and a time-to-live of 0. -
Method Summary
Modifier and TypeMethodDescriptionabstract BufferedImageapply(BufferedImage image) Applies this image effect to the specified BufferedImage.intcompareTo(ImageEffect other) Compares this image effect with another image effect based on their priority.booleanChecks if this image effect is equal to another object.longGets the time in milliseconds that this effect has been alive.getName()Gets the name of this image effect.intGets the priority of this image effect.intGets the time-to-live of this image effect in milliseconds.inthashCode()Returns the hash code of this image effect.voidSets the name of this image effect.voidsetPriority(int priority) Sets the priority of this image effect.booleanChecks if the time-to-live of this image effect has been reached.
-
Constructor Details
-
ImageEffect
Constructs a new ImageEffect with the specified name and a time-to-live of 0.- Parameters:
name- the name of the image effect
-
ImageEffect
Constructs a new ImageEffect with the specified time-to-live and name.- Parameters:
ttl- the time-to-live of the image effect in millisecondsname- the name of the image effect
-
-
Method Details
-
getAliveTime
public long getAliveTime()Gets the time in milliseconds that this effect has been alive.- Specified by:
getAliveTimein interfaceITimeToLive- Returns:
- the alive time in milliseconds
-
getName
-
setName
Sets the name of this image effect.- Parameters:
name- the new name of the image effect
-
getTimeToLive
public int getTimeToLive()Gets the time-to-live of this image effect in milliseconds.- Specified by:
getTimeToLivein interfaceITimeToLive- Returns:
- the time-to-live in milliseconds
-
timeToLiveReached
public boolean timeToLiveReached()Checks if the time-to-live of this image effect has been reached.- Specified by:
timeToLiveReachedin interfaceITimeToLive- Returns:
- true if the time-to-live has been reached, false otherwise
-
getPriority
public int getPriority()Gets the priority of this image effect.- Returns:
- the priority of the image effect
-
setPriority
public void setPriority(int priority) Sets the priority of this image effect.- Parameters:
priority- the new priority of the image effect
-
compareTo
Compares this image effect with another image effect based on their priority.- Specified by:
compareToin interfaceComparable<ImageEffect>- Parameters:
other- the other image effect to compare to- Returns:
- a negative integer, zero, or a positive integer as this image effect's priority is less than, equal to, or greater than the other image effect's priority
-
equals
Checks if this image effect is equal to another object. Two image effects are considered equal if they have the same name and priority. -
hashCode
-
apply
Applies this image effect to the specified BufferedImage.- Parameters:
image- the BufferedImage to apply the effect to- Returns:
- the BufferedImage with the effect applied
-