Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
function getHexFromChar(pixel: string) {
switch (pixel) {
case 'R':
return Jimp.cssColorToHex('#ff0000');
case 'G':
return Jimp.cssColorToHex('#00ff00');
case 'B':
return Jimp.cssColorToHex('#0000ff');
case 'K':
return Jimp.cssColorToHex('#000000');
default:
return Jimp.cssColorToHex('#ffffff');
}
}
function getHexFromChar(pixel: string) {
switch (pixel) {
case 'R':
return Jimp.cssColorToHex('#ff0000');
case 'G':
return Jimp.cssColorToHex('#00ff00');
case 'B':
return Jimp.cssColorToHex('#0000ff');
case 'K':
return Jimp.cssColorToHex('#000000');
default:
return Jimp.cssColorToHex('#ffffff');
}
}
function getHexFromChar(pixel: string) {
switch (pixel) {
case 'R':
return Jimp.cssColorToHex('#ff0000');
case 'G':
return Jimp.cssColorToHex('#00ff00');
case 'B':
return Jimp.cssColorToHex('#0000ff');
case 'K':
return Jimp.cssColorToHex('#000000');
default:
return Jimp.cssColorToHex('#ffffff');
}
}
function getHexFromChar(pixel: string) {
switch (pixel) {
case 'R':
return Jimp.cssColorToHex('#ff0000');
case 'G':
return Jimp.cssColorToHex('#00ff00');
case 'B':
return Jimp.cssColorToHex('#0000ff');
case 'K':
return Jimp.cssColorToHex('#000000');
default:
return Jimp.cssColorToHex('#ffffff');
}
}
function getHexFromChar(pixel: string) {
switch (pixel) {
case 'R':
return Jimp.cssColorToHex('#ff0000');
case 'G':
return Jimp.cssColorToHex('#00ff00');
case 'B':
return Jimp.cssColorToHex('#0000ff');
case 'K':
return Jimp.cssColorToHex('#000000');
default:
return Jimp.cssColorToHex('#ffffff');
}
}
async function rotate(inBuffer) {
const image = await jimp.read(inBuffer);
image.background(jimp.cssColorToHex(backgroundColor)).rotate(rotateDegrees);
return image.getBufferAsync(jimp.MIME_JPEG);
}
const drawRect = (img, xMin, yMin, xMax, yMax, padSize, color, isFilled) => {
for (x of range(xMin, xMax)) {
for (y of range(yMin, yMax)) {
if (withinRange(y, yMin, padSize) || withinRange(x, xMin, padSize) ||
withinRange(y, yMax, padSize) || withinRange(x, xMax, padSize)) {
img.setPixelColor(Jimp.cssColorToHex(color), x, y);
} else if (isFilled && (y <= (yMax + padSize) && x <= (xMax + padSize))) {
img.setPixelColor(Jimp.cssColorToHex(color), x, y);
}
}
}
}