Enum printpdf::types::plugins::graphics::extgstate::SeperableBlendMode [] [src]

pub enum SeperableBlendMode {
    Normal,
    Multiply,
    Screen,
    Overlay,
    Darken,
    Lighten,
    ColorDodge,
    ColorBurn,
    HardLight,
    SoftLight,
    Difference,
    Exclusion,
}

PDF Reference 1.7, Page 520, Table 7.2 Blending modes for objects In the following reference, each function gets one new color (the thing to paint on top) and an old color (the color that was already present before the object gets painted)

The function simply notes the formula that has to be applied to (color_new, color_old) in order to get the desired effect. You have to run each formula once for each color channel.

Variants

Selects the source color, ignoring the old color. Default mode.

color_new

Multiplies the old color and source color values Note that these values have to be in the range [0.0 to 1.0] to work. The result color is always at least as dark as either of the two constituent colors. Multiplying any color with black produces black; multiplying with white leaves the original color unchanged.Painting successive overlapping objects with a color other than black or white produces progressively darker colors.

color_old * color_new

Multiplies the complements of the old color and new color values, then complements the result The result color is always at least as light as either of the two constituent colors. Screening any color with white produces white; screening with black leaves the original color unchanged. The effect is similar to projecting multiple photographic slides simultaneously onto a single screen.

color_old + color_new - (color_old * color_new)

Multiplies or screens the colors, depending on the old color value. Source colors overlay the old color while preserving its highlights and shadows. The old color is not replaced but is mixed with the source color to reflect the lightness or darkness of the old color.

TLDR: It's the inverse of HardLight

Be careful when using this code, it's not being tested!
if color_old <= 0.5 {
    Multiply(color_new, 2 x color_old)
} else {
    Screen(color_new, 2 * color_old - 1)
}

Selects the darker one of two colors.The old color is replaced with the new color where the new color is darker; otherwise, it is left unchanged.

min(color_old, color_new)

Selects the lighter one of two colors. The old color is replaced with the new color where the new color is lighter; otherwise, it is left unchanged.

max(color_old, color_new)

Brightens the backdrop color to reflect the source color. Painting with black produces no changes.

Be careful when using this code, it's not being tested!
if color_new < 1 {
    min(1, color_old / (1 - color_new))
} else {
    1
}

Darkens the backdrop color to reflect the source color. Painting with white produces no change.

Be careful when using this code, it's not being tested!
if color_new > 0 {
    1 - min(1, (1 - color_old) / color_new))
} else {
    0
}

Multiplies or screens the colors, depending on the source color value. The effect is similar to shining a harsh spotlight on the old color. It's the inverse of Screen.

Be careful when using this code, it's not being tested!
if color_new <= 0.5 {
    Multiply(color_old, 2 x color_new)
} else {
    Screen(color_old, 2 * color_new - 1)
}

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

Be careful when using this code, it's not being tested!
if color_new <= 0.5 {
    color_old - ((1 - (2 * color_new)) * color_old * (1 - color_old))
} else {
    let mut dx_factor = color_old.sqrt();
    if color_old <= 0.25 {
        dx_factor = (((16 * color_old - 12) * color_old) + 4) * color_old;
    }
    color_old + ((2 * color_new) - 1) * (dx_factor - color_old)
}

Subtracts the darker of the two constituent colors from the lighter color Painting with white inverts the backdrop color; painting with black produces no change.

abs(color_old - color_new)

Produces an effect similar to that of the Difference mode but lower in contrast. Painting with white inverts the backdrop color; painting with black produces no change.

color_old + color_new - (2 * color_old * color_new)

Trait Implementations

impl Debug for SeperableBlendMode
[src]

[src]

Formats the value using the given formatter.

impl PartialEq for SeperableBlendMode
[src]

[src]

This method tests for self and other values to be equal, and is used by ==. Read more

1.0.0
[src]

This method tests for !=.

impl Copy for SeperableBlendMode
[src]

impl Clone for SeperableBlendMode
[src]

[src]

Returns a copy of the value. Read more

1.0.0
[src]

Performs copy-assignment from source. Read more