feat: add core operations

This commit is contained in:
2026-08-23 11:14:33 +05:00
parent 17b0c68eb5
commit 7fa2c52bb8
6 changed files with 435 additions and 7 deletions
+8 -1
View File
@@ -1,7 +1,14 @@
import { describe, expect, it } from 'vitest';
import { colorMask, flattenOntoColor, parseHex, removeColorToAlpha } from './alpha';
import { colorMask, flattenOntoColor, invertAlpha, parseHex, removeColorToAlpha } from './alpha';
import { makeImage } from './test-helpers';
describe('invertAlpha', () => {
it('обращает альфу, RGB не трогает', () => {
const out = invertAlpha(makeImage(1, 1, [[10, 20, 30, 128]]));
expect([...out.data]).toEqual([10, 20, 30, 127]);
});
});
describe('removeColorToAlpha', () => {
const fixture = () =>
makeImage(2, 1, [