{"version":3,"file":"ColorBurnBlend.mjs","sources":["../../src/advanced-blend-modes/ColorBurnBlend.ts"],"sourcesContent":["import { ExtensionType } from '../extensions/Extensions';\nimport { BlendModeFilter } from '../filters/blend-modes/BlendModeFilter';\n\nimport type { ExtensionMetadata } from '../extensions/Extensions';\n\n/**\n * The final color is the result of inverting the bottom color, dividing the value by the top color,\n * and inverting that value. A white foreground leads to no change.\n * A foreground with the inverse color of the backdrop leads to a black final image.\n * This blend mode is similar to multiply, but the foreground need only be as dark as the inverse\n * of the backdrop to make the final image black.\n *\n * Available as `container.blendMode = 'color-burn'` after importing `pixi.js/advanced-blend-modes`.\n * @example\n * import 'pixi.js/advanced-blend-modes';\n * import { Sprite } from 'pixi.js';\n *\n * const sprite = Sprite.from('something.png');\n * sprite.blendMode = 'color-burn'\n * @category filters\n * @noInheritDoc\n */\nexport class ColorBurnBlend extends BlendModeFilter\n{\n    /** @ignore */\n    public static extension: ExtensionMetadata = {\n        name: 'color-burn',\n        type: ExtensionType.BlendMode\n    };\n\n    constructor()\n    {\n        super({\n            gl: {\n                functions: `\n                float colorBurn(float base, float blend)\n                {\n                    return max((1.0 - ((1.0 - base) / blend)), 0.0);\n                }\n\n                vec3 blendColorBurn(vec3 base, vec3 blend, float opacity)\n                {\n                    vec3 blended = vec3(\n                        colorBurn(base.r, blend.r),\n                        colorBurn(base.g, blend.g),\n                        colorBurn(base.b, blend.b)\n                    );\n\n                    return (blended * opacity + base * (1.0 - opacity));\n                }\n            `,\n                main: `\n                finalColor = vec4(blendColorBurn(back.rgb, front.rgb,front.a), blendedAlpha) * uBlend;\n            `\n            },\n            gpu: {\n                functions: `\n                fn colorBurn(base:f32, blend:f32) -> f32\n                {\n                    return max((1.0-((1.0-base)/blend)),0.0);\n                }\n\n                fn blendColorBurn(base: vec3<f32>, blend: vec3<f32>, opacity: f32) -> vec3<f32>\n                {\n                    let blended = vec3<f32>(\n                        colorBurn(base.r, blend.r),\n                        colorBurn(base.g, blend.g),\n                        colorBurn(base.b, blend.b)\n                    );\n\n                    return (blended * opacity + base * (1.0 - opacity));\n                }\n            `,\n                main: `\n                out = vec4<f32>(blendColorBurn(back.rgb, front.rgb, front.a), blendedAlpha) * blendUniforms.uBlend;\n            `\n            }\n        });\n    }\n}\n"],"names":[],"mappings":";;;;AAsBO,MAAM,uBAAuB,eAAA,CACpC;AAAA,EAOI,WAAA,GACA;AACI,IAAA,KAAA,CAAM;AAAA,MACF,EAAA,EAAI;AAAA,QACA,SAAA,EAAW;AAAA;AAAA;AAAA;AAAA;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;AAAA;AAAA;AAAA,YAAA,CAAA;AAAA,QAiBX,IAAA,EAAM;AAAA;AAAA,YAAA;AAAA,OAGV;AAAA,MACA,GAAA,EAAK;AAAA,QACD,SAAA,EAAW;AAAA;AAAA;AAAA;AAAA;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;AAAA;AAAA;AAAA,YAAA,CAAA;AAAA,QAiBX,IAAA,EAAM;AAAA;AAAA,YAAA;AAAA;AAGV,KACH,CAAA;AAAA,EACL;AACJ;AAAA;AAzDa,cAAA,CAGK,SAAA,GAA+B;AAAA,EACzC,IAAA,EAAM,YAAA;AAAA,EACN,MAAM,aAAA,CAAc;AACxB,CAAA;;;;"}