Package limn.graphics

Enum Class Sampling

java.lang.Object
java.lang.Enum<Sampling>
limn.graphics.Sampling
All Implemented Interfaces:
Serializable, Comparable<Sampling>, Constable

public enum Sampling extends Enum<Sampling>
How Canvas image drawing samples texels when an Image is drawn at a size other than 1:1. Part of the canvas state (Canvas.setSampling(limn.graphics.Sampling)), saved/restored with Canvas.save().

Sampling is realized per GPU texture: drawing the same Image with both modes in one frame reconfigures its texture between draws (a batch break each time it flips), so pick one mode per image where possible.

  • Enum Constant Details

    • SMOOTH

      public static final Sampling SMOOTH
      Bilinear filtering with mipmaps: photos, icons, scaled artwork. The default.
    • PIXELATED

      public static final Sampling PIXELATED
      Nearest-neighbor: pixel art stays crisp when scaled up instead of blurring; each source pixel becomes a sharp block.
  • Method Details

    • values

      public static Sampling[] values()
      Returns an array containing the constants of this enum class, in the order they are declared.
      Returns:
      an array containing the constants of this enum class, in the order they are declared
    • valueOf

      public static Sampling valueOf(String name)
      Returns the enum constant of this class with the specified name. The string must match exactly an identifier used to declare an enum constant in this class. (Extraneous whitespace characters are not permitted.)
      Parameters:
      name - the name of the enum constant to be returned.
      Returns:
      the enum constant with the specified name
      Throws:
      IllegalArgumentException - if this enum class has no constant with the specified name
      NullPointerException - if the argument is null