int updateProgress(int p, int max)


Number in the range 0 to max representing current filter progress
The maximum value p can take


Returns 1 if the user has pressed the Esc key, 0 otherwise.


The function updateProgress(current,max) updates the progress bar on the plug-in or in the information bar at the bottom of the screen in your image editing program. The variable p describes the current progress in the range [0,max]. If the user presses the ESC key, a non-zero value is returned by updateProgress().



// This example updates the progress bar for every pixel in
// the image.  In more complicated filters this can slow
// down the plug-in - it may be better to update the progress
// bar for every Y row.

  for ( y = 0; y < Y; y++ ) // row by row
    for ( x = 0; x < X; x++ ) // column by column
      for ( z = 0; z < Z; z++ ) // channel by channel
        pset( x, y, z, src( x % 100, y % 100, z ) + rnd( -50, 50 ) ); // apply an effect
        updateProgress( y, Y ); // update the progress bar
        updatePreview( a ); // update the preview (only in active filter dialog)
  return true;

Also see

updatePreview, testAbort


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