annotate src/X_main.c @ 966:ca993c473379

Function of removing key frames
author Thinker K.F. Li <thinker@codemud.net>
date Thu, 18 Nov 2010 11:20:24 +0800
parents e6c107b2e271
children 4f4abce1b5df
rev   line source
822
586e50f82c1f Unify coding style tag for emacs and vim.
Shih-Yuan Lee (FourDollars) <fourdollars@gmail.com>
parents: 471
diff changeset
1 // -*- indent-tabs-mode: t; tab-width: 8; c-basic-offset: 4; -*-
586e50f82c1f Unify coding style tag for emacs and vim.
Shih-Yuan Lee (FourDollars) <fourdollars@gmail.com>
parents: 471
diff changeset
2 // vim: sw=4:ts=8:sts=4
3
164162781a7a Test cairo with Xlib surface
Thinker K.F. Li <thinker@branda.to>
parents:
diff changeset
3 #include <stdio.h>
164162781a7a Test cairo with Xlib surface
Thinker K.F. Li <thinker@branda.to>
parents:
diff changeset
4 #include <unistd.h>
39
db2aa914e14b timer for animation
Thinker K.F. Li <thinker@branda.to>
parents: 37
diff changeset
5 #include <sys/time.h>
db2aa914e14b timer for animation
Thinker K.F. Li <thinker@branda.to>
parents: 37
diff changeset
6 #include <sys/select.h>
3
164162781a7a Test cairo with Xlib surface
Thinker K.F. Li <thinker@branda.to>
parents:
diff changeset
7 #include <X11/Xlib.h>
6
772511b8b9be Cairo specify RGB values in range 0.0 ~ 1.0.
Thinker K.F. Li <thinker@branda.to>
parents: 5
diff changeset
8 #include <X11/Xutil.h>
448
16116d84bc5e Replace Cairo with a abstract layer mb_graph_engine.
Thinker K.F. Li <thinker@branda.to>
parents: 278
diff changeset
9 #include "mb_graph_engine.h"
278
a90fd749af82 Implement the whole tspan attribute. Currently, we can accept font family/font style/font weight and font size.
wycc
parents: 186
diff changeset
10 #include <pango/pangocairo.h>
3
164162781a7a Test cairo with Xlib surface
Thinker K.F. Li <thinker@branda.to>
parents:
diff changeset
11
5
9c331ec9e210 SVG path is partially supported
Thinker K.F. Li <thinker@branda.to>
parents: 3
diff changeset
12 #include <string.h>
186
530bb7728546 Move header files to $(top_srcdir)/include/ and prefixed with 'mb_'.
Thinker K.F. Li <thinker@branda.to>
parents: 185
diff changeset
13 #include "mb_shapes.h"
530bb7728546 Move header files to $(top_srcdir)/include/ and prefixed with 'mb_'.
Thinker K.F. Li <thinker@branda.to>
parents: 185
diff changeset
14 #include "mb_redraw_man.h"
530bb7728546 Move header files to $(top_srcdir)/include/ and prefixed with 'mb_'.
Thinker K.F. Li <thinker@branda.to>
parents: 185
diff changeset
15 #include "mb_paint.h"
530bb7728546 Move header files to $(top_srcdir)/include/ and prefixed with 'mb_'.
Thinker K.F. Li <thinker@branda.to>
parents: 185
diff changeset
16 #include "mb_timer.h"
530bb7728546 Move header files to $(top_srcdir)/include/ and prefixed with 'mb_'.
Thinker K.F. Li <thinker@branda.to>
parents: 185
diff changeset
17 #include "mb_animate.h"
39
db2aa914e14b timer for animation
Thinker K.F. Li <thinker@branda.to>
parents: 37
diff changeset
18
db2aa914e14b timer for animation
Thinker K.F. Li <thinker@branda.to>
parents: 37
diff changeset
19 #define OK 0
db2aa914e14b timer for animation
Thinker K.F. Li <thinker@branda.to>
parents: 37
diff changeset
20 #define ERR -1
5
9c331ec9e210 SVG path is partially supported
Thinker K.F. Li <thinker@branda.to>
parents: 3
diff changeset
21
16
e17e12b112c4 A simple animation using rdman_redraw_changed().
Thinker K.F. Li <thinker@branda.to>
parents: 15
diff changeset
22 Display *display;
30
e06a4a667ce2 Accept mouse/pointer event and hint the shape that the pointer is over.
Thinker K.F. Li <thinker@branda.to>
parents: 27
diff changeset
23 Window win;
e06a4a667ce2 Accept mouse/pointer event and hint the shape that the pointer is over.
Thinker K.F. Li <thinker@branda.to>
parents: 27
diff changeset
24
e06a4a667ce2 Accept mouse/pointer event and hint the shape that the pointer is over.
Thinker K.F. Li <thinker@branda.to>
parents: 27
diff changeset
25 void hint_shape(redraw_man_t *rdman, shape_t *shape) {
e06a4a667ce2 Accept mouse/pointer event and hint the shape that the pointer is over.
Thinker K.F. Li <thinker@branda.to>
parents: 27
diff changeset
26 static shape_t *last_shape = NULL;
e06a4a667ce2 Accept mouse/pointer event and hint the shape that the pointer is over.
Thinker K.F. Li <thinker@branda.to>
parents: 27
diff changeset
27 if(last_shape != shape) {
33
d82749f77108 Fix bug of demo and remove *_fill() and *_stroke().
Thinker K.F. Li <thinker@branda.to>
parents: 32
diff changeset
28 if(last_shape != NULL && last_shape->stroke != NULL) {
30
e06a4a667ce2 Accept mouse/pointer event and hint the shape that the pointer is over.
Thinker K.F. Li <thinker@branda.to>
parents: 27
diff changeset
29 last_shape->stroke_width -= 2;
e06a4a667ce2 Accept mouse/pointer event and hint the shape that the pointer is over.
Thinker K.F. Li <thinker@branda.to>
parents: 27
diff changeset
30 rdman_shape_changed(rdman, last_shape);
e06a4a667ce2 Accept mouse/pointer event and hint the shape that the pointer is over.
Thinker K.F. Li <thinker@branda.to>
parents: 27
diff changeset
31 }
e06a4a667ce2 Accept mouse/pointer event and hint the shape that the pointer is over.
Thinker K.F. Li <thinker@branda.to>
parents: 27
diff changeset
32 if(shape != NULL && shape->stroke != NULL) {
e06a4a667ce2 Accept mouse/pointer event and hint the shape that the pointer is over.
Thinker K.F. Li <thinker@branda.to>
parents: 27
diff changeset
33 shape->stroke_width += 2;
e06a4a667ce2 Accept mouse/pointer event and hint the shape that the pointer is over.
Thinker K.F. Li <thinker@branda.to>
parents: 27
diff changeset
34 rdman_shape_changed(rdman, shape);
e06a4a667ce2 Accept mouse/pointer event and hint the shape that the pointer is over.
Thinker K.F. Li <thinker@branda.to>
parents: 27
diff changeset
35 }
e06a4a667ce2 Accept mouse/pointer event and hint the shape that the pointer is over.
Thinker K.F. Li <thinker@branda.to>
parents: 27
diff changeset
36 }
e06a4a667ce2 Accept mouse/pointer event and hint the shape that the pointer is over.
Thinker K.F. Li <thinker@branda.to>
parents: 27
diff changeset
37 last_shape = shape;
e06a4a667ce2 Accept mouse/pointer event and hint the shape that the pointer is over.
Thinker K.F. Li <thinker@branda.to>
parents: 27
diff changeset
38 }
e06a4a667ce2 Accept mouse/pointer event and hint the shape that the pointer is over.
Thinker K.F. Li <thinker@branda.to>
parents: 27
diff changeset
39
e06a4a667ce2 Accept mouse/pointer event and hint the shape that the pointer is over.
Thinker K.F. Li <thinker@branda.to>
parents: 27
diff changeset
40 void event_interaction(Display *display,
e06a4a667ce2 Accept mouse/pointer event and hint the shape that the pointer is over.
Thinker K.F. Li <thinker@branda.to>
parents: 27
diff changeset
41 redraw_man_t *rdman, int w, int h) {
e06a4a667ce2 Accept mouse/pointer event and hint the shape that the pointer is over.
Thinker K.F. Li <thinker@branda.to>
parents: 27
diff changeset
42 XEvent evt;
e06a4a667ce2 Accept mouse/pointer event and hint the shape that the pointer is over.
Thinker K.F. Li <thinker@branda.to>
parents: 27
diff changeset
43 XMotionEvent *mevt;
e06a4a667ce2 Accept mouse/pointer event and hint the shape that the pointer is over.
Thinker K.F. Li <thinker@branda.to>
parents: 27
diff changeset
44 int r;
e06a4a667ce2 Accept mouse/pointer event and hint the shape that the pointer is over.
Thinker K.F. Li <thinker@branda.to>
parents: 27
diff changeset
45 co_aix x, y;
e06a4a667ce2 Accept mouse/pointer event and hint the shape that the pointer is over.
Thinker K.F. Li <thinker@branda.to>
parents: 27
diff changeset
46 shape_t *shape = NULL;
e06a4a667ce2 Accept mouse/pointer event and hint the shape that the pointer is over.
Thinker K.F. Li <thinker@branda.to>
parents: 27
diff changeset
47 int in_stroke;
e06a4a667ce2 Accept mouse/pointer event and hint the shape that the pointer is over.
Thinker K.F. Li <thinker@branda.to>
parents: 27
diff changeset
48
39
db2aa914e14b timer for animation
Thinker K.F. Li <thinker@branda.to>
parents: 37
diff changeset
49 while(XEventsQueued(display, QueuedAfterReading) > 0) {
db2aa914e14b timer for animation
Thinker K.F. Li <thinker@branda.to>
parents: 37
diff changeset
50 r = XNextEvent(display, &evt);
db2aa914e14b timer for animation
Thinker K.F. Li <thinker@branda.to>
parents: 37
diff changeset
51 if(r == -1)
db2aa914e14b timer for animation
Thinker K.F. Li <thinker@branda.to>
parents: 37
diff changeset
52 break;
db2aa914e14b timer for animation
Thinker K.F. Li <thinker@branda.to>
parents: 37
diff changeset
53
30
e06a4a667ce2 Accept mouse/pointer event and hint the shape that the pointer is over.
Thinker K.F. Li <thinker@branda.to>
parents: 27
diff changeset
54 switch(evt.type) {
e06a4a667ce2 Accept mouse/pointer event and hint the shape that the pointer is over.
Thinker K.F. Li <thinker@branda.to>
parents: 27
diff changeset
55 case MotionNotify:
e06a4a667ce2 Accept mouse/pointer event and hint the shape that the pointer is over.
Thinker K.F. Li <thinker@branda.to>
parents: 27
diff changeset
56 mevt = (XMotionEvent *)&evt;
e06a4a667ce2 Accept mouse/pointer event and hint the shape that the pointer is over.
Thinker K.F. Li <thinker@branda.to>
parents: 27
diff changeset
57 x = mevt->x;
e06a4a667ce2 Accept mouse/pointer event and hint the shape that the pointer is over.
Thinker K.F. Li <thinker@branda.to>
parents: 27
diff changeset
58 y = mevt->y;
e06a4a667ce2 Accept mouse/pointer event and hint the shape that the pointer is over.
Thinker K.F. Li <thinker@branda.to>
parents: 27
diff changeset
59 shape = find_shape_at_pos(rdman, x, y, &in_stroke);
e06a4a667ce2 Accept mouse/pointer event and hint the shape that the pointer is over.
Thinker K.F. Li <thinker@branda.to>
parents: 27
diff changeset
60 hint_shape(rdman, shape);
e06a4a667ce2 Accept mouse/pointer event and hint the shape that the pointer is over.
Thinker K.F. Li <thinker@branda.to>
parents: 27
diff changeset
61 break;
37
943acee7f346 update exposed area
Thinker K.F. Li <thinker@branda.to>
parents: 35
diff changeset
62 case Expose:
77
Thinker K.F. Li <thinker@branda.to>
parents: 73
diff changeset
63 rdman_redraw_area(rdman, evt.xexpose.x, evt.xexpose.y,
Thinker K.F. Li <thinker@branda.to>
parents: 73
diff changeset
64 evt.xexpose.width, evt.xexpose.height);
37
943acee7f346 update exposed area
Thinker K.F. Li <thinker@branda.to>
parents: 35
diff changeset
65 break;
30
e06a4a667ce2 Accept mouse/pointer event and hint the shape that the pointer is over.
Thinker K.F. Li <thinker@branda.to>
parents: 27
diff changeset
66 }
e06a4a667ce2 Accept mouse/pointer event and hint the shape that the pointer is over.
Thinker K.F. Li <thinker@branda.to>
parents: 27
diff changeset
67 }
53
ffed18510d55 Use animate feacilities to demo all animation.
Thinker K.F. Li <thinker@branda.to>
parents: 52
diff changeset
68 rdman_redraw_changed(rdman);
39
db2aa914e14b timer for animation
Thinker K.F. Li <thinker@branda.to>
parents: 37
diff changeset
69 XFlush(display);
db2aa914e14b timer for animation
Thinker K.F. Li <thinker@branda.to>
parents: 37
diff changeset
70 }
db2aa914e14b timer for animation
Thinker K.F. Li <thinker@branda.to>
parents: 37
diff changeset
71
db2aa914e14b timer for animation
Thinker K.F. Li <thinker@branda.to>
parents: 37
diff changeset
72 void handle_connection(Display *display, mb_tman_t *tman,
db2aa914e14b timer for animation
Thinker K.F. Li <thinker@branda.to>
parents: 37
diff changeset
73 redraw_man_t *rdman, int w, int h) {
db2aa914e14b timer for animation
Thinker K.F. Li <thinker@branda.to>
parents: 37
diff changeset
74 int xcon;
db2aa914e14b timer for animation
Thinker K.F. Li <thinker@branda.to>
parents: 37
diff changeset
75 fd_set rds;
db2aa914e14b timer for animation
Thinker K.F. Li <thinker@branda.to>
parents: 37
diff changeset
76 int nfds;
db2aa914e14b timer for animation
Thinker K.F. Li <thinker@branda.to>
parents: 37
diff changeset
77 struct timeval tmo;
53
ffed18510d55 Use animate feacilities to demo all animation.
Thinker K.F. Li <thinker@branda.to>
parents: 52
diff changeset
78 mb_timeval_t mb_tmo, next_mb_tmo;
54
Thinker K.F. Li <thinker@branda.to>
parents: 53
diff changeset
79 int r;
39
db2aa914e14b timer for animation
Thinker K.F. Li <thinker@branda.to>
parents: 37
diff changeset
80
db2aa914e14b timer for animation
Thinker K.F. Li <thinker@branda.to>
parents: 37
diff changeset
81 XSelectInput(display, win, PointerMotionMask | ExposureMask);
db2aa914e14b timer for animation
Thinker K.F. Li <thinker@branda.to>
parents: 37
diff changeset
82 XFlush(display);
db2aa914e14b timer for animation
Thinker K.F. Li <thinker@branda.to>
parents: 37
diff changeset
83
db2aa914e14b timer for animation
Thinker K.F. Li <thinker@branda.to>
parents: 37
diff changeset
84 xcon = XConnectionNumber(display);
db2aa914e14b timer for animation
Thinker K.F. Li <thinker@branda.to>
parents: 37
diff changeset
85 nfds = xcon + 1;
49
6a3726fa7aad Reduce times of invoking gettimeofday()
Thinker K.F. Li <thinker@branda.to>
parents: 48
diff changeset
86
6a3726fa7aad Reduce times of invoking gettimeofday()
Thinker K.F. Li <thinker@branda.to>
parents: 48
diff changeset
87 r = gettimeofday(&tmo, NULL);
6a3726fa7aad Reduce times of invoking gettimeofday()
Thinker K.F. Li <thinker@branda.to>
parents: 48
diff changeset
88 if(r == -1) {
6a3726fa7aad Reduce times of invoking gettimeofday()
Thinker K.F. Li <thinker@branda.to>
parents: 48
diff changeset
89 perror("gettimeofday");
6a3726fa7aad Reduce times of invoking gettimeofday()
Thinker K.F. Li <thinker@branda.to>
parents: 48
diff changeset
90 return;
6a3726fa7aad Reduce times of invoking gettimeofday()
Thinker K.F. Li <thinker@branda.to>
parents: 48
diff changeset
91 }
6a3726fa7aad Reduce times of invoking gettimeofday()
Thinker K.F. Li <thinker@branda.to>
parents: 48
diff changeset
92 MB_TIMEVAL_SET(&mb_tmo, tmo.tv_sec, tmo.tv_usec);
6a3726fa7aad Reduce times of invoking gettimeofday()
Thinker K.F. Li <thinker@branda.to>
parents: 48
diff changeset
93
39
db2aa914e14b timer for animation
Thinker K.F. Li <thinker@branda.to>
parents: 37
diff changeset
94 while(1) {
db2aa914e14b timer for animation
Thinker K.F. Li <thinker@branda.to>
parents: 37
diff changeset
95 FD_ZERO(&rds);
db2aa914e14b timer for animation
Thinker K.F. Li <thinker@branda.to>
parents: 37
diff changeset
96 FD_SET(xcon, &rds);
db2aa914e14b timer for animation
Thinker K.F. Li <thinker@branda.to>
parents: 37
diff changeset
97
53
ffed18510d55 Use animate feacilities to demo all animation.
Thinker K.F. Li <thinker@branda.to>
parents: 52
diff changeset
98 r = mb_tman_next_timeout(tman, &mb_tmo, &next_mb_tmo);
39
db2aa914e14b timer for animation
Thinker K.F. Li <thinker@branda.to>
parents: 37
diff changeset
99 if(r != OK)
db2aa914e14b timer for animation
Thinker K.F. Li <thinker@branda.to>
parents: 37
diff changeset
100 r = select(nfds, &rds, NULL, NULL, NULL);
41
400b4b5db0dc Working on animation
Thinker K.F. Li <thinker@branda.to>
parents: 39
diff changeset
101 else {
53
ffed18510d55 Use animate feacilities to demo all animation.
Thinker K.F. Li <thinker@branda.to>
parents: 52
diff changeset
102 tmo.tv_sec = MB_TIMEVAL_SEC(&next_mb_tmo);
ffed18510d55 Use animate feacilities to demo all animation.
Thinker K.F. Li <thinker@branda.to>
parents: 52
diff changeset
103 tmo.tv_usec = MB_TIMEVAL_USEC(&next_mb_tmo);
39
db2aa914e14b timer for animation
Thinker K.F. Li <thinker@branda.to>
parents: 37
diff changeset
104 r = select(nfds, &rds, NULL, NULL, &tmo);
41
400b4b5db0dc Working on animation
Thinker K.F. Li <thinker@branda.to>
parents: 39
diff changeset
105 }
39
db2aa914e14b timer for animation
Thinker K.F. Li <thinker@branda.to>
parents: 37
diff changeset
106
db2aa914e14b timer for animation
Thinker K.F. Li <thinker@branda.to>
parents: 37
diff changeset
107 if(r == -1) {
db2aa914e14b timer for animation
Thinker K.F. Li <thinker@branda.to>
parents: 37
diff changeset
108 perror("select");
db2aa914e14b timer for animation
Thinker K.F. Li <thinker@branda.to>
parents: 37
diff changeset
109 return;
db2aa914e14b timer for animation
Thinker K.F. Li <thinker@branda.to>
parents: 37
diff changeset
110 }
49
6a3726fa7aad Reduce times of invoking gettimeofday()
Thinker K.F. Li <thinker@branda.to>
parents: 48
diff changeset
111
54
Thinker K.F. Li <thinker@branda.to>
parents: 53
diff changeset
112 if(r == 0) {
Thinker K.F. Li <thinker@branda.to>
parents: 53
diff changeset
113 MB_TIMEVAL_ADD(&mb_tmo, &next_mb_tmo);
49
6a3726fa7aad Reduce times of invoking gettimeofday()
Thinker K.F. Li <thinker@branda.to>
parents: 48
diff changeset
114
41
400b4b5db0dc Working on animation
Thinker K.F. Li <thinker@branda.to>
parents: 39
diff changeset
115 mb_tman_handle_timeout(tman, &mb_tmo);
42
e3295c07faa9 mb_shift is work
Thinker K.F. Li <thinker@branda.to>
parents: 41
diff changeset
116 rdman_redraw_changed(rdman);
39
db2aa914e14b timer for animation
Thinker K.F. Li <thinker@branda.to>
parents: 37
diff changeset
117 XFlush(display);
db2aa914e14b timer for animation
Thinker K.F. Li <thinker@branda.to>
parents: 37
diff changeset
118 } else if(FD_ISSET(xcon, &rds)) {
db2aa914e14b timer for animation
Thinker K.F. Li <thinker@branda.to>
parents: 37
diff changeset
119 event_interaction(display, rdman, w, h);
db2aa914e14b timer for animation
Thinker K.F. Li <thinker@branda.to>
parents: 37
diff changeset
120 }
db2aa914e14b timer for animation
Thinker K.F. Li <thinker@branda.to>
parents: 37
diff changeset
121 }
30
e06a4a667ce2 Accept mouse/pointer event and hint the shape that the pointer is over.
Thinker K.F. Li <thinker@branda.to>
parents: 27
diff changeset
122 }
16
e17e12b112c4 A simple animation using rdman_redraw_changed().
Thinker K.F. Li <thinker@branda.to>
parents: 15
diff changeset
123
448
16116d84bc5e Replace Cairo with a abstract layer mb_graph_engine.
Thinker K.F. Li <thinker@branda.to>
parents: 278
diff changeset
124 void draw_path(mbe_t *cr, int w, int h) {
16116d84bc5e Replace Cairo with a abstract layer mb_graph_engine.
Thinker K.F. Li <thinker@branda.to>
parents: 278
diff changeset
125 mbe_t *tmpcr;
16116d84bc5e Replace Cairo with a abstract layer mb_graph_engine.
Thinker K.F. Li <thinker@branda.to>
parents: 278
diff changeset
126 mbe_surface_t *tmpsuf;
471
e98ae1407ca2 Remove mbe_set_source_surface() from graphic engine.
Thinker K.F. Li <thinker@branda.to>
parents: 451
diff changeset
127 mbe_pattern_t *tmpptn;
12
79e9edf4c00a Add redraw manager
Thinker K.F. Li <thinker@branda.to>
parents: 11
diff changeset
128 redraw_man_t rdman;
35
581a03196093 Support rectangle tag of SVG.
Thinker K.F. Li <thinker@branda.to>
parents: 33
diff changeset
129 shape_t *path1, *path2, *rect;
27
19c603dd6ff9 Add text shape.
Thinker K.F. Li <thinker@branda.to>
parents: 26
diff changeset
130 coord_t *coord1, *coord2, *coord3;
23
56f592f56ff7 Fix bug and add linear gradient paint.
Thinker K.F. Li <thinker@branda.to>
parents: 22
diff changeset
131 paint_t *fill1, *fill2, *fill3;
55
01ed2bc37eed Radial gradient paint
Thinker K.F. Li <thinker@branda.to>
parents: 54
diff changeset
132 paint_t *text_fill;
01ed2bc37eed Radial gradient paint
Thinker K.F. Li <thinker@branda.to>
parents: 54
diff changeset
133 grad_stop_t text_stops[2];
27
19c603dd6ff9 Add text shape.
Thinker K.F. Li <thinker@branda.to>
parents: 26
diff changeset
134 paint_t *stroke, *text_stroke;
19c603dd6ff9 Add text shape.
Thinker K.F. Li <thinker@branda.to>
parents: 26
diff changeset
135 shape_t *text;
23
56f592f56ff7 Fix bug and add linear gradient paint.
Thinker K.F. Li <thinker@branda.to>
parents: 22
diff changeset
136 grad_stop_t fill3_stops[3];
448
16116d84bc5e Replace Cairo with a abstract layer mb_graph_engine.
Thinker K.F. Li <thinker@branda.to>
parents: 278
diff changeset
137 mbe_font_face_t *face;
39
db2aa914e14b timer for animation
Thinker K.F. Li <thinker@branda.to>
parents: 37
diff changeset
138 struct timeval tv;
db2aa914e14b timer for animation
Thinker K.F. Li <thinker@branda.to>
parents: 37
diff changeset
139 mb_tman_t *tman;
42
e3295c07faa9 mb_shift is work
Thinker K.F. Li <thinker@branda.to>
parents: 41
diff changeset
140 mb_timeval_t mbtv, start, playing;
e3295c07faa9 mb_shift is work
Thinker K.F. Li <thinker@branda.to>
parents: 41
diff changeset
141 mb_progm_t *progm;
e3295c07faa9 mb_shift is work
Thinker K.F. Li <thinker@branda.to>
parents: 41
diff changeset
142 mb_word_t *word;
e3295c07faa9 mb_shift is work
Thinker K.F. Li <thinker@branda.to>
parents: 41
diff changeset
143 mb_action_t *act;
278
a90fd749af82 Implement the whole tspan attribute. Currently, we can accept font family/font style/font weight and font size.
wycc
parents: 186
diff changeset
144 PangoAttrList *attrs = pango_attr_list_new();
12
79e9edf4c00a Add redraw manager
Thinker K.F. Li <thinker@branda.to>
parents: 11
diff changeset
145
450
a417fd980228 Replace cairo_format_t with mb_img_fmt_t.
Thinker K.F. Li <thinker@branda.to>
parents: 448
diff changeset
146 tmpsuf = mbe_image_surface_create(MB_IFMT_ARGB32, w, h);
471
e98ae1407ca2 Remove mbe_set_source_surface() from graphic engine.
Thinker K.F. Li <thinker@branda.to>
parents: 451
diff changeset
147 tmpptn = mbe_pattern_create_for_surface(tmpsuf);
448
16116d84bc5e Replace Cairo with a abstract layer mb_graph_engine.
Thinker K.F. Li <thinker@branda.to>
parents: 278
diff changeset
148 tmpcr = mbe_create(tmpsuf);
27
19c603dd6ff9 Add text shape.
Thinker K.F. Li <thinker@branda.to>
parents: 26
diff changeset
149
471
e98ae1407ca2 Remove mbe_set_source_surface() from graphic engine.
Thinker K.F. Li <thinker@branda.to>
parents: 451
diff changeset
150 mbe_set_source(cr, tmpptn);
24
e598bc809c0f No more flash when animation.
Thinker K.F. Li <thinker@branda.to>
parents: 23
diff changeset
151 redraw_man_init(&rdman, tmpcr, cr);
19
cf6d65398619 More animation demo
Thinker K.F. Li <thinker@branda.to>
parents: 18
diff changeset
152 coord1 = rdman_coord_new(&rdman, rdman.root_coord);
cf6d65398619 More animation demo
Thinker K.F. Li <thinker@branda.to>
parents: 18
diff changeset
153 coord2 = rdman_coord_new(&rdman, rdman.root_coord);
27
19c603dd6ff9 Add text shape.
Thinker K.F. Li <thinker@branda.to>
parents: 26
diff changeset
154 coord3 = rdman_coord_new(&rdman, rdman.root_coord);
5
9c331ec9e210 SVG path is partially supported
Thinker K.F. Li <thinker@branda.to>
parents: 3
diff changeset
155
159
b90abd31a281 Postponse free of coords, shapes, and paints when the rdman is dirty.
Thinker K.F. Li <thinker@branda.to>
parents: 77
diff changeset
156 fill1 = rdman_paint_color_new(&rdman, 1, 1, 0, 0.5);
b90abd31a281 Postponse free of coords, shapes, and paints when the rdman is dirty.
Thinker K.F. Li <thinker@branda.to>
parents: 77
diff changeset
157 fill2 = rdman_paint_color_new(&rdman, 0, 1, 1, 0.5);
b90abd31a281 Postponse free of coords, shapes, and paints when the rdman is dirty.
Thinker K.F. Li <thinker@branda.to>
parents: 77
diff changeset
158 stroke = rdman_paint_color_new(&rdman, 0.4, 0.4, 0.4, 1);
b90abd31a281 Postponse free of coords, shapes, and paints when the rdman is dirty.
Thinker K.F. Li <thinker@branda.to>
parents: 77
diff changeset
159 text_stroke = rdman_paint_color_new(&rdman, 0.5, 0.5, 0.5, 1);
27
19c603dd6ff9 Add text shape.
Thinker K.F. Li <thinker@branda.to>
parents: 26
diff changeset
160
448
16116d84bc5e Replace Cairo with a abstract layer mb_graph_engine.
Thinker K.F. Li <thinker@branda.to>
parents: 278
diff changeset
161 face = mbe_get_font_face(tmpcr);
159
b90abd31a281 Postponse free of coords, shapes, and paints when the rdman is dirty.
Thinker K.F. Li <thinker@branda.to>
parents: 77
diff changeset
162 text = rdman_shape_text_new(&rdman, "hello \xe6\xbc\xa2\xe5\xad\x97",
278
a90fd749af82 Implement the whole tspan attribute. Currently, we can accept font family/font style/font weight and font size.
wycc
parents: 186
diff changeset
163 10, h / 4, 36.0, face, attrs);
159
b90abd31a281 Postponse free of coords, shapes, and paints when the rdman is dirty.
Thinker K.F. Li <thinker@branda.to>
parents: 77
diff changeset
164 text_fill = rdman_paint_radial_new(&rdman, 100, h / 4, 70);
55
01ed2bc37eed Radial gradient paint
Thinker K.F. Li <thinker@branda.to>
parents: 54
diff changeset
165 grad_stop_init(text_stops, 0, 0.2, 0.9, 0.2, 1);
01ed2bc37eed Radial gradient paint
Thinker K.F. Li <thinker@branda.to>
parents: 54
diff changeset
166 grad_stop_init(text_stops + 1, 1, 0.9, 0.2, 0.2, 0.1);
56
e444a8c01735 Change interface of paint_radial_new()
Thinker K.F. Li <thinker@branda.to>
parents: 55
diff changeset
167 paint_radial_stops(text_fill, 2, text_stops);
27
19c603dd6ff9 Add text shape.
Thinker K.F. Li <thinker@branda.to>
parents: 26
diff changeset
168 rdman_paint_stroke(&rdman, text_stroke, text);
19c603dd6ff9 Add text shape.
Thinker K.F. Li <thinker@branda.to>
parents: 26
diff changeset
169 text->stroke_width = 0.5;
55
01ed2bc37eed Radial gradient paint
Thinker K.F. Li <thinker@branda.to>
parents: 54
diff changeset
170 rdman_paint_fill(&rdman, text_fill, text);
27
19c603dd6ff9 Add text shape.
Thinker K.F. Li <thinker@branda.to>
parents: 26
diff changeset
171 rdman_add_shape(&rdman, text, coord3);
19c603dd6ff9 Add text shape.
Thinker K.F. Li <thinker@branda.to>
parents: 26
diff changeset
172
159
b90abd31a281 Postponse free of coords, shapes, and paints when the rdman is dirty.
Thinker K.F. Li <thinker@branda.to>
parents: 77
diff changeset
173 path1 = rdman_shape_path_new(&rdman, "M 22,89.36218 C -34,-0.63782 39,-9.637817 82,12.36218 C 125,34.36218 142,136.36218 142,136.36218 C 100.66667,125.36218 74.26756,123.42795 22,89.36218 z ");
19
cf6d65398619 More animation demo
Thinker K.F. Li <thinker@branda.to>
parents: 18
diff changeset
174 rdman_paint_fill(&rdman, fill1, path1);
22
8fcf2d878ecd shapes with stroke
Thinker K.F. Li <thinker@branda.to>
parents: 21
diff changeset
175 rdman_paint_stroke(&rdman, stroke, path1);
19
cf6d65398619 More animation demo
Thinker K.F. Li <thinker@branda.to>
parents: 18
diff changeset
176 coord1->matrix[0] = 0.8;
cf6d65398619 More animation demo
Thinker K.F. Li <thinker@branda.to>
parents: 18
diff changeset
177 coord1->matrix[1] = 0;
cf6d65398619 More animation demo
Thinker K.F. Li <thinker@branda.to>
parents: 18
diff changeset
178 coord1->matrix[2] = 20;
cf6d65398619 More animation demo
Thinker K.F. Li <thinker@branda.to>
parents: 18
diff changeset
179 coord1->matrix[4] = 0.8;
cf6d65398619 More animation demo
Thinker K.F. Li <thinker@branda.to>
parents: 18
diff changeset
180 coord1->matrix[5] = 20;
27
19c603dd6ff9 Add text shape.
Thinker K.F. Li <thinker@branda.to>
parents: 26
diff changeset
181
159
b90abd31a281 Postponse free of coords, shapes, and paints when the rdman is dirty.
Thinker K.F. Li <thinker@branda.to>
parents: 77
diff changeset
182 path2 = rdman_shape_path_new(&rdman, "M 22,89.36218 C -34,-0.63782 39,-9.637817 82,12.36218 C 125,34.36218 142,136.36218 142,136.36218 C 100.66667,125.36218 74.26756,123.42795 22,89.36218 z ");
19
cf6d65398619 More animation demo
Thinker K.F. Li <thinker@branda.to>
parents: 18
diff changeset
183 rdman_paint_fill(&rdman, fill2, path2);
22
8fcf2d878ecd shapes with stroke
Thinker K.F. Li <thinker@branda.to>
parents: 21
diff changeset
184 rdman_paint_stroke(&rdman, stroke, path2);
19
cf6d65398619 More animation demo
Thinker K.F. Li <thinker@branda.to>
parents: 18
diff changeset
185 coord2->matrix[0] = -0.8;
cf6d65398619 More animation demo
Thinker K.F. Li <thinker@branda.to>
parents: 18
diff changeset
186 coord2->matrix[1] = 0;
20
74d3d5dc9aaa rename XXX_draw() to XXX_fill()
Thinker K.F. Li <thinker@branda.to>
parents: 19
diff changeset
187 coord2->matrix[2] = 180;
19
cf6d65398619 More animation demo
Thinker K.F. Li <thinker@branda.to>
parents: 18
diff changeset
188 coord2->matrix[4] = 0.8;
cf6d65398619 More animation demo
Thinker K.F. Li <thinker@branda.to>
parents: 18
diff changeset
189 coord2->matrix[5] = 20;
27
19c603dd6ff9 Add text shape.
Thinker K.F. Li <thinker@branda.to>
parents: 26
diff changeset
190
19
cf6d65398619 More animation demo
Thinker K.F. Li <thinker@branda.to>
parents: 18
diff changeset
191 rdman_coord_changed(&rdman, coord1);
cf6d65398619 More animation demo
Thinker K.F. Li <thinker@branda.to>
parents: 18
diff changeset
192 rdman_coord_changed(&rdman, coord2);
cf6d65398619 More animation demo
Thinker K.F. Li <thinker@branda.to>
parents: 18
diff changeset
193 rdman_add_shape(&rdman, (shape_t *)path1, coord1);
cf6d65398619 More animation demo
Thinker K.F. Li <thinker@branda.to>
parents: 18
diff changeset
194 rdman_add_shape(&rdman, (shape_t *)path2, coord2);
15
c2ce186a5c37 X_main uses rdman_redraw_all()
Thinker K.F. Li <thinker@branda.to>
parents: 13
diff changeset
195
822
586e50f82c1f Unify coding style tag for emacs and vim.
Shih-Yuan Lee (FourDollars) <fourdollars@gmail.com>
parents: 471
diff changeset
196
159
b90abd31a281 Postponse free of coords, shapes, and paints when the rdman is dirty.
Thinker K.F. Li <thinker@branda.to>
parents: 77
diff changeset
197 fill3 = rdman_paint_linear_new(&rdman, 50, 50, 150, 150);
23
56f592f56ff7 Fix bug and add linear gradient paint.
Thinker K.F. Li <thinker@branda.to>
parents: 22
diff changeset
198 grad_stop_init(fill3_stops, 0, 1, 0, 0, 0.5);
56f592f56ff7 Fix bug and add linear gradient paint.
Thinker K.F. Li <thinker@branda.to>
parents: 22
diff changeset
199 grad_stop_init(fill3_stops + 1, 0.5, 0, 1, 0, 0.5);
56f592f56ff7 Fix bug and add linear gradient paint.
Thinker K.F. Li <thinker@branda.to>
parents: 22
diff changeset
200 grad_stop_init(fill3_stops + 2, 1, 0, 0, 1, 0.5);
56f592f56ff7 Fix bug and add linear gradient paint.
Thinker K.F. Li <thinker@branda.to>
parents: 22
diff changeset
201 paint_linear_stops(fill3, 3, fill3_stops);
159
b90abd31a281 Postponse free of coords, shapes, and paints when the rdman is dirty.
Thinker K.F. Li <thinker@branda.to>
parents: 77
diff changeset
202 rect = rdman_shape_rect_new(&rdman, 50, 50, 100, 100, 20, 20);
35
581a03196093 Support rectangle tag of SVG.
Thinker K.F. Li <thinker@branda.to>
parents: 33
diff changeset
203 rdman_paint_fill(&rdman, fill3, rect);
581a03196093 Support rectangle tag of SVG.
Thinker K.F. Li <thinker@branda.to>
parents: 33
diff changeset
204 rdman_add_shape(&rdman, (shape_t *)rect, rdman.root_coord);
23
56f592f56ff7 Fix bug and add linear gradient paint.
Thinker K.F. Li <thinker@branda.to>
parents: 22
diff changeset
205
15
c2ce186a5c37 X_main uses rdman_redraw_all()
Thinker K.F. Li <thinker@branda.to>
parents: 13
diff changeset
206 rdman_redraw_all(&rdman);
c2ce186a5c37 X_main uses rdman_redraw_all()
Thinker K.F. Li <thinker@branda.to>
parents: 13
diff changeset
207
16
e17e12b112c4 A simple animation using rdman_redraw_changed().
Thinker K.F. Li <thinker@branda.to>
parents: 15
diff changeset
208 XFlush(display);
e17e12b112c4 A simple animation using rdman_redraw_changed().
Thinker K.F. Li <thinker@branda.to>
parents: 15
diff changeset
209
39
db2aa914e14b timer for animation
Thinker K.F. Li <thinker@branda.to>
parents: 37
diff changeset
210 tman = mb_tman_new();
db2aa914e14b timer for animation
Thinker K.F. Li <thinker@branda.to>
parents: 37
diff changeset
211 if(tman) {
58
Thinker K.F. Li <thinker@branda.to>
parents: 57
diff changeset
212 /* Prepare an animation program. */
863
e6c107b2e271 Do more works in X_main.c for profiling
Thinker K.F. Li <thinker@codemud.net>
parents: 822
diff changeset
213 progm = mb_progm_new(30, &rdman);
822
586e50f82c1f Unify coding style tag for emacs and vim.
Shih-Yuan Lee (FourDollars) <fourdollars@gmail.com>
parents: 471
diff changeset
214
53
ffed18510d55 Use animate feacilities to demo all animation.
Thinker K.F. Li <thinker@branda.to>
parents: 52
diff changeset
215 MB_TIMEVAL_SET(&start, 0, 0);
ffed18510d55 Use animate feacilities to demo all animation.
Thinker K.F. Li <thinker@branda.to>
parents: 52
diff changeset
216 MB_TIMEVAL_SET(&playing, 1, 0);
ffed18510d55 Use animate feacilities to demo all animation.
Thinker K.F. Li <thinker@branda.to>
parents: 52
diff changeset
217 word = mb_progm_next_word(progm, &start, &playing);
ffed18510d55 Use animate feacilities to demo all animation.
Thinker K.F. Li <thinker@branda.to>
parents: 52
diff changeset
218
ffed18510d55 Use animate feacilities to demo all animation.
Thinker K.F. Li <thinker@branda.to>
parents: 52
diff changeset
219 act = mb_shift_new(50, 50, coord1, word);
ffed18510d55 Use animate feacilities to demo all animation.
Thinker K.F. Li <thinker@branda.to>
parents: 52
diff changeset
220 act = mb_shift_new(-50, 50, coord2, word);
ffed18510d55 Use animate feacilities to demo all animation.
Thinker K.F. Li <thinker@branda.to>
parents: 52
diff changeset
221
42
e3295c07faa9 mb_shift is work
Thinker K.F. Li <thinker@branda.to>
parents: 41
diff changeset
222 MB_TIMEVAL_SET(&start, 1, 0);
e3295c07faa9 mb_shift is work
Thinker K.F. Li <thinker@branda.to>
parents: 41
diff changeset
223 MB_TIMEVAL_SET(&playing, 2, 0);
e3295c07faa9 mb_shift is work
Thinker K.F. Li <thinker@branda.to>
parents: 41
diff changeset
224 word = mb_progm_next_word(progm, &start, &playing);
53
ffed18510d55 Use animate feacilities to demo all animation.
Thinker K.F. Li <thinker@branda.to>
parents: 52
diff changeset
225
47
f3818d996f4f change interface of creating a animation action
Thinker K.F. Li <thinker@branda.to>
parents: 44
diff changeset
226 act = mb_shift_new(0, 20, coord1, word);
48
bdf711cbf0fb Use absolute time to dispatch animation actions.
Thinker K.F. Li <thinker@branda.to>
parents: 47
diff changeset
227 act = mb_shift_new(0, -20, coord2, word);
57
ab028c9f0930 Ability to hidden shapes and action of visibility.
Thinker K.F. Li <thinker@branda.to>
parents: 56
diff changeset
228 act = mb_visibility_new(VIS_HIDDEN, coord3, word);
822
586e50f82c1f Unify coding style tag for emacs and vim.
Shih-Yuan Lee (FourDollars) <fourdollars@gmail.com>
parents: 471
diff changeset
229
44
7d9af44f095b Demo of concurrent words
Thinker K.F. Li <thinker@branda.to>
parents: 42
diff changeset
230 MB_TIMEVAL_SET(&start, 3, 0);
7d9af44f095b Demo of concurrent words
Thinker K.F. Li <thinker@branda.to>
parents: 42
diff changeset
231 MB_TIMEVAL_SET(&playing, 2, 0);
42
e3295c07faa9 mb_shift is work
Thinker K.F. Li <thinker@branda.to>
parents: 41
diff changeset
232 word = mb_progm_next_word(progm, &start, &playing);
53
ffed18510d55 Use animate feacilities to demo all animation.
Thinker K.F. Li <thinker@branda.to>
parents: 52
diff changeset
233
47
f3818d996f4f change interface of creating a animation action
Thinker K.F. Li <thinker@branda.to>
parents: 44
diff changeset
234 act = mb_shift_new(0, -20, coord1, word);
48
bdf711cbf0fb Use absolute time to dispatch animation actions.
Thinker K.F. Li <thinker@branda.to>
parents: 47
diff changeset
235 act = mb_shift_new(0, 20, coord2, word);
52
59a295651480 Add action mb_chgcolor_t to change color of paints.
Thinker K.F. Li <thinker@branda.to>
parents: 49
diff changeset
236 act = mb_chgcolor_new(0, 0, 1, 0.5, fill1, word);
59a295651480 Add action mb_chgcolor_t to change color of paints.
Thinker K.F. Li <thinker@branda.to>
parents: 49
diff changeset
237 act = mb_chgcolor_new(1, 0, 0, 0.5, fill2, word);
57
ab028c9f0930 Ability to hidden shapes and action of visibility.
Thinker K.F. Li <thinker@branda.to>
parents: 56
diff changeset
238 act = mb_visibility_new(VIS_VISIBLE, coord3, word);
822
586e50f82c1f Unify coding style tag for emacs and vim.
Shih-Yuan Lee (FourDollars) <fourdollars@gmail.com>
parents: 471
diff changeset
239
863
e6c107b2e271 Do more works in X_main.c for profiling
Thinker K.F. Li <thinker@codemud.net>
parents: 822
diff changeset
240 MB_TIMEVAL_SET(&start, 5, 0);
e6c107b2e271 Do more works in X_main.c for profiling
Thinker K.F. Li <thinker@codemud.net>
parents: 822
diff changeset
241 MB_TIMEVAL_SET(&playing, 2, 0);
e6c107b2e271 Do more works in X_main.c for profiling
Thinker K.F. Li <thinker@codemud.net>
parents: 822
diff changeset
242 word = mb_progm_next_word(progm, &start, &playing);
e6c107b2e271 Do more works in X_main.c for profiling
Thinker K.F. Li <thinker@codemud.net>
parents: 822
diff changeset
243
e6c107b2e271 Do more works in X_main.c for profiling
Thinker K.F. Li <thinker@codemud.net>
parents: 822
diff changeset
244 act = mb_shift_new(0, 20, coord1, word);
e6c107b2e271 Do more works in X_main.c for profiling
Thinker K.F. Li <thinker@codemud.net>
parents: 822
diff changeset
245 act = mb_shift_new(0, -20, coord2, word);
e6c107b2e271 Do more works in X_main.c for profiling
Thinker K.F. Li <thinker@codemud.net>
parents: 822
diff changeset
246 act = mb_chgcolor_new(1, 0, 0, 1, fill1, word);
e6c107b2e271 Do more works in X_main.c for profiling
Thinker K.F. Li <thinker@codemud.net>
parents: 822
diff changeset
247 act = mb_chgcolor_new(0, 0, 1, 1, fill2, word);
e6c107b2e271 Do more works in X_main.c for profiling
Thinker K.F. Li <thinker@codemud.net>
parents: 822
diff changeset
248 act = mb_visibility_new(VIS_HIDDEN, coord3, word);
e6c107b2e271 Do more works in X_main.c for profiling
Thinker K.F. Li <thinker@codemud.net>
parents: 822
diff changeset
249
e6c107b2e271 Do more works in X_main.c for profiling
Thinker K.F. Li <thinker@codemud.net>
parents: 822
diff changeset
250 MB_TIMEVAL_SET(&start, 7, 0);
e6c107b2e271 Do more works in X_main.c for profiling
Thinker K.F. Li <thinker@codemud.net>
parents: 822
diff changeset
251 MB_TIMEVAL_SET(&playing, 2, 0);
e6c107b2e271 Do more works in X_main.c for profiling
Thinker K.F. Li <thinker@codemud.net>
parents: 822
diff changeset
252 word = mb_progm_next_word(progm, &start, &playing);
e6c107b2e271 Do more works in X_main.c for profiling
Thinker K.F. Li <thinker@codemud.net>
parents: 822
diff changeset
253
e6c107b2e271 Do more works in X_main.c for profiling
Thinker K.F. Li <thinker@codemud.net>
parents: 822
diff changeset
254 act = mb_shift_new(0, -20, coord1, word);
e6c107b2e271 Do more works in X_main.c for profiling
Thinker K.F. Li <thinker@codemud.net>
parents: 822
diff changeset
255 act = mb_shift_new(0, 20, coord2, word);
e6c107b2e271 Do more works in X_main.c for profiling
Thinker K.F. Li <thinker@codemud.net>
parents: 822
diff changeset
256 act = mb_chgcolor_new(0, 1, 0, 0.5, fill1, word);
e6c107b2e271 Do more works in X_main.c for profiling
Thinker K.F. Li <thinker@codemud.net>
parents: 822
diff changeset
257 act = mb_chgcolor_new(1, 0, 0, 0.5, fill2, word);
e6c107b2e271 Do more works in X_main.c for profiling
Thinker K.F. Li <thinker@codemud.net>
parents: 822
diff changeset
258 act = mb_visibility_new(VIS_VISIBLE, coord3, word);
e6c107b2e271 Do more works in X_main.c for profiling
Thinker K.F. Li <thinker@codemud.net>
parents: 822
diff changeset
259
e6c107b2e271 Do more works in X_main.c for profiling
Thinker K.F. Li <thinker@codemud.net>
parents: 822
diff changeset
260 MB_TIMEVAL_SET(&start, 9, 0);
e6c107b2e271 Do more works in X_main.c for profiling
Thinker K.F. Li <thinker@codemud.net>
parents: 822
diff changeset
261 MB_TIMEVAL_SET(&playing, 2, 0);
e6c107b2e271 Do more works in X_main.c for profiling
Thinker K.F. Li <thinker@codemud.net>
parents: 822
diff changeset
262 word = mb_progm_next_word(progm, &start, &playing);
e6c107b2e271 Do more works in X_main.c for profiling
Thinker K.F. Li <thinker@codemud.net>
parents: 822
diff changeset
263
e6c107b2e271 Do more works in X_main.c for profiling
Thinker K.F. Li <thinker@codemud.net>
parents: 822
diff changeset
264 act = mb_shift_new(0, 20, coord1, word);
e6c107b2e271 Do more works in X_main.c for profiling
Thinker K.F. Li <thinker@codemud.net>
parents: 822
diff changeset
265 act = mb_shift_new(0, -20, coord2, word);
e6c107b2e271 Do more works in X_main.c for profiling
Thinker K.F. Li <thinker@codemud.net>
parents: 822
diff changeset
266 act = mb_chgcolor_new(0, 0, 1, 1, fill1, word);
e6c107b2e271 Do more works in X_main.c for profiling
Thinker K.F. Li <thinker@codemud.net>
parents: 822
diff changeset
267 act = mb_chgcolor_new(1, 0, 0, 1, fill2, word);
e6c107b2e271 Do more works in X_main.c for profiling
Thinker K.F. Li <thinker@codemud.net>
parents: 822
diff changeset
268 act = mb_visibility_new(VIS_HIDDEN, coord3, word);
e6c107b2e271 Do more works in X_main.c for profiling
Thinker K.F. Li <thinker@codemud.net>
parents: 822
diff changeset
269
e6c107b2e271 Do more works in X_main.c for profiling
Thinker K.F. Li <thinker@codemud.net>
parents: 822
diff changeset
270 MB_TIMEVAL_SET(&start, 11, 0);
e6c107b2e271 Do more works in X_main.c for profiling
Thinker K.F. Li <thinker@codemud.net>
parents: 822
diff changeset
271 MB_TIMEVAL_SET(&playing, 2, 0);
e6c107b2e271 Do more works in X_main.c for profiling
Thinker K.F. Li <thinker@codemud.net>
parents: 822
diff changeset
272 word = mb_progm_next_word(progm, &start, &playing);
e6c107b2e271 Do more works in X_main.c for profiling
Thinker K.F. Li <thinker@codemud.net>
parents: 822
diff changeset
273
e6c107b2e271 Do more works in X_main.c for profiling
Thinker K.F. Li <thinker@codemud.net>
parents: 822
diff changeset
274 act = mb_shift_new(0, -20, coord1, word);
e6c107b2e271 Do more works in X_main.c for profiling
Thinker K.F. Li <thinker@codemud.net>
parents: 822
diff changeset
275 act = mb_shift_new(0, 20, coord2, word);
e6c107b2e271 Do more works in X_main.c for profiling
Thinker K.F. Li <thinker@codemud.net>
parents: 822
diff changeset
276 act = mb_chgcolor_new(0, 1, 0, 0.5, fill1, word);
e6c107b2e271 Do more works in X_main.c for profiling
Thinker K.F. Li <thinker@codemud.net>
parents: 822
diff changeset
277 act = mb_chgcolor_new(1, 0, 0, 0.5, fill2, word);
e6c107b2e271 Do more works in X_main.c for profiling
Thinker K.F. Li <thinker@codemud.net>
parents: 822
diff changeset
278 act = mb_visibility_new(VIS_VISIBLE, coord3, word);
e6c107b2e271 Do more works in X_main.c for profiling
Thinker K.F. Li <thinker@codemud.net>
parents: 822
diff changeset
279
e6c107b2e271 Do more works in X_main.c for profiling
Thinker K.F. Li <thinker@codemud.net>
parents: 822
diff changeset
280 MB_TIMEVAL_SET(&start, 13, 0);
e6c107b2e271 Do more works in X_main.c for profiling
Thinker K.F. Li <thinker@codemud.net>
parents: 822
diff changeset
281 MB_TIMEVAL_SET(&playing, 2, 0);
e6c107b2e271 Do more works in X_main.c for profiling
Thinker K.F. Li <thinker@codemud.net>
parents: 822
diff changeset
282 word = mb_progm_next_word(progm, &start, &playing);
e6c107b2e271 Do more works in X_main.c for profiling
Thinker K.F. Li <thinker@codemud.net>
parents: 822
diff changeset
283
e6c107b2e271 Do more works in X_main.c for profiling
Thinker K.F. Li <thinker@codemud.net>
parents: 822
diff changeset
284 act = mb_shift_new(0, 20, coord1, word);
e6c107b2e271 Do more works in X_main.c for profiling
Thinker K.F. Li <thinker@codemud.net>
parents: 822
diff changeset
285 act = mb_shift_new(0, -20, coord2, word);
e6c107b2e271 Do more works in X_main.c for profiling
Thinker K.F. Li <thinker@codemud.net>
parents: 822
diff changeset
286 act = mb_chgcolor_new(0, 0, 1, 1, fill1, word);
e6c107b2e271 Do more works in X_main.c for profiling
Thinker K.F. Li <thinker@codemud.net>
parents: 822
diff changeset
287 act = mb_chgcolor_new(1, 0, 0, 1, fill2, word);
e6c107b2e271 Do more works in X_main.c for profiling
Thinker K.F. Li <thinker@codemud.net>
parents: 822
diff changeset
288 act = mb_visibility_new(VIS_HIDDEN, coord3, word);
e6c107b2e271 Do more works in X_main.c for profiling
Thinker K.F. Li <thinker@codemud.net>
parents: 822
diff changeset
289
e6c107b2e271 Do more works in X_main.c for profiling
Thinker K.F. Li <thinker@codemud.net>
parents: 822
diff changeset
290 MB_TIMEVAL_SET(&start, 15, 0);
e6c107b2e271 Do more works in X_main.c for profiling
Thinker K.F. Li <thinker@codemud.net>
parents: 822
diff changeset
291 MB_TIMEVAL_SET(&playing, 2, 0);
e6c107b2e271 Do more works in X_main.c for profiling
Thinker K.F. Li <thinker@codemud.net>
parents: 822
diff changeset
292 word = mb_progm_next_word(progm, &start, &playing);
e6c107b2e271 Do more works in X_main.c for profiling
Thinker K.F. Li <thinker@codemud.net>
parents: 822
diff changeset
293
e6c107b2e271 Do more works in X_main.c for profiling
Thinker K.F. Li <thinker@codemud.net>
parents: 822
diff changeset
294 act = mb_shift_new(0, -20, coord1, word);
e6c107b2e271 Do more works in X_main.c for profiling
Thinker K.F. Li <thinker@codemud.net>
parents: 822
diff changeset
295 act = mb_shift_new(0, 20, coord2, word);
e6c107b2e271 Do more works in X_main.c for profiling
Thinker K.F. Li <thinker@codemud.net>
parents: 822
diff changeset
296 act = mb_chgcolor_new(0, 1, 0, 0.5, fill1, word);
e6c107b2e271 Do more works in X_main.c for profiling
Thinker K.F. Li <thinker@codemud.net>
parents: 822
diff changeset
297 act = mb_chgcolor_new(1, 0, 0, 0.5, fill2, word);
e6c107b2e271 Do more works in X_main.c for profiling
Thinker K.F. Li <thinker@codemud.net>
parents: 822
diff changeset
298 act = mb_visibility_new(VIS_VISIBLE, coord3, word);
e6c107b2e271 Do more works in X_main.c for profiling
Thinker K.F. Li <thinker@codemud.net>
parents: 822
diff changeset
299
e6c107b2e271 Do more works in X_main.c for profiling
Thinker K.F. Li <thinker@codemud.net>
parents: 822
diff changeset
300 MB_TIMEVAL_SET(&start, 17, 0);
e6c107b2e271 Do more works in X_main.c for profiling
Thinker K.F. Li <thinker@codemud.net>
parents: 822
diff changeset
301 MB_TIMEVAL_SET(&playing, 2, 0);
e6c107b2e271 Do more works in X_main.c for profiling
Thinker K.F. Li <thinker@codemud.net>
parents: 822
diff changeset
302 word = mb_progm_next_word(progm, &start, &playing);
e6c107b2e271 Do more works in X_main.c for profiling
Thinker K.F. Li <thinker@codemud.net>
parents: 822
diff changeset
303
e6c107b2e271 Do more works in X_main.c for profiling
Thinker K.F. Li <thinker@codemud.net>
parents: 822
diff changeset
304 act = mb_shift_new(0, 20, coord1, word);
e6c107b2e271 Do more works in X_main.c for profiling
Thinker K.F. Li <thinker@codemud.net>
parents: 822
diff changeset
305 act = mb_shift_new(0, -20, coord2, word);
e6c107b2e271 Do more works in X_main.c for profiling
Thinker K.F. Li <thinker@codemud.net>
parents: 822
diff changeset
306 act = mb_chgcolor_new(0, 0, 1, 1, fill1, word);
e6c107b2e271 Do more works in X_main.c for profiling
Thinker K.F. Li <thinker@codemud.net>
parents: 822
diff changeset
307 act = mb_chgcolor_new(1, 0, 0, 1, fill2, word);
e6c107b2e271 Do more works in X_main.c for profiling
Thinker K.F. Li <thinker@codemud.net>
parents: 822
diff changeset
308 act = mb_visibility_new(VIS_HIDDEN, coord3, word);
e6c107b2e271 Do more works in X_main.c for profiling
Thinker K.F. Li <thinker@codemud.net>
parents: 822
diff changeset
309
e6c107b2e271 Do more works in X_main.c for profiling
Thinker K.F. Li <thinker@codemud.net>
parents: 822
diff changeset
310 MB_TIMEVAL_SET(&start, 19, 0);
e6c107b2e271 Do more works in X_main.c for profiling
Thinker K.F. Li <thinker@codemud.net>
parents: 822
diff changeset
311 MB_TIMEVAL_SET(&playing, 2, 0);
e6c107b2e271 Do more works in X_main.c for profiling
Thinker K.F. Li <thinker@codemud.net>
parents: 822
diff changeset
312 word = mb_progm_next_word(progm, &start, &playing);
e6c107b2e271 Do more works in X_main.c for profiling
Thinker K.F. Li <thinker@codemud.net>
parents: 822
diff changeset
313
e6c107b2e271 Do more works in X_main.c for profiling
Thinker K.F. Li <thinker@codemud.net>
parents: 822
diff changeset
314 act = mb_shift_new(0, -20, coord1, word);
e6c107b2e271 Do more works in X_main.c for profiling
Thinker K.F. Li <thinker@codemud.net>
parents: 822
diff changeset
315 act = mb_shift_new(0, 20, coord2, word);
e6c107b2e271 Do more works in X_main.c for profiling
Thinker K.F. Li <thinker@codemud.net>
parents: 822
diff changeset
316 act = mb_chgcolor_new(0, 1, 0, 0.5, fill1, word);
e6c107b2e271 Do more works in X_main.c for profiling
Thinker K.F. Li <thinker@codemud.net>
parents: 822
diff changeset
317 act = mb_chgcolor_new(1, 0, 0, 0.5, fill2, word);
e6c107b2e271 Do more works in X_main.c for profiling
Thinker K.F. Li <thinker@codemud.net>
parents: 822
diff changeset
318 act = mb_visibility_new(VIS_VISIBLE, coord3, word);
e6c107b2e271 Do more works in X_main.c for profiling
Thinker K.F. Li <thinker@codemud.net>
parents: 822
diff changeset
319
e6c107b2e271 Do more works in X_main.c for profiling
Thinker K.F. Li <thinker@codemud.net>
parents: 822
diff changeset
320 MB_TIMEVAL_SET(&start, 21, 0);
e6c107b2e271 Do more works in X_main.c for profiling
Thinker K.F. Li <thinker@codemud.net>
parents: 822
diff changeset
321 MB_TIMEVAL_SET(&playing, 2, 0);
e6c107b2e271 Do more works in X_main.c for profiling
Thinker K.F. Li <thinker@codemud.net>
parents: 822
diff changeset
322 word = mb_progm_next_word(progm, &start, &playing);
e6c107b2e271 Do more works in X_main.c for profiling
Thinker K.F. Li <thinker@codemud.net>
parents: 822
diff changeset
323
e6c107b2e271 Do more works in X_main.c for profiling
Thinker K.F. Li <thinker@codemud.net>
parents: 822
diff changeset
324 act = mb_shift_new(0, 20, coord1, word);
e6c107b2e271 Do more works in X_main.c for profiling
Thinker K.F. Li <thinker@codemud.net>
parents: 822
diff changeset
325 act = mb_shift_new(0, -20, coord2, word);
e6c107b2e271 Do more works in X_main.c for profiling
Thinker K.F. Li <thinker@codemud.net>
parents: 822
diff changeset
326 act = mb_chgcolor_new(0, 0, 1, 1, fill1, word);
e6c107b2e271 Do more works in X_main.c for profiling
Thinker K.F. Li <thinker@codemud.net>
parents: 822
diff changeset
327 act = mb_chgcolor_new(1, 0, 0, 1, fill2, word);
e6c107b2e271 Do more works in X_main.c for profiling
Thinker K.F. Li <thinker@codemud.net>
parents: 822
diff changeset
328 act = mb_visibility_new(VIS_HIDDEN, coord3, word);
e6c107b2e271 Do more works in X_main.c for profiling
Thinker K.F. Li <thinker@codemud.net>
parents: 822
diff changeset
329
e6c107b2e271 Do more works in X_main.c for profiling
Thinker K.F. Li <thinker@codemud.net>
parents: 822
diff changeset
330 MB_TIMEVAL_SET(&start, 23, 0);
e6c107b2e271 Do more works in X_main.c for profiling
Thinker K.F. Li <thinker@codemud.net>
parents: 822
diff changeset
331 MB_TIMEVAL_SET(&playing, 2, 0);
e6c107b2e271 Do more works in X_main.c for profiling
Thinker K.F. Li <thinker@codemud.net>
parents: 822
diff changeset
332 word = mb_progm_next_word(progm, &start, &playing);
e6c107b2e271 Do more works in X_main.c for profiling
Thinker K.F. Li <thinker@codemud.net>
parents: 822
diff changeset
333
e6c107b2e271 Do more works in X_main.c for profiling
Thinker K.F. Li <thinker@codemud.net>
parents: 822
diff changeset
334 act = mb_shift_new(0, -20, coord1, word);
e6c107b2e271 Do more works in X_main.c for profiling
Thinker K.F. Li <thinker@codemud.net>
parents: 822
diff changeset
335 act = mb_shift_new(0, 20, coord2, word);
e6c107b2e271 Do more works in X_main.c for profiling
Thinker K.F. Li <thinker@codemud.net>
parents: 822
diff changeset
336 act = mb_chgcolor_new(0, 1, 0, 0.5, fill1, word);
e6c107b2e271 Do more works in X_main.c for profiling
Thinker K.F. Li <thinker@codemud.net>
parents: 822
diff changeset
337 act = mb_chgcolor_new(1, 0, 0, 0.5, fill2, word);
e6c107b2e271 Do more works in X_main.c for profiling
Thinker K.F. Li <thinker@codemud.net>
parents: 822
diff changeset
338 act = mb_visibility_new(VIS_VISIBLE, coord3, word);
e6c107b2e271 Do more works in X_main.c for profiling
Thinker K.F. Li <thinker@codemud.net>
parents: 822
diff changeset
339
e6c107b2e271 Do more works in X_main.c for profiling
Thinker K.F. Li <thinker@codemud.net>
parents: 822
diff changeset
340 MB_TIMEVAL_SET(&start, 25, 0);
e6c107b2e271 Do more works in X_main.c for profiling
Thinker K.F. Li <thinker@codemud.net>
parents: 822
diff changeset
341 MB_TIMEVAL_SET(&playing, 2, 0);
e6c107b2e271 Do more works in X_main.c for profiling
Thinker K.F. Li <thinker@codemud.net>
parents: 822
diff changeset
342 word = mb_progm_next_word(progm, &start, &playing);
e6c107b2e271 Do more works in X_main.c for profiling
Thinker K.F. Li <thinker@codemud.net>
parents: 822
diff changeset
343
e6c107b2e271 Do more works in X_main.c for profiling
Thinker K.F. Li <thinker@codemud.net>
parents: 822
diff changeset
344 act = mb_shift_new(0, 20, coord1, word);
e6c107b2e271 Do more works in X_main.c for profiling
Thinker K.F. Li <thinker@codemud.net>
parents: 822
diff changeset
345 act = mb_shift_new(0, -20, coord2, word);
e6c107b2e271 Do more works in X_main.c for profiling
Thinker K.F. Li <thinker@codemud.net>
parents: 822
diff changeset
346 act = mb_chgcolor_new(0, 0, 1, 1, fill1, word);
e6c107b2e271 Do more works in X_main.c for profiling
Thinker K.F. Li <thinker@codemud.net>
parents: 822
diff changeset
347 act = mb_chgcolor_new(1, 0, 0, 1, fill2, word);
e6c107b2e271 Do more works in X_main.c for profiling
Thinker K.F. Li <thinker@codemud.net>
parents: 822
diff changeset
348 act = mb_visibility_new(VIS_HIDDEN, coord3, word);
e6c107b2e271 Do more works in X_main.c for profiling
Thinker K.F. Li <thinker@codemud.net>
parents: 822
diff changeset
349
e6c107b2e271 Do more works in X_main.c for profiling
Thinker K.F. Li <thinker@codemud.net>
parents: 822
diff changeset
350 MB_TIMEVAL_SET(&start, 27, 0);
e6c107b2e271 Do more works in X_main.c for profiling
Thinker K.F. Li <thinker@codemud.net>
parents: 822
diff changeset
351 MB_TIMEVAL_SET(&playing, 2, 0);
e6c107b2e271 Do more works in X_main.c for profiling
Thinker K.F. Li <thinker@codemud.net>
parents: 822
diff changeset
352 word = mb_progm_next_word(progm, &start, &playing);
e6c107b2e271 Do more works in X_main.c for profiling
Thinker K.F. Li <thinker@codemud.net>
parents: 822
diff changeset
353
e6c107b2e271 Do more works in X_main.c for profiling
Thinker K.F. Li <thinker@codemud.net>
parents: 822
diff changeset
354 act = mb_shift_new(0, -20, coord1, word);
e6c107b2e271 Do more works in X_main.c for profiling
Thinker K.F. Li <thinker@codemud.net>
parents: 822
diff changeset
355 act = mb_shift_new(0, 20, coord2, word);
e6c107b2e271 Do more works in X_main.c for profiling
Thinker K.F. Li <thinker@codemud.net>
parents: 822
diff changeset
356 act = mb_chgcolor_new(0, 1, 0, 0.5, fill1, word);
e6c107b2e271 Do more works in X_main.c for profiling
Thinker K.F. Li <thinker@codemud.net>
parents: 822
diff changeset
357 act = mb_chgcolor_new(1, 0, 0, 0.5, fill2, word);
e6c107b2e271 Do more works in X_main.c for profiling
Thinker K.F. Li <thinker@codemud.net>
parents: 822
diff changeset
358 act = mb_visibility_new(VIS_VISIBLE, coord3, word);
e6c107b2e271 Do more works in X_main.c for profiling
Thinker K.F. Li <thinker@codemud.net>
parents: 822
diff changeset
359
e6c107b2e271 Do more works in X_main.c for profiling
Thinker K.F. Li <thinker@codemud.net>
parents: 822
diff changeset
360 MB_TIMEVAL_SET(&start, 29, 0);
e6c107b2e271 Do more works in X_main.c for profiling
Thinker K.F. Li <thinker@codemud.net>
parents: 822
diff changeset
361 MB_TIMEVAL_SET(&playing, 2, 0);
e6c107b2e271 Do more works in X_main.c for profiling
Thinker K.F. Li <thinker@codemud.net>
parents: 822
diff changeset
362 word = mb_progm_next_word(progm, &start, &playing);
e6c107b2e271 Do more works in X_main.c for profiling
Thinker K.F. Li <thinker@codemud.net>
parents: 822
diff changeset
363
e6c107b2e271 Do more works in X_main.c for profiling
Thinker K.F. Li <thinker@codemud.net>
parents: 822
diff changeset
364 act = mb_shift_new(0, 20, coord1, word);
e6c107b2e271 Do more works in X_main.c for profiling
Thinker K.F. Li <thinker@codemud.net>
parents: 822
diff changeset
365 act = mb_shift_new(0, -20, coord2, word);
e6c107b2e271 Do more works in X_main.c for profiling
Thinker K.F. Li <thinker@codemud.net>
parents: 822
diff changeset
366 act = mb_chgcolor_new(0, 0, 1, 1, fill1, word);
e6c107b2e271 Do more works in X_main.c for profiling
Thinker K.F. Li <thinker@codemud.net>
parents: 822
diff changeset
367 act = mb_chgcolor_new(1, 0, 0, 1, fill2, word);
e6c107b2e271 Do more works in X_main.c for profiling
Thinker K.F. Li <thinker@codemud.net>
parents: 822
diff changeset
368 act = mb_visibility_new(VIS_HIDDEN, coord3, word);
e6c107b2e271 Do more works in X_main.c for profiling
Thinker K.F. Li <thinker@codemud.net>
parents: 822
diff changeset
369
e6c107b2e271 Do more works in X_main.c for profiling
Thinker K.F. Li <thinker@codemud.net>
parents: 822
diff changeset
370 MB_TIMEVAL_SET(&start, 31, 0);
e6c107b2e271 Do more works in X_main.c for profiling
Thinker K.F. Li <thinker@codemud.net>
parents: 822
diff changeset
371 MB_TIMEVAL_SET(&playing, 2, 0);
e6c107b2e271 Do more works in X_main.c for profiling
Thinker K.F. Li <thinker@codemud.net>
parents: 822
diff changeset
372 word = mb_progm_next_word(progm, &start, &playing);
e6c107b2e271 Do more works in X_main.c for profiling
Thinker K.F. Li <thinker@codemud.net>
parents: 822
diff changeset
373
e6c107b2e271 Do more works in X_main.c for profiling
Thinker K.F. Li <thinker@codemud.net>
parents: 822
diff changeset
374 act = mb_shift_new(0, -20, coord1, word);
e6c107b2e271 Do more works in X_main.c for profiling
Thinker K.F. Li <thinker@codemud.net>
parents: 822
diff changeset
375 act = mb_shift_new(0, 20, coord2, word);
e6c107b2e271 Do more works in X_main.c for profiling
Thinker K.F. Li <thinker@codemud.net>
parents: 822
diff changeset
376 act = mb_chgcolor_new(0, 1, 0, 0.5, fill1, word);
e6c107b2e271 Do more works in X_main.c for profiling
Thinker K.F. Li <thinker@codemud.net>
parents: 822
diff changeset
377 act = mb_chgcolor_new(1, 0, 0, 0.5, fill2, word);
e6c107b2e271 Do more works in X_main.c for profiling
Thinker K.F. Li <thinker@codemud.net>
parents: 822
diff changeset
378 act = mb_visibility_new(VIS_VISIBLE, coord3, word);
e6c107b2e271 Do more works in X_main.c for profiling
Thinker K.F. Li <thinker@codemud.net>
parents: 822
diff changeset
379
e6c107b2e271 Do more works in X_main.c for profiling
Thinker K.F. Li <thinker@codemud.net>
parents: 822
diff changeset
380 MB_TIMEVAL_SET(&start, 33, 0);
e6c107b2e271 Do more works in X_main.c for profiling
Thinker K.F. Li <thinker@codemud.net>
parents: 822
diff changeset
381 MB_TIMEVAL_SET(&playing, 2, 0);
e6c107b2e271 Do more works in X_main.c for profiling
Thinker K.F. Li <thinker@codemud.net>
parents: 822
diff changeset
382 word = mb_progm_next_word(progm, &start, &playing);
e6c107b2e271 Do more works in X_main.c for profiling
Thinker K.F. Li <thinker@codemud.net>
parents: 822
diff changeset
383
e6c107b2e271 Do more works in X_main.c for profiling
Thinker K.F. Li <thinker@codemud.net>
parents: 822
diff changeset
384 act = mb_shift_new(0, 20, coord1, word);
e6c107b2e271 Do more works in X_main.c for profiling
Thinker K.F. Li <thinker@codemud.net>
parents: 822
diff changeset
385 act = mb_shift_new(0, -20, coord2, word);
e6c107b2e271 Do more works in X_main.c for profiling
Thinker K.F. Li <thinker@codemud.net>
parents: 822
diff changeset
386 act = mb_chgcolor_new(0, 0, 1, 1, fill1, word);
e6c107b2e271 Do more works in X_main.c for profiling
Thinker K.F. Li <thinker@codemud.net>
parents: 822
diff changeset
387 act = mb_chgcolor_new(1, 0, 0, 1, fill2, word);
e6c107b2e271 Do more works in X_main.c for profiling
Thinker K.F. Li <thinker@codemud.net>
parents: 822
diff changeset
388 act = mb_visibility_new(VIS_HIDDEN, coord3, word);
e6c107b2e271 Do more works in X_main.c for profiling
Thinker K.F. Li <thinker@codemud.net>
parents: 822
diff changeset
389
e6c107b2e271 Do more works in X_main.c for profiling
Thinker K.F. Li <thinker@codemud.net>
parents: 822
diff changeset
390 MB_TIMEVAL_SET(&start, 35, 0);
e6c107b2e271 Do more works in X_main.c for profiling
Thinker K.F. Li <thinker@codemud.net>
parents: 822
diff changeset
391 MB_TIMEVAL_SET(&playing, 2, 0);
e6c107b2e271 Do more works in X_main.c for profiling
Thinker K.F. Li <thinker@codemud.net>
parents: 822
diff changeset
392 word = mb_progm_next_word(progm, &start, &playing);
e6c107b2e271 Do more works in X_main.c for profiling
Thinker K.F. Li <thinker@codemud.net>
parents: 822
diff changeset
393
e6c107b2e271 Do more works in X_main.c for profiling
Thinker K.F. Li <thinker@codemud.net>
parents: 822
diff changeset
394 act = mb_shift_new(0, -20, coord1, word);
e6c107b2e271 Do more works in X_main.c for profiling
Thinker K.F. Li <thinker@codemud.net>
parents: 822
diff changeset
395 act = mb_shift_new(0, 20, coord2, word);
e6c107b2e271 Do more works in X_main.c for profiling
Thinker K.F. Li <thinker@codemud.net>
parents: 822
diff changeset
396 act = mb_chgcolor_new(0, 1, 0, 0.5, fill1, word);
e6c107b2e271 Do more works in X_main.c for profiling
Thinker K.F. Li <thinker@codemud.net>
parents: 822
diff changeset
397 act = mb_chgcolor_new(1, 0, 0, 0.5, fill2, word);
e6c107b2e271 Do more works in X_main.c for profiling
Thinker K.F. Li <thinker@codemud.net>
parents: 822
diff changeset
398 act = mb_visibility_new(VIS_VISIBLE, coord3, word);
e6c107b2e271 Do more works in X_main.c for profiling
Thinker K.F. Li <thinker@codemud.net>
parents: 822
diff changeset
399
58
Thinker K.F. Li <thinker@branda.to>
parents: 57
diff changeset
400 /* Start playing the program. */
42
e3295c07faa9 mb_shift is work
Thinker K.F. Li <thinker@branda.to>
parents: 41
diff changeset
401 gettimeofday(&tv, NULL);
e3295c07faa9 mb_shift is work
Thinker K.F. Li <thinker@branda.to>
parents: 41
diff changeset
402 MB_TIMEVAL_SET(&mbtv, tv.tv_sec, tv.tv_usec);
e3295c07faa9 mb_shift is work
Thinker K.F. Li <thinker@branda.to>
parents: 41
diff changeset
403 mb_progm_start(progm, tman, &mbtv);
e3295c07faa9 mb_shift is work
Thinker K.F. Li <thinker@branda.to>
parents: 41
diff changeset
404
39
db2aa914e14b timer for animation
Thinker K.F. Li <thinker@branda.to>
parents: 37
diff changeset
405 handle_connection(display, tman, &rdman, w, h);
41
400b4b5db0dc Working on animation
Thinker K.F. Li <thinker@branda.to>
parents: 39
diff changeset
406
57
ab028c9f0930 Ability to hidden shapes and action of visibility.
Thinker K.F. Li <thinker@branda.to>
parents: 56
diff changeset
407 mb_progm_free(progm);
39
db2aa914e14b timer for animation
Thinker K.F. Li <thinker@branda.to>
parents: 37
diff changeset
408 mb_tman_free(tman);
db2aa914e14b timer for animation
Thinker K.F. Li <thinker@branda.to>
parents: 37
diff changeset
409 }
30
e06a4a667ce2 Accept mouse/pointer event and hint the shape that the pointer is over.
Thinker K.F. Li <thinker@branda.to>
parents: 27
diff changeset
410
159
b90abd31a281 Postponse free of coords, shapes, and paints when the rdman is dirty.
Thinker K.F. Li <thinker@branda.to>
parents: 77
diff changeset
411 rdman_paint_free(&rdman, fill1);
b90abd31a281 Postponse free of coords, shapes, and paints when the rdman is dirty.
Thinker K.F. Li <thinker@branda.to>
parents: 77
diff changeset
412 rdman_paint_free(&rdman, fill2);
b90abd31a281 Postponse free of coords, shapes, and paints when the rdman is dirty.
Thinker K.F. Li <thinker@branda.to>
parents: 77
diff changeset
413 rdman_paint_free(&rdman, stroke);
b90abd31a281 Postponse free of coords, shapes, and paints when the rdman is dirty.
Thinker K.F. Li <thinker@branda.to>
parents: 77
diff changeset
414 rdman_paint_free(&rdman, text_stroke);
b90abd31a281 Postponse free of coords, shapes, and paints when the rdman is dirty.
Thinker K.F. Li <thinker@branda.to>
parents: 77
diff changeset
415 rdman_paint_free(&rdman, text_fill);
b90abd31a281 Postponse free of coords, shapes, and paints when the rdman is dirty.
Thinker K.F. Li <thinker@branda.to>
parents: 77
diff changeset
416 rdman_shape_free(&rdman, path1);
b90abd31a281 Postponse free of coords, shapes, and paints when the rdman is dirty.
Thinker K.F. Li <thinker@branda.to>
parents: 77
diff changeset
417 rdman_shape_free(&rdman, path2);
b90abd31a281 Postponse free of coords, shapes, and paints when the rdman is dirty.
Thinker K.F. Li <thinker@branda.to>
parents: 77
diff changeset
418 rdman_shape_free(&rdman, rect);
b90abd31a281 Postponse free of coords, shapes, and paints when the rdman is dirty.
Thinker K.F. Li <thinker@branda.to>
parents: 77
diff changeset
419 rdman_shape_free(&rdman, text);
15
c2ce186a5c37 X_main uses rdman_redraw_all()
Thinker K.F. Li <thinker@branda.to>
parents: 13
diff changeset
420 redraw_man_destroy(&rdman);
448
16116d84bc5e Replace Cairo with a abstract layer mb_graph_engine.
Thinker K.F. Li <thinker@branda.to>
parents: 278
diff changeset
421 mbe_destroy(tmpcr);
16116d84bc5e Replace Cairo with a abstract layer mb_graph_engine.
Thinker K.F. Li <thinker@branda.to>
parents: 278
diff changeset
422 mbe_surface_destroy(tmpsuf);
5
9c331ec9e210 SVG path is partially supported
Thinker K.F. Li <thinker@branda.to>
parents: 3
diff changeset
423 }
9c331ec9e210 SVG path is partially supported
Thinker K.F. Li <thinker@branda.to>
parents: 3
diff changeset
424
448
16116d84bc5e Replace Cairo with a abstract layer mb_graph_engine.
Thinker K.F. Li <thinker@branda.to>
parents: 278
diff changeset
425 void drawing(mbe_surface_t *surface, int w, int h) {
16116d84bc5e Replace Cairo with a abstract layer mb_graph_engine.
Thinker K.F. Li <thinker@branda.to>
parents: 278
diff changeset
426 mbe_t *cr;
3
164162781a7a Test cairo with Xlib surface
Thinker K.F. Li <thinker@branda.to>
parents:
diff changeset
427
448
16116d84bc5e Replace Cairo with a abstract layer mb_graph_engine.
Thinker K.F. Li <thinker@branda.to>
parents: 278
diff changeset
428 cr = mbe_create(surface);
16116d84bc5e Replace Cairo with a abstract layer mb_graph_engine.
Thinker K.F. Li <thinker@branda.to>
parents: 278
diff changeset
429 mbe_set_source_rgb(cr, 0, 0, 0);
16116d84bc5e Replace Cairo with a abstract layer mb_graph_engine.
Thinker K.F. Li <thinker@branda.to>
parents: 278
diff changeset
430 mbe_paint(cr);
5
9c331ec9e210 SVG path is partially supported
Thinker K.F. Li <thinker@branda.to>
parents: 3
diff changeset
431 draw_path(cr, w, h);
448
16116d84bc5e Replace Cairo with a abstract layer mb_graph_engine.
Thinker K.F. Li <thinker@branda.to>
parents: 278
diff changeset
432 mbe_destroy(cr);
3
164162781a7a Test cairo with Xlib surface
Thinker K.F. Li <thinker@branda.to>
parents:
diff changeset
433 }
164162781a7a Test cairo with Xlib surface
Thinker K.F. Li <thinker@branda.to>
parents:
diff changeset
434
164162781a7a Test cairo with Xlib surface
Thinker K.F. Li <thinker@branda.to>
parents:
diff changeset
435 int
164162781a7a Test cairo with Xlib surface
Thinker K.F. Li <thinker@branda.to>
parents:
diff changeset
436 main(int argc, char * const argv[]) {
164162781a7a Test cairo with Xlib surface
Thinker K.F. Li <thinker@branda.to>
parents:
diff changeset
437 Window root;
164162781a7a Test cairo with Xlib surface
Thinker K.F. Li <thinker@branda.to>
parents:
diff changeset
438 Visual *visual;
164162781a7a Test cairo with Xlib surface
Thinker K.F. Li <thinker@branda.to>
parents:
diff changeset
439 int screen;
164162781a7a Test cairo with Xlib surface
Thinker K.F. Li <thinker@branda.to>
parents:
diff changeset
440 XSetWindowAttributes wattr;
164162781a7a Test cairo with Xlib surface
Thinker K.F. Li <thinker@branda.to>
parents:
diff changeset
441 int depth;
448
16116d84bc5e Replace Cairo with a abstract layer mb_graph_engine.
Thinker K.F. Li <thinker@branda.to>
parents: 278
diff changeset
442 mbe_surface_t *surface;
3
164162781a7a Test cairo with Xlib surface
Thinker K.F. Li <thinker@branda.to>
parents:
diff changeset
443 int w, h;
164162781a7a Test cairo with Xlib surface
Thinker K.F. Li <thinker@branda.to>
parents:
diff changeset
444 int x, y;
164162781a7a Test cairo with Xlib surface
Thinker K.F. Li <thinker@branda.to>
parents:
diff changeset
445 int r;
164162781a7a Test cairo with Xlib surface
Thinker K.F. Li <thinker@branda.to>
parents:
diff changeset
446
164162781a7a Test cairo with Xlib surface
Thinker K.F. Li <thinker@branda.to>
parents:
diff changeset
447 display = XOpenDisplay(":0.0");
164162781a7a Test cairo with Xlib surface
Thinker K.F. Li <thinker@branda.to>
parents:
diff changeset
448 if(display == NULL)
164162781a7a Test cairo with Xlib surface
Thinker K.F. Li <thinker@branda.to>
parents:
diff changeset
449 printf("XOpenDisplay\n");
164162781a7a Test cairo with Xlib surface
Thinker K.F. Li <thinker@branda.to>
parents:
diff changeset
450 screen = DefaultScreen(display);
164162781a7a Test cairo with Xlib surface
Thinker K.F. Li <thinker@branda.to>
parents:
diff changeset
451 root = DefaultRootWindow(display);
164162781a7a Test cairo with Xlib surface
Thinker K.F. Li <thinker@branda.to>
parents:
diff changeset
452 visual = DefaultVisual(display, screen);
164162781a7a Test cairo with Xlib surface
Thinker K.F. Li <thinker@branda.to>
parents:
diff changeset
453 depth = DefaultDepth(display, screen);
164162781a7a Test cairo with Xlib surface
Thinker K.F. Li <thinker@branda.to>
parents:
diff changeset
454 wattr.override_redirect = False;
164162781a7a Test cairo with Xlib surface
Thinker K.F. Li <thinker@branda.to>
parents:
diff changeset
455 x = 10;
164162781a7a Test cairo with Xlib surface
Thinker K.F. Li <thinker@branda.to>
parents:
diff changeset
456 y = 10;
164162781a7a Test cairo with Xlib surface
Thinker K.F. Li <thinker@branda.to>
parents:
diff changeset
457 w = 200;
164162781a7a Test cairo with Xlib surface
Thinker K.F. Li <thinker@branda.to>
parents:
diff changeset
458 h = 200;
164162781a7a Test cairo with Xlib surface
Thinker K.F. Li <thinker@branda.to>
parents:
diff changeset
459 win = XCreateWindow(display, root,
164162781a7a Test cairo with Xlib surface
Thinker K.F. Li <thinker@branda.to>
parents:
diff changeset
460 x, y,
164162781a7a Test cairo with Xlib surface
Thinker K.F. Li <thinker@branda.to>
parents:
diff changeset
461 w, h,
164162781a7a Test cairo with Xlib surface
Thinker K.F. Li <thinker@branda.to>
parents:
diff changeset
462 1, depth, InputOutput, visual,
164162781a7a Test cairo with Xlib surface
Thinker K.F. Li <thinker@branda.to>
parents:
diff changeset
463 CWOverrideRedirect, &wattr);
164162781a7a Test cairo with Xlib surface
Thinker K.F. Li <thinker@branda.to>
parents:
diff changeset
464 r = XMapWindow(display, win);
164162781a7a Test cairo with Xlib surface
Thinker K.F. Li <thinker@branda.to>
parents:
diff changeset
465
448
16116d84bc5e Replace Cairo with a abstract layer mb_graph_engine.
Thinker K.F. Li <thinker@branda.to>
parents: 278
diff changeset
466 surface = mbe_xlib_surface_create(display, win, visual, w, h);
3
164162781a7a Test cairo with Xlib surface
Thinker K.F. Li <thinker@branda.to>
parents:
diff changeset
467 if(surface == NULL)
448
16116d84bc5e Replace Cairo with a abstract layer mb_graph_engine.
Thinker K.F. Li <thinker@branda.to>
parents: 278
diff changeset
468 printf("mbe_xlib_surface_create\n");
3
164162781a7a Test cairo with Xlib surface
Thinker K.F. Li <thinker@branda.to>
parents:
diff changeset
469
164162781a7a Test cairo with Xlib surface
Thinker K.F. Li <thinker@branda.to>
parents:
diff changeset
470 drawing(surface, w, h);
164162781a7a Test cairo with Xlib surface
Thinker K.F. Li <thinker@branda.to>
parents:
diff changeset
471
164162781a7a Test cairo with Xlib surface
Thinker K.F. Li <thinker@branda.to>
parents:
diff changeset
472 XFlush(display);
164162781a7a Test cairo with Xlib surface
Thinker K.F. Li <thinker@branda.to>
parents:
diff changeset
473 sleep(10);
164162781a7a Test cairo with Xlib surface
Thinker K.F. Li <thinker@branda.to>
parents:
diff changeset
474
164162781a7a Test cairo with Xlib surface
Thinker K.F. Li <thinker@branda.to>
parents:
diff changeset
475 XCloseDisplay(display);
10
7cfecdce94cc Remove warning messages
Thinker K.F. Li <thinker@branda.to>
parents: 9
diff changeset
476 return 0;
3
164162781a7a Test cairo with Xlib surface
Thinker K.F. Li <thinker@branda.to>
parents:
diff changeset
477 }