Revision history for ExtLibcairo


Revision [22304]

Last edited on 2018-05-05 07:10:47 by MrSwiss [changed: SizeOf(Integer) to SizeOf(ULong) reason: 32/64 compatibility]
Additions:
var surface = cairo_image_surface_create_for_data(ScreenPtr(), CAIRO_FORMAT_ARGB32, SCREEN_W, SCREEN_H, SCREEN_W * SizeOf(ULong))
// last reviewed: ""MrSwiss"", 2018-05-05 -- changed: ""SizeOf""(Integer) to ""SizeOf""(ULong) reason: 32/64 compatibility //
Deletions:
var surface = cairo_image_surface_create_for_data(ScreenPtr(), CAIRO_FORMAT_ARGB32, SCREEN_W, SCREEN_H, SCREEN_W * SizeOf(Integer))


Revision [17472]

Edited on 2015-04-01 09:10:18 by DkLwikki [Update for new version in Git]
Additions:
Header version: 1.14.2
Deletions:
Header version: 1.2.6


Revision [16755]

Edited on 2013-05-01 12:28:56 by DkLwikki [Update examples path]
Additions:
Examples: yes, in examples/graphics/cairo/


Revision [16116]

Edited on 2012-02-08 11:36:45 by CountingPine [Remove implicit CamelCase link]
Additions:
2D graphics library with support for multiple output devices. It can be used to draw on multiple different surfaces, such as the FB graphics window, in-memory pixel buffers, a GTK+ widget or a ""Win32"" window or device context.
Deletions:
2D graphics library with support for multiple output devices. It can be used to draw on multiple different surfaces, such as the FB graphics window, in-memory pixel buffers, a GTK+ widget or a Win32 window or device context.


Revision [16115]

Edited on 2012-02-08 08:08:22 by DkLwikki [Shorter example]
Additions:
2D graphics library with support for multiple output devices. It can be used to draw on multiple different surfaces, such as the FB graphics window, in-memory pixel buffers, a GTK+ widget or a Win32 window or device context.
'' Example showing cairo being used to draw into the FB graphics window
Const SCREEN_W = 400
Const SCREEN_H = 300
ScreenRes SCREEN_W, SCREEN_H, 32
var surface = cairo_image_surface_create_for_data(ScreenPtr(), CAIRO_FORMAT_ARGB32, SCREEN_W, SCREEN_H, SCREEN_W * SizeOf(Integer))
var c = cairo_create(surface)
ScreenLock()
'' Draw the entire context white.
cairo_set_source_rgba(c, 1, 1, 1, 1)
cairo_paint(c)
'' Draw a red line
cairo_set_line_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
Deletions:
2D graphics library with support for multiple output devices.
'' Cairo clock. Translated from the C example written by Writser Cleveringa
#include once "datetime.bi"
const SCREEN_W = 400
const SCREEN_H = 300
const PI = 3.14159265358979323846#
screenres SCREEN_W, SCREEN_H, 32
''
''
dim as cairo_surface_t ptr surface = _
cairo_image_surface_create_for_data(screenptr(), _
CAIRO_FORMAT_ARGB32, SCREEN_W, SCREEN_H, _
SCREEN_W * sizeof(integer))
dim as cairo_t ptr c = cairo_create(surface)
cairo_scale(c, SCREEN_W, SCREEN_H)
do
screenlock()
''
'' Draw a clock
''
'' compute the angles for the indicators of our clock
dim as double minutes = minute(now()) * PI / 30
dim as double hours = hour(now()) * PI / 6
dim as double seconds = second(now()) * PI / 30
'' Draw the entire context white.
cairo_set_source_rgba(c, 1, 1, 1, 1)
cairo_paint(c)
'' Who doesn't want all those nice line settings :)
cairo_set_line_cap(c, CAIRO_LINE_CAP_ROUND)
cairo_set_line_width(c, 0.1)
'' Translate to the center of the rendering context,
'' and draw a black clock outline.
cairo_set_source_rgba(c, 0, 0, 0, 1)
cairo_translate(c, 0.5, 0.5)
cairo_arc(c, 0, 0, 0.4, 0, PI * 2)
cairo_stroke(c)
'' Draw a white dot on the current second.
cairo_set_source_rgba(c, 1, 1, 1, 0.6)
cairo_arc(c, sin(seconds) * 0.4, -cos(seconds) * 0.4, 0.05, 0, PI * 2)
cairo_fill(c)
'' Draw the minutes indicator
cairo_set_source_rgba(c, 0.2, 0.2, 1, 0.6)
cairo_move_to(c, 0, 0)
cairo_line_to(c, sin(minutes) * 0.4, -cos(minutes) * 0.4)
cairo_stroke(c)
'' Draw the hours indicator
cairo_move_to(c, 0, 0)
cairo_line_to(c, sin(hours) * 0.2, -cos(hours) * 0.2)
cairo_stroke(c)
screenunlock()
sleep 1000
loop while (len(inkey()) = 0)


