All Projects → DjDeveloperr → deno-canvas

DjDeveloperr / deno-canvas

Licence: MIT license
Canvas API for Deno, ported from canvaskit-wasm (Skia).

Programming Languages

javascript
184084 projects - #8 most used programming language
typescript
32286 projects

Projects that are alternatives of or similar to deno-canvas

skeditor
Online sketch file editor.
Stars: ✭ 133 (+7.26%)
Mutual labels:  skia, canvaskit-wasm
Skija
Java bindings for Skia
Stars: ✭ 2,292 (+1748.39%)
Mutual labels:  skia, 2d
ArchGE
A 2D and 3D C++ Game Engine using SDL2 and OpenGL
Stars: ✭ 15 (-87.9%)
Mutual labels:  2d
deno-x-ranking
🦕 Deno Third Party Modules Ranking 👑
Stars: ✭ 28 (-77.42%)
Mutual labels:  deno
hatcher
🐣 Registries toolbox & update notifications for your CLI
Stars: ✭ 14 (-88.71%)
Mutual labels:  deno
vector2d
2D Vector Library. Operates using Objects, Array or Float32Array types to allow flexible performance.
Stars: ✭ 28 (-77.42%)
Mutual labels:  2d
slack-web-api
Simple, convenient, and configurable HTTP client for making requests to Slack’s Web API. Deno port of @slack/web-api
Stars: ✭ 16 (-87.1%)
Mutual labels:  deno
deno-dex
🦕 A dexterous deno executor
Stars: ✭ 19 (-84.68%)
Mutual labels:  deno
windowjs
Window.js is an open-source Javascript runtime for desktop graphics programming.
Stars: ✭ 2,223 (+1692.74%)
Mutual labels:  2d
now-deno-example
A demo application of now-deno and deno-postgres.
Stars: ✭ 30 (-75.81%)
Mutual labels:  deno
scuttlesaurus
retog.github.io/scuttlesaurus/
Stars: ✭ 21 (-83.06%)
Mutual labels:  deno
azure-webapps-deno-deploy
A GitHub Action for deploying Deno 🦕 web apps to Azure ☁️
Stars: ✭ 27 (-78.23%)
Mutual labels:  deno
drash
A microframework for Deno's HTTP server with zero third-party dependencies
Stars: ✭ 1,013 (+716.94%)
Mutual labels:  deno
rpg
OpenGL cross platform topdown 2d magic action rpg game single player arpg
Stars: ✭ 20 (-83.87%)
Mutual labels:  2d
FixedPoint-Sharp
Fixed point math with 48.16 precision (based on lib by https://github.com/fholm)
Stars: ✭ 114 (-8.06%)
Mutual labels:  2d
deno deploy versailles
凡尔赛语录(部署在 Deno Deploy)
Stars: ✭ 18 (-85.48%)
Mutual labels:  deno
carol
A Deno port of carlo
Stars: ✭ 63 (-49.19%)
Mutual labels:  deno
mock
Utilities to help mock behavior, spy on function calls, stub methods, and fake time for tests.
Stars: ✭ 31 (-75%)
Mutual labels:  deno
prettyBenching
🦕 A small lib to make your Deno benchmarking progress and results look pretty
Stars: ✭ 23 (-81.45%)
Mutual labels:  deno
deno desktop
Windowing support for Deno WebGPU.
Stars: ✭ 49 (-60.48%)
Mutual labels:  deno

deno-canvas

Canvas API for Deno, ported from canvaskit-wasm (Skia).

Installation

Import from https://deno.land/x/canvas/mod.ts or just import from raw GitHub URL, https://raw.githubusercontent.com/DjDeveloperr/deno-canvas/master/mod.ts.

Usage

mod.ts provides a default export exposing the complete CanvasKit API, and other exports from the file are types and utility functions.

import { createCanvas } from "https://deno.land/x/canvas/mod.ts";

const canvas = createCanvas(200, 200);
const ctx = canvas.getContext("2d");

ctx.fillStyle = "red";
ctx.fillRect(10, 10, 200 - 20, 200 - 20);

await Deno.writeFile("image.png", canvas.toBuffer());

And run with deno run --allow-write filename.ts.

You can also try this HTTP server example, https://raw.githubusercontent.com/DjDeveloperr/deno-canvas/master/examples/square.ts

For using images, use loadImage method exported from mod.ts.

const image = await loadImage(myURL);
ctx.drawImage(image, x, y);

Limitations

Just like original canvaskit-wasm, the emulated Canvas has some limitations:

  • measureText returns width only and does no shaping. It is only sort of valid with ASCII letters.
  • textAlign is not supported.
  • textBaseAlign is not supported.
  • fillText does not support the width parameter.

License

Check LICENSE for more info.

Copyright 2022 © DjDeveloperr

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].