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

@thi.ng/canvas

Package Overview
Dependencies
Maintainers
0
Versions
40
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@thi.ng/canvas - npm Package Compare versions

Comparing version 0.3.0 to 0.4.0

8

CHANGELOG.md
# Change Log
- **Last updated**: 2024-08-01T16:32:31Z
- **Last updated**: 2024-08-01T17:11:25Z
- **Generator**: [thi.ng/monopub](https://thi.ng/monopub)

@@ -12,2 +12,8 @@

## [0.4.0](https://github.com/thi-ng/umbrella/tree/@thi.ng/canvas@0.4.0) (2024-08-01)
#### 🚀 Features
- add offscreenCanvas2d() & OffscreenCanvasContext ([ec59f5c](https://github.com/thi-ng/umbrella/commit/ec59f5c))
## [0.3.0](https://github.com/thi-ng/umbrella/tree/@thi.ng/canvas@0.3.0) (2024-08-01)

@@ -14,0 +20,0 @@

@@ -25,5 +25,14 @@ export interface Canvas2DOpts {

export interface CanvasContext {
canvas: HTMLCanvasElement | OffscreenCanvas;
ctx: CanvasRenderingContext2D | OffscreenCanvasRenderingContext2D;
canvas: HTMLCanvasElement;
ctx: CanvasRenderingContext2D;
}
export interface OffscreenCanvasContext {
canvas: OffscreenCanvas;
ctx: OffscreenCanvasRenderingContext2D;
}
export interface OffscreenCtxOpts {
alpha: boolean;
willReadFrequently: boolean;
storage: string;
}
/**

@@ -66,2 +75,3 @@ * Creates a canvas element of given size, obtains its 2D drawing context and

export declare const pixelCanvas2d: (width: number, height?: number, parent?: HTMLElement | null, opts?: Partial<Canvas2DOpts>) => CanvasContext;
export declare const offscreenCanvas2d: (width: number, height?: number, opts?: Partial<OffscreenCtxOpts>) => OffscreenCanvasContext;
/**

@@ -68,0 +78,0 @@ * Creates a canvas and draws given image into it. The `width` and `height`

@@ -17,2 +17,6 @@ const adaptiveCanvas2d = (width, height = width, parent, opts = {}) => {

});
const offscreenCanvas2d = (width, height = width, opts) => {
const canvas = new OffscreenCanvas(width, height);
return { canvas, ctx: canvas.getContext("2d", opts) };
};
const imageCanvas = (img, width = img.width, height = img.height, parent, opts) => {

@@ -39,3 +43,4 @@ const res = canvas2d(width, height, parent, opts);

isHighDPI,
offscreenCanvas2d,
pixelCanvas2d
};

4

package.json
{
"name": "@thi.ng/canvas",
"version": "0.3.0",
"version": "0.4.0",
"description": "Canvas creation & HDPI support helpers",

@@ -78,3 +78,3 @@ "type": "module",

},
"gitHead": "5b6de5f99277b244646722a40ea787971c6ffd05\n"
"gitHead": "74b023c95ab8219fd4192ef2a02962b2e2038563\n"
}
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