Progres bar

hi

i use SDL_console in image processing app. i need to display progress bar
when image filtering routine is called.

  1. i can filter image in subprocess/subthread and use shared variable to
    display percent of work done
  2. i can filter ex. 10 lines of image, display percent of work done and
    filter another 10 lines of image…

what o you suggest ?

thanks, stan

To get a termometer-type progress bar:

First, take lines filtered / lines to filter, that’s the percentage of
lines you have completed.

Figure out how big your progress display will be, usually it’s either a
fixed size or a fraction of the screen’s resoltuon or something. Either
way, you need to figure out how many pixels long it will be. Multiply
that number by the percentage above. This is the number of pixels to
fill in.

Draw the frame of the progress bar, then the filled in part. Obviously
variations on this will get you different effects. The reason this sort
of indicator is used so much is because it is both very informative to
the user, and extremely simple to code! =)

2D optimization, if you don’t have to redraw the bar, don’t. Keep track
of your last percentage value and only fill in the difference. Don’t
forget to account for double or triplebuffer if you’re using that (and if
you are running fullscreen, you probably should be.)On Tue, Jan 29, 2002 at 07:02:56PM +0100, Stanislaw Stepien wrote:

i use SDL_console in image processing app. i need to display progress bar
when image filtering routine is called.

  1. i can filter image in subprocess/subthread and use shared variable to
    display percent of work done
  2. i can filter ex. 10 lines of image, display percent of work done and
    filter another 10 lines of image…

what o you suggest ?


Joseph Carter This end upside-down

it’s too bad most ancient unices are y2k compliant
<|Rain|> too bad?
<|Rain|> why, because people won’t upgrade until 2038?

-------------- next part --------------
A non-text attachment was scrubbed…
Name: not available
Type: application/pgp-signature
Size: 273 bytes
Desc: not available
URL: http://lists.libsdl.org/pipermail/sdl-libsdl.org/attachments/20020130/ccb353d6/attachment.pgp

i use SDL_console in image processing app. i need to display progress bar
when image filtering routine is called.

  1. i can filter image in subprocess/subthread and use shared variable to
    display percent of work done
  2. i can filter ex. 10 lines of image, display percent of work done and
    filter another 10 lines of image…

what o you suggest ?

To get a termometer-type progress bar:


i kow how to draw a bar. i asked how to draw it in separate thread or in other way.
i do not want to redraw bar and screen in filtering function. its purpose is
to filter and not to draw sth on screen.

2D optimization, if you don’t have to redraw the bar, don’t. Keep track
of your last percentage value and only fill in the difference. Don’t
forget to account for double or triplebuffer if you’re using that (and if
you are running fullscreen, you probably should be.)
the slowest part is SDL_UpdateRect - about 10fps on xfree4.0, celeron 600 :frowning:

Joseph Carter This end upside-down
stanOn Wed, Jan 30, 2002 at 03:21:51PM -0800, Joseph Carter wrote:
On Tue, Jan 29, 2002 at 07:02:56PM +0100, Stanislaw Stepien wrote: