X-Git-Url: https://git.cworth.org/git?a=blobdiff_plain;f=xoboot.c;h=1feb5dccbcb3059b4d445821168f4ef96e6079db;hb=75e8d26e33f0a990a79a48f0a382b26fe0da63f8;hp=2d7fe962b2026458ee27fde5b72933747f252132;hpb=7d4ecd60b1bf1dcef2932c7c004e2271e0d754e2;p=xoboot diff --git a/xoboot.c b/xoboot.c index 2d7fe96..1feb5dc 100644 --- a/xoboot.c +++ b/xoboot.c @@ -19,6 +19,23 @@ * Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA." */ +/* This is simply a proof-of-concept for using cairo to implement a + * design idea for an OLPC boot-time animation. The animation here is + * implemented to mimic an animation originally provided as a + * Quicktime movie by Rebecca Allen . + * + * So far, this animation has been developed exclusively on an x86 + * laptop with GTK+ targeting the X Window System. No guarantees are + * provided as to how this might perform on an OLPC XO machine. What's + * likely desired is to write the application to use cairo image + * surfaces, and augment cairo to support targeting the XO's 565 image + * format directly. + * + * And obviously, to serve as a real boot-time animation, code will + * have to be written to advance the animation according to various + * system events, instead of using the hard-coded timeline below. + */ + #include #include #include @@ -127,6 +144,8 @@ draw_head (cairo_t *cr, double extra) static void draw_body (cairo_t *cr, double extra, double spin_transition) { + double angle, x, y; + cairo_save (cr); cairo_move_to (cr, @@ -136,7 +155,13 @@ draw_body (cairo_t *cr, double extra, double spin_transition) cairo_rel_line_to (cr, XO_BODY_DELTA, XO_BODY_DELTA); cairo_translate (cr, XO_HEAD_CENTER_X, XO_HEAD_CENTER_Y); - cairo_rotate (cr, 2 * M_PI * spin_transition); + + angle = 2 * M_PI * spin_transition; + y = cos (angle) * XO_DOTS_POSITION_RADIUS; + x = sin (angle) * XO_DOTS_POSITION_RADIUS; + angle = atan2 (x, y + XO_BODY_CENTER_Y - XO_HEAD_CENTER_Y); + + cairo_rotate (cr, angle); cairo_translate (cr, -XO_HEAD_CENTER_X, -XO_HEAD_CENTER_Y); cairo_move_to (cr, @@ -164,7 +189,7 @@ draw_dots (cairo_t *cr, double num_dots) cairo_translate (cr, XO_DOTS_CENTER_X, XO_DOTS_CENTER_Y); cairo_rotate (cr, - 1.5 * M_PI); - for (i = 0; i < num_dots; i++) { + for (i = 0; i <= num_dots; i++) { if (i != 0) { cairo_arc (cr, XO_DOTS_POSITION_RADIUS, 0, @@ -250,7 +275,7 @@ xoboot_expose_event (GtkWidget *widget, goto DONE; if (anim_stage < ANIM_FADE) { - draw_dots (cr, (XO_DOTS_NUM_DOTS + 1) * spin_transition); + draw_dots (cr, (XO_DOTS_NUM_DOTS) * spin_transition); } else { draw_ring (cr); }