The Cairo graphics tutorial -------Introduction

转载 2012年03月30日 08:13:29

Welcome to the Cairo graphics tutorial. This tutorial will teach you basics and some advanced topics of the Cairo 2D vector drawing library. In most examples we will use the GTK+ programming library.This tutorial is done in C programming language.

2D Vector Graphics

There are two different computer graphics. Vector and raster graphics. Raster graphics represents images as a collection of pixels. Vector graphics is the use of geometrical primitives such as points, lines, curves or polygons to represent images. These primitives are created using mathematical equations.

Both types of computer graphics have advantages and disadvantages. The advantages of vector graphics over raster are:

  • smaller size
  • ability to zoom indefinitely
  • moving, scaling, filling or rotating does not degrade the quality of an image

Cairo

Cairo is a library for creating 2D vector graphics. It is written in the C programming language. Binding for other computer languages exist. Python, Perl, C++, C#, Java. Cairo is a multiplatform library, works on Linux, BSDs, OSX.

Cairo supports various backends.

  • X Window System
  • Win32 GDI
  • Mac OS X Quartz
  • PNG
  • PDF
  • PostScript
  • SVG

This means, we can use the library to draw on windows on Linux/BSDs, Windows, OSX and we can use the library to createPNG images, PDF files, PostScript files and SVG files.

We can compare the cairo library to the GDI+ library on Windows OS and the Quartz 2D on Mac OS. Cairo is an open source software library. From version 2.8, the cairo library is part of the GTK+ system.

Compiling exampes

The examples are created in the C programming language. We use GNU C compiler to compile them.

gcc -o example `pkg-config --cflags --libs gtk+-2.0` example.c


The Cairo graphics tutorial -------Images in Cairo

In this part of the Cairo graphics tutorial, we will talk about the images. We will show how to disp...
  • intruder83
  • intruder83
  • 2012年03月30日 08:24
  • 375

The Cairo graphics tutorial -------Text in Cairo

In this part of the Cairo graphics tutorial, we will work with text. Soulmate In the first...
  • intruder83
  • intruder83
  • 2012年03月30日 08:23
  • 206

The Cairo graphics tutorial -------Cairo backends

The Cairo library supports various backends. In this section of the Cairo graphics tutorial, we will...
  • intruder83
  • intruder83
  • 2012年03月30日 08:15
  • 338

The Cairo graphics tutorial -------Cairo definitions

Cairo definitions In this part of the Cairo graphics tutorial, we will provide some useful definiti...
  • intruder83
  • intruder83
  • 2012年03月30日 08:14
  • 216

The Cairo graphics tutorial -------Compositing

In this part of the Cairo graphics programming tutorial, we will define compositing operations. ...
  • intruder83
  • intruder83
  • 2012年03月30日 08:20
  • 181

The Cairo graphics tutorial -------Transparency

In this part of the Cairo C API tutorial, we will talk about transparency. We will provide some basi...
  • intruder83
  • intruder83
  • 2012年03月30日 08:19
  • 267

The Cairo graphics tutorial -------Transformations

In this part of the Cairo graphics programming tutorial, we will talk about transformations. ...
  • intruder83
  • intruder83
  • 2012年03月30日 08:22
  • 312

The Cairo graphics tutorial -------Shapes and fills in Cairo

In this part of the Cairo tutorial, we will create some basic and more advanced shapes. We will fill...
  • intruder83
  • intruder83
  • 2012年03月30日 08:18
  • 353

The Cairo graphics tutorial -------Basic drawing in Cairo

In this part of the Cairo graphics tutorial, we will draw some basic primitives. We will draw simple...
  • intruder83
  • intruder83
  • 2012年03月30日 08:16
  • 260

The Cairo graphics tutorial -------Clipping and masking

In this part of the Cairo tutorial, we will talk about clipping and masking. Clipping ...
  • intruder83
  • intruder83
  • 2012年03月30日 08:21
  • 416
内容举报
返回顶部
收藏助手
不良信息举报
您举报文章:The Cairo graphics tutorial -------Introduction
举报原因:
原因补充:

(最多只允许输入30个字)