diff options
Diffstat (limited to 'abs/mv-core/ghosd/ghosd-0.0.1/examples/image.c')
-rw-r--r-- | abs/mv-core/ghosd/ghosd-0.0.1/examples/image.c | 113 |
1 files changed, 0 insertions, 113 deletions
diff --git a/abs/mv-core/ghosd/ghosd-0.0.1/examples/image.c b/abs/mv-core/ghosd/ghosd-0.0.1/examples/image.c deleted file mode 100644 index ed061af..0000000 --- a/abs/mv-core/ghosd/ghosd-0.0.1/examples/image.c +++ /dev/null @@ -1,113 +0,0 @@ -/* ghosd -- OSD with fake transparency, cairo, and pango. - * Copyright (C) 2006 Evan Martin <martine@danga.com> - */ - -#include <stdio.h> -#include <math.h> -#include <cairo/cairo.h> -#include <unistd.h> -#include <ghosd/ghosd.h> - -#include "example-shared.h" - -#define MARGIN 10 -#define RADIUS 20 -#define WIDTH 185 -#define HEIGHT 220 - -int posX = 10; -int posY = 10; -char displayText[200] = "default message"; -float red = 1.0; -float green = 1.0; -float blue = 1.0; -int ftSize = 30; -int fadIn = 500; -int fadOt = 3300; - -static void -render(Ghosd *ghosd, cairo_t *cr, void* data) { - cairo_surface_t* image = data; - const int width = cairo_image_surface_get_width(image); - const int height = cairo_image_surface_get_height(image); - - cairo_set_source_rgba(cr, 0, 0, 0, 0.5); - cairo_new_path(cr); - example_round_rect(cr, 0, 0, width+(2*MARGIN), height+(2*MARGIN), RADIUS); - cairo_fill(cr); - - cairo_save(cr); - cairo_set_source_surface(cr, image, MARGIN, MARGIN); - - - - - cairo_paint_with_alpha(cr, 0.9); - cairo_restore(cr); -cairo_select_font_face (cr, "Sans", CAIRO_FONT_SLANT_NORMAL, - CAIRO_FONT_WEIGHT_BOLD); -cairo_set_font_size (cr, ftSize); - -// cairo_move_to (cr, 10.0, 135.0); -// cairo_show_text (cr, "Hello"); - -cairo_move_to (cr, posX, posY); -cairo_text_path (cr, displayText); -cairo_set_source_rgb (cr, red, green, blue); -cairo_fill_preserve (cr); -cairo_set_source_rgb (cr, 0, 0, 0); -cairo_set_line_width (cr, 2.56); -cairo_stroke (cr); -} - -int main(int argc, char* argv[]) { - //g_type_init(); - - char *filename = NULL; - GOptionEntry options[] = { - { "image", 'i', G_OPTION_FLAG_IN_MAIN, G_OPTION_ARG_STRING, - (gpointer)&filename, "image to display", "PATH" }, - { NULL } - }; - GOptionGroup *group = g_option_group_new("image", "Image Options", "image help", - NULL, NULL); - g_option_group_add_entries(group, options); - example_options_parse(&argc, &argv, group, NULL); - - if (filename == NULL) { - printf("must specify image with -i flag.\n" - "try e.g. /usr/share/pixmaps/gnome-logo-large.png\n"); - return 1; - } - - if( argc == 10 ) - { - - posX = atoi(argv[1]); - posY = atoi(argv[2]); - red = atoi(argv[3]); - green = atoi(argv[4]); - blue = atoi(argv[5]); - ftSize = atoi(argv[6]); - fadIn = atoi(argv[7]); - fadOt = atoi(argv[8]); -sprintf(displayText, argv[9]); - } - - - Ghosd *ghosd; - cairo_surface_t* image = cairo_image_surface_create_from_png(filename); - const int width = cairo_image_surface_get_width(image); - const int height = cairo_image_surface_get_height(image); - - ghosd = ghosd_new(); - ghosd_set_transparent(ghosd, opts.transparent); - ghosd_set_position(ghosd, opts.x, opts.y, - width+(2*MARGIN), height+(2*MARGIN)); - ghosd_set_render(ghosd, render, image); - - ghosd_flash(ghosd, fadIn, fadOt); - return 0; -} - -/* vim: set ts=2 sw=2 et cino=(0 : */ |