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, mSizeFields 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 TypeMethodDescriptionintGets the size of the base or root layer in global canvas coordinates.intGets the size of the base or root layer in global canvas coordinates.@Nullable ContextReturns GPU context of the GPU surface associated with Canvas.protected voidonDrawArc(float cx, float cy, float radius, float startAngle, float sweepAngle, int cap, float width, Paint paint) protected voidonDrawBlurredRRect(RRect rr, Paint paint, float blurRadius, float noiseAlpha) protected voidonDrawChord(float cx, float cy, float radius, float startAngle, float sweepAngle, Paint paint) protected voidonDrawEdgeAAQuad(Rect2fc rect, float[] clip, int edgeFlags, Paint paint) protected voidonDrawEllipse(float cx, float cy, float rx, float ry, Paint paint) protected voidonDrawGlyphRunList(GlyphRunList glyphRunList, Paint paint) protected voidonDrawImageRect(@RawPtr Image image, Rect2fc src, Rect2fc dst, SamplingOptions sampling, Paint paint, int constraint) protected voidonDrawLine(float x0, float y0, float x1, float y1, int cap, float width, Paint paint) protected voidonDrawPaint(Paint paint) protected voidprotected voidonDrawPoints(int mode, float[] pts, int offset, int count, Paint paint) protected voidonDrawRect(Rect2fc r, Paint paint) protected voidonDrawRRect(RRect rr, Paint paint) protected voidonDrawTextBlob(TextBlob blob, float originX, float originY, Paint paint) protected voidonDrawVertices(Vertices vertices, Blender blender, Paint paint) abstract booleanCalled with the paint that will be used to draw the specified type.protected @NonNull ImageInfoprotected @Nullable SurfaceonNewSurface(ImageInfo info) Methods inherited from class icyllis.arc3d.sketch.NWayCanvas
addCanvas, close, didConcat, didScale, didSetMatrix, didTranslate, onClipRect, removeAll, removeCanvas, willRestore, willSaveMethods 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:CanvasGets 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:
getBaseLayerWidthin classCanvas- Returns:
- integral width of base layer
-
getBaseLayerHeight
public int getBaseLayerHeight()Description copied from class:CanvasGets 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:
getBaseLayerHeightin classCanvas- Returns:
- integral height of base layer
-
getCommandContext
Description copied from class:CanvasReturns GPU context of the GPU surface associated with Canvas.- Overrides:
getCommandContextin classCanvas- Returns:
- GPU context, if available; null otherwise
-
onDrawPaint
- Overrides:
onDrawPaintin classNWayCanvas
-
onDrawPoints
- Overrides:
onDrawPointsin classNWayCanvas
-
onDrawLine
protected void onDrawLine(float x0, float y0, float x1, float y1, int cap, float width, Paint paint) - Overrides:
onDrawLinein classNWayCanvas
-
onDrawRect
- Overrides:
onDrawRectin classNWayCanvas
-
onDrawRRect
- Overrides:
onDrawRRectin classNWayCanvas
-
onDrawEllipse
- Overrides:
onDrawEllipsein classNWayCanvas
-
onDrawArc
protected void onDrawArc(float cx, float cy, float radius, float startAngle, float sweepAngle, int cap, float width, Paint paint) - Overrides:
onDrawArcin classNWayCanvas
-
onDrawPie
protected void onDrawPie(float cx, float cy, float radius, float startAngle, float sweepAngle, Paint paint) - Overrides:
onDrawPiein classNWayCanvas
-
onDrawChord
protected void onDrawChord(float cx, float cy, float radius, float startAngle, float sweepAngle, Paint paint) - Overrides:
onDrawChordin classNWayCanvas
-
onDrawImageRect
protected void onDrawImageRect(@RawPtr @RawPtr Image image, Rect2fc src, Rect2fc dst, SamplingOptions sampling, Paint paint, int constraint) - Overrides:
onDrawImageRectin classNWayCanvas
-
onDrawTextBlob
- Overrides:
onDrawTextBlobin classNWayCanvas
-
onDrawGlyphRunList
- Overrides:
onDrawGlyphRunListin classNWayCanvas
-
onDrawVertices
- Overrides:
onDrawVerticesin classNWayCanvas
-
onDrawEdgeAAQuad
- Overrides:
onDrawEdgeAAQuadin classNWayCanvas
-
onDrawBlurredRRect
- Overrides:
onDrawBlurredRRectin classNWayCanvas
-
onNewSurface
- Overrides:
onNewSurfacein classCanvas
-
onGetImageInfo
- Overrides:
onGetImageInfoin classCanvas
-