File:Cairo example.svg

Summary

Description This is an example with a german label "Hallo Wikipedia!"
Date
Source own sourcecode, compile with gcc cairo.c `pkg-config --cflags --libs cairo` and execute it.
Author
This file was made by User:Sven
Translation

If this image contains text, it can be translated easily into your language. If you need help, contact me

Flexible licenses

If you want to use this picture with another license than stated below, contact me

Contact the author

If you need a really fast answer, mail me. If you need only a fast answer, write me here.

Permission
(Reusing this file)

it's quite stupid, so see it as public domain:

Public domain I, the copyright holder of this work, release this work into the public domain. This applies worldwide.
In some countries this may not be legally possible; if so:
I grant anyone the right to use this work for any purpose, without any conditions, unless such conditions are required by law.
Category:Self-published work#Cairo%20example.svgCategory:PD-self#Cairo%20example.svg
SVG development
InfoField
Source code
InfoField

SVG code

#include <cairo-svg.h>
#include <stdio.h>

int main(int argc, char **argv) {
    cairo_t *cr;
    cairo_surface_t *surface;
    cairo_pattern_t *pattern;

    int x,y;

    surface = (cairo_surface_t *)cairo_svg_surface_create("beispiel.svg", 100.0, 100.0);
    cr = cairo_create(surface);

    /* Quadrate im Hintergrund zeichnen */
    for (x=0; x<10; x++)
       for (y=0; y<10; y++)
           cairo_rectangle(cr, x*10.0, y*10.0, 5, 5);

    pattern = cairo_pattern_create_radial(50, 50, 5, 50, 50, 50);
    cairo_pattern_add_color_stop_rgb(pattern, 0, 0.75, 0.15, 0.99);
    cairo_pattern_add_color_stop_rgb(pattern, 0.9, 1, 1, 1);

    cairo_set_source(cr, pattern);
    cairo_fill(cr);

    /* Schrift im Vordergrund */
    cairo_set_font_size (cr, 15);
    cairo_select_font_face (cr, "Georgia",
        CAIRO_FONT_SLANT_NORMAL, CAIRO_FONT_WEIGHT_BOLD);
    cairo_set_source_rgb (cr, 0, 0, 0);

    cairo_move_to(cr, 10, 25);
    cairo_show_text(cr, "Hallo");

    cairo_move_to(cr, 10, 75);
    cairo_show_text(cr, "Wikipedia!");

    cairo_destroy (cr);
    cairo_surface_destroy (surface);
    return 0;
}
Category:Files by User:Sven#Cairo%20example.svg
Category:German-language SVG diagrams Category:Hello Wikipedia
Category:Files by User:Sven Category:German-language SVG diagrams Category:Hello Wikipedia Category:PD-self Category:Self-published work Category:Valid SVG created with Other tools code