Rect

rect

FragmentProgram

program

var

shader

program

createShader

();

shader

setFloat

42.0

);

canvas

drawRect

rect

Paint

().

shader

shader

);

Canvas API

Fragment shaders can be used with most Canvas APIs by setting Paint.shader.
For example, when using Canvas.drawRect the shader is evaluated for all
fragments within the rectangle. For an API like Canvas.drawPath with a
stroked path, the shader is evaluated for all fragments within the stroked
line. Some APIs, such as Canvas.drawImage, ignore the value of the shader.