Skip to content
Member Filters
Show Inherited
Show Protected
Show abstract
GR32.Blend.Modes.PhotoShop🞂PhotoShopUnit

GR32.Blend.Modes.PhotoShop

Provides Adobe Photoshop and W3C compliant separable, non-separable, and component blend modes for Graphics32.

Description ​

The GR32.Blend.Modes.PhotoShop unit implements the full suite of standard Adobe Photoshop and W3C Compositing and Blending Specification blending algorithms for Graphics32.

Overview of Photoshop Blend Modes ​

Unlike Porter-Duff operators, which primarily determine geometry-based alpha coverage cutouts and layer intersections, Photoshop blend modes blend color channel values (CS foreground/source and CB background/backdrop) according to non-linear color algebra and component-based color space transformations.

The blend modes in GR32.Blend.Modes.PhotoShop are organized into 5 functional groups:

GroupDescription
DarkenAlways produce a result color that is at least as dark as either constituent color.
LightenAlways produce a result color that is at least as light as either constituent color.
ContrastIncrease or decrease contrast based on whether the source color component is lighter or darker than 50% neutral gray.
InversionHighlight differences or invert colors between source and backdrop layers.
ComponentBlend color attributes based on Hue, Saturation, and Luminosity (Luminance).

Luminance & Lightness Functions ​

The unit includes cross-platform inline helper routines to compute lightness, luminance, brightness, and average intensity values from 32-bit TColor32 values or RGB byte components:

RoutineFormula / StandardDescription
ColorLightnessmax(R,G,B)+min(R,G,B)2Calculates HSL lightness (Chroma midpoint).
ColorLuminance0.30R+0.59G+0.11BCalculates perceived Rec. 601 NTSC luminance (Luma).
ColorAverageR+G+B3Calculates unweighted average RGB intensity.
ColorBrightnessmax(R,G,B)Calculates HSV Value (maximum color component).

Summary Table ​

Darken group ​

IDNameClassFormula / Behavior
DarkenDarkenTGraphics32BlenderDarkenB≤F?B:F
multiplyMultiplyTGraphics32BlenderMultiplyBâ‹…F255
ColorBurnColor BurnTGraphics32BlenderColorBurn255−(255−B)⋅255F
LinearBurnLinear BurnTGraphics32BlenderLinearBurnmax(0,B+F−255)
DarkerDarker ColorTGraphics32BlenderDarkerColorCompares overall luminance; retains darker pixel.

Lighten group ​

IDNameClassFormula / Behavior
LightenLightenTGraphics32BlenderLightenB≥F?B:F
screenScreenTGraphics32BlenderScreen255−(255−B)(255−F)255
ColorDodgeColor DodgeTGraphics32BlenderColorDodgemin(255,B⋅255255−F)
AddLinear Dodge (Add)TGraphics32BlenderLinearDodgemin(255,B+F)
LighterLighter ColorTGraphics32BlenderLighterColorCompares overall luminance; retains lighter pixel.

Contrast group ​

IDNameClassFormula / Behavior
OverlayOverlayTGraphics32BlenderOverlayScreens or multiplies based on backdrop B.
SoftLightSoft LightTGraphics32BlenderSoftLightDiffused spotlight effect based on source F.
HardLightHard LightTGraphics32BlenderHardLightHarsh spotlight effect based on source F.
VividLightVivid LightTGraphics32BlenderVividLightDodges or burns by adjusting contrast.
LinearLightLinear LightTGraphics32BlenderLinearLightDodges or burns by adjusting brightness.
PinLightPin LightTGraphics32BlenderPinLightReplaces color depending on 50% gray threshold.
HardMixHard MixTGraphics32BlenderHardMixThresholds channels to 0 or 255 primary colors.

Inversion group ​

IDNameClassFormula / Behavior
DifferenceDifferenceTGraphics32BlenderDifference|B−F|
ExclusionExclusionTGraphics32BlenderExclusionF+B−2⋅F⋅B255
NegationNegationTGraphics32BlenderNegation255−|B−F|

Component group ​

IDNameClassFormula / Behavior
HueHueTGraphics32BlenderHueCombines source Hue with backdrop Saturation and Luminance.
SaturationSaturationTGraphics32BlenderSaturationCombines source Saturation with backdrop Hue and Luminance.
ColorColorTGraphics32BlenderColorCombines source Hue and Saturation with backdrop Luminance.
LuminosityLuminosityTGraphics32BlenderLuminanceCombines source Luminance with backdrop Hue and Saturation.

Darken Blend Modes ​

Darken ​

ID: Darken
Name: Darken
Class: TGraphics32BlenderDarken

Compares each channel value of the source and backdrop color and selects the smaller (darker) of the two values.


Multiply ​

ID: multiply
Name: Multiply
Class: TGraphics32BlenderMultiply

Multiplies the source and backdrop color values. The result is always a darker color. Blending with white leaves the image unchanged; blending with black produces black.


Color Burn ​

ID: ColorBurn
Name: Color Burn
Class: TGraphics32BlenderColorBurn

