mirror of
https://github.com/penpot/penpot.git
synced 2026-09-09 13:39:02 +00:00
WIP
This commit is contained in:
parent
721d9ee399
commit
66aa5fd01f
@ -30,7 +30,8 @@
|
|||||||
(println "init vbox" vbox)
|
(println "init vbox" vbox)
|
||||||
(-> (.initialize impl/CanvasKit "skia-canvas" vbox)
|
(-> (.initialize impl/CanvasKit "skia-canvas" vbox)
|
||||||
(.then (fn [k]
|
(.then (fn [k]
|
||||||
(reset! canvas-kit k)))))))
|
(reset! canvas-kit k)
|
||||||
|
#_(.clear ^js k)))))))
|
||||||
|
|
||||||
[:canvas {:id "skia-canvas"
|
[:canvas {:id "skia-canvas"
|
||||||
:class (stl/css :canvas)
|
:class (stl/css :canvas)
|
||||||
|
|||||||
@ -16,6 +16,15 @@ class CanvasKit {
|
|||||||
this.vbox = vbox;
|
this.vbox = vbox;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
clear() {
|
||||||
|
const surface = this.CanvasKit.MakeCanvasSurface(this.canvasId)
|
||||||
|
function draw(canvas) {
|
||||||
|
canvas.clear(CanvasKit.TRANSPARENT);
|
||||||
|
}
|
||||||
|
surface.drawOnce(draw);
|
||||||
|
}
|
||||||
|
|
||||||
paintRect(shape) {
|
paintRect(shape) {
|
||||||
const surface = this.CanvasKit.MakeCanvasSurface(this.canvasId)
|
const surface = this.CanvasKit.MakeCanvasSurface(this.canvasId)
|
||||||
|
|
||||||
@ -29,6 +38,7 @@ class CanvasKit {
|
|||||||
paint.setStyle(self.CanvasKit.PaintStyle.Fill);
|
paint.setStyle(self.CanvasKit.PaintStyle.Fill);
|
||||||
const color = self.CanvasKit.parseColorString(fill["fill-color"]);
|
const color = self.CanvasKit.parseColorString(fill["fill-color"]);
|
||||||
const opacity = fill["fill-opacity"]
|
const opacity = fill["fill-opacity"]
|
||||||
|
console.log("color", fill["fill-color"], fill["fill-opacity"])
|
||||||
color[3] = opacity
|
color[3] = opacity
|
||||||
paint.setColor(color);
|
paint.setColor(color);
|
||||||
const rr = self.CanvasKit.RRectXY(self.CanvasKit.LTRBRect(shape.x, shape.y, shape.x + shape.width, shape.y + shape.height), 0, 0);
|
const rr = self.CanvasKit.RRectXY(self.CanvasKit.LTRBRect(shape.x, shape.y, shape.x + shape.width, shape.y + shape.height), 0, 0);
|
||||||
@ -178,16 +188,3 @@ export function path(CanvasKit, canvasId, x, y, content, kk1, kk2, kk3) {
|
|||||||
|
|
||||||
// }
|
// }
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
export function clear(CanvasKit, canvasId) {
|
|
||||||
surface = CanvasKit.MakeCanvasSurface(canvasId)
|
|
||||||
|
|
||||||
function draw(canvas) {
|
|
||||||
// canvas.clear(CanvasKit.WHITE);
|
|
||||||
canvas.translate(400, 400);
|
|
||||||
|
|
||||||
}
|
|
||||||
surface.drawOnce(draw);
|
|
||||||
}
|
|
||||||
Loading…
x
Reference in New Issue
Block a user