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
6/// properly 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
20/// channels in the texture should all be equal to the alpha channel
21/// (grayscale) so that 100% opaque regions are white and 100% transparent
22/// regions are black.
23pub const BLEND_FUNC_INVERT_COLOR : glium::Blend = glium::Blend {
24  color:          glium::BlendingFunction::Addition {
25    source:         glium::LinearBlendingFactor::OneMinusDestinationColor,
26    destination:    glium::LinearBlendingFactor::OneMinusSourceAlpha
27  },
28  alpha:          glium::BlendingFunction::Max,
29  constant_value: (0.0, 0.0, 0.0, 0.0)
30};