Darkens the backdrop color to reflect the source color by increasing the contrast between the two. Painting with white produces no change.


Linear Burn ​

ID: LinearBurn
Name: Linear Burn
Class: TGraphics32BlenderLinearBurn

Darkens the backdrop color to reflect the source color by decreasing brightness. Painting with white produces no change. Also known as the Subtract blend mode.


Darker Color ​

ID: Darker
Name: Darker color
Class: TGraphics32BlenderDarkerColor

Compares the overall perceived luminance of the source and backdrop pixels and displays the lower-luminance color in its entirety.


Lighten Blend Modes ​

Lighten ​

ID: Lighten
Name: Lighten
Class: TGraphics32BlenderLighten

Compares each channel value of the source and backdrop color and selects the larger (lighter) of the two values.


Screen ​

ID: screen
Name: Screen
Class: TGraphics32BlenderScreen

Multiplies the inverse of the source and backdrop colors, then complements the result. The result color is always lighter. Screening with black leaves the color unchanged; screening with white yields white.


Color Dodge ​

ID: ColorDodge
Name: Color Dodge
Class: TGraphics32BlenderColorDodge

Brightens the backdrop color to reflect the source color by decreasing contrast between them. Painting with black produces no change.


Linear Dodge (Add) ​

ID: Add
Name: Linear Dodge (Add)
Class: TGraphics32BlenderLinearDodge

Sums the channel values of the backdrop and source colors. Blending with black causes no change; blending with white yields pure white.


Lighter Color ​

ID: Lighter
Name: Lighter color
Class: TGraphics32BlenderLighterColor

Compares the overall perceived luminance of the source and backdrop pixels and displays the higher-luminance color in its entirety.


Contrast Blend Modes ​

Overlay ​

ID: Overlay
Name: Overlay
Class: TGraphics32BlenderOverlay

Multiplies or screens the colors depending on the backdrop color value. Patterns or colors overlay the existing backdrop while preserving its highlights and shadows.


Soft Light ​

ID: SoftLight
Name: Soft Light
Class: TGraphics32BlenderSoftLight

Darkens or lightens colors depending on the source color value. The visual effect is similar to shining a diffused spotlight on the backdrop image.


Hard Light ​

ID: HardLight
Name: Hard Light
Class: TGraphics32BlenderHardLight

Multiplies or screens colors depending on the source color value. The visual effect is similar to shining a harsh spotlight on the backdrop image.


Vivid Light ​

ID: VividLight
Name: Vivid Light
Class: TGraphics32BlenderVividLight

Burns or dodges colors by increasing or decreasing contrast depending on whether the source color is darker or lighter than 50% gray.


Linear Light ​

ID: LinearLight
Name: Linear Light
Class: TGraphics32BlenderLinearLight

Burns or dodges colors by increasing or decreasing brightness depending on whether the source color is darker or lighter than 50% gray.


Pin Light ​

ID: PinLight
Name: Pin Light
Class: TGraphics32BlenderPinLight

Replaces colors depending on the source color. If the source is lighter than 50% gray, darker backdrop pixels are replaced; if darker than 50% gray, lighter backdrop pixels are replaced.


Hard Mix ​

ID: HardMix
Name: Hard Mix
Class: TGraphics32BlenderHardMix

Adds the red, green, and blue channel values of the source to the backdrop. Values ≥255 become 255, and values <255 become 0, reducing all pixels to primary additive colors (Red, Green, Blue, White, Black).


Inversion Blend Modes ​

Difference ​

ID: Difference
Name: Difference
Class: TGraphics32BlenderDifference

Subtracts the darker of the source and backdrop colors from the lighter color. Blending with white inverts backdrop colors; blending with black produces no change.


Exclusion ​

ID: Exclusion
Name: Exclusion
Class: TGraphics32BlenderExclusion

Creates an effect similar to Difference mode but lower in contrast. Blending with white inverts base color values; blending with black produces no change.


Negation ​

ID: Negation
Name: Negation
Class: TGraphics32BlenderNegation

Subtracts the darker color from the lighter color and complements the result. Blending with black inverts backdrop colors; blending with white produces no change.


Component (HSL) Blend Modes ​

Hue ​

ID: Hue
Name: Hue
Class: TGraphics32BlenderHue

Creates a result color with the luminance and saturation of the backdrop color and the hue of the source color.


Saturation ​

ID: Saturation
Name: Saturation
Class: TGraphics32BlenderSaturation

Creates a result color with the luminance and hue of the backdrop color and the saturation of the source color.


Color ​

ID: Color
Name: Color
Class: TGraphics32BlenderColor

Creates a result color with the luminance of the backdrop color and the hue and saturation of the source color. Preserves gray levels and is useful for tinting monochrome or color images.


Luminosity ​

ID: Luminosity
Name: Luminosity
Class: TGraphics32BlenderLuminance

Creates a result color with the hue and saturation of the backdrop color and the luminance of the source color. This mode creates the inverse effect of the Color blend mode.

See also ​