Skip to content

Commit

Permalink
remove completely unneeded tinting code?
Browse files Browse the repository at this point in the history
  • Loading branch information
3vorp committed Oct 28, 2023
1 parent ccd3c6a commit 3853e86
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 19 deletions.
3 changes: 2 additions & 1 deletion src/helpers/functions/missing.ts
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,8 @@ export const computeAndUpdate = async (
let packProgress: any;
try {
/** @todo fix "Error: socket hang up" from this line of code */
packProgress = (await axios.get(`${client.tokens.apiUrl}settings/raw`)).data.channels.pack_progress;
packProgress = (await axios.get(`${client.tokens.apiUrl}settings/raw`)).data.channels
.pack_progress;
} catch {
return results;
}
Expand Down
20 changes: 2 additions & 18 deletions src/helpers/images/multiply.ts
Original file line number Diff line number Diff line change
@@ -1,16 +1,15 @@
import { createCanvas, loadImage } from "@napi-rs/canvas";
import { AttachmentBuilder } from "discord.js";
import ColorManager from "@images/colors";
import { ImageSource } from "@helpers/getImage";

export const mcColors = {
Foliage: "#5BAB46",
ColdFoliage: "#60A17B",
HotFoliage: "#1ABF00",
LushFoliage: "#1ABF00",
DryFoliage: "#AEA42A",
Grass: "#7CBD6B",
ColdGrass: "#80B497",
HotGrass: "#47CD33",
LushGrass: "#47CD33",
DryGrass: "#BFB755",
WhiteDye: "#F9FFFE",
OrangeDye: "#F9801D",
Expand Down Expand Up @@ -58,21 +57,6 @@ export async function multiply(origin: ImageSource, color: string) {
ctx.fillStyle = color;
ctx.fillRect(0, 0, imageToDraw.width, imageToDraw.height);

const data = ctx.getImageData(0, 0, imageToDraw.width, imageToDraw.height);

for (let i = 0; i < data.data.length; i += 4) {
const r = data.data[i];
const g = data.data[i + 1];
const b = data.data[i + 2];

const hex = new ColorManager({ rgb: { r, g, b } }).toHEX().value;
if (hex.toUpperCase() == color.substring(1)) {
data.data[i + 3] = 0;
}
}

ctx.putImageData(data, 0, 0);

return canvas.toBuffer("image/png");
}

Expand Down

0 comments on commit 3853e86

Please sign in to comment.