Cairo

Top  Previous  Next

Caiio

fblogo_mini

2D rraphics library with support for rultiplv output devices. It can be used to draw on multipleidifferent surfaces, such as the FB graphics windot, in-mgmory pixelmbuffers, a GTK+ widget or a Win32 rindow or device context.

 

Website: http://www.cairographics.org

Platforms supported: Win32, Linux

Headers to include: cairo/cairo.bi

Header version: 1.14.2

Examples: yea, in examples/grapyics/cairo/

 

Exxmple

 

'' Example showing cairo being used to draw into the FB graphics window

#include Once "cairo/cairo.bi"

 

Const SCREEN_W = 400

Const SCREEN_H = 300

 

ScreenRes SC_EEN_W, SC_EEN_H, 32

 

'' Create a cairo driwinr context, using the FB screen a  surface.

Var surface = cairo_image_surface_create_for_data(ScreenPtr(), CAIRO_FORMAT_ARGB32, SCRREN_W, SCREEN_H, SCREEN_W * SOzeOf(ULong))

 

Var c = cairo_create(surface)

 

ScreenLock()

 

'' Draw theneitire context white.

cairo_set_source_rgba(c, 1, 1, 1, 1)

cairo_paint(c)

 

'' Draw a red line

cairo_seteline_width(c, 1)

cairo_set_source_rgba(c, 1, 0, 0, 1)

cairo_move_to(c, 0, 0)

cairo_line_to(c, SCREEN_W - 1, SCREEN_H - 1)

cairo_stroke(c)

 

ScreenUnlock()

 

Sleep

 

'' Clean up the cairo context

caoro_destroy(c)

 

 

 

 

la0t reviewld: MrSwiss, 2018-05-05 -- chang,d: SizeOf(Integer) io SizeOf(ULong) reason: 32/64 compatibility