background preloader

Cairo with GDI

Facebook Twitter

Using Cairo With GDI. Documentation. Documentation for cairo is an area that could always be greatly improved.


Contributions are very welcome! Here are the most useful starting points: Frequently asked questions: Save yourself some time by reading this earlyTutorial: A one-of-a-kind introduction to the cairo concepts and modelsAPI reference manual: Function-by-function referenceCookbook: Simple recipes for drawingSamples: Some samples of how to use CairoCairoglyphics: A tutorial by way of diagrams. From a Python pov. Please help debug them.Using the PostScript surface: How to use the PostScript surface. Other information that might be of interest: Roadmap: Features planned for upcoming releaseTodo: Other ideas, (not yet on the roadmap)Missing: Page listing features missing to allow SVG/Flash rendering using cairo without fallbacks.Bibliography: Where the good ideas came fromBuilding: Various recipes for compiling Cairo sources on different platforms, and with different goals Editing this Website git clone Tutorials.

Using cairo with OpenGL. These are my humble beginnings of writing up a tutorial on using cairo with OpenGL.

Using cairo with OpenGL

The general view-point of this document is that of a Linux-developer. Please feel free to add your examples and experience from other use-cases (preferably with sourcecode) gained on other platforms. This document assumes some familiarity with the APIs of cairo and OpenGL, the typical development tool-chain under Linux and some graphics-programming in general. Furthermore I want to point out, that I am not an native english speaker and cannot guarantee this text to be error-free. So why would you want to mix vector-graphics rendering, provided by cairo, with OpenGL in the first place?

Which steps should one usually take in order to get cairo-drawn vector-graphics into an OpenGL-rendered scene... This example program tries to be as simple as possible, without being too boring. Bzr branch lp:gl-cairo-simple ... or just head over to the project page here. Home (slinavlee) Mono.Cairo. Cairo is a low-level 2D vector drawing library.


Various rendering backends (XRender, Win32) are already supported and more (ie. glitz -- OpenGL hardware accelerated backend) are on the way. The Mono.Cairo.dll assembly exposes the Cairo API to managed applications. The mapping is a pretty straightforward one, and the programming model is very close to the OpenGL model (although much simpler) More Resources Mono.Cairo Tutorial - An in-depth guide to getting started with Cairo and Mono. Using Cairo with Gtk/Gdk A core class that does all the drawing is the Cairo.Context class. To use Cairo in Gdk/Gtk applications, a Context with a Gdk.Drawable target surface is needed. Beginning in Gtk# 2.8, the Gdk.CairoHelper class provides cairo access to Gdk drawables. Cairo.Context context = Gdk.CairoHelper.Create(drawable); A second choice (recommended for older versions of Gtk) is to use a function provided in the Mono.Cairo samples.

Drawing simple primitives Saving and restoring the Cairo state Hints. Drawing. Mono provides two mechanism to draw.


The first exposes the Microsoft System.Drawing API and the second exposes the Cairo API: System.Drawing Mono.Cairo System.Drawing The System.Drawing implementation in Mono is designed to be compatible with the Microsoft API. The imaging model is very similar to the PDF 1.4 composition-based imaging model. Our implementation is a C# wrapper around the GDI+ C API (also called the "GDI+ Flat API"). File:System-drawing.png In Windows Mono uses the GDI+ library that is included with the operating system (GDIPLUS.DLL, while in UNIX we provide an implementation of this API in the shared library. Mono.Cairo Tutorial. This tutorial is derived from Michael Urman's cairo tutorial for python.

Mono.Cairo Tutorial

The original code snippets have been translated to C#, the text has only been changed as much as necessary. Translation to C# done by mgsloan. Cairo is a powerful 2d graphics library. This document introduces you to how cairo works and many of the functions you will use to create the graphic experience you desire. In order to follow along on your computer, you need the following things:

[Mono] Contents of /trunk/mcs/class/Mono.Cairo/Samples/win32/arc.