annotate dox/define_backend.h @ 795:46a4cd4d382b

Remove dependent on system time to gain frame rate Date.now() would read system time. It is ineffeciency in for some implementation. To gain frame rate, we should rely on accuration of setInterval().
author Thinker K.F. Li <thinker@codemud.net>
date Tue, 31 Aug 2010 10:04:15 +0800
parents 1f900a67bd38
children 5dedeedf0408
rev   line source
443
1f900a67bd38 Doc How to Define a Backend
Thinker K.F. Li <thinker@branda.to>
parents:
diff changeset
1 /*! \page backend How to Define a Backend
1f900a67bd38 Doc How to Define a Backend
Thinker K.F. Li <thinker@branda.to>
parents:
diff changeset
2 *
1f900a67bd38 Doc How to Define a Backend
Thinker K.F. Li <thinker@branda.to>
parents:
diff changeset
3 * A backend is factory to initialize environment to make
1f900a67bd38 Doc How to Define a Backend
Thinker K.F. Li <thinker@branda.to>
parents:
diff changeset
4 * MadBufferfly available. A backend should provide resources
1f900a67bd38 Doc How to Define a Backend
Thinker K.F. Li <thinker@branda.to>
parents:
diff changeset
5 * needed by MadButterfly, for example, to provide a surface
1f900a67bd38 Doc How to Define a Backend
Thinker K.F. Li <thinker@branda.to>
parents:
diff changeset
6 * that will show everything drawing on it. It also translate and
1f900a67bd38 Doc How to Define a Backend
Thinker K.F. Li <thinker@branda.to>
parents:
diff changeset
7 * relay input events, mouse or keyboard, to MadButterfly.
1f900a67bd38 Doc How to Define a Backend
Thinker K.F. Li <thinker@branda.to>
parents:
diff changeset
8 * The tasks that a backend should do are listed following,
1f900a67bd38 Doc How to Define a Backend
Thinker K.F. Li <thinker@branda.to>
parents:
diff changeset
9 * - to prepare a backend surface,
1f900a67bd38 Doc How to Define a Backend
Thinker K.F. Li <thinker@branda.to>
parents:
diff changeset
10 * - to prepare a front surface,
1f900a67bd38 Doc How to Define a Backend
Thinker K.F. Li <thinker@branda.to>
parents:
diff changeset
11 * - to translate and relay input events to MadButterfly,
1f900a67bd38 Doc How to Define a Backend
Thinker K.F. Li <thinker@branda.to>
parents:
diff changeset
12 * - to handle a timer, and relay timeout events to MadButterfly.
1f900a67bd38 Doc How to Define a Backend
Thinker K.F. Li <thinker@branda.to>
parents:
diff changeset
13 *
1f900a67bd38 Doc How to Define a Backend
Thinker K.F. Li <thinker@branda.to>
parents:
diff changeset
14 * The output device surface for X Window is a surface return by
1f900a67bd38 Doc How to Define a Backend
Thinker K.F. Li <thinker@branda.to>
parents:
diff changeset
15 * cairo_xlib_surface_create(). MadButterfly will copy everything
1f900a67bd38 Doc How to Define a Backend
Thinker K.F. Li <thinker@branda.to>
parents:
diff changeset
16 * from front surface to backend surface to show graphy to user.
1f900a67bd38 Doc How to Define a Backend
Thinker K.F. Li <thinker@branda.to>
parents:
diff changeset
17 * The copying is to avoid user find slowly redrawing. The latency
1f900a67bd38 Doc How to Define a Backend
Thinker K.F. Li <thinker@branda.to>
parents:
diff changeset
18 * between X client and server can be large. For this situation,
1f900a67bd38 Doc How to Define a Backend
Thinker K.F. Li <thinker@branda.to>
parents:
diff changeset
19 * we need a font surface as a buffer drawing, and copy image from
1f900a67bd38 Doc How to Define a Backend
Thinker K.F. Li <thinker@branda.to>
parents:
diff changeset
20 * front surface to backend surface after completion of a series
1f900a67bd38 Doc How to Define a Backend
Thinker K.F. Li <thinker@branda.to>
parents:
diff changeset
21 * of drawing. A front surface can be an image surface for this
1f900a67bd38 Doc How to Define a Backend
Thinker K.F. Li <thinker@branda.to>
parents:
diff changeset
22 * situation.
1f900a67bd38 Doc How to Define a Backend
Thinker K.F. Li <thinker@branda.to>
parents:
diff changeset
23 *
1f900a67bd38 Doc How to Define a Backend
Thinker K.F. Li <thinker@branda.to>
parents:
diff changeset
24 * The input events of X Window should be translated to raw events of
1f900a67bd38 Doc How to Define a Backend
Thinker K.F. Li <thinker@branda.to>
parents:
diff changeset
25 * MadButterfly and sent them to rdman through notify_coord_or_shape()
1f900a67bd38 Doc How to Define a Backend
Thinker K.F. Li <thinker@branda.to>
parents:
diff changeset
26 * function.
1f900a67bd38 Doc How to Define a Backend
Thinker K.F. Li <thinker@branda.to>
parents:
diff changeset
27 *
1f900a67bd38 Doc How to Define a Backend
Thinker K.F. Li <thinker@branda.to>
parents:
diff changeset
28 * \see X_supp.c
1f900a67bd38 Doc How to Define a Backend
Thinker K.F. Li <thinker@branda.to>
parents:
diff changeset
29 */