Skip to content

Commit

Permalink
Rebuild
Browse files Browse the repository at this point in the history
  • Loading branch information
exogen committed Oct 11, 2024
1 parent 861b5c8 commit a16a144
Show file tree
Hide file tree
Showing 19 changed files with 394 additions and 55 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -130,3 +130,4 @@ dist
.pnp.*

.DS_Store
.tshy
12 changes: 6 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -108,13 +108,13 @@ search.

| Function | Type |
| ---------- | ---------- |
| `snapColorToTurbo` | `(rgbColor: Color, cache?: Map<string, number> or undefined) => Uint8ClampedArray` |
| `snapColorToTurbo` | `(rgbColor: Color, options?: { cache?: Map<string, number> or undefined; }) => Color` |

Parameters:

* `rgbColor`: An array-like RGB triplet.
* `cache`: A Map to use as a lookup cache, to avoid repeated nearest-neighbor
searches.
* `options.cache`: A Map to use as a lookup cache, to avoid repeated
nearest-neighbor searches.


### :gear: snapColorToIntensity
Expand All @@ -128,13 +128,13 @@ search.

| Function | Type |
| ---------- | ---------- |
| `snapColorToIntensity` | `(rgbColor: Color, cache?: Map<string, number> or undefined) => number` |
| `snapColorToIntensity` | `(rgbColor: Color, options?: { cache?: Map<string, number> or undefined; }) => number` |

Parameters:

* `rgbColor`: An array-like RGB triplet.
* `cache`: A Map to use as a lookup cache, to avoid repeated nearest-neighbor
searches.
* `options.cache`: A Map to use as a lookup cache, to avoid repeated
nearest-neighbor searches.


### :gear: snapNormalizedToTurbo
Expand Down
20 changes: 4 additions & 16 deletions demo/tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,11 +1,7 @@
{
"compilerOptions": {
"lib": [
"dom",
"dom.iterable",
"esnext"
],
"allowJs": true,
"lib": ["dom", "dom.iterable", "esnext"],
"allowJs": false,
"skipLibCheck": true,
"strict": false,
"noEmit": true,
Expand All @@ -22,14 +18,6 @@
}
]
},
"include": [
"next-env.d.ts",
"../**/*.ts",
"../**/*.tsx",
".next/types/**/*.ts"
],
"exclude": [
"node_modules",
"../node_modules"
]
"include": ["next-env.d.ts", "**/*.ts", "**/*.tsx", ".next/types/**/*.ts"],
"exclude": ["node_modules", "../node_modules"]
}
16 changes: 13 additions & 3 deletions demo/worker.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import {
convertGrayscaleBufferToTurbo,
} from "..";

const cache = new Map();
const cache: Map<string, number> = new Map();

type Job = {
id: number;
Expand All @@ -15,7 +15,12 @@ type Job = {
cache?: boolean;
};

function toGrayscale(buffer, options) {
function toGrayscale(
buffer: ArrayBufferLike,
options: {
cache: Map<string, number>;
}
) {
const t0 = Date.now();
const outputBuffer = convertTurboBufferToGrayscale(
buffer,
Expand All @@ -28,7 +33,12 @@ function toGrayscale(buffer, options) {
return outputBuffer;
}

function toTurbo(buffer, options) {
function toTurbo(
buffer: ArrayBufferLike,
options: {
cache: Map<string, number>;
}
) {
const t0 = Date.now();
const outputBuffer = convertGrayscaleBufferToTurbo(buffer, undefined);
const t1 = Date.now();
Expand Down
2 changes: 1 addition & 1 deletion docs/404.html

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion docs/404/index.html

Large diffs are not rendered by default.

1 change: 0 additions & 1 deletion docs/_next/static/chunks/586.4452c6a9930ee390.js

This file was deleted.

Loading

0 comments on commit a16a144

Please sign in to comment.