Package com.samsthenerd.inline.utils
Interface SpriteUVLens
- All Known Implementing Classes:
SpriteUVLens.AnimUVLens
- Functional Interface:
- This is a functional interface and can therefore be used as the assignment target for a lambda expression or method reference.
Effectively a time-variant unary operator over SpriteUVData.
UV lenses allow specifying static region lenses (constructed via SpriteUVRegion.asLens()
)
or animated region lenses (via SpriteUVLens.AnimUVLens
).
More complex lenses can be constructed by composition with andThen(com.samsthenerd.inline.utils.SpriteUVLens)
.
For example, one may want to select a static region within an animated region.
Finally, since it's an open interface, you may define your own lenses if no existing ones fit your needs.
-
Nested Class Summary
Nested ClassesModifier and TypeInterfaceDescriptionstatic final record
A lens referring to an animated region. -
Method Summary
Modifier and TypeMethodDescriptiondefault SpriteUVLens
andThen
(SpriteUVLens lens) Returns a new lens which first applies this lens and then applies the given lens.focusUVs
(SpriteUVRegion uvs, long time) Apply a lens to a given UV region.default SpriteUVRegion
genUVs
(long time) focusUVs but applied to a full regionstatic long
static SpriteUVRegion
identity
(SpriteUVRegion uvs, long time)
-
Method Details
-
focusUVs
Apply a lens to a given UV region.- Parameters:
uvs
- base region to start from. SeeSpriteUVRegion.FULL
to start with.time
- in milliseconds, used for animated region calculations. SeegetSysTime()
for a usable input.
-
genUVs
focusUVs but applied to a full region -
identity
-
andThen
Returns a new lens which first applies this lens and then applies the given lens.- Parameters:
lens
- the lens to apply after this lens- Returns:
- a composed lens which first applies this lens and then applies the given lens.
-
getSysTime
static long getSysTime()
-