Interface Layer
- All Known Implementing Classes:
LayerImpl
public interface Layer
Represents a single layer within a
SurfaceMaskLayers
, containing a surface mask
and a history of previous states for undo/redo functionality.-
Method Summary
Modifier and TypeMethodDescriptionvoid
addMask
(SurfaceMask2D mask) Adds a new surface mask to this layer and sets it as the current mask.Returns all surface masks in this layer.Returns the current surface mask in this layer.void
goBack()
Moves back to the previous mask state in the history if possible.void
Moves forward to the next mask state in the history if possible.boolean
Checks if the layer is currently visible.void
setCurrentMask
(int dir) Sets a new current surface mask for this layer.void
setCurrentMask
(SurfaceMask2D mask) Sets a new currentvoid
setVisibility
(boolean visible) Sets the visibility of this layer.void
Update the history, if the max depth is exceeded, the history is halved, and sets the current index to the last entry added.void
updateMask
(SurfaceMask2D oldMask, SurfaceMask2D newMask) Updates mask according to 3D
-
Method Details
-
getCurrentMask
SurfaceMask2D getCurrentMask()Returns the current surface mask in this layer.- Returns:
- The current
SurfaceMask2D
.
-
setCurrentMask
void setCurrentMask(int dir) Sets a new current surface mask for this layer.- Parameters:
dir
- 1 - forward; -1 - back in masks.
-
setCurrentMask
Sets a new current- Parameters:
mask
- mask to be set as current
-
getAllMasks
List<SurfaceMask2D> getAllMasks()Returns all surface masks in this layer.- Returns:
- A list of all
SurfaceMask2D
objects in this layer.
-
addMask
Adds a new surface mask to this layer and sets it as the current mask.- Parameters:
mask
- TheSurfaceMask2D
to be added.
-
setVisibility
void setVisibility(boolean visible) Sets the visibility of this layer.- Parameters:
visible
-true
to make the layer visible;false
to hide it.
-
isVisible
boolean isVisible()Checks if the layer is currently visible.- Returns:
true
if the layer is visible;false
otherwise.
-
updateHistory
void updateHistory()Update the history, if the max depth is exceeded, the history is halved, and sets the current index to the last entry added. -
goBack
void goBack()Moves back to the previous mask state in the history if possible. -
goForward
void goForward()Moves forward to the next mask state in the history if possible. -
updateMask
Updates mask according to 3D- Parameters:
oldMask
- Original masknewMask
- New mask
-