Send to Printer


Cairo Graphics: Getting Started

February 5, 2010 13:54:43.463

Next week I'll be redoing some of the Cairo screencasts - they are all outdated, simply due to the fact that you can load cairo much more easily now:

On Windows and OS X, you'll have the shared libraries installed as well (assuming you picked those when you ran the installer. If you didn't, re-run the installer and do so). For Linux or Unix platforms, you'll have to get Cairo installed yourself.

Once you have it loaded, try this as a simple "Is Cairo Working" test:

| win component |
win := ApplicationWindow new.
	component: (VisualBlock block: 
					[:gc :box |
					gc newCairoContextWhile: 
						[:cr |
							source: ColorValue red;
							rectangle: (box insetBy: 20);
							source: ColorValue blue;
							strokeWidth: 20;
win open.

If it worked, you should get this (make the window bigger to see it:

Technorati Tags: , ,

posted by James Robertson


Re: Cairo Graphics: Getting Started

[anonymous] February 5, 2010 14:52:55.241

What is Cairo?

n which versions of smalltalk does it run?

Re: Cairo Graphics: Getting Started

[James Robertson] February 5, 2010 16:10:27.454

Cairo is a cross platform graphics library - see:

[link 1]

There's an interface to it from VisualWorks and ObjectStudio; no idea whether anyone has built anything for Pharo/Squeak, or any other Smalltalk


 Share Tweet This