diff options
author | James Meyer <james.meyer@operamail.com> | 2010-10-23 18:17:40 (GMT) |
---|---|---|
committer | James Meyer <james.meyer@operamail.com> | 2010-10-23 18:19:39 (GMT) |
commit | adbcf19958300e9b6598990184c8815b945ba0ee (patch) | |
tree | f4283c850ac0ac202c17e78a637ee7ca8147621b /abs/mv-core/ghosd/ghosd-0.0.1/examples/animation.c | |
parent | 61a68250df10d29b624650948484898334ff22d0 (diff) | |
download | linhes_pkgbuild-adbcf19958300e9b6598990184c8815b945ba0ee.zip linhes_pkgbuild-adbcf19958300e9b6598990184c8815b945ba0ee.tar.gz linhes_pkgbuild-adbcf19958300e9b6598990184c8815b945ba0ee.tar.bz2 |
Removed old core and extra from repo. Renamed -testing to core/extra. This will setup the base for the testing branch.
Diffstat (limited to 'abs/mv-core/ghosd/ghosd-0.0.1/examples/animation.c')
-rw-r--r-- | abs/mv-core/ghosd/ghosd-0.0.1/examples/animation.c | 97 |
1 files changed, 0 insertions, 97 deletions
diff --git a/abs/mv-core/ghosd/ghosd-0.0.1/examples/animation.c b/abs/mv-core/ghosd/ghosd-0.0.1/examples/animation.c deleted file mode 100644 index 8c1a2c5..0000000 --- a/abs/mv-core/ghosd/ghosd-0.0.1/examples/animation.c +++ /dev/null @@ -1,97 +0,0 @@ -/* ghosd -- OSD with fake transparency, cairo, and pango. - * Copyright (C) 2006 Evan Martin <martine@danga.com> - */ - -#include <stdio.h> -#include <sys/time.h> -#include <sys/poll.h> -#include <time.h> - -#include <cairo/cairo.h> - -#include <ghosd/ghosd.h> - -typedef struct { - cairo_surface_t* foot; - float alpha; -} RenderData; - -static void -round_rect(cairo_t *cr, int x, int y, int w, int h, int r) { - cairo_move_to(cr, x+r, y); - cairo_line_to(cr, x+w-r, y); /* top edge */ - cairo_curve_to(cr, x+w, y, x+w, y, x+w, y+r); - cairo_line_to(cr, x+w, y+h-r); /* right edge */ - cairo_curve_to(cr, x+w, y+h, x+w, y+h, x+w-r, y+h); - cairo_line_to(cr, x+r, y+h); /* bottom edge */ - cairo_curve_to(cr, x, y+h, x, y+h, x, y+h-r); - cairo_line_to(cr, x, y+r); /* left edge */ - cairo_curve_to(cr, x, y, x, y, x+r, y); - cairo_close_path(cr); -} - -#define RADIUS 20 - -static void -render(Ghosd *ghosd, cairo_t *cr, void* data) { - RenderData *rdata = data; - - cairo_set_source_rgba(cr, rdata->alpha, 0, 0, 0.5); - cairo_new_path(cr); - round_rect(cr, 10, 10, 180, 230, RADIUS); - cairo_fill(cr); - - cairo_set_source_rgba(cr, 1, 1, 1, 1.0); - cairo_new_path(cr); - round_rect(cr, 20, 20, 160, 210, RADIUS); - cairo_stroke(cr); - - cairo_save(cr); - cairo_set_source_rgba(cr, 1, 1, 1, 1.0); - cairo_set_source_surface(cr, rdata->foot, 30, 30); - cairo_paint(cr); - cairo_restore(cr); -} - -int main(int argc, char* argv[]) { - Ghosd *ghosd; - RenderData data = {0}; - - const char *image = "/usr/share/pixmaps/gnome-background-image.png"; - data.foot = cairo_image_surface_create_from_png(image); - data.alpha = 0.5; - - ghosd = ghosd_new(); - ghosd_set_position(ghosd, 50, 50, 200, 240); - ghosd_set_render(ghosd, render, &data); - ghosd_render(ghosd); - ghosd_show(ghosd); - - ghosd_main_iterations(ghosd); - - const int STEP = 50; - float dalpha = 0.05; - - struct timeval tv_nextupdate; - - for (;;) { - gettimeofday(&tv_nextupdate, NULL); - tv_nextupdate.tv_usec += STEP*1000; - - ghosd_main_until(ghosd, &tv_nextupdate); - - data.alpha += dalpha; - if (data.alpha >= 1.0) { - data.alpha = 1.0; - dalpha = -dalpha; - } else if (data.alpha <= 0.0) { - data.alpha = 0.0; - dalpha = -dalpha; - } - ghosd_render(ghosd); - } - - return 0; -} - -/* vim: set ts=2 sw=2 et cino=(0 : */ |