Package icyllis.arc3d.sketch
Class PaintFilterCanvas
java.lang.Object
icyllis.arc3d.sketch.Canvas
icyllis.arc3d.sketch.NoDrawCanvas
icyllis.arc3d.sketch.NWayCanvas
icyllis.arc3d.sketch.PaintFilterCanvas
- All Implemented Interfaces:
AutoCloseable
-
Nested Class Summary
Nested classes/interfaces inherited from class icyllis.arc3d.sketch.Canvas
Canvas.PointMode, Canvas.SaveLayerFlag, Canvas.SrcRectConstraint
-
Field Summary
Fields inherited from class icyllis.arc3d.sketch.NWayCanvas
mList, mSize
Fields inherited from class icyllis.arc3d.sketch.Canvas
F16_COLOR_TYPE_SAVE_LAYER_FLAG, FULL_LAYER_SAVE_LAYER_STRATEGY, INIT_WITH_PREVIOUS_SAVE_LAYER_FLAG, NO_LAYER_SAVE_LAYER_STRATEGY, POINT_MODE_LINES, POINT_MODE_POINTS, POINT_MODE_POLYGON, QUAD_AA_FLAG_BOTTOM, QUAD_AA_FLAG_LEFT, QUAD_AA_FLAG_RIGHT, QUAD_AA_FLAG_TOP, QUAD_AA_FLAGS_ALL, QUAD_AA_FLAGS_NONE, SRC_RECT_CONSTRAINT_FAST, SRC_RECT_CONSTRAINT_STRICT
-
Constructor Summary
ConstructorsConstructorDescriptionPaintFilterCanvas
(@RawPtr @NonNull Canvas canvas) The new PaintFilterCanvas is configured for forwarding to the specified canvas. -
Method Summary
Modifier and TypeMethodDescriptionint
Gets the size of the base or root layer in global canvas coordinates.int
Gets the size of the base or root layer in global canvas coordinates.@Nullable Context
Returns GPU context of the GPU surface associated with Canvas.protected void
onDrawArc
(float cx, float cy, float radius, float startAngle, float sweepAngle, int cap, float width, Paint paint) protected void
onDrawBlurredRRect
(RRect rr, Paint paint, float blurRadius, float noiseAlpha) protected void
onDrawChord
(float cx, float cy, float radius, float startAngle, float sweepAngle, Paint paint) protected void
onDrawEdgeAAQuad
(Rect2fc rect, float[] clip, int edgeFlags, Paint paint) protected void
onDrawEllipse
(float cx, float cy, float rx, float ry, Paint paint) protected void
onDrawGlyphRunList
(GlyphRunList glyphRunList, Paint paint) protected void
onDrawImageRect
(@RawPtr Image image, Rect2fc src, Rect2fc dst, SamplingOptions sampling, Paint paint, int constraint) protected void
onDrawLine
(float x0, float y0, float x1, float y1, int cap, float width, Paint paint) protected void
onDrawPaint
(Paint paint) protected void
protected void
onDrawPoints
(int mode, float[] pts, int offset, int count, Paint paint) protected void
onDrawRect
(Rect2fc r, Paint paint) protected void
onDrawRRect
(RRect rr, Paint paint) protected void
onDrawTextBlob
(TextBlob blob, float originX, float originY, Paint paint) protected void
onDrawVertices
(Vertices vertices, Blender blender, Paint paint) abstract boolean
Called with the paint that will be used to draw the specified type.protected @NonNull ImageInfo
protected @Nullable Surface
onNewSurface
(ImageInfo info) Methods inherited from class icyllis.arc3d.sketch.NWayCanvas
addCanvas, close, didConcat, didScale, didSetMatrix, didTranslate, onClipRect, removeAll, removeCanvas, willRestore, willSave
Methods inherited from class icyllis.arc3d.sketch.Canvas
clear, clear, clipRect, clipRect, clipRect, clipRect, clipRect, clipRect, clipRect, clipRect, clipRect, concat, concat, concat, didRestore, discard, drawArc, drawArc, drawBlurredRRect, drawChord, drawCircle, drawColor, drawColor, drawColor, drawColor, drawEdgeAAQuad, drawEllipse, drawGlyphs, drawImage, drawImageRect, drawImageRect, drawLine, drawLine, drawPaint, drawPie, drawPoint, drawPoint, drawPoints, drawRect, drawRect, drawRect, drawRRect, drawTextBlob, drawVertices, getDeviceClipBounds, getImageInfo, getLocalClipBounds, getLocalToDevice, getLocalToDevice, getRootDevice, getSaveCount, getSaveLayerStrategy, getSurface, isClipEmpty, isClipRect, makeSurface, onDiscard, quickReject, quickReject, resetMatrix, restore, restoreToCount, rotate, rotate, save, saveLayer, saveLayer, saveLayer, saveLayer, saveLayerAlpha, saveLayerAlpha, scale, scale, scale, setMatrix, shear, shear, translate, translate
-
Constructor Details
-
PaintFilterCanvas
The new PaintFilterCanvas is configured for forwarding to the specified canvas. Also copies the target canvas matrix and clip bounds.
-
-
Method Details
-
onFilter
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 classCanvas
- 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 classCanvas
- Returns:
- integral height of base layer
-
getCommandContext
Description copied from class:Canvas
Returns GPU context of the GPU surface associated with Canvas.- Overrides:
getCommandContext
in classCanvas
- Returns:
- GPU context, if available; null otherwise
-
onDrawPaint
- Overrides:
onDrawPaint
in classNWayCanvas
-
onDrawPoints
- Overrides:
onDrawPoints
in classNWayCanvas
-
onDrawLine
protected void onDrawLine(float x0, float y0, float x1, float y1, int cap, float width, Paint paint) - Overrides:
onDrawLine
in classNWayCanvas
-
onDrawRect
- Overrides:
onDrawRect
in classNWayCanvas
-
onDrawRRect
- Overrides:
onDrawRRect
in classNWayCanvas
-
onDrawEllipse
- Overrides:
onDrawEllipse
in classNWayCanvas
-
onDrawArc
protected void onDrawArc(float cx, float cy, float radius, float startAngle, float sweepAngle, int cap, float width, Paint paint) - Overrides:
onDrawArc
in classNWayCanvas
-
onDrawPie
protected void onDrawPie(float cx, float cy, float radius, float startAngle, float sweepAngle, Paint paint) - Overrides:
onDrawPie
in classNWayCanvas
-
onDrawChord
protected void onDrawChord(float cx, float cy, float radius, float startAngle, float sweepAngle, Paint paint) - Overrides:
onDrawChord
in classNWayCanvas
-
onDrawImageRect
protected void onDrawImageRect(@RawPtr @RawPtr Image image, Rect2fc src, Rect2fc dst, SamplingOptions sampling, Paint paint, int constraint) - Overrides:
onDrawImageRect
in classNWayCanvas
-
onDrawTextBlob
- Overrides:
onDrawTextBlob
in classNWayCanvas
-
onDrawGlyphRunList
- Overrides:
onDrawGlyphRunList
in classNWayCanvas
-
onDrawVertices
- Overrides:
onDrawVertices
in classNWayCanvas
-
onDrawEdgeAAQuad
- Overrides:
onDrawEdgeAAQuad
in classNWayCanvas
-
onDrawBlurredRRect
- Overrides:
onDrawBlurredRRect
in classNWayCanvas
-
onNewSurface
- Overrides:
onNewSurface
in classCanvas
-
onGetImageInfo
- Overrides:
onGetImageInfo
in classCanvas
-