Older Newer
Fri, 27 Dec 2019 05:41:35 . . . . SyneRyder [reformat code sample to fit eBook screens]


Changes by last author:

Added:
= updateProgress =

== Syntax ==

int updateProgress(int p, int max)

== Arguments ==

:p

::Number in the range 0 to max representing current filter progress

:max

::The maximum value p can take

== Return ==

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

== Description ==

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().

== Example ==

<code>

%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;

}

</code>

== See Also ==

updatePreview, testAbort

== Comments ==

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