Programowanie w systemie UNIX/c grafika/cairo: Różnice pomiędzy wersjami
Usunięta treść Dodana treść
m →Zależności: opis |
m →Źródła: przykłąd |
||
Linia 10:
sudo apt-get install libcairo2-dev
=Przykłady=
==Pierwszy program==
<source lang=c>
/*
http://zetcode.com/gfx/cairo/cairobackends/
the first example,
it will create a PNG image.
© 2007 - 2016 Jan Bodnar
*/
#include <cairo.h>
int main(void)
{
cairo_surface_t *surface;
cairo_t *cr;
surface = cairo_image_surface_create(CAIRO_FORMAT_ARGB32, 390, 60);
cr = cairo_create(surface);
cairo_set_source_rgb(cr, 0, 0, 0);
cairo_select_font_face(cr, "Sans", CAIRO_FONT_SLANT_NORMAL,
CAIRO_FONT_WEIGHT_NORMAL);
cairo_set_font_size(cr, 40.0);
cairo_move_to(cr, 10.0, 50.0);
cairo_show_text(cr, "Disziplin ist Macht.");
cairo_surface_write_to_png(surface, "image.png");
cairo_destroy(cr);
cairo_surface_destroy(surface);
return 0;
}
</source>
=Źródła=
|