Photoshop's remaining blend modes in its groups (12.7a); v1.2.2 kernels for 12.7b

This commit is contained in:
雷电芽衣 committed 2026-09-27 12:50:33 -04:00
1 parent 29eab10edc
commit 7d47cc367a
26 files changed
+348 -56

No files matched your search

+19 -6
View File
@@ -6,12 +6,15 @@
#include <utility>
namespace {
const std::array<std::pair<LayerBlendMode, const char *>, 14> names{{
{LayerBlendMode::normal, "Normal"}, {LayerBlendMode::multiply, "Multiply"}, {LayerBlendMode::screen, "Screen"},
{LayerBlendMode::overlay, "Overlay"}, {LayerBlendMode::softLight, "Soft Light"}, {LayerBlendMode::darken, "Darken"}, {LayerBlendMode::lighten, "Lighten"},
{LayerBlendMode::difference, "Difference"}, {LayerBlendMode::colorDodge, "Color Dodge"},
{LayerBlendMode::colorBurn, "Color Burn"}, {LayerBlendMode::hue, "Hue"}, {LayerBlendMode::saturation, "Saturation"},
{LayerBlendMode::color, "Color"}, {LayerBlendMode::luminosity, "Luminosity"},
const std::array<std::pair<LayerBlendMode, const char *>, 24> names{{
{LayerBlendMode::normal, "Normal"}, {LayerBlendMode::darken, "Darken"}, {LayerBlendMode::multiply, "Multiply"},
{LayerBlendMode::colorBurn, "Color Burn"}, {LayerBlendMode::linearBurn, "Linear Burn"}, {LayerBlendMode::lighten, "Lighten"},
{LayerBlendMode::screen, "Screen"}, {LayerBlendMode::colorDodge, "Color Dodge"}, {LayerBlendMode::linearDodge, "Linear Dodge (Add)"},
{LayerBlendMode::overlay, "Overlay"}, {LayerBlendMode::softLight, "Soft Light"}, {LayerBlendMode::hardLight, "Hard Light"},
{LayerBlendMode::vividLight, "Vivid Light"}, {LayerBlendMode::linearLight, "Linear Light"}, {LayerBlendMode::pinLight, "Pin Light"},
{LayerBlendMode::hardMix, "Hard Mix"}, {LayerBlendMode::difference, "Difference"}, {LayerBlendMode::exclusion, "Exclusion"},
{LayerBlendMode::subtract, "Subtract"}, {LayerBlendMode::divide, "Divide"}, {LayerBlendMode::hue, "Hue"},
{LayerBlendMode::saturation, "Saturation"}, {LayerBlendMode::color, "Color"}, {LayerBlendMode::luminosity, "Luminosity"},
}};
}
@@ -20,6 +23,16 @@ QString rawValue(LayerBlendMode mode)
return QString::fromLatin1(names.at(size_t(mode)).second);
}
int blendGroup(LayerBlendMode mode)
{
// Each group's modes sit together in the enum.
for (const auto &[first, group] : std::array<std::pair<LayerBlendMode, int>, 5>{{{LayerBlendMode::hue, 5},
{LayerBlendMode::difference, 4}, {LayerBlendMode::overlay, 3}, {LayerBlendMode::lighten, 2}, {LayerBlendMode::darken, 1}}})
if (mode >= first)
return group;
return 0;
}
std::optional<LayerBlendMode> layerBlendMode(const QString &rawValue)
{
for (const auto &[mode, name] : names) {
+14 -6
View File
@@ -4,16 +4,24 @@
#include <optional>
enum class LayerBlendMode {
normal, multiply, screen, overlay, softLight, darken, lighten, difference,
colorDodge, colorBurn, hue, saturation, color, luminosity
normal,
darken, multiply, colorBurn, linearBurn,
lighten, screen, colorDodge, linearDodge,
overlay, softLight, hardLight, vividLight, linearLight, pinLight, hardMix,
difference, exclusion, subtract, divide,
hue, saturation, color, luminosity
};
// Swift's `groups`, Photoshop's: the menu draws a line between.
int blendGroup(LayerBlendMode mode);
// Swift's `allCases`: the order of the blend menu.
inline constexpr std::array allLayerBlendModes{
LayerBlendMode::normal, LayerBlendMode::multiply, LayerBlendMode::screen, LayerBlendMode::overlay,
LayerBlendMode::softLight, LayerBlendMode::darken, LayerBlendMode::lighten, LayerBlendMode::difference, LayerBlendMode::colorDodge,
LayerBlendMode::colorBurn, LayerBlendMode::hue, LayerBlendMode::saturation, LayerBlendMode::color,
LayerBlendMode::luminosity};
LayerBlendMode::normal, LayerBlendMode::darken, LayerBlendMode::multiply, LayerBlendMode::colorBurn, LayerBlendMode::linearBurn,
LayerBlendMode::lighten, LayerBlendMode::screen, LayerBlendMode::colorDodge, LayerBlendMode::linearDodge,
LayerBlendMode::overlay, LayerBlendMode::softLight, LayerBlendMode::hardLight, LayerBlendMode::vividLight, LayerBlendMode::linearLight,
LayerBlendMode::pinLight, LayerBlendMode::hardMix, LayerBlendMode::difference, LayerBlendMode::exclusion, LayerBlendMode::subtract,
LayerBlendMode::divide, LayerBlendMode::hue, LayerBlendMode::saturation, LayerBlendMode::color, LayerBlendMode::luminosity};
// The name users see and the manifest stores.
QString rawValue(LayerBlendMode mode);