상위 질문
타임라인
채팅
관점

카이로 (그래픽스)

위키백과, 무료 백과사전

카이로 (그래픽스)
Remove ads

카이로벡터 그래픽스 기반 장치 독립 API를 제공하는, 소프트웨어 개발자를 위한 오픈 소스 그래픽스 라이브러리이다. 수많은 백엔드를 가로지르는 2차원 드로잉을 위한 프리미티브를 제공한다. 카이로는 사용 가능한 경우 하드웨어 가속을 사용한다.

간략 정보 원저자, 개발자 ...
Remove ads

예시 코드

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

int main(int argc, char **argv) {
    cairo_surface_t *surface = cairo_svg_surface_create("Cairo_example.svg", 100.0, 100.0);
    cairo_t *cr = cairo_create(surface);

    /* Draw the squares in the background */
    for (int x = 0; x < 10; ++x)
       for (int y = 0; y < 10; ++y)
           cairo_rectangle(cr, x * 10.0, y * 10.0, 5, 5);

    cairo_pattern_t *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);

    /* Writing in the foreground */
    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);
}
Remove ads

같이 보기

각주

외부 링크

Loading content...
Loading related searches...

Wikiwand - on

Seamless Wikipedia browsing. On steroids.

Remove ads