fix: eslinit errors
This commit is contained in:
+12
-6
@@ -101,12 +101,17 @@ function newImage() {
|
||||
|
||||
function download() {
|
||||
const link = document.createElement("a");
|
||||
link.download = `coverify-${new Date().getTime()}.png`;
|
||||
link.download = `coverify-${new Date().getTime().toString()}.png`;
|
||||
link.href = canvas.value?.toDataURL() ?? "#";
|
||||
link.click();
|
||||
}
|
||||
|
||||
function applyFilter(f: Filter, r: number, g: number, b: number): [number, number, number] {
|
||||
function applyFilter(
|
||||
f: Filter,
|
||||
r: number,
|
||||
g: number,
|
||||
b: number,
|
||||
): [number, number, number] {
|
||||
switch (f) {
|
||||
case Filter.Gray:
|
||||
const gray = 0.21 * r + 0.72 * g + 0.07 * b;
|
||||
@@ -147,11 +152,12 @@ function draw() {
|
||||
targetSize.value,
|
||||
targetSize.value,
|
||||
);
|
||||
const pixelData = imageData.data;
|
||||
// @ts-expect-error: safer to cast
|
||||
const pixelData = imageData.data as number[];
|
||||
for (let i = 0; i < pixelData.length; i += 4) {
|
||||
const r1 = (pixelData[i] as number);
|
||||
const g1 = (pixelData[i + 1] as number);
|
||||
const b1 = (pixelData[i + 2] as number);
|
||||
const r1 = pixelData[i];
|
||||
const g1 = pixelData[i + 1];
|
||||
const b1 = pixelData[i + 2];
|
||||
|
||||
const [r2, g2, b2] = applyFilter(filter.value, r1, g1, b1);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user