Skip to main content

gl_utils/render/
params.rs

1//! Some useful drawing parameters.
2
3use glium;
4
5/// The usual blending function to ensure that magnified texels are blended properly
6/// with transparency.
7pub const BLEND_FUNC_NORMAL : glium::Blend = glium::Blend {
8  color:          glium::BlendingFunction::Addition {
9    source:         glium::LinearBlendingFactor::SourceAlpha,
10    destination:    glium::LinearBlendingFactor::OneMinusSourceAlpha
11  },
12  alpha:          glium::BlendingFunction::Addition {
13    source:         glium::LinearBlendingFactor::One,
14    destination:    glium::LinearBlendingFactor::One
15  },
16  constant_value: (0.0, 0.0, 0.0, 0.0)
17};
18
19/// Writing white source pixels will invert the destination pixel. Color channels in the
20/// texture should all be equal to the alpha channel (grayscale) so that 100% opaque
21/// regions are white and 100% transparent regions are black.
22pub const BLEND_FUNC_INVERT_COLOR : glium::Blend = glium::Blend {
23  color:          glium::BlendingFunction::Addition {
24    source:         glium::LinearBlendingFactor::OneMinusDestinationColor,
25    destination:    glium::LinearBlendingFactor::OneMinusSourceAlpha
26  },
27  alpha:          glium::BlendingFunction::Max,
28  constant_value: (0.0, 0.0, 0.0, 0.0)
29};