Package icyllis.arc3d.granite

# Class Clip_old

java.lang.Object
icyllis.arc3d.granite.Clip_old

public abstract class Clip_old extends Object
`Clip_old` is an abstract base class for producing a clip. It constructs a clip mask if necessary, and fills out a `ClipResult_old` instructing the caller on how to set up the draw state.

- ## Field Summary

  Fields
  Modifier and Type
  Field
  Description
  `static final int`
  `CLIPPED`
  `static final int`
  `CLIPPED_OUT`
  `static final float`
  `kBoundsTolerance`
  This is the maximum distance that a draw may extend beyond a clip's boundary and still count count as "on the other side".
  `static final float`
  `kHalfPixelRoundingTolerance`
  This is the slack around a half-pixel vertex coordinate where we don't trust the GPU's rasterizer to round consistently.
  `static final int`
  `NOT_CLIPPED`

- ## Constructor Summary

  Constructors
  Constructor
  Description
  `Clip_old()`

- ## Method Summary

  Modifier and Type
  Method
  Description
  `abstract int`
  `apply(SurfaceDrawContext sdc, boolean aa, ClipResult_old out, Rect2f bounds)`
  `abstract void`
  `getConservativeBounds(Rect2i out)`
  Compute a conservative pixel bounds restricted to the given render target dimensions.
  `static void`
  `getPixelBounds(Rect2fc bounds, boolean aa, boolean exterior, Rect2i out)`
  Convert the analytic bounds of a shape into an integer pixel bounds, where the given aa type is used when the shape is rendered.

  ### Methods inherited from class java.lang.Object

  `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- ## Field Details

  - ### CLIPPED

    public static final int CLIPPED
    See Also:
      - Constant Field Values

  - ### NOT_CLIPPED

    public static final int NOT_CLIPPED
    See Also:
      - Constant Field Values

  - ### CLIPPED_OUT

    public static final int CLIPPED_OUT
    See Also:
      - Constant Field Values

  - ### kBoundsTolerance

    public static final float kBoundsTolerance
    This is the maximum distance that a draw may extend beyond a clip's boundary and still count count as "on the other side". We leave some slack because floating point rounding error is likely to blame. The rationale for 1e-3 is that in the coverage case (and barring unexpected rounding), as long as coverage stays within 0.5 * 1/256 of its intended value it shouldn't have any effect on the final pixel values.
    See Also:
      - Constant Field Values

  - ### kHalfPixelRoundingTolerance

    public static final float kHalfPixelRoundingTolerance
    This is the slack around a half-pixel vertex coordinate where we don't trust the GPU's rasterizer to round consistently. The rounding method is not defined in GPU specs, and rasterizer precision frequently introduces errors where a fraction invalid input: '<' 1/2 still rounds up.

    For non-AA bounds edges, an edge value between 0.45 and 0.55 will round in or round out depending on what side its on. Outside of this range, the non-AA edge will snap using round()

    See Also:
      - Constant Field Values

- ## Constructor Details

  - ### Clip_old

    public Clip_old()

- ## Method Details

  - ### apply

    public abstract int apply(SurfaceDrawContext sdc, boolean aa, ClipResult_old out, Rect2f bounds)

  - ### getConservativeBounds

    public abstract void getConservativeBounds(Rect2i out)
    Compute a conservative pixel bounds restricted to the given render target dimensions. The returned bounds represent the limits of pixels that can be drawn; anything outside the bounds will be entirely clipped out.

  - ### getPixelBounds

    public static void getPixelBounds(Rect2fc bounds, boolean aa, boolean exterior, Rect2i out)
    Convert the analytic bounds of a shape into an integer pixel bounds, where the given aa type is used when the shape is rendered. The bounds mode can be used to query exterior or interior pixel boundaries. Interior bounds only make sense when its know that the analytic bounds are filled completely.

    NOTE: When using kExterior_Bounds, some coverage-AA rendering methods may still touch a pixel center outside of these bounds but will evaluate to 0 coverage. This is visually acceptable, but an additional outset of 1px should be used for dst proxy access.