????
Current Path : C:/inetpub/vhost/invest.gdtsolutions.vn/api/node_modules/@jimp/plugin-color/test/ |
Current File : C:/inetpub/vhost/invest.gdtsolutions.vn/api/node_modules/@jimp/plugin-color/test/color.test.js |
import { Jimp, donutJGD } from "@jimp/test-utils"; import configure from "@jimp/custom"; import color from "../src"; import { expectToBeJGD } from "@jimp/test-utils/src"; const jimp = configure({ plugins: [color] }, Jimp); describe("canvas color transformation", () => { const redDonutJGD = donutJGD(0x00000000, 0xff000088, 0xff0000ff); it("can apply more than one color transformation", async () => { const image = await jimp.read(redDonutJGD); const newJGD = image .color([ { apply: "hue", params: [-180] }, { apply: "lighten", params: [25] }, ]) .getJGDSync(); expectToBeJGD(newJGD, donutJGD(0x40404000, 0x80ffff88, 0x80ffffff)); }); it("lighten", async () => { const image = await jimp.read(redDonutJGD); expectToBeJGD( image.color([{ apply: "lighten", params: [25] }]).getJGDSync(), donutJGD(0x40404000, 0xff808088, 0xff8080ff) ); }); it("brighten", async () => { const image = await jimp.read(redDonutJGD); expectToBeJGD( image.color([{ apply: "brighten", params: [25] }]).getJGDSync(), donutJGD(0x40404000, 0xff404088, 0xff4040ff) ); }); it("spin hue", async () => { const image = await jimp.read(redDonutJGD); expectToBeJGD( image.color([{ apply: "hue", params: [150] }]).getJGDSync(), donutJGD(0x00000000, 0x00ff8088, 0x00ff80ff) ); }); });