Class Canvas
- java.lang.Object
-
- io.github.humbleui.skija.impl.Native
-
- io.github.humbleui.skija.impl.Managed
-
- io.github.humbleui.skija.Canvas
-
- All Implemented Interfaces:
java.lang.AutoCloseable
- Direct Known Subclasses:
PaintFilterCanvas
public class Canvas extends Managed
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classCanvas._FinalizerHolder-
Nested classes/interfaces inherited from class io.github.humbleui.skija.impl.Managed
Managed.CleanerThunk
-
-
Field Summary
Fields Modifier and Type Field Description java.lang.Object_owner-
Fields inherited from class io.github.humbleui.skija.impl.Managed
_cleanable
-
-
Constructor Summary
Constructors Constructor Description Canvas(long ptr, boolean managed, java.lang.Object owner)Canvas(@NotNull Bitmap bitmap)Constructs a canvas that draws into bitmap.Canvas(@NotNull Bitmap bitmap, @NotNull SurfaceProps surfaceProps)Constructs a canvas that draws into bitmap.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static void_nClear(long ptr, int color)static void_nClipPath(long ptr, long nativePath, int mode, boolean antiAlias)static void_nClipRect(long ptr, float left, float top, float right, float bottom, int mode, boolean antiAlias)static void_nClipRegion(long ptr, long nativeRegion, int mode)static void_nClipRRect(long ptr, float left, float top, float right, float bottom, float[] radii, int mode, boolean antiAlias)static void_nConcat(long ptr, float[] matrix)static void_nConcat44(long ptr, float[] matrix)static void_nDrawArc(long ptr, float left, float top, float right, float bottom, float startAngle, float sweepAngle, boolean includeCenter, long paintPtr)static void_nDrawColor(long ptr, int color, int blendMode)static void_nDrawColor4f(long ptr, float r, float g, float b, float a, int blendMode)static void_nDrawDrawable(long ptr, long drawablePrt, float[] matrix)static void_nDrawDRRect(long ptr, float ol, float ot, float or, float ob, float[] oradii, float il, float it, float ir, float ib, float[] iradii, long paintPtr)static void_nDrawImageNine(long ptr, long nativeImage, int cl, int ct, int cr, int cb, float dl, float dt, float dr, float db, int filterMode, long paintPtr)static void_nDrawImageRect(long ptr, long nativeImage, float sl, float st, float sr, float sb, float dl, float dt, float dr, float db, long samplingMode, long paintPtr, boolean strict)static void_nDrawLine(long ptr, float x0, float y0, float x1, float y1, long paintPtr)static void_nDrawOval(long ptr, float left, float top, float right, float bottom, long paint)static void_nDrawPaint(long ptr, long paintPtr)static void_nDrawPatch(long ptr, float[] cubics, int[] colors, float[] texCoords, int blendMode, long paintPtr)static void_nDrawPath(long ptr, long nativePath, long paintPtr)static void_nDrawPicture(long ptr, long picturePtr, float[] matrix, long paintPtr)static void_nDrawPoint(long ptr, float x, float y, long paintPtr)static void_nDrawPoints(long ptr, int mode, float[] coords, long paintPtr)static void_nDrawRect(long ptr, float left, float top, float right, float bottom, long paintPtr)static void_nDrawRegion(long ptr, long nativeRegion, long paintPtr)static void_nDrawRRect(long ptr, float left, float top, float right, float bottom, float[] radii, long paintPtr)static void_nDrawString(long ptr, java.lang.String string, float x, float y, long font, long paint)static void_nDrawTextBlob(long ptr, long blob, float x, float y, long paint)static void_nDrawVertices(long ptr, int verticesMode, float[] cubics, int[] colors, float[] texCoords, short[] indices, int blendMode, long paintPtr)static SurfaceProps_nGetBaseProps(long ptr)static long_nGetFinalizer()static float[]_nGetLocalToDevice(long ptr)static int_nGetSaveCount(long ptr)static long_nGetSurface(long ptr)static SurfaceProps_nGetTopProps(long ptr)static long_nMakeFromBitmap(long bitmapPtr, int flags, int pixelGeometry)static boolean_nQuickReject(long ptr, float left, float top, float right, float bottom)static boolean_nQuickRejectPath(long ptr, long pathPtr)static boolean_nReadPixels(long ptr, long bitmapPtr, int srcX, int srcY)static void_nResetMatrix(long ptr)static void_nRestore(long ptr)static void_nRestoreToCount(long ptr, int saveCount)static int_nSave(long ptr)static int_nSaveLayer(long ptr, long paintPtr)static int_nSaveLayerAlpha(long ptr, int alpha)static int_nSaveLayerAlphaRect(long ptr, float left, float top, float right, float bottom, int alpha)static int_nSaveLayerRec(long ptr, long paintPtr, long backdropPtr, int flags)static int_nSaveLayerRecRect(long ptr, float left, float top, float right, float bottom, long paintPtr, long backdropPtr, int flags)static int_nSaveLayerRect(long ptr, float left, float top, float right, float bottom, long paintPtr)static void_nSetMatrix(long ptr, float[] matrix)static void_nSetMatrix44(long ptr, float[] matrix)static boolean_nWritePixels(long ptr, long bitmapPtr, int x, int y)@NotNull Canvasclear(int color)@NotNull CanvasclipPath(@NotNull Path p)@NotNull CanvasclipPath(@NotNull Path p, boolean antiAlias)@NotNull CanvasclipPath(@NotNull Path p, @NotNull ClipMode mode)@NotNull CanvasclipPath(@NotNull Path p, @NotNull ClipMode mode, boolean antiAlias)@NotNull CanvasclipRect(@NotNull io.github.humbleui.types.Rect r)@NotNull CanvasclipRect(@NotNull io.github.humbleui.types.Rect r, boolean antiAlias)@NotNull CanvasclipRect(@NotNull io.github.humbleui.types.Rect r, @NotNull ClipMode mode)@NotNull CanvasclipRect(@NotNull io.github.humbleui.types.Rect r, @NotNull ClipMode mode, boolean antiAlias)@NotNull CanvasclipRegion(@NotNull Region r)@NotNull CanvasclipRegion(@NotNull Region r, @NotNull ClipMode mode)@NotNull CanvasclipRRect(@NotNull io.github.humbleui.types.RRect r)@NotNull CanvasclipRRect(@NotNull io.github.humbleui.types.RRect r, boolean antiAlias)@NotNull CanvasclipRRect(@NotNull io.github.humbleui.types.RRect r, @NotNull ClipMode mode)@NotNull CanvasclipRRect(@NotNull io.github.humbleui.types.RRect r, @NotNull ClipMode mode, boolean antiAlias)@NotNull Canvasconcat(@NotNull Matrix33 matrix)@NotNull Canvasconcat(@NotNull Matrix44 matrix)@NotNull CanvasdrawArc(float left, float top, float right, float bottom, float startAngle, float sweepAngle, boolean includeCenter, @NotNull Paint paint)@NotNull CanvasdrawCircle(float x, float y, float radius, @NotNull Paint paint)@NotNull CanvasdrawColor(int color)@NotNull CanvasdrawColor(int color, @NotNull BlendMode mode)@NotNull CanvasdrawColor(@NotNull Color4f color)@NotNull CanvasdrawColor(@NotNull Color4f color, @NotNull BlendMode mode)@NotNull CanvasdrawDrawable(@NotNull Drawable drawable)Draws Drawable drawable using clip and matrix.@NotNull CanvasdrawDrawable(@NotNull Drawable drawable, float x, float y)Draws Drawable drawable using clip and matrix, offset by (x, y).@NotNull CanvasdrawDrawable(@NotNull Drawable drawable, @Nullable Matrix33 matrix)Draws Drawable drawable using clip and matrix, concatenated with optional matrix.@NotNull CanvasdrawDRRect(@NotNull io.github.humbleui.types.RRect outer, @NotNull io.github.humbleui.types.RRect inner, @NotNull Paint paint)@NotNull CanvasdrawImage(@NotNull Image image, float left, float top)@NotNull CanvasdrawImage(@NotNull Image image, float left, float top, @Nullable Paint paint)@NotNull CanvasdrawImageNine(@NotNull Image image, @NotNull io.github.humbleui.types.IRect center, @NotNull io.github.humbleui.types.Rect dst, @NotNull FilterMode filterMode, @Nullable Paint paint)@NotNull CanvasdrawImageRect(@NotNull Image image, @NotNull io.github.humbleui.types.Rect dst)@NotNull CanvasdrawImageRect(@NotNull Image image, @NotNull io.github.humbleui.types.Rect src, @NotNull io.github.humbleui.types.Rect dst)@NotNull CanvasdrawImageRect(@NotNull Image image, @NotNull io.github.humbleui.types.Rect src, @NotNull io.github.humbleui.types.Rect dst, @NotNull SamplingMode samplingMode, @Nullable Paint paint, boolean strict)@NotNull CanvasdrawImageRect(@NotNull Image image, @NotNull io.github.humbleui.types.Rect src, @NotNull io.github.humbleui.types.Rect dst, @Nullable Paint paint)@NotNull CanvasdrawImageRect(@NotNull Image image, @NotNull io.github.humbleui.types.Rect src, @NotNull io.github.humbleui.types.Rect dst, @Nullable Paint paint, boolean strict)@NotNull CanvasdrawImageRect(@NotNull Image image, @NotNull io.github.humbleui.types.Rect dst, @Nullable Paint paint)@NotNull CanvasdrawLine(float x0, float y0, float x1, float y1, @NotNull Paint paint)@NotNull CanvasdrawLines(@org.jetbrains.annotations.NotNull float[] coords, @NotNull Paint paint)Draws pts using clip, Matrix and Paint paint.@NotNull CanvasdrawLines(@NotNull io.github.humbleui.types.Point[] coords, @NotNull Paint paint)Draws pts using clip, Matrix and Paint paint.@NotNull CanvasdrawOval(@NotNull io.github.humbleui.types.Rect r, @NotNull Paint paint)@NotNull CanvasdrawPaint(@NotNull Paint paint)@NotNull CanvasdrawPatch(@NotNull io.github.humbleui.types.Point[] cubics, @org.jetbrains.annotations.NotNull int[] colors, @NotNull Paint paint)Draws a Coons patch: the interpolation of four cubics with shared corners, associating a color, and optionally a texture SkPoint, with each corner.@NotNull CanvasdrawPatch(@NotNull io.github.humbleui.types.Point[] cubics, @org.jetbrains.annotations.NotNull int[] colors, @Nullable io.github.humbleui.types.Point[] texCoords, @NotNull BlendMode mode, @NotNull Paint paint)Draws a Coons patch: the interpolation of four cubics with shared corners, associating a color, and optionally a texture SkPoint, with each corner.@NotNull CanvasdrawPatch(@NotNull io.github.humbleui.types.Point[] cubics, @org.jetbrains.annotations.NotNull int[] colors, @Nullable io.github.humbleui.types.Point[] texCoords, @NotNull Paint paint)Draws a Coons patch: the interpolation of four cubics with shared corners, associating a color, and optionally a texture SkPoint, with each corner.@NotNull CanvasdrawPath(@NotNull Path path, @NotNull Paint paint)@NotNull CanvasdrawPicture(@NotNull Picture picture)@NotNull CanvasdrawPicture(@NotNull Picture picture, @Nullable Matrix33 matrix, @Nullable Paint paint)@NotNull CanvasdrawPoint(float x, float y, @NotNull Paint paint)@NotNull CanvasdrawPoints(@org.jetbrains.annotations.NotNull float[] coords, @NotNull Paint paint)Draws pts using clip, Matrix and Paint paint.@NotNull CanvasdrawPoints(@NotNull io.github.humbleui.types.Point[] coords, @NotNull Paint paint)Draws pts using clip, Matrix and Paint paint.@NotNull CanvasdrawPolygon(@org.jetbrains.annotations.NotNull float[] coords, @NotNull Paint paint)Draws pts using clip, Matrix and Paint paint.@NotNull CanvasdrawPolygon(@NotNull io.github.humbleui.types.Point[] coords, @NotNull Paint paint)Draws pts using clip, Matrix and Paint paint.@NotNull CanvasdrawRect(@NotNull io.github.humbleui.types.Rect r, @NotNull Paint paint)@NotNull CanvasdrawRectShadow(@NotNull io.github.humbleui.types.Rect r, float dx, float dy, float blur, float spread, int color)@NotNull CanvasdrawRectShadow(@NotNull io.github.humbleui.types.Rect r, float dx, float dy, float blur, int color)@NotNull CanvasdrawRectShadowNoclip(@NotNull io.github.humbleui.types.Rect r, float dx, float dy, float blur, float spread, int color)@NotNull CanvasdrawRegion(@NotNull Region r, @NotNull Paint paint)@NotNull CanvasdrawRRect(@NotNull io.github.humbleui.types.RRect r, @NotNull Paint paint)@NotNull CanvasdrawString(@NotNull java.lang.String s, float x, float y, Font font, @NotNull Paint paint)@NotNull CanvasdrawTextBlob(@NotNull TextBlob blob, float x, float y, @NotNull Paint paint)@NotNull CanvasdrawTextLine(@NotNull TextLine line, float x, float y, @NotNull Paint paint)@NotNull CanvasdrawTriangleFan(@NotNull io.github.humbleui.types.Point[] positions, @org.jetbrains.annotations.Nullable int[] colors, @NotNull Paint paint)Draws a triangle fan mesh, using clip and Matrix.@NotNull CanvasdrawTriangleFan(@NotNull io.github.humbleui.types.Point[] positions, @org.jetbrains.annotations.Nullable int[] colors, @Nullable io.github.humbleui.types.Point[] texCoords, @org.jetbrains.annotations.Nullable short[] indices, @NotNull BlendMode mode, @NotNull Paint paint)Draws a triangle fan mesh, using clip and Matrix.@NotNull CanvasdrawTriangleFan(@NotNull io.github.humbleui.types.Point[] positions, @org.jetbrains.annotations.Nullable int[] colors, @Nullable io.github.humbleui.types.Point[] texCoords, @org.jetbrains.annotations.Nullable short[] indices, @NotNull Paint paint)Draws a triangle fan mesh, using clip and Matrix.@NotNull CanvasdrawTriangles(@NotNull io.github.humbleui.types.Point[] positions, @org.jetbrains.annotations.Nullable int[] colors, @NotNull Paint paint)Draws a triangle mesh, using clip and Matrix.@NotNull CanvasdrawTriangles(@NotNull io.github.humbleui.types.Point[] positions, @org.jetbrains.annotations.Nullable int[] colors, @Nullable io.github.humbleui.types.Point[] texCoords, @org.jetbrains.annotations.Nullable short[] indices, @NotNull BlendMode mode, @NotNull Paint paint)Draws a triangle mesh, using clip and Matrix.@NotNull CanvasdrawTriangles(@NotNull io.github.humbleui.types.Point[] positions, @org.jetbrains.annotations.Nullable int[] colors, @Nullable io.github.humbleui.types.Point[] texCoords, @org.jetbrains.annotations.Nullable short[] indices, @NotNull Paint paint)Draws a triangle mesh, using clip and Matrix.@NotNull CanvasdrawTriangleStrip(@NotNull io.github.humbleui.types.Point[] positions, @org.jetbrains.annotations.Nullable int[] colors, @NotNull Paint paint)Draws a triangle strip mesh, using clip and Matrix.@NotNull CanvasdrawTriangleStrip(@NotNull io.github.humbleui.types.Point[] positions, @org.jetbrains.annotations.Nullable int[] colors, @Nullable io.github.humbleui.types.Point[] texCoords, @org.jetbrains.annotations.Nullable short[] indices, @NotNull BlendMode mode, @NotNull Paint paint)Draws a triangle strip mesh, using clip and Matrix.@NotNull CanvasdrawTriangleStrip(@NotNull io.github.humbleui.types.Point[] positions, @org.jetbrains.annotations.Nullable int[] colors, @Nullable io.github.humbleui.types.Point[] texCoords, @org.jetbrains.annotations.Nullable short[] indices, @NotNull Paint paint)Draws a triangle strip mesh, using clip and Matrix.@NotNull SurfacePropsgetBaseProps()Returns the SurfaceProps associated with the canvas (i.e., at the base of the layer stack).@NotNull Matrix44getLocalToDevice()Returns the total transformation matrix for the canvas.@NotNull Matrix33getLocalToDeviceAsMatrix33()intgetSaveCount()@Nullable SurfacegetSurface()@NotNull SurfacePropsgetTopProps()Returns the SurfaceProps associated with the canvas that are currently active (i.e., at the top of the layer stack).@org.jetbrains.annotations.NotNull booleanquickReject(@NotNull Path path)@org.jetbrains.annotations.NotNull booleanquickReject(@NotNull io.github.humbleui.types.Rect r)booleanreadPixels(@NotNull Bitmap bitmap, int srcX, int srcY)Copies Rect of pixels from Canvas into bitmap.@NotNull CanvasresetMatrix()Sets SkMatrix to the identity matrix.@NotNull Canvasrestore()@NotNull CanvasrestoreToCount(int saveCount)@NotNull Canvasrotate(float deg)intsave()intsaveLayer(float left, float top, float right, float bottom, @Nullable Paint paint)intsaveLayer(@NotNull SaveLayerRec layerRec)Saves matrix and clip, and allocates Bitmap for subsequent drawing.intsaveLayer(@Nullable io.github.humbleui.types.Rect bounds, @Nullable Paint paint)Saves Matrix and clip, and allocates a Bitmap for subsequent drawing.intsaveLayerAlpha(@Nullable io.github.humbleui.types.Rect bounds, int alpha)Saves matrix and clip, and allocates bitmap for subsequent drawing.@NotNull Canvasscale(float sx, float sy)@NotNull CanvassetMatrix(@NotNull Matrix33 matrix)Replaces Matrix with matrix.@NotNull CanvassetMatrix(@NotNull Matrix44 matrix)Replaces Matrix with matrix.@NotNull Canvasskew(float sx, float sy)@NotNull Canvastranslate(float dx, float dy)booleanwritePixels(@NotNull Bitmap bitmap, int x, int y)Copies Rect from pixels to Canvas.-
Methods inherited from class io.github.humbleui.skija.impl.Managed
_nInvokeFinalizer, close, isClosed
-
-
-
-
Constructor Detail
-
Canvas
@Internal public Canvas(long ptr, boolean managed, java.lang.Object owner)
-
Canvas
public Canvas(@NotNull @NotNull Bitmap bitmap)Constructs a canvas that draws into bitmap. Sets default pixel geometry in constructed Surface.
Bitmap is copied so that subsequently editing bitmap will not affect constructed Canvas.
May be deprecated in the future.
- Parameters:
bitmap- width, height, ColorType, ColorAlphaType, and pixel storage of raster surface- See Also:
- https://fiddle.skia.org/c/@Canvas_copy_const_SkBitmap
-
Canvas
public Canvas(@NotNull @NotNull Bitmap bitmap, @NotNull @NotNull SurfaceProps surfaceProps)Constructs a canvas that draws into bitmap. Use props to match the device characteristics, like LCD striping.
Bitmap is copied so that subsequently editing bitmap will not affect constructed Canvas.
- Parameters:
bitmap- width, height, ColorType, ColorAlphaType, and pixel storage of raster surfacesurfaceProps- order and orientation of RGB striping; and whether to use device independent fonts- See Also:
- https://fiddle.skia.org/c/@Canvas_const_SkBitmap_const_SkSurfaceProps
-
-
Method Detail
-
getBaseProps
@NotNull public @NotNull SurfaceProps getBaseProps()
Returns the SurfaceProps associated with the canvas (i.e., at the base of the layer stack).- Returns:
- SurfaceProps
-
getTopProps
@NotNull public @NotNull SurfaceProps getTopProps()
Returns the SurfaceProps associated with the canvas that are currently active (i.e., at the top of the layer stack). This can differ from {getBaseProps()} depending on the flags passed to saveLayer.- Returns:
- SurfaceProps active in the current/top layer
-
getSurface
@Nullable public @Nullable Surface getSurface()
-
drawPoint
@NotNull @Contract("_, _, _ -> this") public @NotNull Canvas drawPoint(float x, float y, @NotNull @NotNull Paint paint)
-
drawPoints
@NotNull @Contract("_, _ -> this") public @NotNull Canvas drawPoints(@NotNull @NotNull io.github.humbleui.types.Point[] coords, @NotNull @NotNull Paint paint)Draws pts using clip, Matrix and Paint paint.
The shape of point drawn depends on paint PaintStrokeCap. If paint is set to
PaintStrokeCap.ROUND, each point draws a circle of diameter Paint stroke width. If paint is set toPaintStrokeCap.SQUAREorPaintStrokeCap.BUTT, each point draws a square of width and height Paint stroke width.Each line segment respects paint PaintStrokeCap and Paint stroke width. PaintMode is ignored, as if were set to
PaintMode.STROKE.Always draws each element one at a time; is not affected by PaintStrokeJoin, and unlike drawPath(), does not create a mask from all points and lines before drawing.
- Parameters:
coords- array of points to drawpaint- stroke, blend, color, and so on, used to draw- See Also:
- https://fiddle.skia.org/c/@Canvas_drawPoints
-
drawPoints
@NotNull @Contract("_, _ -> this") public @NotNull Canvas drawPoints(@NotNull @org.jetbrains.annotations.NotNull float[] coords, @NotNull @NotNull Paint paint)Draws pts using clip, Matrix and Paint paint.
The shape of point drawn depends on paint PaintStrokeCap. If paint is set to
PaintStrokeCap.ROUND, each point draws a circle of diameter Paint stroke width. If paint is set toPaintStrokeCap.SQUAREorPaintStrokeCap.BUTT, each point draws a square of width and height Paint stroke width.Each line segment respects paint PaintStrokeCap and Paint stroke width. PaintMode is ignored, as if were set to
PaintMode.STROKE.Always draws each element one at a time; is not affected by PaintStrokeJoin, and unlike drawPath(), does not create a mask from all points and lines before drawing.
- Parameters:
coords- array of points to drawpaint- stroke, blend, color, and so on, used to draw- See Also:
- https://fiddle.skia.org/c/@Canvas_drawPoints
-
drawLines
@NotNull @Contract("_, _ -> this") public @NotNull Canvas drawLines(@NotNull @NotNull io.github.humbleui.types.Point[] coords, @NotNull @NotNull Paint paint)Draws pts using clip, Matrix and Paint paint.
Each pair of points draws a line segment. One line is drawn for every two points; each point is used once. If count is odd, the final point is ignored.
Each line segment respects paint PaintStrokeCap and Paint stroke width. PaintMode is ignored, as if were set to
PaintMode.STROKE.Always draws each element one at a time; is not affected by PaintStrokeJoin, and unlike drawPath(), does not create a mask from all points and lines before drawing.
- Parameters:
coords- array of points to drawpaint- stroke, blend, color, and so on, used to draw- See Also:
- https://fiddle.skia.org/c/@Canvas_drawPoints
-
drawLines
@NotNull @Contract("_, _ -> this") public @NotNull Canvas drawLines(@NotNull @org.jetbrains.annotations.NotNull float[] coords, @NotNull @NotNull Paint paint)Draws pts using clip, Matrix and Paint paint.
Each pair of points draws a line segment. One line is drawn for every two points; each point is used once. If count is odd, the final point is ignored.
Each line segment respects paint PaintStrokeCap and Paint stroke width. PaintMode is ignored, as if were set to
PaintMode.STROKE.Always draws each element one at a time; is not affected by PaintStrokeJoin, and unlike drawPath(), does not create a mask from all points and lines before drawing.
- Parameters:
coords- array of points to drawpaint- stroke, blend, color, and so on, used to draw- See Also:
- https://fiddle.skia.org/c/@Canvas_drawPoints
-
drawPolygon
@NotNull @Contract("_, _ -> this") public @NotNull Canvas drawPolygon(@NotNull @NotNull io.github.humbleui.types.Point[] coords, @NotNull @NotNull Paint paint)Draws pts using clip, Matrix and Paint paint.
Each adjacent pair of points draws a line segment. count minus one lines are drawn; the first and last point are used once.
Each line segment respects paint PaintStrokeCap and Paint stroke width. PaintMode is ignored, as if were set to
PaintMode.STROKE.Always draws each element one at a time; is not affected by PaintStrokeJoin, and unlike drawPath(), does not create a mask from all points and lines before drawing.
- Parameters:
coords- array of points to drawpaint- stroke, blend, color, and so on, used to draw- See Also:
- https://fiddle.skia.org/c/@Canvas_drawPoints
-
drawPolygon
@NotNull @Contract("_, _ -> this") public @NotNull Canvas drawPolygon(@NotNull @org.jetbrains.annotations.NotNull float[] coords, @NotNull @NotNull Paint paint)Draws pts using clip, Matrix and Paint paint.
Each adjacent pair of points draws a line segment. count minus one lines are drawn; the first and last point are used once.
Each line segment respects paint PaintStrokeCap and Paint stroke width. PaintMode is ignored, as if were set to
PaintMode.STROKE.Always draws each element one at a time; is not affected by PaintStrokeJoin, and unlike drawPath(), does not create a mask from all points and lines before drawing.
- Parameters:
coords- array of points to drawpaint- stroke, blend, color, and so on, used to draw- See Also:
- https://fiddle.skia.org/c/@Canvas_drawPoints
-
drawLine
@NotNull @Contract("_, _, _, _, _ -> this") public @NotNull Canvas drawLine(float x0, float y0, float x1, float y1, @NotNull @NotNull Paint paint)
-
drawArc
@NotNull @Contract("_, _, _, _, _, _, _, _ -> this") public @NotNull Canvas drawArc(float left, float top, float right, float bottom, float startAngle, float sweepAngle, boolean includeCenter, @NotNull @NotNull Paint paint)
-
drawRect
@NotNull @Contract("_, _ -> this") public @NotNull Canvas drawRect(@NotNull @NotNull io.github.humbleui.types.Rect r, @NotNull @NotNull Paint paint)
-
drawOval
@NotNull @Contract("_, _ -> this") public @NotNull Canvas drawOval(@NotNull @NotNull io.github.humbleui.types.Rect r, @NotNull @NotNull Paint paint)
-
drawCircle
@NotNull @Contract("_, _, _, _ -> this") public @NotNull Canvas drawCircle(float x, float y, float radius, @NotNull @NotNull Paint paint)
-
drawRRect
@NotNull @Contract("_, _ -> this") public @NotNull Canvas drawRRect(@NotNull @NotNull io.github.humbleui.types.RRect r, @NotNull @NotNull Paint paint)
-
quickReject
@NotNull @Contract("_ -> this") public @org.jetbrains.annotations.NotNull boolean quickReject(@NotNull @NotNull io.github.humbleui.types.Rect r)
-
quickReject
@NotNull @Contract("_ -> this") public @org.jetbrains.annotations.NotNull boolean quickReject(@NotNull @NotNull Path path)
-
drawDRRect
@NotNull @Contract("_, _, _ -> this") public @NotNull Canvas drawDRRect(@NotNull @NotNull io.github.humbleui.types.RRect outer, @NotNull @NotNull io.github.humbleui.types.RRect inner, @NotNull @NotNull Paint paint)
-
drawRectShadow
@NotNull @Contract("_, _ -> this") public @NotNull Canvas drawRectShadow(@NotNull @NotNull io.github.humbleui.types.Rect r, float dx, float dy, float blur, int color)
-
drawRectShadow
@NotNull @Contract("_, _ -> this") public @NotNull Canvas drawRectShadow(@NotNull @NotNull io.github.humbleui.types.Rect r, float dx, float dy, float blur, float spread, int color)
-
drawRectShadowNoclip
@NotNull @Contract("_, _ -> this") public @NotNull Canvas drawRectShadowNoclip(@NotNull @NotNull io.github.humbleui.types.Rect r, float dx, float dy, float blur, float spread, int color)
-
drawPath
@NotNull @Contract("_, _ -> this") public @NotNull Canvas drawPath(@NotNull @NotNull Path path, @NotNull @NotNull Paint paint)
-
drawImage
@NotNull @Contract("_, _, _ -> this") public @NotNull Canvas drawImage(@NotNull @NotNull Image image, float left, float top)
-
drawImage
@NotNull @Contract("_, _, _, _ -> this") public @NotNull Canvas drawImage(@NotNull @NotNull Image image, float left, float top, @Nullable @Nullable Paint paint)
-
drawImageRect
@NotNull @Contract("_, _ -> this") public @NotNull Canvas drawImageRect(@NotNull @NotNull Image image, @NotNull @NotNull io.github.humbleui.types.Rect dst)
-
drawImageRect
@NotNull @Contract("_, _, _ -> this") public @NotNull Canvas drawImageRect(@NotNull @NotNull Image image, @NotNull @NotNull io.github.humbleui.types.Rect dst, @Nullable @Nullable Paint paint)
-
drawImageRect
@NotNull @Contract("_, _, _, _ -> this") public @NotNull Canvas drawImageRect(@NotNull @NotNull Image image, @NotNull @NotNull io.github.humbleui.types.Rect src, @NotNull @NotNull io.github.humbleui.types.Rect dst)
-
drawImageRect
@NotNull @Contract("_, _, _, _ -> this") public @NotNull Canvas drawImageRect(@NotNull @NotNull Image image, @NotNull @NotNull io.github.humbleui.types.Rect src, @NotNull @NotNull io.github.humbleui.types.Rect dst, @Nullable @Nullable Paint paint)
-
drawImageRect
@NotNull @Contract("_, _, _, _, _ -> this") public @NotNull Canvas drawImageRect(@NotNull @NotNull Image image, @NotNull @NotNull io.github.humbleui.types.Rect src, @NotNull @NotNull io.github.humbleui.types.Rect dst, @Nullable @Nullable Paint paint, boolean strict)
-
drawImageRect
@NotNull @Contract("_, _, _, _, _ -> this") public @NotNull Canvas drawImageRect(@NotNull @NotNull Image image, @NotNull @NotNull io.github.humbleui.types.Rect src, @NotNull @NotNull io.github.humbleui.types.Rect dst, @NotNull @NotNull SamplingMode samplingMode, @Nullable @Nullable Paint paint, boolean strict)
-
drawImageNine
@NotNull @Contract("_, _, _, _, _ -> this") public @NotNull Canvas drawImageNine(@NotNull @NotNull Image image, @NotNull @NotNull io.github.humbleui.types.IRect center, @NotNull @NotNull io.github.humbleui.types.Rect dst, @NotNull @NotNull FilterMode filterMode, @Nullable @Nullable Paint paint)
-
drawRegion
@NotNull @Contract("_, _ -> this") public @NotNull Canvas drawRegion(@NotNull @NotNull Region r, @NotNull @NotNull Paint paint)
-
drawString
@NotNull @Contract("_, _, _, _, _ -> this") public @NotNull Canvas drawString(@NotNull @NotNull java.lang.String s, float x, float y, Font font, @NotNull @NotNull Paint paint)
-
drawTextBlob
@NotNull @Contract("_, _, _, _ -> this") public @NotNull Canvas drawTextBlob(@NotNull @NotNull TextBlob blob, float x, float y, @NotNull @NotNull Paint paint)
-
drawTextLine
@NotNull @Contract("_, _, _, _ -> this") public @NotNull Canvas drawTextLine(@NotNull @NotNull TextLine line, float x, float y, @NotNull @NotNull Paint paint)
-
drawPicture
@NotNull @Contract("_ -> this") public @NotNull Canvas drawPicture(@NotNull @NotNull Picture picture)
-
drawPicture
@NotNull @Contract("_, _, _ -> this") public @NotNull Canvas drawPicture(@NotNull @NotNull Picture picture, @Nullable @Nullable Matrix33 matrix, @Nullable @Nullable Paint paint)
-
drawTriangles
@NotNull @Contract("_, _, _ -> this") public @NotNull Canvas drawTriangles(@NotNull @NotNull io.github.humbleui.types.Point[] positions, @Nullable @org.jetbrains.annotations.Nullable int[] colors, @NotNull @NotNull Paint paint)Draws a triangle mesh, using clip and Matrix.
If paint contains an Shader, the shader is mapped using the vertices' positions.
If vertices colors are defined in vertices, and Paint paint contains Shader, BlendMode mode combines vertices colors with Shader.
- Parameters:
positions- triangle mesh to drawcolors- color array, one for each corner; may be nullpaint- specifies the Shader, used as Vertices texture- See Also:
- https://fiddle.skia.org/c/@Canvas_drawVertices, https://fiddle.skia.org/c/@Canvas_drawVertices_2
-
drawTriangles
@NotNull @Contract("_, _, _, _, _ -> this") public @NotNull Canvas drawTriangles(@NotNull @NotNull io.github.humbleui.types.Point[] positions, @Nullable @org.jetbrains.annotations.Nullable int[] colors, @Nullable @Nullable io.github.humbleui.types.Point[] texCoords, @Nullable @org.jetbrains.annotations.Nullable short[] indices, @NotNull @NotNull Paint paint)Draws a triangle mesh, using clip and Matrix.
If paint contains an Shader and vertices does not contain texCoords, the shader is mapped using the vertices' positions.
If vertices colors are defined in vertices, and Paint paint contains Shader, BlendMode mode combines vertices colors with Shader.
- Parameters:
positions- triangle mesh to drawcolors- color array, one for each corner; may be nulltexCoords- Point array of texture coordinates, mapping Shader to corners; may be nullindices- with which indices points should be drawn; may be nullpaint- specifies the Shader, used as Vertices texture- See Also:
- https://fiddle.skia.org/c/@Canvas_drawVertices, https://fiddle.skia.org/c/@Canvas_drawVertices_2
-
drawTriangles
@NotNull @Contract("_, _, _, _, _, _ -> this") public @NotNull Canvas drawTriangles(@NotNull @NotNull io.github.humbleui.types.Point[] positions, @Nullable @org.jetbrains.annotations.Nullable int[] colors, @Nullable @Nullable io.github.humbleui.types.Point[] texCoords, @Nullable @org.jetbrains.annotations.Nullable short[] indices, @NotNull @NotNull BlendMode mode, @NotNull @NotNull Paint paint)Draws a triangle mesh, using clip and Matrix.
If paint contains an Shader and vertices does not contain texCoords, the shader is mapped using the vertices' positions.
If vertices colors are defined in vertices, and Paint paint contains Shader, BlendMode mode combines vertices colors with Shader.
- Parameters:
positions- triangle mesh to drawcolors- color array, one for each corner; may be nulltexCoords- Point array of texture coordinates, mapping Shader to corners; may be nullindices- with which indices points should be drawn; may be nullmode- combines vertices colors with Shader, if both are presentpaint- specifies the Shader, used as Vertices texture- See Also:
- https://fiddle.skia.org/c/@Canvas_drawVertices, https://fiddle.skia.org/c/@Canvas_drawVertices_2
-
drawTriangleStrip
@NotNull @Contract("_, _, _ -> this") public @NotNull Canvas drawTriangleStrip(@NotNull @NotNull io.github.humbleui.types.Point[] positions, @Nullable @org.jetbrains.annotations.Nullable int[] colors, @NotNull @NotNull Paint paint)Draws a triangle strip mesh, using clip and Matrix.
If paint contains an Shader, the shader is mapped using the vertices' positions.
If vertices colors are defined in vertices, and Paint paint contains Shader, BlendMode mode combines vertices colors with Shader.
- Parameters:
positions- triangle mesh to drawcolors- color array, one for each corner; may be nullpaint- specifies the Shader, used as Vertices texture- See Also:
- https://fiddle.skia.org/c/@Canvas_drawVertices, https://fiddle.skia.org/c/@Canvas_drawVertices_2
-
drawTriangleStrip
@NotNull @Contract("_, _, _, _, _ -> this") public @NotNull Canvas drawTriangleStrip(@NotNull @NotNull io.github.humbleui.types.Point[] positions, @Nullable @org.jetbrains.annotations.Nullable int[] colors, @Nullable @Nullable io.github.humbleui.types.Point[] texCoords, @Nullable @org.jetbrains.annotations.Nullable short[] indices, @NotNull @NotNull Paint paint)Draws a triangle strip mesh, using clip and Matrix.
If paint contains an Shader and vertices does not contain texCoords, the shader is mapped using the vertices' positions.
If vertices colors are defined in vertices, and Paint paint contains Shader, BlendMode mode combines vertices colors with Shader.
- Parameters:
positions- triangle mesh to drawcolors- color array, one for each corner; may be nulltexCoords- Point array of texture coordinates, mapping Shader to corners; may be nullindices- with which indices points should be drawn; may be nullpaint- specifies the Shader, used as Vertices texture- See Also:
- https://fiddle.skia.org/c/@Canvas_drawVertices, https://fiddle.skia.org/c/@Canvas_drawVertices_2
-
drawTriangleStrip
@NotNull @Contract("_, _, _, _, _, _ -> this") public @NotNull Canvas drawTriangleStrip(@NotNull @NotNull io.github.humbleui.types.Point[] positions, @Nullable @org.jetbrains.annotations.Nullable int[] colors, @Nullable @Nullable io.github.humbleui.types.Point[] texCoords, @Nullable @org.jetbrains.annotations.Nullable short[] indices, @NotNull @NotNull BlendMode mode, @NotNull @NotNull Paint paint)Draws a triangle strip mesh, using clip and Matrix.
If paint contains an Shader and vertices does not contain texCoords, the shader is mapped using the vertices' positions.
If vertices colors are defined in vertices, and Paint paint contains Shader, BlendMode mode combines vertices colors with Shader.
- Parameters:
positions- triangle mesh to drawcolors- color array, one for each corner; may be nulltexCoords- Point array of texture coordinates, mapping Shader to corners; may be nullindices- with which indices points should be drawn; may be nullmode- combines vertices colors with Shader, if both are presentpaint- specifies the Shader, used as Vertices texture- See Also:
- https://fiddle.skia.org/c/@Canvas_drawVertices, https://fiddle.skia.org/c/@Canvas_drawVertices_2
-
drawTriangleFan
@NotNull @Contract("_, _, _ -> this") public @NotNull Canvas drawTriangleFan(@NotNull @NotNull io.github.humbleui.types.Point[] positions, @Nullable @org.jetbrains.annotations.Nullable int[] colors, @NotNull @NotNull Paint paint)Draws a triangle fan mesh, using clip and Matrix.
If paint contains an Shader, the shader is mapped using the vertices' positions.
If vertices colors are defined in vertices, and Paint paint contains Shader, BlendMode mode combines vertices colors with Shader.
- Parameters:
positions- triangle mesh to drawcolors- color array, one for each corner; may be nullpaint- specifies the Shader, used as Vertices texture- See Also:
- https://fiddle.skia.org/c/@Canvas_drawVertices, https://fiddle.skia.org/c/@Canvas_drawVertices_2
-
drawTriangleFan
@NotNull @Contract("_, _, _, _, _ -> this") public @NotNull Canvas drawTriangleFan(@NotNull @NotNull io.github.humbleui.types.Point[] positions, @Nullable @org.jetbrains.annotations.Nullable int[] colors, @Nullable @Nullable io.github.humbleui.types.Point[] texCoords, @Nullable @org.jetbrains.annotations.Nullable short[] indices, @NotNull @NotNull Paint paint)Draws a triangle fan mesh, using clip and Matrix.
If paint contains an Shader and vertices does not contain texCoords, the shader is mapped using the vertices' positions.
If vertices colors are defined in vertices, and Paint paint contains Shader, BlendMode mode combines vertices colors with Shader.
- Parameters:
positions- triangle mesh to drawcolors- color array, one for each corner; may be nulltexCoords- Point array of texture coordinates, mapping Shader to corners; may be nullindices- with which indices points should be drawn; may be nullpaint- specifies the Shader, used as Vertices texture- See Also:
- https://fiddle.skia.org/c/@Canvas_drawVertices, https://fiddle.skia.org/c/@Canvas_drawVertices_2
-
drawTriangleFan
@NotNull @Contract("_, _, _, _, _, _ -> this") public @NotNull Canvas drawTriangleFan(@NotNull @NotNull io.github.humbleui.types.Point[] positions, @Nullable @org.jetbrains.annotations.Nullable int[] colors, @Nullable @Nullable io.github.humbleui.types.Point[] texCoords, @Nullable @org.jetbrains.annotations.Nullable short[] indices, @NotNull @NotNull BlendMode mode, @NotNull @NotNull Paint paint)Draws a triangle fan mesh, using clip and Matrix.
If paint contains an Shader and vertices does not contain texCoords, the shader is mapped using the vertices' positions.
If vertices colors are defined in vertices, and Paint paint contains Shader, BlendMode mode combines vertices colors with Shader.
- Parameters:
positions- triangle mesh to drawcolors- color array, one for each corner; may be nulltexCoords- Point array of texture coordinates, mapping Shader to corners; may be nullindices- with which indices points should be drawn; may be nullmode- combines vertices colors with Shader, if both are presentpaint- specifies the Shader, used as Vertices texture- See Also:
- https://fiddle.skia.org/c/@Canvas_drawVertices, https://fiddle.skia.org/c/@Canvas_drawVertices_2
-
drawPatch
@NotNull @Contract("_, _, _ -> this") public @NotNull Canvas drawPatch(@NotNull @NotNull io.github.humbleui.types.Point[] cubics, @NotNull @org.jetbrains.annotations.NotNull int[] colors, @NotNull @NotNull Paint paint)Draws a Coons patch: the interpolation of four cubics with shared corners, associating a color, and optionally a texture SkPoint, with each corner.
Coons patch uses clip and Matrix, paint Shader, ColorFilter, alpha, ImageFilter, and BlendMode. If Shader is provided it is treated as Coons patch texture.
Point array cubics specifies four Path cubic starting at the top-left corner, in clockwise order, sharing every fourth point. The last Path cubic ends at the first point.
Color array color associates colors with corners in top-left, top-right, bottom-right, bottom-left order.
- Parameters:
cubics- Path cubic array, sharing common pointscolors- color array, one for each cornerpaint- Shader, ColorFilter, BlendMode, used to draw- Returns:
- this
- See Also:
- https://fiddle.skia.org/c/4cf70f8d194867d053d7e177e5088445
-
drawPatch
@NotNull @Contract("_, _, _, _ -> this") public @NotNull Canvas drawPatch(@NotNull @NotNull io.github.humbleui.types.Point[] cubics, @NotNull @org.jetbrains.annotations.NotNull int[] colors, @Nullable @Nullable io.github.humbleui.types.Point[] texCoords, @NotNull @NotNull Paint paint)Draws a Coons patch: the interpolation of four cubics with shared corners, associating a color, and optionally a texture SkPoint, with each corner.
Coons patch uses clip and Matrix, paint Shader, ColorFilter, alpha, ImageFilter, and BlendMode. If Shader is provided it is treated as Coons patch texture.
Point array cubics specifies four Path cubic starting at the top-left corner, in clockwise order, sharing every fourth point. The last Path cubic ends at the first point.
Color array color associates colors with corners in top-left, top-right, bottom-right, bottom-left order.
If paint contains Shader, Point array texCoords maps Shader as texture to corners in top-left, top-right, bottom-right, bottom-left order. If texCoords is nullptr, Shader is mapped using positions (derived from cubics).
- Parameters:
cubics- Path cubic array, sharing common pointscolors- color array, one for each cornertexCoords- Point array of texture coordinates, mapping Shader to corners; may be nullpaint- Shader, ColorFilter, BlendMode, used to draw- Returns:
- this
- See Also:
- https://fiddle.skia.org/c/4cf70f8d194867d053d7e177e5088445
-
drawPatch
@NotNull @Contract("_, _, _, _, _ -> this") public @NotNull Canvas drawPatch(@NotNull @NotNull io.github.humbleui.types.Point[] cubics, @NotNull @org.jetbrains.annotations.NotNull int[] colors, @Nullable @Nullable io.github.humbleui.types.Point[] texCoords, @NotNull @NotNull BlendMode mode, @NotNull @NotNull Paint paint)Draws a Coons patch: the interpolation of four cubics with shared corners, associating a color, and optionally a texture SkPoint, with each corner.
Coons patch uses clip and Matrix, paint Shader, ColorFilter, alpha, ImageFilter, and BlendMode. If Shader is provided it is treated as Coons patch texture; BlendMode mode combines color colors and Shader if both are provided.
Point array cubics specifies four Path cubic starting at the top-left corner, in clockwise order, sharing every fourth point. The last Path cubic ends at the first point.
Color array color associates colors with corners in top-left, top-right, bottom-right, bottom-left order.
If paint contains Shader, Point array texCoords maps Shader as texture to corners in top-left, top-right, bottom-right, bottom-left order. If texCoords is nullptr, Shader is mapped using positions (derived from cubics).
- Parameters:
cubics- Path cubic array, sharing common pointscolors- color array, one for each cornertexCoords- Point array of texture coordinates, mapping Shader to corners; may be nullmode- BlendMode for colors, and for Shader if paint has onepaint- Shader, ColorFilter, BlendMode, used to draw- Returns:
- this
- See Also:
- https://fiddle.skia.org/c/4cf70f8d194867d053d7e177e5088445
-
drawDrawable
@NotNull @Contract("_ -> this") public @NotNull Canvas drawDrawable(@NotNull @NotNull Drawable drawable)Draws Drawable drawable using clip and matrix.
If Canvas has an asynchronous implementation, as is the case when it is recording into Picture, then drawable will be referenced, so that Drawable::draw() can be called when the operation is finalized. To force immediate drawing, call Drawable::draw() instead.
- Parameters:
drawable- custom struct encapsulating drawing commands- Returns:
- this
-
drawDrawable
@NotNull @Contract("_, _, _ -> this") public @NotNull Canvas drawDrawable(@NotNull @NotNull Drawable drawable, float x, float y)Draws Drawable drawable using clip and matrix, offset by (x, y).
If Canvas has an asynchronous implementation, as is the case when it is recording into Picture, then drawable will be referenced, so that Drawable::draw() can be called when the operation is finalized. To force immediate drawing, call Drawable::draw() instead.
- Parameters:
drawable- custom struct encapsulating drawing commandsx- offset into Canvas writable pixels on x-axisy- offset into Canvas writable pixels on y-axis- Returns:
- this
- See Also:
- https://fiddle.skia.org/c/@Canvas_drawDrawable_2
-
drawDrawable
@NotNull @Contract("_, _ -> this") public @NotNull Canvas drawDrawable(@NotNull @NotNull Drawable drawable, @Nullable @Nullable Matrix33 matrix)Draws Drawable drawable using clip and matrix, concatenated with optional matrix.
If Canvas has an asynchronous implementation, as is the case when it is recording into Picture, then drawable will be referenced, so that Drawable::draw() can be called when the operation is finalized. To force immediate drawing, call Drawable::draw() instead.
- Parameters:
drawable- custom struct encapsulating drawing commandsmatrix- transformation applied to drawing; may be null- Returns:
- this
- See Also:
- https://fiddle.skia.org/c/@Canvas_drawDrawable
-
drawColor
@NotNull @Contract("_ -> this") public @NotNull Canvas drawColor(int color)
-
drawColor
@NotNull @Contract("_, _ -> this") public @NotNull Canvas drawColor(int color, @NotNull @NotNull BlendMode mode)
-
drawColor
@NotNull @Contract("_ -> this") public @NotNull Canvas drawColor(@NotNull @NotNull Color4f color)
-
drawColor
@NotNull @Contract("_, _ -> this") public @NotNull Canvas drawColor(@NotNull @NotNull Color4f color, @NotNull @NotNull BlendMode mode)
-
clear
@NotNull @Contract("_ -> this") public @NotNull Canvas clear(int color)
-
drawPaint
@NotNull @Contract("_ -> this") public @NotNull Canvas drawPaint(@NotNull @NotNull Paint paint)
-
setMatrix
@NotNull @Contract("_ -> this") public @NotNull Canvas setMatrix(@NotNull @NotNull Matrix33 matrix)Replaces Matrix with matrix. Unlike concat(), any prior matrix state is overwritten.- Parameters:
matrix- matrix to copy, replacing existing Matrix- See Also:
- https://fiddle.skia.org/c/@Canvas_setMatrix
-
setMatrix
@NotNull @Contract("_ -> this") public @NotNull Canvas setMatrix(@NotNull @NotNull Matrix44 matrix)Replaces Matrix with matrix. Unlike concat(), any prior matrix state is overwritten.- Parameters:
matrix- matrix to copy, replacing existing Matrix- See Also:
- https://fiddle.skia.org/c/@Canvas_setMatrix
-
resetMatrix
@NotNull @Contract("-> this") public @NotNull Canvas resetMatrix()Sets SkMatrix to the identity matrix. Any prior matrix state is overwritten.
-
getLocalToDevice
@NotNull @Contract("-> new") public @NotNull Matrix44 getLocalToDevice()Returns the total transformation matrix for the canvas.
-
getLocalToDeviceAsMatrix33
@NotNull @Contract("-> new") public @NotNull Matrix33 getLocalToDeviceAsMatrix33()
-
clipRect
@NotNull @Contract("_, _, _ -> this") public @NotNull Canvas clipRect(@NotNull @NotNull io.github.humbleui.types.Rect r, @NotNull @NotNull ClipMode mode, boolean antiAlias)
-
clipRect
@NotNull @Contract("_, _ -> this") public @NotNull Canvas clipRect(@NotNull @NotNull io.github.humbleui.types.Rect r, @NotNull @NotNull ClipMode mode)
-
clipRect
@NotNull @Contract("_, _ -> this") public @NotNull Canvas clipRect(@NotNull @NotNull io.github.humbleui.types.Rect r, boolean antiAlias)
-
clipRect
@NotNull @Contract("_ -> this") public @NotNull Canvas clipRect(@NotNull @NotNull io.github.humbleui.types.Rect r)
-
clipRRect
@NotNull @Contract("_, _, _ -> this") public @NotNull Canvas clipRRect(@NotNull @NotNull io.github.humbleui.types.RRect r, @NotNull @NotNull ClipMode mode, boolean antiAlias)
-
clipRRect
@NotNull @Contract("_, _ -> this") public @NotNull Canvas clipRRect(@NotNull @NotNull io.github.humbleui.types.RRect r, @NotNull @NotNull ClipMode mode)
-
clipRRect
@NotNull @Contract("_, _ -> this") public @NotNull Canvas clipRRect(@NotNull @NotNull io.github.humbleui.types.RRect r, boolean antiAlias)
-
clipRRect
@NotNull @Contract("_ -> this") public @NotNull Canvas clipRRect(@NotNull @NotNull io.github.humbleui.types.RRect r)
-
clipPath
@NotNull @Contract("_, _, _ -> this") public @NotNull Canvas clipPath(@NotNull @NotNull Path p, @NotNull @NotNull ClipMode mode, boolean antiAlias)
-
clipPath
@NotNull @Contract("_, _ -> this") public @NotNull Canvas clipPath(@NotNull @NotNull Path p, @NotNull @NotNull ClipMode mode)
-
clipPath
@NotNull @Contract("_, _ -> this") public @NotNull Canvas clipPath(@NotNull @NotNull Path p, boolean antiAlias)
-
clipRegion
@NotNull @Contract("_, _ -> this") public @NotNull Canvas clipRegion(@NotNull @NotNull Region r, @NotNull @NotNull ClipMode mode)
-
clipRegion
@NotNull @Contract("_ -> this") public @NotNull Canvas clipRegion(@NotNull @NotNull Region r)
-
translate
@NotNull @Contract("_, _ -> this") public @NotNull Canvas translate(float dx, float dy)
-
scale
@NotNull @Contract("_, _ -> this") public @NotNull Canvas scale(float sx, float sy)
-
rotate
@NotNull @Contract("_ -> this") public @NotNull Canvas rotate(float deg)- Parameters:
deg- angle in degrees- Returns:
- this
-
skew
@NotNull @Contract("_, _ -> this") public @NotNull Canvas skew(float sx, float sy)
-
concat
@NotNull @Contract("_ -> this") public @NotNull Canvas concat(@NotNull @NotNull Matrix33 matrix)
-
concat
@NotNull @Contract("_ -> this") public @NotNull Canvas concat(@NotNull @NotNull Matrix44 matrix)
-
readPixels
public boolean readPixels(@NotNull @NotNull Bitmap bitmap, int srcX, int srcY)Copies Rect of pixels from Canvas into bitmap. Matrix and clip are ignored.
Source Rect corners are (srcX, srcY) and (imageInfo().width(), imageInfo().height()). Destination Rect corners are (0, 0) and (bitmap.width(), bitmap.height()). Copies each readable pixel intersecting both rectangles, without scaling, converting to bitmap.colorType() and bitmap.alphaType() if required.
Pixels are readable when BaseDevice is raster, or backed by a GPU. Pixels are not readable when Canvas is returned by Document::beginPage, returned by PictureRecorder::beginRecording, or Canvas is the base of a utility class like DebugCanvas.
Caller must allocate pixel storage in bitmap if needed.
SkBitmap values are converted only if ColorType and AlphaType do not match. Only pixels within both source and destination rectangles are copied. Bitmap pixels outside Rect intersection are unchanged.
Pass negative values for srcX or srcY to offset pixels across or down bitmap.
Does not copy, and returns false if:
- Source and destination rectangles do not intersect.
- SkCanvas pixels could not be converted to bitmap.colorType() or bitmap.alphaType().
- SkCanvas pixels are not readable; for instance, Canvas is document-based.
- bitmap pixels could not be allocated.
- bitmap.rowBytes() is too small to contain one row of pixels.
- Parameters:
bitmap- storage for pixels copied from CanvassrcX- offset into readable pixels on x-axis; may be negativesrcY- offset into readable pixels on y-axis; may be negative- Returns:
- true if pixels were copied
- See Also:
- https://fiddle.skia.org/c/@Canvas_readPixels_3
-
writePixels
public boolean writePixels(@NotNull @NotNull Bitmap bitmap, int x, int y)Copies Rect from pixels to Canvas. Matrix and clip are ignored. Source Rect corners are (0, 0) and (bitmap.width(), bitmap.height()).
Destination Rect corners are (x, y) and (imageInfo().width(), imageInfo().height()).
Copies each readable pixel intersecting both rectangles, without scaling, converting to getImageInfo().getColorType() and getImageInfo().getAlphaType() if required.
Pixels are writable when BaseDevice is raster, or backed by a GPU. Pixels are not writable when Canvas is returned by Document::beginPage, returned by PictureRecorder::beginRecording, or Canvas is the base of a utility class like DebugCanvas.
Pixel values are converted only if ColorType and AlphaType do not match. Only pixels within both source and destination rectangles are copied. Canvas pixels outside Rect intersection are unchanged.
Pass negative values for x or y to offset pixels to the left or above Canvas pixels.
Does not copy, and returns false if:
- Source and destination rectangles do not intersect.
- bitmap does not have allocated pixels.
- bitmap pixels could not be converted to Canvas getImageInfo().getColorType() or getImageInfo().getAlphaType().
- Canvas pixels are not writable; for instance, Canvas is document based.
- bitmap pixels are inaccessible; for instance, bitmap wraps a texture.
- Parameters:
bitmap- contains pixels copied to Canvasx- offset into Canvas writable pixels on x-axis; may be negativey- offset into Canvas writable pixels on y-axis; may be negative- Returns:
- true if pixels were written to Canvas
- See Also:
- https://fiddle.skia.org/c/@Canvas_writePixels_2, https://fiddle.skia.org/c/@State_Stack_a, https://fiddle.skia.org/c/@State_Stack_b
-
save
public int save()
-
saveLayer
public int saveLayer(float left, float top, float right, float bottom, @Nullable @Nullable Paint paint)
-
saveLayer
public int saveLayer(@Nullable @Nullable io.github.humbleui.types.Rect bounds, @Nullable @Nullable Paint paint)Saves Matrix and clip, and allocates a Bitmap for subsequent drawing. Calling restore() discards changes to Matrix and clip, and draws the Bitmap.
Matrix may be changed by translate(), scale(), rotate(), skew(), concat(), setMatrix(), and resetMatrix(). Clip may be changed by clipRect(), clipRRect(), clipPath(), clipRegion().
Rect bounds suggests but does not define the Bitmap size. To clip drawing to a specific rectangle, use clipRect().
Optional Paint paint applies alpha, ColorFilter, ImageFilter, and BlendMode when restore() is called.
Call restoreToCount() with returned value to restore this and subsequent saves.
- Parameters:
bounds- hint to limit the size of the layerpaint- graphics state for layer; may be null- Returns:
- depth of saved stack
- See Also:
- https://fiddle.skia.org/c/@Canvas_saveLayer, https://fiddle.skia.org/c/@Canvas_saveLayer_4
-
saveLayerAlpha
public int saveLayerAlpha(@Nullable @Nullable io.github.humbleui.types.Rect bounds, int alpha)Saves matrix and clip, and allocates bitmap for subsequent drawing.
Calling restore() discards changes to matrix and clip, and blends layer with alpha opacity onto prior layer.
matrix may be changed by translate(), scale(), rotate(), skew(), concat(), setMatrix(), and resetMatrix(). Clip may be changed by clipRect(), clipRRect(), clipPath(), clipRegion().
Bounds suggests but does not define layer size. To clip drawing to a specific rectangle, use clipRect().
Call restoreToCount() with returned value to restore this and subsequent saves.
- Parameters:
bounds- hint to limit the size of layer; may be nullalpha- opacity of layer, zero is fully transparent, 255 is fully opaque.- Returns:
- depth of saved stack
- See Also:
- https://fiddle.skia.org/c/@Canvas_saveLayerAlpha
-
saveLayer
public int saveLayer(@NotNull @NotNull SaveLayerRec layerRec)Saves matrix and clip, and allocates Bitmap for subsequent drawing.
Calling restore() discards changes to matrix and clip, and blends Bitmap with alpha opacity onto the prior layer.
matrix may be changed by translate(), scale(), rotate(), skew(), concat(), setMatrix(), and resetMatrix(). Clip may be changed by clipRect(), clipRRect(), clipPath(), clipRegion().
SaveLayerRec contains the state used to create the layer.
Call restoreToCount() with returned value to restore this and subsequent saves.
- Parameters:
layerRec- layer state- Returns:
- depth of save state stack before this call was made.
- See Also:
- https://fiddle.skia.org/c/@Canvas_saveLayer_3
-
getSaveCount
public int getSaveCount()
-
restore
@NotNull @Contract("-> this") public @NotNull Canvas restore()
-
restoreToCount
@NotNull @Contract("_ -> this") public @NotNull Canvas restoreToCount(int saveCount)
-
_nGetFinalizer
public static long _nGetFinalizer()
-
_nMakeFromBitmap
public static long _nMakeFromBitmap(long bitmapPtr, int flags, int pixelGeometry)
-
_nGetBaseProps
public static SurfaceProps _nGetBaseProps(long ptr)
-
_nGetTopProps
public static SurfaceProps _nGetTopProps(long ptr)
-
_nGetSurface
public static long _nGetSurface(long ptr)
-
_nDrawPoint
public static void _nDrawPoint(long ptr, float x, float y, long paintPtr)
-
_nDrawPoints
public static void _nDrawPoints(long ptr, int mode, float[] coords, long paintPtr)
-
_nDrawLine
public static void _nDrawLine(long ptr, float x0, float y0, float x1, float y1, long paintPtr)
-
_nDrawArc
public static void _nDrawArc(long ptr, float left, float top, float right, float bottom, float startAngle, float sweepAngle, boolean includeCenter, long paintPtr)
-
_nDrawRect
public static void _nDrawRect(long ptr, float left, float top, float right, float bottom, long paintPtr)
-
_nDrawOval
public static void _nDrawOval(long ptr, float left, float top, float right, float bottom, long paint)
-
_nDrawRRect
public static void _nDrawRRect(long ptr, float left, float top, float right, float bottom, float[] radii, long paintPtr)
-
_nQuickReject
public static boolean _nQuickReject(long ptr, float left, float top, float right, float bottom)
-
_nQuickRejectPath
public static boolean _nQuickRejectPath(long ptr, long pathPtr)
-
_nDrawDRRect
public static void _nDrawDRRect(long ptr, float ol, float ot, float or, float ob, float[] oradii, float il, float it, float ir, float ib, float[] iradii, long paintPtr)
-
_nDrawPath
public static void _nDrawPath(long ptr, long nativePath, long paintPtr)
-
_nDrawImageRect
public static void _nDrawImageRect(long ptr, long nativeImage, float sl, float st, float sr, float sb, float dl, float dt, float dr, float db, long samplingMode, long paintPtr, boolean strict)
-
_nDrawImageNine
public static void _nDrawImageNine(long ptr, long nativeImage, int cl, int ct, int cr, int cb, float dl, float dt, float dr, float db, int filterMode, long paintPtr)
-
_nDrawRegion
public static void _nDrawRegion(long ptr, long nativeRegion, long paintPtr)
-
_nDrawString
public static void _nDrawString(long ptr, java.lang.String string, float x, float y, long font, long paint)
-
_nDrawTextBlob
public static void _nDrawTextBlob(long ptr, long blob, float x, float y, long paint)
-
_nDrawPicture
public static void _nDrawPicture(long ptr, long picturePtr, float[] matrix, long paintPtr)
-
_nDrawVertices
public static void _nDrawVertices(long ptr, int verticesMode, float[] cubics, int[] colors, float[] texCoords, short[] indices, int blendMode, long paintPtr)
-
_nDrawPatch
public static void _nDrawPatch(long ptr, float[] cubics, int[] colors, float[] texCoords, int blendMode, long paintPtr)
-
_nDrawDrawable
public static void _nDrawDrawable(long ptr, long drawablePrt, float[] matrix)
-
_nDrawColor
public static void _nDrawColor(long ptr, int color, int blendMode)
-
_nDrawColor4f
public static void _nDrawColor4f(long ptr, float r, float g, float b, float a, int blendMode)
-
_nClear
public static void _nClear(long ptr, int color)
-
_nDrawPaint
public static void _nDrawPaint(long ptr, long paintPtr)
-
_nSetMatrix
public static void _nSetMatrix(long ptr, float[] matrix)
-
_nSetMatrix44
public static void _nSetMatrix44(long ptr, float[] matrix)
-
_nGetLocalToDevice
public static float[] _nGetLocalToDevice(long ptr)
-
_nResetMatrix
public static void _nResetMatrix(long ptr)
-
_nClipRect
public static void _nClipRect(long ptr, float left, float top, float right, float bottom, int mode, boolean antiAlias)
-
_nClipRRect
public static void _nClipRRect(long ptr, float left, float top, float right, float bottom, float[] radii, int mode, boolean antiAlias)
-
_nClipPath
public static void _nClipPath(long ptr, long nativePath, int mode, boolean antiAlias)
-
_nClipRegion
public static void _nClipRegion(long ptr, long nativeRegion, int mode)
-
_nConcat
public static void _nConcat(long ptr, float[] matrix)
-
_nConcat44
public static void _nConcat44(long ptr, float[] matrix)
-
_nReadPixels
public static boolean _nReadPixels(long ptr, long bitmapPtr, int srcX, int srcY)
-
_nWritePixels
public static boolean _nWritePixels(long ptr, long bitmapPtr, int x, int y)
-
_nSave
public static int _nSave(long ptr)
-
_nSaveLayer
public static int _nSaveLayer(long ptr, long paintPtr)
-
_nSaveLayerRect
public static int _nSaveLayerRect(long ptr, float left, float top, float right, float bottom, long paintPtr)
-
_nSaveLayerAlpha
public static int _nSaveLayerAlpha(long ptr, int alpha)
-
_nSaveLayerAlphaRect
public static int _nSaveLayerAlphaRect(long ptr, float left, float top, float right, float bottom, int alpha)
-
_nSaveLayerRec
public static int _nSaveLayerRec(long ptr, long paintPtr, long backdropPtr, int flags)
-
_nSaveLayerRecRect
public static int _nSaveLayerRecRect(long ptr, float left, float top, float right, float bottom, long paintPtr, long backdropPtr, int flags)
-
_nGetSaveCount
public static int _nGetSaveCount(long ptr)
-
_nRestore
public static void _nRestore(long ptr)
-
_nRestoreToCount
public static void _nRestoreToCount(long ptr, int saveCount)
-
-