Skip to content

Instantly share code, notes, and snippets.

@jrsa
Created March 4, 2016 00:06
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jrsa/d0d40755fb57e7bec93f to your computer and use it in GitHub Desktop.
Save jrsa/d0d40755fb57e7bec93f to your computer and use it in GitHub Desktop.
/*
A Core Image kernel routine that computes a multiply effect.
The code looks up the source pixel in the sampler and then multiplies it by the value passed to the routine.
*/
kernel vec4 basicSharp(sampler image, float width)
{
vec2 center = sample(image, samplerCoord(image));
// width = 1.0 /width;
vec2 _00 = sample(image, samplerTransform(image, samplerCoord(image) + vec2(-width, -width)));
vec2 _10 = sample(image, samplerTransform(image, samplerCoord(image) + vec2( width, -width)));
vec2 _11 = sample(image, samplerTransform(image, samplerCoord(image) + vec2(-width, width)));
vec2 _01 = sample(image, samplerTransform(image, samplerCoord(image) + vec2( width, width)));
return vec4(5.) * center - ( _00 + _10 + _11 + _01);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment