Skip to content

Commit 44c6bcd

Browse files
committed
Create HTML::Canvas::To::HTML
Treat HTML/JS rendering as another backend.
1 parent 7c385a6 commit 44c6bcd

File tree

9 files changed

+522
-509
lines changed

9 files changed

+522
-509
lines changed

META6.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
"Color",
1212
"CSS::Properties:ver<0.7.0+>",
1313
"CSS::Font::Resources:ver<0.0.8+>",
14-
"FontConfig",
14+
"FontConfig:ver<0.1.5+>",
1515
"Font::FreeType:ver<0.3.7+>",
1616
"HarfBuzz::Font::FreeType:ver<0.0.5+>",
1717
"HarfBuzz::Shaper::Cairo:ver<0.0.3+>",
@@ -32,6 +32,7 @@
3232
"HTML::Canvas::Path2D": "lib/HTML/Canvas/Path2D.rakumod",
3333
"HTML::Canvas::Pattern": "lib/HTML/Canvas/Pattern.rakumod",
3434
"HTML::Canvas::To::Cairo": "lib/HTML/Canvas/To/Cairo.rakumod",
35+
"HTML::Canvas::To::HTML": "lib/HTML/Canvas/To/HTML.rakumod",
3536
"HTML::Canvas::Tracer": "lib/HTML/Canvas/Tracer.rakumod"
3637
},
3738
"resources": [

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -117,7 +117,7 @@ my HTML::Canvas $canvas .= new;
117117
my @html-body;
118118
# add the image, as a hidden DOM item
119119
my HTML::Canvas::Image \image .= open("t/images/camelia-logo.png");
120-
@html-body.push: HTML::Canvas.to-html: image, :style("visibility:hidden");
120+
@html-body.push: $canvas.to-html: image, :style("visibility:hidden");
121121
# draw it
122122
$canvas.context: -> \ctx {
123123
ctx.drawImage(image, 10, 10 );
@@ -362,7 +362,7 @@ my @html-body;
362362
my HTML::Canvas::Image \image .= open("t/images/crosshair-100x100.jpg");
363363
364364
# save to HTML
365-
@html-body.push: HTML::Canvas.to-html: image, :style("visibility:hidden");
365+
@html-body.push: ctx.to-html: image, :style("visibility:hidden");
366366
# draw on the canvas
367367
ctx.drawImage(image, 20, 10, 50, 50);
368368

examples/canvas-demo.png

31 Bytes
Loading

0 commit comments

Comments
 (0)