Skip to content

Commit

Permalink
fix build
Browse files Browse the repository at this point in the history
  • Loading branch information
hipstersmoothie committed Sep 1, 2024
1 parent 0d7a6a9 commit b45e3dd
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 11 deletions.
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -54,4 +54,5 @@ dist/
# ESM Version
es/
jimp.js.*
repro-playground.js
repro-playground.js
**/src/package.json
22 changes: 12 additions & 10 deletions plugins/plugin-color/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ function applyKernel(
x: number,
y: number
) {
const value = [0, 0, 0];
const value = [0, 0, 0] as [number, number, number];
const size = (kernel.length - 1) / 2;

for (let kx = 0; kx < kernel.length; kx += 1) {
Expand Down Expand Up @@ -236,9 +236,9 @@ function histogram<I extends JimpClass>(image: I) {
};

image.scan((_, __, index) => {
histogram.r[image.bitmap.data[index + 0]!]++;
histogram.g[image.bitmap.data[index + 1]!]++;
histogram.b[image.bitmap.data[index + 2]!]++;
histogram.r[image.bitmap.data[index + 0]!]!++;
histogram.g[image.bitmap.data[index + 1]!]!++;
histogram.b[image.bitmap.data[index + 2]!]!++;
});

return histogram;
Expand Down Expand Up @@ -357,13 +357,15 @@ export const methods = {

image.scan((_, __, idx) => {
if (val < 0.0) {
image.bitmap.data[idx] *= 1 + val;
image.bitmap.data[idx + 1] *= 1 + val;
image.bitmap.data[idx + 2] *= 1 + val;
image.bitmap.data[idx]! *= 1 + val;
image.bitmap.data[idx + 1]! *= 1 + val;
image.bitmap.data[idx + 2]! *= 1 + val;
} else {
image.bitmap.data[idx] += (255 - image.bitmap.data[idx]!) * val;
image.bitmap.data[idx + 1] += (255 - image.bitmap.data[idx + 1]!) * val;
image.bitmap.data[idx + 2] += (255 - image.bitmap.data[idx + 2]!) * val;
image.bitmap.data[idx]! += (255 - image.bitmap.data[idx]!) * val;
image.bitmap.data[idx + 1]! +=
(255 - image.bitmap.data[idx + 1]!) * val;
image.bitmap.data[idx + 2]! +=
(255 - image.bitmap.data[idx + 2]!) * val;
}
});

Expand Down

0 comments on commit b45e3dd

Please sign in to comment.