Skip to: [ search ] [ menus ] [ content ] Select style [ Aqua ] [ Citrus ] [ Fire ] [ Orange ] [ show/hide more content ]



Hydra and AIF

Well this week Adobe announced Hydra and AIF. They are basically a way to write your own Pixel shaders which eventually will be available in flash. So I’ve been experimenting and here is my first experiment with Hydra. It is a Mosaic filter!

[as]

kernel MosaicFilter
< nameSpace : "com.deviant.AIF";
vendor : "DevSlash.com";
version : 1;
description : "A Mosaic filter similar to Photoshop";
>
{
parameter int gridSize
<
minValue: 2;
maxValue: 100;
>;

void evaluatePixel(in image4 src, out pixel4 dst)
{
float2 coord = outCoord();
float2 currGridOrigin = floor(coord / float2(gridSize, gridSize)) * float2(gridSize, gridSize);
coord = mod(coord, float2(gridSize, gridSize));

int x, y;
float totalGrid = float(gridSize*gridSize);
float4 curPix;
if(gridSize > 1)
{
for(x = 0; x < gridSize; x++)
{
for(y = 0; y < gridSize; y++)
{
curPix = curPix + sampleLinear(src, currGridOrigin + float2(x,y));
}
}
}

dst = curPix / totalGrid;
}

region needed(region outputRegion, int inputIndex, region inputDOD[])
{
region result = outputRegion;
result = inset (outputRegion, float2(gridSize,gridSize));
return result;
}
}
[/as]

No Comments to “Hydra and AIF”

  (RSS feed for these comments)

XHTML: You can use these tags: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <code> <em> <i> <strike> <strong>