#include "EF.h" #include #include #include void computeChecks(EF_Image *image, EF_Image *outimage, float param) { int x,y; /* remap param so that it can be used to describe the number of pixels across each check is: its range is 0->1 when this is called, this maps a param of 0 to 1, and a param of 1 to 101. */ float extent = (100. * (param + .01)); /* Loop over every pixel (x,y) */ for (x = 0; x < image->xSize; x++) for (y = 0; y < image->ySize; y++) { /* Use the pixel number (x,y) to decide if there is a check at this pixel or not. Val is either 0 or 1. */ int val = ((int)(x / extent)+ (int)(y / extent)) % 2; /* Set the RGBA components of the pixel depending on val. Note that pixels without a check have alpha of zero. */ RED(EF_ImageXY(outimage, x, y)) = val*50; GREEN(EF_ImageXY(outimage, x, y)) = val*50; BLUE(EF_ImageXY(outimage, x, y)) = val*200; ALPHA(EF_ImageXY(outimage, x, y)) = val*255; } } void pluginInit(EF_PluginOptions *options) { if (options->structSize!=sizeof(EF_PluginOptions)) { puts("Plugin is wrong version"); return; } options->pluginApply = computeChecks; strcpy(options->name,"Checks"); }