pathfinder/shaders/gles2/xcaa-mono-resolve.fs.glsl

28 lines
885 B
Plaintext
Raw Normal View History

// pathfinder/shaders/gles2/xcaa-mono-resolve.fs.glsl
//
2017-09-07 17:58:41 -04:00
// Copyright (c) 2017 The Pathfinder Project Developers.
//
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
// option. This file may not be copied, modified, or distributed
// except according to those terms.
//! Renders a single-channel alpha coverage buffer to an RGB framebuffer.
precision mediump float;
2018-01-04 21:07:14 -05:00
/// The background color of the monochrome path.
uniform vec4 uBGColor;
2018-01-04 21:07:14 -05:00
/// The foreground color of the monochrome path.
uniform vec4 uFGColor;
2018-01-04 21:07:14 -05:00
/// The alpha coverage texture.
uniform sampler2D uAAAlpha;
varying vec2 vTexCoord;
void main() {
float alpha = clamp(texture2D(uAAAlpha, vTexCoord).r, 0.0, 1.0);
gl_FragColor = mix(uBGColor, uFGColor, alpha);
}