duplicate a image with gs
Matthias Lang
matthias@REDACTED
Wed Apr 12 12:05:46 CEST 2006
> > This not the point.
> > But, is there any solution to manualy unload or delete graphic components
> > (or variables) in memory, for example like the function free in C ?
And now, in the vague hope of putting an end to this thread,
here is some code which uses gs to make an animated progress bar.
Matthias
----------------------------------------------------------------------
-module(progress).
-export([go/0]).
go() ->
Top = gs:start(),
W = gs:window(Top, {map, true}),
C = gs:create(canvas, W, [{width, 100}, {height, 20}]),
R1 = gs:create(rectangle, C,
[{coords, [{0,1}, {0,10}]}, {fg, red}, {fill, red}]),
R2 = gs:create(rectangle, C,
[{coords, [{0,1}, {100,10}]}, {fg, green}, {fill, green}]),
animate(R1, R2, 1),
gs:stop().
animate(_R1, _R2, 100) ->
done;
animate(R1, R2, N) ->
timer:sleep(100),
gs:config(R1, [{coords, [{0,1}, {N,10}]}]),
gs:config(R2, [{coords, [{N,1}, {100,10}]}]),
animate(R1, R2, N + 1).
More information about the erlang-questions
mailing list