1set_dirty_rectangle_marker(3)   gstream manual   set_dirty_rectangle_marker(3)
2
3
4

NAME

6       set_dirty_rectangle_marker
7

SYNOPSIS

9       #include <gstream.h>
10
11
12       void set_dirty_rectangle_marker(void (*drm)(int, int, int, int))
13

DESCRIPTION

15       Sets  a  function  which the gstream will use to mark the areas that it
16       draws inside as "dirty"; this can, for instance, be very useful in con‐
17       juction with a dirty rectangle system in a game where you are using the
18       gstream to output various information during the main loop. The gstream
19       will then automatically be able to inform the system about the parts of
20       the bitmap it has changed so that  you  don't  have  to  take  up  that
21       responsibility.
22
23       The  provided  function  will  be given the parameters: x and y coordi‐
24       nates, and width and height of the rectangle,  in  that  order.  So  if
25       you're  using  DRS,  you could call this function like this (since that
26       function takes these four parameters x, y, width, height directly):
27
28          set_dirty_rectangle_marker(DRS_add_rectangle);
29
30       The marker type function is typedef'ed in the  class  gbuf,  which  may
31       come in handy in some situations:
32
33          gbuf::dirty_rectangle_marker tmp_drm;
34
35          //...
36
37          tmp_drm = gs1.get_dirty_rectangle_marker();
38          gs1.set_dirty_rectangle_marker(gs2.get_dirty_rectangle_marker());
39          gs2.set_dirty_rectangle_marker(tmp_drm);
40
41       Pass  the  function a null pointer to prevent the gstream from thinking
42       about dirty rectangles, e.g.
43
44          set_dirty_rectangle_marker(0);  // or perhaps
45          set_dirty_rectangle_marker(NULL);
46
47       If you don't know what the "dirty" principle is all about: well, it  is
48       a  screen-updating  technique similar to double buffering but where you
49       mark the areas that you have drawn on (which made them dirty), and then
50       later when you need to update the screen only blit these areas (thereby
51       cleaning the,) instead of the whole buffer.  I  suggest  you  get  your
52       hands  on DRS if this has made you curious, since it contains an longer
53       introduction to the principle (and also the routines to make  it  work,
54       by the way :-). It can be fetched at
55
56       http://sunsite.dk/olau/drs/
57
58       The  default value of the dirty rectangle marker is the null pointer so
59       that the gstream will not bother marking any rectangles.
60
61       Note that only the outputter will mark any rectangles  dirty,  and  not
62       the  inputter  since  it is blocking program anyway, waiting for input,
63       meanwhile preventing the main loop from reaching  the  place  where  it
64       updates the rectangles.
65
66

SEE ALSO

68       gstream-get_dirty_rectangle_marker(3)
69
70
71
72gstream                           version 1.6    set_dirty_rectangle_marker(3)
Impressum