Package nl.colorize.multimedialib.stage
Interface Graphic2D
- All Superinterfaces:
Updatable
Shared interface for all types of 2D graphics that are part of the scene
graph. It defines a common API for managing graphics. Each graphic is part
of the display list, which is controlled by the renderer and
determines when and how graphics should be displayed.
-
Method Summary
Modifier and TypeMethodDescriptiondefault Transformable
Returns this graphic's global transform, which is calculated by combining the graphic's local transform with that of its parents.Returns theDisplayListLocation
attached to this graphic, which is used by the renderer to determine how this graphic should be drawn.Returns the smallest possible rectangle that can contain this graphic, based on its current position and size.default Transform
Provides access to this graphic's local transform, which can be used to influence how the graphic should be displayed.default boolean
Returns true if the specified stage coordinates are included within this graphic's bounds.default void
setPosition
(float x, float y) Deprecated.
-
Method Details
-
getLocation
DisplayListLocation getLocation()Returns theDisplayListLocation
attached to this graphic, which is used by the renderer to determine how this graphic should be drawn. -
getTransform
Provides access to this graphic's local transform, which can be used to influence how the graphic should be displayed. As the "local" implies, these properties are relative to the graphic's parent. The graphic's global transform is then calculated by combining the graphic's transform properties with those of its parent. -
getGlobalTransform
Returns this graphic's global transform, which is calculated by combining the graphic's local transform with that of its parents. -
setPosition
Deprecated.PrefergetTransform().setPosition(x, y)
.Convenience method of changing this graphic's position. The X and Y coordinates are relative to the graphic's local transform. -
getStageBounds
Rect getStageBounds()Returns the smallest possible rectangle that can contain this graphic, based on its current position and size. The returned coordinates are relative to the stage, not relative to the graphic's parent. -
hitTest
Returns true if the specified stage coordinates are included within this graphic's bounds. The default implementation does not perform a pixel-perfect check, and instead relies on the graphic's bounding rectangle as returned bygetStageBounds()
.
-
getTransform().setPosition(x, y)
.