Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More β†’
Socket
Sign inDemoInstall
Socket

@napi-rs/canvas

Package Overview
Dependencies
Maintainers
2
Versions
76
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@napi-rs/canvas

Canvas for Node.js with skia backend

  • 0.1.65
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
292K
increased by79.79%
Maintainers
2
Weekly downloads
Β 
Created

What is @napi-rs/canvas?

@napi-rs/canvas is a high-performance canvas implementation for Node.js, providing a set of APIs for drawing graphics, manipulating images, and creating visual content. It is built on top of the napi-rs framework, which allows for native performance by leveraging Rust's capabilities.

What are @napi-rs/canvas's main functionalities?

Drawing Shapes

This feature allows you to draw basic shapes like rectangles on a canvas. The code sample demonstrates how to create a canvas and draw a green rectangle on it.

const { createCanvas } = require('@napi-rs/canvas');
const canvas = createCanvas(200, 200);
const ctx = canvas.getContext('2d');
ctx.fillStyle = 'green';
ctx.fillRect(10, 10, 100, 100);

Image Manipulation

This feature allows you to load and manipulate images. The code sample shows how to load an image and draw it onto a canvas.

const { loadImage, createCanvas } = require('@napi-rs/canvas');
const canvas = createCanvas(200, 200);
const ctx = canvas.getContext('2d');
loadImage('path/to/image.jpg').then((image) => {
  ctx.drawImage(image, 0, 0, 200, 200);
});

Text Rendering

This feature enables text rendering on a canvas. The code sample demonstrates how to set a font and render text onto the canvas.

const { createCanvas } = require('@napi-rs/canvas');
const canvas = createCanvas(200, 200);
const ctx = canvas.getContext('2d');
ctx.font = '30px Arial';
ctx.fillText('Hello World', 50, 50);

Other packages similar to @napi-rs/canvas

Keywords

FAQs

Package last updated on 02 Dec 2024

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚑️ by Socket Inc