int updateProgress(int p, int max)
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().
%ffp ////////////////////////////////////////// // 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. ////////////////////////////////////////// ForEveryTile: { // row by row for ( y = 0; y < Y; y++ ) { // column by column for ( x = 0; x < X; x++ ) { // channel by channel for ( z = 0; z < Z; z++ ) { // apply an effect pset( x, y, z, src( x % 100, y % 100, z ) + rnd( -50, 50 ) ); // update the progress bar updateProgress( y, Y ); // update the preview // (only in active filter dialog) updatePreview( a ); } } } return true; }
Everyone can add his comments about his experiences with this function here. Tips for using it are welcome, too.