/
evo
/
Gtk4-tutorial
Обзор
Документация
Войти
/
evo
/
Gtk4-tutorial
Код
Запросы
0
Задачи
Вики
Пакеты
0
Релизы
0
Аналитика
Безопасность
v0.8
src/misc/cairo.c
31 строка
814 B
Toshio Sekiya
Add section 19.
22 янв 2021, 16:14
22 янв 2021, 16:14
7f1228c
Код
Авторство
О чём код?
#include <cairo.h> int main (int argc, char **argv) { cairo_surface_t *surface; cairo_t *cr; int width = 100; int height = 100; /* Generate surface and cairo */ surface = cairo_image_surface_create (CAIRO_FORMAT_RGB24, width, height); cr = cairo_create (surface); /* Drawing starts here. */ /* Paint the background white */ cairo_set_source_rgb (cr, 1.0, 1.0, 1.0); cairo_paint (cr); /* Draw a black rectangle */ cairo_set_source_rgb (cr, 0.0, 0.0, 0.0); cairo_set_line_width (cr, 2.0); cairo_rectangle (cr, width/2.0 - 20.0, height/2.0 - 20.0, 40.0, 40.0); cairo_stroke (cr); /* Write the surface to a png file and clean up cairo and surface. */ cairo_surface_write_to_png (surface, "rectangle.png"); cairo_destroy (cr); cairo_surface_destroy (surface); return 0; }