{"id":15631468,"url":"https://github.com/djdeveloperr/deno-canvas","last_synced_at":"2025-04-03T20:12:49.236Z","repository":{"id":39882161,"uuid":"315208983","full_name":"DjDeveloperr/deno-canvas","owner":"DjDeveloperr","description":"Canvas API for Deno, ported from canvaskit-wasm (Skia).","archived":false,"fork":false,"pushed_at":"2024-10-03T06:12:27.000Z","size":22620,"stargazers_count":196,"open_issues_count":12,"forks_count":20,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-03-27T19:17:34.856Z","etag":null,"topics":["2d","canvas","canvaskit-wasm","deno","deno-canvas","skia"],"latest_commit_sha":null,"homepage":"https://deno.land/x/canvas","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/DjDeveloperr.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2020-11-23T05:24:51.000Z","updated_at":"2025-03-25T13:09:18.000Z","dependencies_parsed_at":"2024-10-23T01:36:00.902Z","dependency_job_id":null,"html_url":"https://github.com/DjDeveloperr/deno-canvas","commit_stats":{"total_commits":47,"total_committers":5,"mean_commits":9.4,"dds":0.4042553191489362,"last_synced_commit":"d55d38171d3996e22f23a2fdfebcccbdcaa5c702"},"previous_names":[],"tags_count":18,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/DjDeveloperr%2Fdeno-canvas","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/DjDeveloperr%2Fdeno-canvas/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/DjDeveloperr%2Fdeno-canvas/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/DjDeveloperr%2Fdeno-canvas/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/DjDeveloperr","download_url":"https://codeload.github.com/DjDeveloperr/deno-canvas/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247070928,"owners_count":20878586,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["2d","canvas","canvaskit-wasm","deno","deno-canvas","skia"],"created_at":"2024-10-03T10:40:33.907Z","updated_at":"2025-04-03T20:12:49.213Z","avatar_url":"https://github.com/DjDeveloperr.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# deno-canvas\n\nCanvas API for Deno, ported from\n[canvaskit-wasm (Skia)](https://github.com/google/skia/tree/main/modules/canvaskit).\n\n## Installation\n\nImport from https://deno.land/x/canvas/mod.ts or just import from raw GitHub\nURL, https://raw.githubusercontent.com/DjDeveloperr/deno-canvas/master/mod.ts.\n\n## Usage\n\n`mod.ts` provides a default export exposing the complete CanvasKit API, and\nother exports from the file are types and utility functions.\n\n```ts\nimport { createCanvas } from \"https://deno.land/x/canvas/mod.ts\";\n\nconst canvas = createCanvas(200, 200);\nconst ctx = canvas.getContext(\"2d\");\n\nctx.fillStyle = \"red\";\nctx.fillRect(10, 10, 200 - 20, 200 - 20);\n\nawait Deno.writeFile(\"image.png\", canvas.toBuffer());\n```\n\nAnd run with `deno run --allow-write filename.ts`.\n\nYou can also try this HTTP server example,\nhttps://raw.githubusercontent.com/DjDeveloperr/deno-canvas/master/examples/square.ts\n\nFor using images, use `loadImage` method exported from `mod.ts`.\n\n```ts\nconst image = await loadImage(myURL);\nctx.drawImage(image, x, y);\n```\n\nFor custom fonts, including Emoji support, use the `loadfont` method:\n\n```ts\nconst font = await Deno.readFile(\"NotoColorEmoji.ttf\"); // Path to font file\nconst canvas = createCanvas(128, 128);\nconst ctx = canvas.getContext(\"2d\");\ncanvas.loadFont(font, { family: 'Noto Color Emoji' });\nctx.font = \"105px Noto Color Emoji\";\nctx.fillText('🚜', 0, 90);\n```\n\n## Limitations\n\n[Just like original canvaskit-wasm, the emulated Canvas has some limitations:](https://github.com/google/skia/tree/main/modules/canvaskit/npm_build#known-issues-with-canvas2d-emulation-layer)\n\n- measureText returns width only and does no shaping. It is only sort of valid\n  with ASCII letters.\n- textAlign is not supported.\n- textBaseAlign is not supported.\n- fillText does not support the width parameter.\n\n## Alternative\n\nThere is also [skia_canvas](https://github.com/DjDeveloperr/skia_canvas).\n\n- Fast \u0026 low-overhead, 2x performance improvement\n- Above mentioned limitations are not present, in fact there are no limitations\n- Uses FFI instead of WASM\n\n## License\n\nCheck [LICENSE](./LICENSE) for more info.\n\nCopyright 2022 © DjDeveloperr\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdjdeveloperr%2Fdeno-canvas","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdjdeveloperr%2Fdeno-canvas","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdjdeveloperr%2Fdeno-canvas/lists"}