MCPcopy Create free account
hub / github.com/JetBrains/skija / Canvas

Class Canvas

shared/java/Canvas.java:7–1269  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

5import org.jetbrains.skija.impl.*;
6
7public class Canvas extends Managed {
8 static { Library.staticLoad(); }
9
10 @ApiStatus.Internal
11 public final Object _owner;
12
13 @ApiStatus.Internal
14 public Canvas(long ptr, boolean managed, Object owner) {
15 super(ptr, _FinalizerHolder.PTR, managed);
16 this._owner = owner;
17 }
18
19 /**
20 * <p>Constructs a canvas that draws into bitmap.
21 * Sets default pixel geometry in constructed Surface.</p>
22 *
23 * <p>Bitmap is copied so that subsequently editing bitmap will not affect
24 * constructed Canvas.</p>
25 *
26 * <p>May be deprecated in the future.</p>
27 *
28 * @param bitmap width, height, ColorType, ColorAlphaType, and pixel
29 * storage of raster surface
30 *
31 * @see <a href="https://fiddle.skia.org/c/@Canvas_copy_const_SkBitmap">https://fiddle.skia.org/c/@Canvas_copy_const_SkBitmap</a>
32 */
33 public Canvas(@NotNull Bitmap bitmap) {
34 this(bitmap, new SurfaceProps());
35 }
36
37 /**
38 * <p>Constructs a canvas that draws into bitmap.
39 * Use props to match the device characteristics, like LCD striping.</p>
40 *
41 * <p>Bitmap is copied so that subsequently editing bitmap will not affect
42 * constructed Canvas.</p>
43 *
44 * @param bitmap width, height, ColorType, ColorAlphaType, and pixel
45 * storage of raster surface
46 * @param surfaceProps order and orientation of RGB striping; and whether to use
47 * device independent fonts
48 *
49 * @see <a href="https://fiddle.skia.org/c/@Canvas_const_SkBitmap_const_SkSurfaceProps">https://fiddle.skia.org/c/@Canvas_const_SkBitmap_const_SkSurfaceProps</a>
50 */
51 public Canvas(@NotNull Bitmap bitmap, @NotNull SurfaceProps surfaceProps) {
52 this(_nMakeFromBitmap(bitmap._ptr, surfaceProps._getFlags(), surfaceProps._pixelGeometry.ordinal()), true, bitmap);
53 Stats.onNativeCall();
54 Reference.reachabilityFence(bitmap);
55 }
56
57 @NotNull @Contract("_, _, _ -> this")
58 public Canvas drawPoint(float x, float y, @NotNull Paint paint) {
59 assert paint != null : "Can’t drawPoint with paint == null";
60 Stats.onNativeCall();
61 _nDrawPoint(_ptr, x, y, Native.getPtr(paint));
62 Reference.reachabilityFence(paint);
63 return this;
64 }

Callers

nothing calls this directly

Calls 1

staticLoadMethod · 0.95

Tested by

no test coverage detected