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.

@FunctionalInterface public interface SpriteUVLens
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.

  • Method Details

    • focusUVs

      SpriteUVRegion focusUVs(SpriteUVRegion uvs, long time)
      Apply a lens to a given UV region.
      Parameters:
      uvs - base region to start from. See SpriteUVRegion.FULL to start with.
      time - in milliseconds, used for animated region calculations. See getSysTime() for a usable input.
    • genUVs

      default SpriteUVRegion genUVs(long time)
      focusUVs but applied to a full region
    • identity

      static SpriteUVRegion identity(SpriteUVRegion uvs, long time)
    • andThen

      default SpriteUVLens andThen(SpriteUVLens lens)
      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()