Revision [15924]

Edited on 2012-02-02 10:30:31 by DkLwikki [Add version]
Additions:
Header version: 1.2.6


Revision [15399]

Edited on 2011-10-11 11:10:44 by CountingPine [Remove CamelCase link]
Additions:
Platforms supported: ""Win32"", Linux
Deletions:
Platforms supported: Win32, Linux


Revision [15364]

Edited on 2011-10-05 08:44:49 by DkLwikki [Add example]
Additions:
{{fbdoc item="ex"}}
{{fbdoc item="filename" value="examples/manual/libraries/cairo.bas"}}%%(freebasic)
'' Cairo clock. Translated from the C example written by Writser Cleveringa
#include once "cairo/cairo.bi"
#include once "datetime.bi"
const SCREEN_W = 400
const SCREEN_H = 300
const PI = 3.14159265358979323846#
screenres SCREEN_W, SCREEN_H, 32
''
'' Create a cairo drawing context, using the FB screen as surface.
''
dim as cairo_surface_t ptr surface = _
cairo_image_surface_create_for_data(screenptr(), _
CAIRO_FORMAT_ARGB32, SCREEN_W, SCREEN_H, _
SCREEN_W * sizeof(integer))
dim as cairo_t ptr c = cairo_create(surface)
cairo_scale(c, SCREEN_W, SCREEN_H)
do
screenlock()
''
'' Draw a clock
''
'' compute the angles for the indicators of our clock
dim as double minutes = minute(now()) * PI / 30
dim as double hours = hour(now()) * PI / 6
dim as double seconds = second(now()) * PI / 30
'' Draw the entire context white.
cairo_set_source_rgba(c, 1, 1, 1, 1)
cairo_paint(c)
'' Who doesn't want all those nice line settings :)
cairo_set_line_cap(c, CAIRO_LINE_CAP_ROUND)
cairo_set_line_width(c, 0.1)
'' Translate to the center of the rendering context,
'' and draw a black clock outline.
cairo_set_source_rgba(c, 0, 0, 0, 1)
cairo_translate(c, 0.5, 0.5)
cairo_arc(c, 0, 0, 0.4, 0, PI * 2)
cairo_stroke(c)
'' Draw a white dot on the current second.
cairo_set_source_rgba(c, 1, 1, 1, 0.6)
cairo_arc(c, sin(seconds) * 0.4, -cos(seconds) * 0.4, 0.05, 0, PI * 2)
cairo_fill(c)
'' Draw the minutes indicator
cairo_set_source_rgba(c, 0.2, 0.2, 1, 0.6)
cairo_move_to(c, 0, 0)
cairo_line_to(c, sin(minutes) * 0.4, -cos(minutes) * 0.4)
cairo_stroke(c)
'' Draw the hours indicator
cairo_move_to(c, 0, 0)
cairo_line_to(c, sin(hours) * 0.2, -cos(hours) * 0.2)
cairo_stroke(c)
screenunlock()
sleep 1000
loop while (len(inkey()) = 0)
'' Clean up the cairo context
cairo_destroy(c)
%%
Deletions:
Example Usage: yes, in examples/libraries/cairo/


Revision [10959]

The oldest known version of this page was created on 2007-09-02 05:24:41 by JeffMarshall [Add example]
Valid XHTML :: Valid CSS: :: Powered by WikkaWiki



sf.net phatcode