vispy.visuals.filters.color module

class vispy.visuals.filters.color.Alpha(alpha=1.0)[source]

Bases: vispy.visuals.filters.base_filter.Filter

FRAG_SHADER = '\n void apply_alpha() {\n gl_FragColor.a = gl_FragColor.a * $alpha;\n }\n '
property alpha
class vispy.visuals.filters.color.ColorFilter(filter=(1.0, 1.0, 1.0, 1.0))[source]

Bases: vispy.visuals.filters.base_filter.Filter

FRAG_SHADER = '\n void apply_color_filter() {\n gl_FragColor = gl_FragColor * $filter;\n }\n '
property filter
class vispy.visuals.filters.color.IsolineFilter(level=2.0, width=2.0, antialias=1.0, color='black')[source]

Bases: vispy.visuals.filters.base_filter.Filter

FRAG_SHADER = '\n void isoline() {\n if ($isolevel <= 0. || $isowidth <= 0.) {\n return;\n }\n\n // function taken from glumpy/examples/isocurves.py\n // and extended to have level, width, color and antialiasing\n // as parameters\n\n // Extract data value\n // this accounts for perception,\n // have to decide, which one to use or make this a uniform\n const vec3 w = vec3(0.299, 0.587, 0.114);\n //const vec3 w = vec3(0.2126, 0.7152, 0.0722);\n float value = dot(gl_FragColor.rgb, w);\n\n // setup lw, aa\n float linewidth = $isowidth + $antialias;\n\n // "middle" contour(s) dividing upper and lower half\n // but only if isolevel is even\n if( mod($isolevel,2.0) == 0.0 ) {\n if( length(value - 0.5) < 0.5 / $isolevel)\n linewidth = linewidth * 2;\n }\n\n // Trace contour isoline\n float v = $isolevel * value - 0.5;\n float dv = linewidth/2.0 * fwidth(v);\n float f = abs(fract(v) - 0.5);\n float d = smoothstep(-dv, +dv, f);\n float t = linewidth/2.0 - $antialias;\n d = abs(d)*linewidth/2.0 - t;\n\n if( d < - linewidth ) {\n d = 1.0;\n } else {\n d /= $antialias;\n }\n\n // setup foreground\n vec4 fc = $isocolor;\n\n // mix with background\n if (d < 1.) {\n gl_FragColor = mix(gl_FragColor, fc, 1-d);\n }\n\n }\n '
property antialias
property color
property level
property width
class vispy.visuals.filters.color.ZColormapFilter(cmap, zrange=(0.0, 1.0))[source]

Bases: vispy.visuals.filters.base_filter.Filter

FRAG_SHADER = '\n void z_colormap_support() {\n $zval = $position.z;\n }\n '
VERT_SHADER = '\n void apply_z_colormap() {\n gl_FragColor = $cmap(($zval - $zrange.x) /\n ($zrange.y - $zrange.x));\n }\n '