Mercurial > MadButterfly
annotate orgfiles/index.muse @ 811:5aca6024b147
subtree of root coord can not be skept
author | Thinker K.F. Li <thinker@codemud.net> |
---|---|
date | Thu, 02 Sep 2010 11:00:30 +0800 |
parents | 6eecdd331fe7 |
children |
rev | line source |
---|---|
0
5aca939dbfbe
MatButterfly is a SVG browser
Thinker K.F. Li <thinker@branda.to>
parents:
diff
changeset
|
1 * MadButterfly |
5aca939dbfbe
MatButterfly is a SVG browser
Thinker K.F. Li <thinker@branda.to>
parents:
diff
changeset
|
2 #MadButterfly |
5aca939dbfbe
MatButterfly is a SVG browser
Thinker K.F. Li <thinker@branda.to>
parents:
diff
changeset
|
3 MadButterfly is a [[#SVG][SVG]] browser, HTML browser (ex, Firefox) is a HTML |
5aca939dbfbe
MatButterfly is a SVG browser
Thinker K.F. Li <thinker@branda.to>
parents:
diff
changeset
|
4 respective one. MadButterfly only understand SVG, controlling from users, |
5aca939dbfbe
MatButterfly is a SVG browser
Thinker K.F. Li <thinker@branda.to>
parents:
diff
changeset
|
5 and API for applications base on it. It is supposed to be a GUI framework |
5aca939dbfbe
MatButterfly is a SVG browser
Thinker K.F. Li <thinker@branda.to>
parents:
diff
changeset
|
6 for applications. The host applications can interact with MadButterfly |
5aca939dbfbe
MatButterfly is a SVG browser
Thinker K.F. Li <thinker@branda.to>
parents:
diff
changeset
|
7 like Javascript applications interacts with DOM objects. MadButterfly |
5aca939dbfbe
MatButterfly is a SVG browser
Thinker K.F. Li <thinker@branda.to>
parents:
diff
changeset
|
8 is a GUI evnironment based on SVG technologies for desktop and mobile |
5aca939dbfbe
MatButterfly is a SVG browser
Thinker K.F. Li <thinker@branda.to>
parents:
diff
changeset
|
9 device. It tries to make the work of programmers closed to client-side |
5aca939dbfbe
MatButterfly is a SVG browser
Thinker K.F. Li <thinker@branda.to>
parents:
diff
changeset
|
10 Javascript ones. |
5aca939dbfbe
MatButterfly is a SVG browser
Thinker K.F. Li <thinker@branda.to>
parents:
diff
changeset
|
11 |
5aca939dbfbe
MatButterfly is a SVG browser
Thinker K.F. Li <thinker@branda.to>
parents:
diff
changeset
|
12 MadButterfly is a SVG browser, it can be used to implement file manager, |
5aca939dbfbe
MatButterfly is a SVG browser
Thinker K.F. Li <thinker@branda.to>
parents:
diff
changeset
|
13 UI of commerical application for business, and even window manager for |
5aca939dbfbe
MatButterfly is a SVG browser
Thinker K.F. Li <thinker@branda.to>
parents:
diff
changeset
|
14 X Window. We try to implement MadButterfly as a library that can be |
5aca939dbfbe
MatButterfly is a SVG browser
Thinker K.F. Li <thinker@branda.to>
parents:
diff
changeset
|
15 embedded by host programs. It is alike Firefox been embedded by |
5aca939dbfbe
MatButterfly is a SVG browser
Thinker K.F. Li <thinker@branda.to>
parents:
diff
changeset
|
16 host programs. |
5aca939dbfbe
MatButterfly is a SVG browser
Thinker K.F. Li <thinker@branda.to>
parents:
diff
changeset
|
17 |
5aca939dbfbe
MatButterfly is a SVG browser
Thinker K.F. Li <thinker@branda.to>
parents:
diff
changeset
|
18 * SVG |
5aca939dbfbe
MatButterfly is a SVG browser
Thinker K.F. Li <thinker@branda.to>
parents:
diff
changeset
|
19 #SVG |
5aca939dbfbe
MatButterfly is a SVG browser
Thinker K.F. Li <thinker@branda.to>
parents:
diff
changeset
|
20 SVG is "Scalable Vector Graphics". It is a standard of W3C. |
5aca939dbfbe
MatButterfly is a SVG browser
Thinker K.F. Li <thinker@branda.to>
parents:
diff
changeset
|
21 MadButterfly implements [[http://www.w3.org/TR/SVGMobile12/][SVG Tiny 1.2]], a simplified version of SVG for |
5aca939dbfbe
MatButterfly is a SVG browser
Thinker K.F. Li <thinker@branda.to>
parents:
diff
changeset
|
22 mobile devices. |
5aca939dbfbe
MatButterfly is a SVG browser
Thinker K.F. Li <thinker@branda.to>
parents:
diff
changeset
|
23 |
5aca939dbfbe
MatButterfly is a SVG browser
Thinker K.F. Li <thinker@branda.to>
parents:
diff
changeset
|
24 * Design |
5aca939dbfbe
MatButterfly is a SVG browser
Thinker K.F. Li <thinker@branda.to>
parents:
diff
changeset
|
25 Most notable of SVG, except sharps, is coordination transforms. To make |
5aca939dbfbe
MatButterfly is a SVG browser
Thinker K.F. Li <thinker@branda.to>
parents:
diff
changeset
|
26 MadButterfly efficiency, the execution of code should highly leverage |
5aca939dbfbe
MatButterfly is a SVG browser
Thinker K.F. Li <thinker@branda.to>
parents:
diff
changeset
|
27 time locality and spartial locality. So, we should aggregate computation |
5aca939dbfbe
MatButterfly is a SVG browser
Thinker K.F. Li <thinker@branda.to>
parents:
diff
changeset
|
28 of a function together. The data of container and contained elements |
5aca939dbfbe
MatButterfly is a SVG browser
Thinker K.F. Li <thinker@branda.to>
parents:
diff
changeset
|
29 should also be aggregated together. |
5aca939dbfbe
MatButterfly is a SVG browser
Thinker K.F. Li <thinker@branda.to>
parents:
diff
changeset
|
30 |
5aca939dbfbe
MatButterfly is a SVG browser
Thinker K.F. Li <thinker@branda.to>
parents:
diff
changeset
|
31 Since the attributes of SVG objects will be chagned frequently, |
5aca939dbfbe
MatButterfly is a SVG browser
Thinker K.F. Li <thinker@branda.to>
parents:
diff
changeset
|
32 unnecessarily recomputing for coordination transforms should be avoided. |
5aca939dbfbe
MatButterfly is a SVG browser
Thinker K.F. Li <thinker@branda.to>
parents:
diff
changeset
|
33 A sequential number should be attached to the objects to ditinguish |
5aca939dbfbe
MatButterfly is a SVG browser
Thinker K.F. Li <thinker@branda.to>
parents:
diff
changeset
|
34 dirty transformation result and recompute it when it is needed. |
5aca939dbfbe
MatButterfly is a SVG browser
Thinker K.F. Li <thinker@branda.to>
parents:
diff
changeset
|
35 |
5aca939dbfbe
MatButterfly is a SVG browser
Thinker K.F. Li <thinker@branda.to>
parents:
diff
changeset
|
36 ** Aggregate Computation |
5aca939dbfbe
MatButterfly is a SVG browser
Thinker K.F. Li <thinker@branda.to>
parents:
diff
changeset
|
37 Every update potentially invokes a function for every graphic elements. |
5aca939dbfbe
MatButterfly is a SVG browser
Thinker K.F. Li <thinker@branda.to>
parents:
diff
changeset
|
38 To be efficient, calls of a function are collected into a loop to avoid |
5aca939dbfbe
MatButterfly is a SVG browser
Thinker K.F. Li <thinker@branda.to>
parents:
diff
changeset
|
39 overhead of function calls. It also avoid interleaving of calls of |
5aca939dbfbe
MatButterfly is a SVG browser
Thinker K.F. Li <thinker@branda.to>
parents:
diff
changeset
|
40 functions to leverage time locality of code cache. |
5aca939dbfbe
MatButterfly is a SVG browser
Thinker K.F. Li <thinker@branda.to>
parents:
diff
changeset
|
41 |
5aca939dbfbe
MatButterfly is a SVG browser
Thinker K.F. Li <thinker@branda.to>
parents:
diff
changeset
|
42 ** Aggregate Relative Data |
5aca939dbfbe
MatButterfly is a SVG browser
Thinker K.F. Li <thinker@branda.to>
parents:
diff
changeset
|
43 Changes of a container usually effect contained elements. So, it had |
5aca939dbfbe
MatButterfly is a SVG browser
Thinker K.F. Li <thinker@branda.to>
parents:
diff
changeset
|
44 better to put container together with contained elements to increase |
5aca939dbfbe
MatButterfly is a SVG browser
Thinker K.F. Li <thinker@branda.to>
parents:
diff
changeset
|
45 hit rate of cache. |
5aca939dbfbe
MatButterfly is a SVG browser
Thinker K.F. Li <thinker@branda.to>
parents:
diff
changeset
|
46 |
5aca939dbfbe
MatButterfly is a SVG browser
Thinker K.F. Li <thinker@branda.to>
parents:
diff
changeset
|
47 * Transform |
5aca939dbfbe
MatButterfly is a SVG browser
Thinker K.F. Li <thinker@branda.to>
parents:
diff
changeset
|
48 If a coordination transformation transforms (x, y) to (x', y'), then |
5aca939dbfbe
MatButterfly is a SVG browser
Thinker K.F. Li <thinker@branda.to>
parents:
diff
changeset
|
49 > x' = xa * x + xb * y + xc |
5aca939dbfbe
MatButterfly is a SVG browser
Thinker K.F. Li <thinker@branda.to>
parents:
diff
changeset
|
50 > y' = ya * x + yb * y + yc |
5aca939dbfbe
MatButterfly is a SVG browser
Thinker K.F. Li <thinker@branda.to>
parents:
diff
changeset
|
51 is equal to |
5aca939dbfbe
MatButterfly is a SVG browser
Thinker K.F. Li <thinker@branda.to>
parents:
diff
changeset
|
52 > | xa xb xc | | x | |
5aca939dbfbe
MatButterfly is a SVG browser
Thinker K.F. Li <thinker@branda.to>
parents:
diff
changeset
|
53 > | ya yb yc | * | y | |
5aca939dbfbe
MatButterfly is a SVG browser
Thinker K.F. Li <thinker@branda.to>
parents:
diff
changeset
|
54 > | 0 0 1 | | 1 | |
5aca939dbfbe
MatButterfly is a SVG browser
Thinker K.F. Li <thinker@branda.to>
parents:
diff
changeset
|
55 |
5aca939dbfbe
MatButterfly is a SVG browser
Thinker K.F. Li <thinker@branda.to>
parents:
diff
changeset
|
56 A transform function of a element to canvas is production of all |
5aca939dbfbe
MatButterfly is a SVG browser
Thinker K.F. Li <thinker@branda.to>
parents:
diff
changeset
|
57 transform functions of containers, it is called aggregated transform |
5aca939dbfbe
MatButterfly is a SVG browser
Thinker K.F. Li <thinker@branda.to>
parents:
diff
changeset
|
58 function. The aggregated transform function of elements are |
5aca939dbfbe
MatButterfly is a SVG browser
Thinker K.F. Li <thinker@branda.to>
parents:
diff
changeset
|
59 computed with [[http://en.wikipedia.org/wiki/Dynamic_programming][dynamic programming]]. |
9 | 60 |
61 ** Use Absolute | |
62 Since we need to tranform positions, positions are transform to | |
63 absolute coordinations if they are specified relative. It is | |
64 fine when a relative position are rotated or resized. But, it | |
65 would be wrong when shifting. |