17 "title" :
"VuoImageDilate",
40 for (
int func = 0; func <= 1; ++func)
41 for (
int shape = VuoBlurShape_Box; shape <= VuoBlurShape_Disc; ++shape)
54 \n#include
"VuoGlslAlpha.glsl"
55 \n#include
"VuoGlslBrightness.glsl"
58 uniform sampler2D texture;
59 uniform vec2 viewportSize;
60 uniform
float halfWidth;
61 varying vec2 fragmentTextureCoordinate;
71 float straightstep(
float edge0,
float edge1,
float x)
73 return clamp((x - edge0) / (edge1 - edge0), 0., 1.);
80 float delta = fwidth(fragmentTextureCoordinate.x) * viewportSize.x/2.;
84 int steps = int(halfWidth) + 1;
86 for (
int y = -steps; y <= steps; ++y)
87 for (
int x = -steps; x <= steps; ++x)
89 float f = straightstep(halfWidth + delta, halfWidth - delta, abs(
float(x)))
90 * straightstep(halfWidth + delta, halfWidth - delta, abs(
float(y)));
91 c =
mix(c, func(c, VuoGlsl_sample(texture, fragmentTextureCoordinate + vec2(
float(x)/viewportSize.x,
float(y)/viewportSize.y))), f);
96 for (
int y = 0; y <= halfWidth + 1; ++y)
97 for (
int x = 0; x <= halfWidth + 1; ++x)
99 float dist = length(vec2(x,y));
100 float f = straightstep(halfWidth + delta, halfWidth - delta, dist);
101 float sx = float(x)/viewportSize.x;
102 float sy = float(y)/viewportSize.y;
105 c =
mix(c, func(c, VuoGlsl_sample(texture, fragmentTextureCoordinate + vec2( sx, sy))), f);
106 c =
mix(c, func(c, VuoGlsl_sample(texture, fragmentTextureCoordinate + vec2(-sx, sy))), f);
107 c =
mix(c, func(c, VuoGlsl_sample(texture, fragmentTextureCoordinate + vec2( sx, -sy))), f);
108 c =
mix(c, func(c, VuoGlsl_sample(texture, fragmentTextureCoordinate + vec2(-sx, -sy))), f);
117 for (
int func = 0; func <= 1; ++func)
118 for (
int shape = VuoBlurShape_Box; shape <= VuoBlurShape_Disc; ++shape)
120 char *sourceWithPrefix =
VuoText_format(
"#version 120\n#define FUNC %d\n#define SHAPE %d\n\n%s", func, shape, fragmentShader);
137 radius *= image->scaleFactor;
144 int func = radius >= 0 ? 0 : 1;
145 int shape2 =
MAX(
MIN(shape, VuoBlurShape_Disc), VuoBlurShape_Box);
157 int otherFunc = 1-func;