Skip to content

Commit

Permalink
refactor(pixel): update type usage
Browse files Browse the repository at this point in the history
  • Loading branch information
postspectacular committed Apr 19, 2024
1 parent 8e242f1 commit 8ccc518
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 5 deletions.
3 changes: 2 additions & 1 deletion packages/pixel/src/api.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import type {
FnU2,
IGrid2D,
IObjectOf,
Maybe,
NumericArray,
Range0_3,
TypedArray,
Expand Down Expand Up @@ -229,7 +230,7 @@ export interface IPixelBuffer<T extends TypedArray = TypedArray, P = any>
y: number,
width: number,
height: number
): IPixelBuffer<T, P> | undefined;
): Maybe<IPixelBuffer<T, P>>;
}

export interface IBlit<T extends IPixelBuffer> {
Expand Down
4 changes: 2 additions & 2 deletions packages/pixel/src/checks.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import type { TypedArray } from "@thi.ng/api";
import type { Maybe, TypedArray } from "@thi.ng/api";
import { assert } from "@thi.ng/errors/assert";
import type { FloatFormat, IntFormat } from "./api.js";

Expand All @@ -12,7 +12,7 @@ export const ensureSize = (

/** @internal */
export const ensureImageData = (
data: ImageData | undefined,
data: Maybe<ImageData>,
width: number,
height: number
) =>
Expand Down
4 changes: 2 additions & 2 deletions packages/pixel/src/int.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import type { Fn2, FnN2, ICopy, IEmpty, Range0_3 } from "@thi.ng/api";
import type { Fn2, FnN2, ICopy, IEmpty, Maybe, Range0_3 } from "@thi.ng/api";
import { IGrid2DMixin } from "@thi.ng/api/mixins/igrid";
import {
typedArray,
Expand Down Expand Up @@ -111,7 +111,7 @@ export const intBufferFromCanvas = (
const ctx = canvasPixels(canvas);
const w = canvas.width;
const h = canvas.height;
let dest: UIntArray | undefined;
let dest: Maybe<UIntArray>;
if (fmt === ABGR8888) {
dest = ctx.data;
} else {
Expand Down

0 comments on commit 8ccc518

Please sign in to comment.