@oliversalzburg/js-utils 0.0.13 → 0.0.15
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/_site/assets/navigation.js +1 -1
- package/_site/assets/search.js +1 -1
- package/_site/classes/AbstractError.html +47 -8
- package/_site/classes/Canvas.html +66 -26
- package/_site/classes/CanvasSandbox.html +76 -0
- package/_site/classes/Euler.html +217 -0
- package/_site/classes/InternalError.html +48 -9
- package/_site/classes/InvalidArgumentError.html +47 -8
- package/_site/classes/InvalidOperationError.html +47 -8
- package/_site/classes/Matrix3.html +167 -0
- package/_site/classes/NotImplementedError.html +47 -8
- package/_site/classes/PermissionViolationError.html +47 -8
- package/_site/classes/Quaternion.html +211 -0
- package/_site/classes/Random.html +60 -13
- package/_site/classes/RenderLoop.html +62 -20
- package/_site/classes/ResourceConflictError.html +47 -8
- package/_site/classes/Transformation.html +52 -0
- package/_site/classes/UnexpectedNilError.html +44 -5
- package/_site/classes/UnknownError.html +47 -8
- package/_site/classes/Vector2.html +80 -37
- package/_site/classes/Vector3.html +201 -15
- package/_site/classes/Vector4.html +156 -0
- package/_site/favicon.ico +0 -0
- package/_site/functions/addVector2.html +43 -4
- package/_site/functions/addVector3.html +44 -0
- package/_site/functions/blend.html +41 -2
- package/_site/functions/blendAdditive.html +41 -2
- package/_site/functions/blendSubtractive.html +41 -2
- package/_site/functions/clamp.html +41 -2
- package/_site/functions/coalesceOnRejection.html +48 -0
- package/_site/functions/cosDeg.html +41 -2
- package/_site/functions/crossVector3.html +44 -0
- package/_site/functions/deg2rad.html +41 -2
- package/_site/functions/difference.html +41 -2
- package/_site/functions/distance.html +41 -2
- package/_site/functions/dotVector3.html +44 -0
- package/_site/functions/errorToJSON.html +41 -2
- package/_site/functions/errorToRecord.html +41 -2
- package/_site/functions/errorToSimpleSerializable.html +41 -2
- package/_site/functions/filterType.html +41 -2
- package/_site/functions/formatString.html +41 -2
- package/_site/functions/formatStringTemplate.html +41 -2
- package/_site/functions/fromRGB.html +41 -2
- package/_site/functions/fromRGBA.html +41 -2
- package/_site/functions/getA.html +41 -2
- package/_site/functions/getB.html +41 -2
- package/_site/functions/getDocumentElementTypeById.html +41 -2
- package/_site/functions/getG.html +41 -2
- package/_site/functions/getR.html +41 -2
- package/_site/functions/intersect.html +41 -2
- package/_site/functions/is.html +41 -2
- package/_site/functions/isError.html +41 -2
- package/_site/functions/isInteger.html +41 -2
- package/_site/functions/isNil.html +41 -2
- package/_site/functions/isqrt.html +41 -2
- package/_site/functions/multiplyVector2.html +43 -4
- package/_site/functions/multiplyVector3.html +44 -0
- package/_site/functions/mustExist.html +41 -2
- package/_site/functions/nextPalette.html +42 -2
- package/_site/functions/prepareAsyncContext.html +46 -0
- package/_site/functions/putPixel32.html +47 -8
- package/_site/functions/putPixel32Add.html +47 -8
- package/_site/functions/putPixel32Sub.html +47 -8
- package/_site/functions/putSubPixel32.html +41 -2
- package/_site/functions/rad2deg.html +41 -2
- package/_site/functions/randomRange.html +41 -2
- package/_site/functions/safeRGBComponent.html +41 -2
- package/_site/functions/seedFromString.html +41 -2
- package/_site/functions/shuffleArray.html +41 -2
- package/_site/functions/sinDeg.html +41 -2
- package/_site/functions/sleep.html +41 -2
- package/_site/functions/somecolor.html +41 -2
- package/_site/functions/subtractVector2.html +43 -4
- package/_site/functions/subtractVector3.html +44 -0
- package/_site/functions/toGrayScale.html +41 -2
- package/_site/functions/unknownToError.html +41 -2
- package/_site/index.html +41 -2
- package/_site/interfaces/CanvasOptions.html +42 -3
- package/_site/interfaces/CanvasSandboxApplication.html +60 -0
- package/_site/interfaces/CanvasSandboxExpectedOptions.html +48 -0
- package/_site/interfaces/RenderLoopOptions.html +43 -4
- package/_site/modules.html +59 -3
- package/_site/types/AnyAsyncFunction.html +41 -0
- package/_site/types/AnyConstructor.html +41 -2
- package/_site/types/AnyFunction.html +41 -2
- package/_site/types/ConstructorOf.html +41 -2
- package/_site/types/FunctionReturning.html +41 -2
- package/_site/types/Maybe.html +41 -2
- package/_site/types/Mixin.html +41 -2
- package/_site/types/Nil.html +41 -2
- package/_site/types/RenderLoopCallback.html +41 -2
- package/_site/types/SerializedError.html +41 -2
- package/_site/variables/MS_PER_FRAME_60FPS.html +42 -0
- package/_site/variables/PALETTES.html +41 -2
- package/_site/variables/TWO_PI.html +41 -2
- package/_site/variables/random-1.html +41 -2
- package/docs/assets/favicon.ico +0 -0
- package/lib/Async.d.ts +3 -0
- package/lib/Async.js +17 -0
- package/lib/Async.js.map +1 -0
- package/lib/async.d.ts +24 -0
- package/lib/async.js +37 -0
- package/lib/async.js.map +1 -0
- package/lib/core.d.ts +4 -0
- package/lib/core.js.map +1 -1
- package/lib/graphics/canvas copy.d.ts +170 -0
- package/lib/graphics/canvas copy.js +300 -0
- package/lib/graphics/canvas copy.js.map +1 -0
- package/lib/graphics/canvas-sandbox.d.ts +206 -0
- package/lib/graphics/canvas-sandbox.js +272 -0
- package/lib/graphics/canvas-sandbox.js.map +1 -0
- package/lib/graphics/canvas-worker.d.ts +50 -0
- package/lib/graphics/canvas-worker.js +78 -0
- package/lib/graphics/canvas-worker.js.map +1 -0
- package/lib/graphics/canvas.d.ts +14 -9
- package/lib/graphics/canvas.js +53 -19
- package/lib/graphics/canvas.js.map +1 -1
- package/lib/graphics/core.d.ts +2 -1
- package/lib/graphics/core.js +2 -0
- package/lib/graphics/core.js.map +1 -1
- package/lib/graphics/index.d.ts +1 -0
- package/lib/graphics/index.js +1 -0
- package/lib/graphics/index.js.map +1 -1
- package/lib/graphics/render-loop.d.ts +6 -5
- package/lib/graphics/render-loop.js +18 -9
- package/lib/graphics/render-loop.js.map +1 -1
- package/lib/index.d.ts +1 -0
- package/lib/index.js +1 -0
- package/lib/index.js.map +1 -1
- package/lib/math/euler.d.ts +19 -0
- package/lib/math/euler.js +23 -0
- package/lib/math/euler.js.map +1 -0
- package/lib/math/index.d.ts +5 -1
- package/lib/math/index.js +5 -1
- package/lib/math/index.js.map +1 -1
- package/lib/math/matrix3.d.ts +218 -0
- package/lib/math/matrix3.js +509 -0
- package/lib/math/matrix3.js.map +1 -0
- package/lib/math/quaternion.d.ts +120 -0
- package/lib/math/quaternion.js +272 -0
- package/lib/math/quaternion.js.map +1 -0
- package/lib/math/transformation.d.ts +27 -0
- package/lib/math/transformation.js +32 -0
- package/lib/math/transformation.js.map +1 -0
- package/lib/math/vector2.d.ts +19 -13
- package/lib/math/vector2.js +12 -4
- package/lib/math/vector2.js.map +1 -1
- package/lib/math/vector3.d.ts +256 -3
- package/lib/math/vector3.js +440 -1
- package/lib/math/vector3.js.map +1 -1
- package/lib/math/vector4.d.ts +183 -0
- package/lib/math/vector4.js +303 -0
- package/lib/math/vector4.js.map +1 -0
- package/lib/random.d.ts +12 -0
- package/lib/random.js +16 -0
- package/lib/random.js.map +1 -1
- package/package.json +4 -3
package/lib/Async.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Async.js","sourceRoot":"","sources":["../source/Async.ts"],"names":[],"mappings":"AAAA,MAAM,CAAC,MAAM,mBAAmB,GAAG,CACjC,OAA+B,EAC/B,OAAkC,EAClC,MAA+B,EAC/B,EAAE;IACF,OAAO,KAAK,OAAO,EAAE;SAClB,IAAI,CAAC,OAAO,IAAI,CAAC,GAAG,EAAE,CAAC,SAAS,CAAC,CAAC;SAClC,KAAK,CAAC,MAAM,IAAI,OAAO,CAAC,KAAK,CAAC,CAAC;AACpC,CAAC,CAAC;AAEF,MAAM,CAAC,MAAM,mBAAmB,GAAG,CAAC,OAA+B,EAAE,EAAE;IACrE,OAAO,GAAG,EAAE,CAAC,mBAAmB,CAAC,OAAO,CAAC,CAAC;AAC5C,CAAC,CAAC;AAEF,MAAM,CAAC,MAAM,eAAe,GAAG,KAAK,EAClC,UAAmE,EACnE,EAAK,EACL,EAAE;IACF,IAAI;QACF,OAAO,MAAM,UAAU,EAAE,CAAC;KAC3B;IAAC,OAAO,KAAK,EAAE;QACd,OAAO,EAAE,CAAC;KACX;AACH,CAAC,CAAC"}
|
package/lib/async.d.ts
ADDED
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { AnyAsyncFunction, FunctionReturning } from "./core.js";
|
|
2
|
+
/**
|
|
3
|
+
* Wraps the given asynchronous function in a new function that will ignore any outcome of
|
|
4
|
+
* the context as it resolves.
|
|
5
|
+
*
|
|
6
|
+
* This can be useful when providing asynchonous event handler to `.addEventlistener()`,
|
|
7
|
+
* which only expects synchronous functions.
|
|
8
|
+
* @param context The asynchronous function to exectute.
|
|
9
|
+
* @returns A function returning nothing.
|
|
10
|
+
* @group Async
|
|
11
|
+
*/
|
|
12
|
+
export declare const prepareAsyncContext: (context: AnyAsyncFunction) => (() => void);
|
|
13
|
+
/**
|
|
14
|
+
* Executes an asynchronous function and resolves with an alternative result
|
|
15
|
+
* in case the function failed.
|
|
16
|
+
* @param executable The asynchronous function to execute.
|
|
17
|
+
* @param to The result we want to return when the function errors.
|
|
18
|
+
* @template {unknown} TExecutableReturn The return type of the function.
|
|
19
|
+
* @template {unknown} TCoalesce The type of the object to coalesce to.
|
|
20
|
+
* @returns Whatever the function resolved to, or the provided replacement,
|
|
21
|
+
* in case the function failed.
|
|
22
|
+
* @group Async
|
|
23
|
+
*/
|
|
24
|
+
export declare const coalesceOnRejection: <TExecutableReturn, TCoalesce>(executable: FunctionReturning<Promise<TExecutableReturn>>, to: TCoalesce) => Promise<TExecutableReturn | TCoalesce>;
|
package/lib/async.js
ADDED
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Wraps the given asynchronous function in a new function that will ignore any outcome of
|
|
3
|
+
* the context as it resolves.
|
|
4
|
+
*
|
|
5
|
+
* This can be useful when providing asynchonous event handler to `.addEventlistener()`,
|
|
6
|
+
* which only expects synchronous functions.
|
|
7
|
+
* @param context The asynchronous function to exectute.
|
|
8
|
+
* @returns A function returning nothing.
|
|
9
|
+
* @group Async
|
|
10
|
+
*/
|
|
11
|
+
export const prepareAsyncContext = (context) => {
|
|
12
|
+
return () => {
|
|
13
|
+
void context()
|
|
14
|
+
.then(() => undefined)
|
|
15
|
+
.catch(() => undefined);
|
|
16
|
+
};
|
|
17
|
+
};
|
|
18
|
+
/**
|
|
19
|
+
* Executes an asynchronous function and resolves with an alternative result
|
|
20
|
+
* in case the function failed.
|
|
21
|
+
* @param executable The asynchronous function to execute.
|
|
22
|
+
* @param to The result we want to return when the function errors.
|
|
23
|
+
* @template {unknown} TExecutableReturn The return type of the function.
|
|
24
|
+
* @template {unknown} TCoalesce The type of the object to coalesce to.
|
|
25
|
+
* @returns Whatever the function resolved to, or the provided replacement,
|
|
26
|
+
* in case the function failed.
|
|
27
|
+
* @group Async
|
|
28
|
+
*/
|
|
29
|
+
export const coalesceOnRejection = async (executable, to) => {
|
|
30
|
+
try {
|
|
31
|
+
return await executable();
|
|
32
|
+
}
|
|
33
|
+
catch (error) {
|
|
34
|
+
return to;
|
|
35
|
+
}
|
|
36
|
+
};
|
|
37
|
+
//# sourceMappingURL=async.js.map
|
package/lib/async.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"async.js","sourceRoot":"","sources":["../source/async.ts"],"names":[],"mappings":"AAEA;;;;;;;;;GASG;AACH,MAAM,CAAC,MAAM,mBAAmB,GAAG,CAAC,OAAyB,EAAgB,EAAE;IAC7E,OAAO,GAAG,EAAE;QACV,KAAK,OAAO,EAAE;aACX,IAAI,CAAC,GAAG,EAAE,CAAC,SAAS,CAAC;aACrB,KAAK,CAAC,GAAG,EAAE,CAAC,SAAS,CAAC,CAAC;IAC5B,CAAC,CAAC;AACJ,CAAC,CAAC;AAEF;;;;;;;;;;GAUG;AACH,MAAM,CAAC,MAAM,mBAAmB,GAAG,KAAK,EACtC,UAAyD,EACzD,EAAa,EACb,EAAE;IACF,IAAI;QACF,OAAO,MAAM,UAAU,EAAE,CAAC;KAC3B;IAAC,OAAO,KAAK,EAAE;QACd,OAAO,EAAE,CAAC;KACX;AACH,CAAC,CAAC"}
|
package/lib/core.d.ts
CHANGED
|
@@ -6,6 +6,10 @@ export type ConstructorOf<T = Record<string, unknown>> = new (...args: Array<any
|
|
|
6
6
|
* Describes literally any function.
|
|
7
7
|
*/
|
|
8
8
|
export type AnyFunction = (...args: Array<any>) => any;
|
|
9
|
+
/**
|
|
10
|
+
* Describes literally any asynchronous function.
|
|
11
|
+
*/
|
|
12
|
+
export type AnyAsyncFunction = (...args: Array<any>) => Promise<any>;
|
|
9
13
|
/**
|
|
10
14
|
* Any constructor
|
|
11
15
|
*/
|
package/lib/core.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"core.js","sourceRoot":"","sources":["../source/core.ts"],"names":[],"mappings":"AAAA,uDAAuD;
|
|
1
|
+
{"version":3,"file":"core.js","sourceRoot":"","sources":["../source/core.ts"],"names":[],"mappings":"AAAA,uDAAuD;AAiCvD;;;;;;GAMG;AACH,MAAM,CAAC,MAAM,KAAK,GAAG,CAAC,KAAa,EAAE,KAAa,EAAE,IAAY,EAAU,EAAE;IAC1E,OAAO,IAAI,CAAC,GAAG,CAAC,KAAK,EAAE,IAAI,CAAC,GAAG,CAAC,KAAK,EAAE,IAAI,CAAC,CAAC,CAAC;AAChD,CAAC,CAAC"}
|
|
@@ -0,0 +1,170 @@
|
|
|
1
|
+
/// <reference types="@types/web" />
|
|
2
|
+
/**
|
|
3
|
+
* Construction options for a {@linkcode Canvas}.
|
|
4
|
+
* @group Graphics
|
|
5
|
+
*/
|
|
6
|
+
export interface CanvasOptions {
|
|
7
|
+
/**
|
|
8
|
+
* Was this {@linkcode Canvas} created with the ability to copy the front buffer back into
|
|
9
|
+
* the back buffer?
|
|
10
|
+
*/
|
|
11
|
+
readonly supportReadBack: boolean;
|
|
12
|
+
}
|
|
13
|
+
/**
|
|
14
|
+
* The {@linkcode Canvas} is a double-buffered construct to help with drawing to a
|
|
15
|
+
* {@linkcode !HTMLCanvasElement} with best possible performance.
|
|
16
|
+
* We utilize an {@linkcode !OffscreenCanvas} with a {@linkcode !OffscreenCanvasRenderingContext2D}
|
|
17
|
+
* to draw frames and expect to render them back to the DOM in regular intervals.
|
|
18
|
+
* @group Graphics
|
|
19
|
+
*/
|
|
20
|
+
export declare class Canvas {
|
|
21
|
+
#private;
|
|
22
|
+
/**
|
|
23
|
+
* The {@linkcode !HTMLCanvasElement} we're interacting with in the DOM.
|
|
24
|
+
*/
|
|
25
|
+
readonly canvasDom: HTMLCanvasElement | undefined;
|
|
26
|
+
/**
|
|
27
|
+
* The width of the canvas.
|
|
28
|
+
*/
|
|
29
|
+
readonly width: number;
|
|
30
|
+
/**
|
|
31
|
+
* The height of the canvas.
|
|
32
|
+
*/
|
|
33
|
+
readonly height: number;
|
|
34
|
+
/**
|
|
35
|
+
* The {@linkcode !OffscreenCanvasRenderingContext2D} we're using to draw to the canvas.
|
|
36
|
+
*/
|
|
37
|
+
readonly context: OffscreenCanvasRenderingContext2D | undefined;
|
|
38
|
+
/**
|
|
39
|
+
* Our back buffer.
|
|
40
|
+
*/
|
|
41
|
+
buffer: Uint8ClampedArray | undefined;
|
|
42
|
+
/**
|
|
43
|
+
* The configuration that was used for this canvas.
|
|
44
|
+
*/
|
|
45
|
+
readonly options: Readonly<Partial<CanvasOptions>>;
|
|
46
|
+
constructor(canvas: OffscreenCanvas);
|
|
47
|
+
/**
|
|
48
|
+
* Constructs a new {@linkcode Canvas}.
|
|
49
|
+
* @param canvas The canvas to wrap.
|
|
50
|
+
* @param worker
|
|
51
|
+
* @param options The configuration for this canvas.
|
|
52
|
+
*/
|
|
53
|
+
constructor(canvas: HTMLCanvasElement, worker: Worker, options?: Partial<CanvasOptions>);
|
|
54
|
+
static reconstruct(canvasOffscreen: OffscreenCanvas): Canvas;
|
|
55
|
+
/**
|
|
56
|
+
* Draws the back buffer onto the canvas.
|
|
57
|
+
*/
|
|
58
|
+
update(): void;
|
|
59
|
+
/**
|
|
60
|
+
* Draws the offscreen canvas into the DOM canvas.
|
|
61
|
+
*/
|
|
62
|
+
render(): void;
|
|
63
|
+
/**
|
|
64
|
+
* Draws a slightly transparent, black rectangle over the canvas,
|
|
65
|
+
* and then reads the result back into the buffer.
|
|
66
|
+
* @param color The color to fade the buffer with. The alpha component of
|
|
67
|
+
* the color defines how strong the fade is. `0` is not at all, `255` makes
|
|
68
|
+
* it instantly black.
|
|
69
|
+
*/
|
|
70
|
+
fade(color?: number): void;
|
|
71
|
+
/**
|
|
72
|
+
* Reads the front buffer back into the back buffer.
|
|
73
|
+
*/
|
|
74
|
+
bufferReadBack(): void;
|
|
75
|
+
/**
|
|
76
|
+
* Returns the color of a pixel in the back buffer.
|
|
77
|
+
* @param x The X coordinate to retrieve.
|
|
78
|
+
* @param y The X coordinate to retrieve.
|
|
79
|
+
* @returns The color of the pixel at the given local.
|
|
80
|
+
*/
|
|
81
|
+
getPixel32(x: number, y: number): number;
|
|
82
|
+
/**
|
|
83
|
+
* Colors a pixel in the back buffer.
|
|
84
|
+
* @param x The X coordinate to color.
|
|
85
|
+
* @param y The Y coordinate to color.
|
|
86
|
+
* @param color The color to place at the coordinate.
|
|
87
|
+
*/
|
|
88
|
+
setPixel32(x: number, y: number, color: number): void;
|
|
89
|
+
/**
|
|
90
|
+
* Fills the entire back buffer with the given color.
|
|
91
|
+
* @param color The color to fill the back buffer with.
|
|
92
|
+
*/
|
|
93
|
+
clearWith(color: number): void;
|
|
94
|
+
/**
|
|
95
|
+
* Fills the entire back buffer with the given color.
|
|
96
|
+
* @param color The color to fill the back buffer with.
|
|
97
|
+
*/
|
|
98
|
+
blendWith(color: number): void;
|
|
99
|
+
}
|
|
100
|
+
/**
|
|
101
|
+
* Linearly blends a new pixel with an existing color value in a {@linkcode Canvas}.
|
|
102
|
+
*
|
|
103
|
+
* As this method is often called many times in render loops, only bounds
|
|
104
|
+
* checking is applied to the given coordinates.
|
|
105
|
+
*
|
|
106
|
+
* The coordinates are **expected to already be integers**. Supplying numbers with fractions
|
|
107
|
+
* has performance implications. Ensure you're working with integers, or truncate the
|
|
108
|
+
* coordinates before passing them in.
|
|
109
|
+
*
|
|
110
|
+
* The `alpha` value is expected to be an integer in the range from `0` to `255`.
|
|
111
|
+
* `0` meaning fully transparent, `255` meaning fully opaque.
|
|
112
|
+
* @param canvas The {@linkcode Canvas} to interact with.
|
|
113
|
+
* @param x The X coordinate at which to place the pixel.
|
|
114
|
+
* @param y The Y coordinate at which to place the pixel.
|
|
115
|
+
* @param color The color of the pixel.
|
|
116
|
+
* @param alpha The alpha value to use to blend the pixel with existing color at the location.
|
|
117
|
+
* @group Graphics
|
|
118
|
+
*/
|
|
119
|
+
export declare const putPixel32: (canvas: Canvas, x: number, y: number, color: number, alpha: number) => void;
|
|
120
|
+
/**
|
|
121
|
+
* Additively blends a new pixel with an existing color value in a {@linkcode Canvas}.
|
|
122
|
+
*
|
|
123
|
+
* As this method is often called many times in render loops, only bounds
|
|
124
|
+
* checking is applied to the given coordinates.
|
|
125
|
+
*
|
|
126
|
+
* The coordinates are **expected to already be integers**. Supplying numbers with fractions
|
|
127
|
+
* has performance implications. Ensure you're working with integers, or truncate the
|
|
128
|
+
* coordinates before passing them in.
|
|
129
|
+
*
|
|
130
|
+
* The `alpha` value is expected to be an integer in the range from `0` to `255`.
|
|
131
|
+
* `0` meaning fully transparent, `255` meaning fully opaque.
|
|
132
|
+
* @param canvas The {@linkcode Canvas} to interact with.
|
|
133
|
+
* @param x The X coordinate at which to place the pixel.
|
|
134
|
+
* @param y The Y coordinate at which to place the pixel.
|
|
135
|
+
* @param color The color of the pixel.
|
|
136
|
+
* @param alpha The alpha value to use to blend the pixel with existing color at the location.
|
|
137
|
+
* @group Graphics
|
|
138
|
+
*/
|
|
139
|
+
export declare const putPixel32Add: (canvas: Canvas, x: number, y: number, color: number, alpha: number) => void;
|
|
140
|
+
/**
|
|
141
|
+
* Subtractively blends a new pixel with an existing color value in a {@linkcode Canvas}.
|
|
142
|
+
*
|
|
143
|
+
* As this method is often called many times in render loops, only bounds
|
|
144
|
+
* checking is applied to the given coordinates.
|
|
145
|
+
*
|
|
146
|
+
* The coordinates are **expected to already be integers**. Supplying numbers with fractions
|
|
147
|
+
* has performance implications. Ensure you're working with integers, or truncate the
|
|
148
|
+
* coordinates before passing them in.
|
|
149
|
+
*
|
|
150
|
+
* The `alpha` value is expected to be an integer in the range from `0` to `255`.
|
|
151
|
+
* `0` meaning fully transparent, `255` meaning fully opaque.
|
|
152
|
+
* @param canvas The {@linkcode Canvas} to interact with.
|
|
153
|
+
* @param x The X coordinate at which to place the pixel.
|
|
154
|
+
* @param y The Y coordinate at which to place the pixel.
|
|
155
|
+
* @param color The color of the pixel.
|
|
156
|
+
* @param alpha The alpha value to use to blend the pixel with existing color at the location.
|
|
157
|
+
* @group Graphics
|
|
158
|
+
*/
|
|
159
|
+
export declare const putPixel32Sub: (canvas: Canvas, x: number, y: number, color: number, alpha: number) => void;
|
|
160
|
+
/**
|
|
161
|
+
* Linearly blends a new pixel with an existing color value in a {@linkcode Canvas}.
|
|
162
|
+
* Compared to {@linkcode putPixel32}, this function supports sub-pixel placement, but is dramatically slower.
|
|
163
|
+
* @param canvas The {@linkcode Canvas} to interact with.
|
|
164
|
+
* @param x The X coordinate at which to place the pixel.
|
|
165
|
+
* @param y The Y coordinate at which to place the pixel.
|
|
166
|
+
* @param color The color of the pixel.
|
|
167
|
+
* @param alpha The alpha value to use to blend the pixel with existing color at the location.
|
|
168
|
+
* @group Graphics
|
|
169
|
+
*/
|
|
170
|
+
export declare const putSubPixel32: (canvas: Canvas, x: number, y: number, color: number, alpha: number) => void;
|
|
@@ -0,0 +1,300 @@
|
|
|
1
|
+
import { InvalidOperationError } from "../errors/InvalidOperationError.js";
|
|
2
|
+
import { mustExist } from "../nil.js";
|
|
3
|
+
import { blend, blendAdditive, blendSubtractive, fromRGBA, getA, getB, getG, getR, } from "./core.js";
|
|
4
|
+
/**
|
|
5
|
+
* The {@linkcode Canvas} is a double-buffered construct to help with drawing to a
|
|
6
|
+
* {@linkcode !HTMLCanvasElement} with best possible performance.
|
|
7
|
+
* We utilize an {@linkcode !OffscreenCanvas} with a {@linkcode !OffscreenCanvasRenderingContext2D}
|
|
8
|
+
* to draw frames and expect to render them back to the DOM in regular intervals.
|
|
9
|
+
* @group Graphics
|
|
10
|
+
*/
|
|
11
|
+
export class Canvas {
|
|
12
|
+
/**
|
|
13
|
+
* The {@linkcode !HTMLCanvasElement} we're interacting with in the DOM.
|
|
14
|
+
*/
|
|
15
|
+
canvasDom;
|
|
16
|
+
/**
|
|
17
|
+
* The rendering context for the canvas located in the DOM.
|
|
18
|
+
*/
|
|
19
|
+
//#canvasDomContext: ImageBitmapRenderingContext;
|
|
20
|
+
/**
|
|
21
|
+
* The offscreen canvas we use for rendering.
|
|
22
|
+
*/
|
|
23
|
+
#canvasOffscreen;
|
|
24
|
+
/**
|
|
25
|
+
* The width of the canvas.
|
|
26
|
+
*/
|
|
27
|
+
width;
|
|
28
|
+
/**
|
|
29
|
+
* The height of the canvas.
|
|
30
|
+
*/
|
|
31
|
+
height;
|
|
32
|
+
/**
|
|
33
|
+
* The {@linkcode !OffscreenCanvasRenderingContext2D} we're using to draw to the canvas.
|
|
34
|
+
*/
|
|
35
|
+
context;
|
|
36
|
+
/**
|
|
37
|
+
* The {@linkcode !ImageData} object in our offscreen canvas. We usually interact with its
|
|
38
|
+
* {@linkcode Canvas.buffer buffer} directly.
|
|
39
|
+
*/
|
|
40
|
+
#imageData;
|
|
41
|
+
/**
|
|
42
|
+
* Our back buffer.
|
|
43
|
+
*/
|
|
44
|
+
buffer;
|
|
45
|
+
/**
|
|
46
|
+
* The configuration that was used for this canvas.
|
|
47
|
+
*/
|
|
48
|
+
options;
|
|
49
|
+
constructor(canvas, worker, options) {
|
|
50
|
+
this.width = canvas.width;
|
|
51
|
+
this.height = canvas.height;
|
|
52
|
+
// @ts-expect-error this is fucked
|
|
53
|
+
if (canvas["__proto__"].toString().includes("HTMLCanvasElement")) {
|
|
54
|
+
this.options = options ?? {};
|
|
55
|
+
this.canvasDom = canvas;
|
|
56
|
+
//this.#canvasDomContext = mustExist(
|
|
57
|
+
// this.canvasDom.getContext("bitmaprenderer", {
|
|
58
|
+
// alpha: false,
|
|
59
|
+
// }),
|
|
60
|
+
// "Unable to create rendering context for DOM canvas.",
|
|
61
|
+
//);
|
|
62
|
+
this.#canvasOffscreen = this.canvasDom.transferControlToOffscreen();
|
|
63
|
+
//this.context.font = "12px sans-serif";
|
|
64
|
+
mustExist(worker).postMessage({ id: "init", canvas: this.#canvasOffscreen }, [
|
|
65
|
+
this.#canvasOffscreen,
|
|
66
|
+
]);
|
|
67
|
+
}
|
|
68
|
+
else {
|
|
69
|
+
this.options = options ?? {};
|
|
70
|
+
this.#canvasOffscreen = canvas;
|
|
71
|
+
this.context = mustExist(this.#canvasOffscreen.getContext("2d", {
|
|
72
|
+
alpha: false,
|
|
73
|
+
desynchronized: false,
|
|
74
|
+
//willReadFrequently: this.options.supportReadBack,
|
|
75
|
+
}), "Unable to create rendering context for offscreen canvas.");
|
|
76
|
+
this.#imageData = this.context.createImageData(this.width, this.height);
|
|
77
|
+
this.buffer = this.#imageData.data;
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
static reconstruct(canvasOffscreen) {
|
|
81
|
+
const instance = new Canvas(canvasOffscreen);
|
|
82
|
+
return instance;
|
|
83
|
+
}
|
|
84
|
+
/**
|
|
85
|
+
* Draws the back buffer onto the canvas.
|
|
86
|
+
*/
|
|
87
|
+
update() {
|
|
88
|
+
if (!this.context || !this.#imageData) {
|
|
89
|
+
return;
|
|
90
|
+
}
|
|
91
|
+
this.context.putImageData(this.#imageData, 0, 0);
|
|
92
|
+
}
|
|
93
|
+
/**
|
|
94
|
+
* Draws the offscreen canvas into the DOM canvas.
|
|
95
|
+
*/
|
|
96
|
+
render() {
|
|
97
|
+
this.update();
|
|
98
|
+
return;
|
|
99
|
+
//const newFrame = this.#canvasOffscreen.transferToImageBitmap();
|
|
100
|
+
//this.#canvasDomContext.transferFromImageBitmap(newFrame);
|
|
101
|
+
}
|
|
102
|
+
/**
|
|
103
|
+
* Draws a slightly transparent, black rectangle over the canvas,
|
|
104
|
+
* and then reads the result back into the buffer.
|
|
105
|
+
* @param color The color to fade the buffer with. The alpha component of
|
|
106
|
+
* the color defines how strong the fade is. `0` is not at all, `255` makes
|
|
107
|
+
* it instantly black.
|
|
108
|
+
*/
|
|
109
|
+
fade(color = fromRGBA(0, 0, 0, 1)) {
|
|
110
|
+
this.blendWith(color);
|
|
111
|
+
}
|
|
112
|
+
/**
|
|
113
|
+
* Reads the front buffer back into the back buffer.
|
|
114
|
+
*/
|
|
115
|
+
bufferReadBack() {
|
|
116
|
+
if (!this.options.supportReadBack) {
|
|
117
|
+
throw new InvalidOperationError("To use `bufferReadBack()`, you must construct the `Canvas` with `options.supportReadBack` set to `true`.");
|
|
118
|
+
}
|
|
119
|
+
if (!this.context) {
|
|
120
|
+
return;
|
|
121
|
+
}
|
|
122
|
+
this.#imageData = this.context.getImageData(0, 0, this.width, this.height);
|
|
123
|
+
this.buffer = this.#imageData.data;
|
|
124
|
+
}
|
|
125
|
+
/**
|
|
126
|
+
* Returns the color of a pixel in the back buffer.
|
|
127
|
+
* @param x The X coordinate to retrieve.
|
|
128
|
+
* @param y The X coordinate to retrieve.
|
|
129
|
+
* @returns The color of the pixel at the given local.
|
|
130
|
+
*/
|
|
131
|
+
getPixel32(x, y) {
|
|
132
|
+
if (!this.buffer) {
|
|
133
|
+
return 0;
|
|
134
|
+
}
|
|
135
|
+
const bufferOffset = (x + y * this.width) * 4;
|
|
136
|
+
return fromRGBA(this.buffer[bufferOffset + 0], this.buffer[bufferOffset + 1], this.buffer[bufferOffset + 2], this.buffer[bufferOffset + 3]);
|
|
137
|
+
}
|
|
138
|
+
/**
|
|
139
|
+
* Colors a pixel in the back buffer.
|
|
140
|
+
* @param x The X coordinate to color.
|
|
141
|
+
* @param y The Y coordinate to color.
|
|
142
|
+
* @param color The color to place at the coordinate.
|
|
143
|
+
*/
|
|
144
|
+
setPixel32(x, y, color) {
|
|
145
|
+
if (!this.buffer) {
|
|
146
|
+
return;
|
|
147
|
+
}
|
|
148
|
+
const bufferOffset = (x + y * this.width) * 4;
|
|
149
|
+
this.buffer[bufferOffset + 0] = getR(color);
|
|
150
|
+
this.buffer[bufferOffset + 1] = getG(color);
|
|
151
|
+
this.buffer[bufferOffset + 2] = getB(color);
|
|
152
|
+
this.buffer[bufferOffset + 3] = getA(color);
|
|
153
|
+
}
|
|
154
|
+
/**
|
|
155
|
+
* Fills the entire back buffer with the given color.
|
|
156
|
+
* @param color The color to fill the back buffer with.
|
|
157
|
+
*/
|
|
158
|
+
clearWith(color) {
|
|
159
|
+
if (!this.buffer) {
|
|
160
|
+
return;
|
|
161
|
+
}
|
|
162
|
+
const r = getR(color);
|
|
163
|
+
const g = getG(color);
|
|
164
|
+
const b = getB(color);
|
|
165
|
+
const a = getA(color);
|
|
166
|
+
for (let bufferOffset = 0; bufferOffset < this.width * this.height * 4; bufferOffset += 4) {
|
|
167
|
+
this.buffer[bufferOffset + 0] = r;
|
|
168
|
+
this.buffer[bufferOffset + 1] = g;
|
|
169
|
+
this.buffer[bufferOffset + 2] = b;
|
|
170
|
+
this.buffer[bufferOffset + 3] = a;
|
|
171
|
+
}
|
|
172
|
+
}
|
|
173
|
+
/**
|
|
174
|
+
* Fills the entire back buffer with the given color.
|
|
175
|
+
* @param color The color to fill the back buffer with.
|
|
176
|
+
*/
|
|
177
|
+
blendWith(color) {
|
|
178
|
+
if (!this.buffer) {
|
|
179
|
+
return;
|
|
180
|
+
}
|
|
181
|
+
const r = getR(color);
|
|
182
|
+
const g = getG(color);
|
|
183
|
+
const b = getB(color);
|
|
184
|
+
const a = getA(color);
|
|
185
|
+
for (let bufferOffset = 0; bufferOffset < this.width * this.height * 4; bufferOffset += 4) {
|
|
186
|
+
this.buffer[bufferOffset + 0] = (a * r + (255 - a) * this.buffer[bufferOffset + 0]) >> 8;
|
|
187
|
+
this.buffer[bufferOffset + 1] = (a * g + (255 - a) * this.buffer[bufferOffset + 1]) >> 8;
|
|
188
|
+
this.buffer[bufferOffset + 2] = (a * b + (255 - a) * this.buffer[bufferOffset + 2]) >> 8;
|
|
189
|
+
}
|
|
190
|
+
}
|
|
191
|
+
}
|
|
192
|
+
/**
|
|
193
|
+
* Linearly blends a new pixel with an existing color value in a {@linkcode Canvas}.
|
|
194
|
+
*
|
|
195
|
+
* As this method is often called many times in render loops, only bounds
|
|
196
|
+
* checking is applied to the given coordinates.
|
|
197
|
+
*
|
|
198
|
+
* The coordinates are **expected to already be integers**. Supplying numbers with fractions
|
|
199
|
+
* has performance implications. Ensure you're working with integers, or truncate the
|
|
200
|
+
* coordinates before passing them in.
|
|
201
|
+
*
|
|
202
|
+
* The `alpha` value is expected to be an integer in the range from `0` to `255`.
|
|
203
|
+
* `0` meaning fully transparent, `255` meaning fully opaque.
|
|
204
|
+
* @param canvas The {@linkcode Canvas} to interact with.
|
|
205
|
+
* @param x The X coordinate at which to place the pixel.
|
|
206
|
+
* @param y The Y coordinate at which to place the pixel.
|
|
207
|
+
* @param color The color of the pixel.
|
|
208
|
+
* @param alpha The alpha value to use to blend the pixel with existing color at the location.
|
|
209
|
+
* @group Graphics
|
|
210
|
+
*/
|
|
211
|
+
export const putPixel32 = (canvas, x, y, color, alpha) => {
|
|
212
|
+
if (canvas.width < x || x < 0 || canvas.height < y || y < 0) {
|
|
213
|
+
return;
|
|
214
|
+
}
|
|
215
|
+
const srcColor = canvas.getPixel32(x, y);
|
|
216
|
+
const newColor = blend(srcColor, color, alpha);
|
|
217
|
+
canvas.setPixel32(x, y, newColor);
|
|
218
|
+
};
|
|
219
|
+
/**
|
|
220
|
+
* Additively blends a new pixel with an existing color value in a {@linkcode Canvas}.
|
|
221
|
+
*
|
|
222
|
+
* As this method is often called many times in render loops, only bounds
|
|
223
|
+
* checking is applied to the given coordinates.
|
|
224
|
+
*
|
|
225
|
+
* The coordinates are **expected to already be integers**. Supplying numbers with fractions
|
|
226
|
+
* has performance implications. Ensure you're working with integers, or truncate the
|
|
227
|
+
* coordinates before passing them in.
|
|
228
|
+
*
|
|
229
|
+
* The `alpha` value is expected to be an integer in the range from `0` to `255`.
|
|
230
|
+
* `0` meaning fully transparent, `255` meaning fully opaque.
|
|
231
|
+
* @param canvas The {@linkcode Canvas} to interact with.
|
|
232
|
+
* @param x The X coordinate at which to place the pixel.
|
|
233
|
+
* @param y The Y coordinate at which to place the pixel.
|
|
234
|
+
* @param color The color of the pixel.
|
|
235
|
+
* @param alpha The alpha value to use to blend the pixel with existing color at the location.
|
|
236
|
+
* @group Graphics
|
|
237
|
+
*/
|
|
238
|
+
export const putPixel32Add = (canvas, x, y, color, alpha) => {
|
|
239
|
+
if (canvas.width < x || x < 0 || canvas.height < y || y < 0) {
|
|
240
|
+
return;
|
|
241
|
+
}
|
|
242
|
+
const srcColor = canvas.getPixel32(x, y);
|
|
243
|
+
const newColor = blendAdditive(srcColor, color, alpha);
|
|
244
|
+
canvas.setPixel32(x, y, newColor);
|
|
245
|
+
};
|
|
246
|
+
/**
|
|
247
|
+
* Subtractively blends a new pixel with an existing color value in a {@linkcode Canvas}.
|
|
248
|
+
*
|
|
249
|
+
* As this method is often called many times in render loops, only bounds
|
|
250
|
+
* checking is applied to the given coordinates.
|
|
251
|
+
*
|
|
252
|
+
* The coordinates are **expected to already be integers**. Supplying numbers with fractions
|
|
253
|
+
* has performance implications. Ensure you're working with integers, or truncate the
|
|
254
|
+
* coordinates before passing them in.
|
|
255
|
+
*
|
|
256
|
+
* The `alpha` value is expected to be an integer in the range from `0` to `255`.
|
|
257
|
+
* `0` meaning fully transparent, `255` meaning fully opaque.
|
|
258
|
+
* @param canvas The {@linkcode Canvas} to interact with.
|
|
259
|
+
* @param x The X coordinate at which to place the pixel.
|
|
260
|
+
* @param y The Y coordinate at which to place the pixel.
|
|
261
|
+
* @param color The color of the pixel.
|
|
262
|
+
* @param alpha The alpha value to use to blend the pixel with existing color at the location.
|
|
263
|
+
* @group Graphics
|
|
264
|
+
*/
|
|
265
|
+
export const putPixel32Sub = (canvas, x, y, color, alpha) => {
|
|
266
|
+
if (canvas.width < x || x < 0 || canvas.height < y || y < 0) {
|
|
267
|
+
return;
|
|
268
|
+
}
|
|
269
|
+
const srcColor = canvas.getPixel32(x, y);
|
|
270
|
+
const newColor = blendSubtractive(srcColor, color, alpha);
|
|
271
|
+
canvas.setPixel32(x, y, newColor);
|
|
272
|
+
};
|
|
273
|
+
/**
|
|
274
|
+
* Linearly blends a new pixel with an existing color value in a {@linkcode Canvas}.
|
|
275
|
+
* Compared to {@linkcode putPixel32}, this function supports sub-pixel placement, but is dramatically slower.
|
|
276
|
+
* @param canvas The {@linkcode Canvas} to interact with.
|
|
277
|
+
* @param x The X coordinate at which to place the pixel.
|
|
278
|
+
* @param y The Y coordinate at which to place the pixel.
|
|
279
|
+
* @param color The color of the pixel.
|
|
280
|
+
* @param alpha The alpha value to use to blend the pixel with existing color at the location.
|
|
281
|
+
* @group Graphics
|
|
282
|
+
*/
|
|
283
|
+
export const putSubPixel32 = (canvas, x, y, color, alpha) => {
|
|
284
|
+
if (canvas.width < x || x < 0 || canvas.height < y || y < 0) {
|
|
285
|
+
return;
|
|
286
|
+
}
|
|
287
|
+
const xweight = x - Math.trunc(x);
|
|
288
|
+
const yweight = y - Math.trunc(y);
|
|
289
|
+
const xweightn = 1 - xweight;
|
|
290
|
+
const yweightn = 1 - yweight;
|
|
291
|
+
const alpha0 = xweightn * yweightn * alpha;
|
|
292
|
+
const alpha1 = xweight * yweightn * alpha;
|
|
293
|
+
const alpha2 = xweightn * yweight * alpha;
|
|
294
|
+
const alpha3 = xweight * yweight * alpha;
|
|
295
|
+
putPixel32(canvas, x + 0, y + 0, color, alpha0);
|
|
296
|
+
putPixel32(canvas, x + 1, y + 0, color, alpha1);
|
|
297
|
+
putPixel32(canvas, x + 0, y + 1, color, alpha2);
|
|
298
|
+
putPixel32(canvas, x + 1, y + 1, color, alpha3);
|
|
299
|
+
};
|
|
300
|
+
//# sourceMappingURL=canvas%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