LibWeb/CSS: Implement 'background-blend-mode'

This implements the 'background-blend-mode' CSS property.
This commit is contained in:
Glenn Skrzypczak 2025-03-20 15:36:36 +01:00 committed by Sam Atkins
commit a73cd88f0c
Notes: github-actions[bot] 2025-03-28 09:42:07 +00:00
27 changed files with 303 additions and 199 deletions

View file

@ -0,0 +1,48 @@
/*
* Copyright (c) 2025, Glenn Skrzypczak <glenn.skrzypczak@gmail.com>
*
* SPDX-License-Identifier: BSD-2-Clause
*/
#pragma once
#include <LibGfx/CompositingAndBlendingOperator.h>
#include <LibWeb/CSS/Enums.h>
namespace Web::Painting {
#define ENUMERATE_MIX_BLEND_MODES(E) \
E(Normal) \
E(Multiply) \
E(Screen) \
E(Overlay) \
E(Darken) \
E(Lighten) \
E(ColorDodge) \
E(ColorBurn) \
E(HardLight) \
E(SoftLight) \
E(Difference) \
E(Exclusion) \
E(Hue) \
E(Saturation) \
E(Color) \
E(Luminosity) \
E(PlusDarker) \
E(PlusLighter)
static Gfx::CompositingAndBlendingOperator mix_blend_mode_to_compositing_and_blending_operator(CSS::MixBlendMode blend_mode)
{
switch (blend_mode) {
#undef __ENUMERATE
#define __ENUMERATE(blend_mode) \
case CSS::MixBlendMode::blend_mode: \
return Gfx::CompositingAndBlendingOperator::blend_mode;
ENUMERATE_MIX_BLEND_MODES(__ENUMERATE)
#undef __ENUMERATE
default:
VERIFY_NOT_REACHED();
}
}
}