comparison src/mb_types.h @ 138:9f4fc9ecfd1f

Make shapes and coords drawed in post-order of tree. 1. Add opacity for each coord. 2. Trival and draw tree of shapes and coords in post-order. 3. Coords have a before_pmem member variable to note it's order been draw. It is relative to it's siblings and member shapes of parent coord.
author Thinker K.F. Li <thinker@branda.to>
date Mon, 22 Sep 2008 11:45:00 +0800
parents ea758bb3bbe2
children 1695a4b02b14
comparison
equal deleted inserted replaced
137:5dcfaafd1a9c 138:9f4fc9ecfd1f
86 * \enddot 86 * \enddot
87 */ 87 */
88 typedef struct _coord { 88 typedef struct _coord {
89 unsigned int order; 89 unsigned int order;
90 unsigned int flags; 90 unsigned int flags;
91 co_aix opacity;
92 /*! Own one or inherit from an ancestor.
93 * Setup it when clean coords.
94 * \sa
95 * - \ref COF_OWN_CANVAS
96 * - \ref redraw
97 */
98 cairo_t *canvas;
91 area_t *cur_area, *last_area; 99 area_t *cur_area, *last_area;
92 area_t areas[2]; 100 area_t areas[2];
93 101
94 co_aix matrix[6]; 102 co_aix matrix[6];
95 co_aix aggr_matrix[6]; 103 co_aix aggr_matrix[6];
96 104
97 struct _coord *parent; 105 struct _coord *parent;
98 STAILQ(struct _coord) children; 106 STAILQ(struct _coord) children;
99 struct _coord *sibling; 107 struct _coord *sibling;
108 unsigned int before_pmem; /*!< \brief The coord is before nth member
109 * of parent. */
100 110
101 STAILQ(shape_t) members; /*!< All shape_t objects in this coord. */ 111 STAILQ(shape_t) members; /*!< All shape_t objects in this coord. */
102 subject_t *mouse_event; 112 subject_t *mouse_event;
103 } coord_t; 113 } coord_t;
104 #define COF_DIRTY 0x1 114 #define COF_DIRTY 0x1
105 #define COF_HIDDEN 0x2 115 #define COF_HIDDEN 0x2
116 #define COF_OWN_CANVAS 0x4 /*!< A coord owns a canvas or inherit it
117 * from an ancestor.
118 */
106 119
107 extern void coord_init(coord_t *co, coord_t *parent); 120 extern void coord_init(coord_t *co, coord_t *parent);
108 extern void coord_trans_pos(coord_t *co, co_aix *x, co_aix *y); 121 extern void coord_trans_pos(coord_t *co, co_aix *x, co_aix *y);
109 extern co_aix coord_trans_size(coord_t *co, co_aix size); 122 extern co_aix coord_trans_size(coord_t *co, co_aix size);
110 extern void compute_aggr_of_coord(coord_t *coord); 123 extern void compute_aggr_of_coord(coord_t *coord);
111 extern void update_aggr_matrix(coord_t *start); 124 extern void update_aggr_matrix(coord_t *start);
112 extern coord_t *preorder_coord_subtree(coord_t *root, coord_t *last); 125 extern coord_t *preorder_coord_subtree(coord_t *root, coord_t *last);
126 extern coord_t *postorder_coord_subtree(coord_t *root, coord_t *last);
113 #define coord_hide(co) do { co->flags |= COF_HIDDEN; } while(0) 127 #define coord_hide(co) do { co->flags |= COF_HIDDEN; } while(0)
114 #define coord_show(co) do { co->flags &= ~COF_HIDDEN; } while(0) 128 #define coord_show(co) do { co->flags &= ~COF_HIDDEN; } while(0)
115 #define coord_get_mouse_event(coord) ((coord)->mouse_event) 129 #define coord_get_mouse_event(coord) ((coord)->mouse_event)
116 130
117 131