Class PaintFilterCanvas

All Implemented Interfaces:
AutoCloseable

public abstract class PaintFilterCanvas extends NWayCanvas
  • Constructor Details

    • PaintFilterCanvas

      public PaintFilterCanvas(@RawPtr @RawPtr @NonNull Canvas canvas)
      The new PaintFilterCanvas is configured for forwarding to the specified canvas. Also copies the target canvas matrix and clip bounds.
  • Method Details

    • onFilter

      public abstract boolean onFilter(Paint paint)
      Called with the paint that will be used to draw the specified type. The implementation may modify the paint as they wish.

      The result bool is used to determine whether the draw op is to be executed (true) or skipped (false).

      Note: The base implementation calls onFilter() for top-level/explicit paints only. To also filter encapsulated paints (e.g. Picture, TextBlob), clients may need to override the relevant methods (i.e. drawPicture, drawTextBlob).

    • getBaseLayerWidth

      public int getBaseLayerWidth()
      Description copied from class: Canvas
      Gets the size of the base or root layer in global canvas coordinates. The origin of the base layer is always (0,0). The area available for drawing may be smaller (due to clipping or saveLayer).
      Overrides:
      getBaseLayerWidth in class Canvas
      Returns:
      integral width of base layer
    • getBaseLayerHeight

      public int getBaseLayerHeight()
      Description copied from class: Canvas
      Gets the size of the base or root layer in global canvas coordinates. The origin of the base layer is always (0,0). The area available for drawing may be smaller (due to clipping or saveLayer).
      Overrides:
      getBaseLayerHeight in class Canvas
      Returns:
      integral height of base layer
    • getCommandContext

      public @Nullable Context getCommandContext()
      Description copied from class: Canvas
      Returns GPU context of the GPU surface associated with Canvas.
      Overrides:
      getCommandContext in class Canvas
      Returns:
      GPU context, if available; null otherwise
    • onDrawPaint

      protected void onDrawPaint(Paint paint)
      Overrides:
      onDrawPaint in class NWayCanvas
    • onDrawPoints

      protected void onDrawPoints(int mode, float[] pts, int offset, int count, Paint paint)
      Overrides:
      onDrawPoints in class NWayCanvas
    • onDrawLine

      protected void onDrawLine(float x0, float y0, float x1, float y1, int cap, float width, Paint paint)
      Overrides:
      onDrawLine in class NWayCanvas
    • onDrawRect

      protected void onDrawRect(Rect2fc r, Paint paint)
      Overrides:
      onDrawRect in class NWayCanvas
    • onDrawRRect

      protected void onDrawRRect(RRect rr, Paint paint)
      Overrides:
      onDrawRRect in class NWayCanvas
    • onDrawEllipse

      protected void onDrawEllipse(float cx, float cy, float rx, float ry, Paint paint)
      Overrides:
      onDrawEllipse in class NWayCanvas
    • onDrawArc

      protected void onDrawArc(float cx, float cy, float radius, float startAngle, float sweepAngle, int cap, float width, Paint paint)
      Overrides:
      onDrawArc in class NWayCanvas
    • onDrawPie

      protected void onDrawPie(float cx, float cy, float radius, float startAngle, float sweepAngle, Paint paint)
      Overrides:
      onDrawPie in class NWayCanvas
    • onDrawChord

      protected void onDrawChord(float cx, float cy, float radius, float startAngle, float sweepAngle, Paint paint)
      Overrides:
      onDrawChord in class NWayCanvas
    • onDrawImageRect

      protected void onDrawImageRect(@RawPtr @RawPtr Image image, Rect2fc src, Rect2fc dst, SamplingOptions sampling, Paint paint, int constraint)
      Overrides:
      onDrawImageRect in class NWayCanvas
    • onDrawTextBlob

      protected void onDrawTextBlob(TextBlob blob, float originX, float originY, Paint paint)
      Overrides:
      onDrawTextBlob in class NWayCanvas
    • onDrawGlyphRunList

      protected void onDrawGlyphRunList(GlyphRunList glyphRunList, Paint paint)
      Overrides:
      onDrawGlyphRunList in class NWayCanvas
    • onDrawVertices

      protected void onDrawVertices(Vertices vertices, Blender blender, Paint paint)
      Overrides:
      onDrawVertices in class NWayCanvas
    • onDrawEdgeAAQuad

      protected void onDrawEdgeAAQuad(Rect2fc rect, float[] clip, int edgeFlags, Paint paint)
      Overrides:
      onDrawEdgeAAQuad in class NWayCanvas
    • onDrawBlurredRRect

      protected void onDrawBlurredRRect(RRect rr, Paint paint, float blurRadius, float noiseAlpha)
      Overrides:
      onDrawBlurredRRect in class NWayCanvas
    • onNewSurface

      protected @Nullable Surface onNewSurface(ImageInfo info)
      Overrides:
      onNewSurface in class Canvas
    • onGetImageInfo

      protected @NonNull ImageInfo onGetImageInfo()
      Overrides:
      onGetImageInfo in class Canvas