@effing/canvas 0.40.0 → 0.40.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -434,15 +434,25 @@ type FontData = {
434
434
  type ImageCache = Map<string, Promise<Image>>;
435
435
 
436
436
  type EmojiStyle =
437
- | "twemoji"
438
- | "openmoji"
439
- | "blobmoji"
440
- | "noto"
441
- | "fluent"
442
- | "fluentFlat";
437
+ "twemoji" | "openmoji" | "blobmoji" | "noto" | "fluent" | "fluentFlat";
443
438
  ```
444
439
 
445
- Also re-exports from `@napi-rs/canvas`: `Canvas`, `SKRSContext2D`, `GlobalFonts`, `Image`, `LottieAnimation`. (`loadImage` is wrapped — see above — not re-exported directly.)
440
+ ### Canvas Primitives
441
+
442
+ The building blocks you need alongside a context are re-exported from `@napi-rs/canvas`, so you never need to import (or declare a dependency on) `@napi-rs/canvas` directly: `Canvas`, `SKRSContext2D`, `GlobalFonts`, `Image`, `ImageData`, `Path2D`, `DOMMatrix`, `DOMPoint`, `DOMRect`, `PathOp`, `FillType`, `StrokeJoin`, `StrokeCap`, and `LottieAnimation`. (`loadImage` is wrapped — see above — not re-exported directly.)
443
+
444
+ ```typescript
445
+ import { createCanvas, Path2D } from "@effing/canvas";
446
+
447
+ const canvas = createCanvas(200, 200);
448
+ const ctx = canvas.getContext("2d");
449
+
450
+ const star = new Path2D(
451
+ "M100 10 L123 80 L195 80 L137 125 L160 195 L100 150 L40 195 L63 125 L5 80 L77 80 Z",
452
+ );
453
+ ctx.fillStyle = "gold";
454
+ ctx.fill(star);
455
+ ```
446
456
 
447
457
  ## Examples
448
458
 
package/dist/index.d.ts CHANGED
@@ -1,6 +1,6 @@
1
1
  import * as _napi_rs_canvas from '@napi-rs/canvas';
2
- import { loadImage as loadImage$1, Image, LottieAnimation, SKRSContext2D } from '@napi-rs/canvas';
3
- export { Canvas, GlobalFonts, Image, LottieAnimation, SKRSContext2D } from '@napi-rs/canvas';
2
+ import { Image, loadImage as loadImage$1, LottieAnimation, SKRSContext2D } from '@napi-rs/canvas';
3
+ export { Canvas, DOMMatrix, DOMPoint, DOMRect, FillType, GlobalFonts, Image, ImageData, LottieAnimation, Path2D, PathOp, SKRSContext2D, StrokeCap, StrokeJoin } from '@napi-rs/canvas';
4
4
  import { ReactNode } from 'react';
5
5
 
6
6
  /** Source types accepted by {@link loadImage}, mirroring @napi-rs/canvas. */
package/dist/index.js CHANGED
@@ -3,7 +3,16 @@ import { createCanvas as _createCanvas } from "@napi-rs/canvas";
3
3
  import {
4
4
  Canvas,
5
5
  GlobalFonts as GlobalFonts2,
6
- Image
6
+ Image,
7
+ ImageData,
8
+ Path2D as Path2D4,
9
+ DOMMatrix,
10
+ DOMPoint,
11
+ DOMRect,
12
+ PathOp,
13
+ FillType,
14
+ StrokeJoin,
15
+ StrokeCap
7
16
  } from "@napi-rs/canvas";
8
17
 
9
18
  // src/image.ts
@@ -4087,9 +4096,18 @@ function createCanvas3(width, height) {
4087
4096
  }
4088
4097
  export {
4089
4098
  Canvas,
4099
+ DOMMatrix,
4100
+ DOMPoint,
4101
+ DOMRect,
4102
+ FillType,
4090
4103
  GlobalFonts2 as GlobalFonts,
4091
4104
  Image,
4105
+ ImageData,
4092
4106
  LottieAnimation,
4107
+ Path2D4 as Path2D,
4108
+ PathOp,
4109
+ StrokeCap,
4110
+ StrokeJoin,
4093
4111
  createCanvas3 as createCanvas,
4094
4112
  findLargestUsableFontSize,
4095
4113
  loadImage,