msk

Syntax

int msk(int x, int y)

Arguments

x
Horizontal coordinate of the requested mask pixel, starting from the left at 0.
y
Vertical coordinate of the requested mask pixel, starting from the top at 0.

Return

The mask value for the requested pixel in the range [0, 255] (regardless of whether the color depth of the source image).
0 means the pixel is completely outside the selection mask, 255 means the pixel is completely inside the selection mask.

Description

Use this function to determine whether a pixel is inside, outside or somewhere on the edge of the host application's selection mask.

Example

%ffp
SupportedModes:RGBMode

 ForEveryTile: {
  for (x = x_start; x < x_end; x++) {
   for (y = y_start; y < y_end; y++) {
    m = msk(x, y);
    if (m == 0)continue; //speed up

    for (z = 0; z < 3; z++) { //don't process alpha
     int s = src(x, y, z);
     if (doingProxy)
      pset(x, y, z, mix(255 - s, s, m, 255)); //if you wish, apply mask on preview
     else 
      pset(x, y, z, s); //the mask is applied after pressing ok
    }//end for z
   }//end for y
  }//end for x
  return true;
 }//end ForEveryTile

Also see

haveMask

Comments

By default, FilterMeister automatically applies the selection mask to pixels for the final render; you only need to check the mask to render a correct preview inside FilterMeister. Nonetheless, if you use a msk(..) == 0 check, you can increase performance by not calculating pixels outside the selection mask.

Everyone can add his comments about his experiences with this event here. Tips for using it are welcome.