[In construction] Cairo Tutorials

Source: Internet
Author: User
Tags cairo

This article is for the translation of Cairo official tutorials

Original English Link: http://cairographics.org/tutorial/

Please correct me if there is any translation error.

Reprint please indicate the original link.

"It's under construction!" 】

Cairo Tutorials

This tutorial is from Michael Urman's Cairo tutorial for Python programmers. The original code snippet has been translated into C, where the necessary changes have been made.

Cairo is a powerful 2D graphics library. This article will show you how Cairo works and many people will use it to write graphical applications.

Here are a few things you need to do to work on your computer:

      1. Cairo body. You will need two libraries and a development file. If you don't have one, see download.
      2. A C compiler, the FAQ contains a small example of how to convert the code to produce the required output program.

If you want to see a snippet of the action included in this tutorial, you can try clicking on some pictures. You will get a short C program, which includes the drawing code described.

In addition, if you are challenging yourself, you can rewrite the sample code into your preferred language and your host environment and use only Cairo.

Note: the cairo_push_group () and Cairo_pop_group ()mentioned in the article. Requires at least Cairo 1.2.0 or more versions.


    • The drawing model of Cairo
      • Noun
      • Verb
    • Cairo drawing
      • Preparing and selecting a signal source
      • Create path
      • Understanding text
    • Transform work
    • What's next?
    • Tips and Tricks
      • Line width
      • Text alignment

The drawing model of Cairo

To explain the operations used by Cairo, we first dive into how a model draws the Cairo model. Only a few concepts are involved, which are then repeated through different methods. First, I'll describe the noun: destination, source, mask, path, and environment. After that, I'll introduce the methods it provides to manipulate the nouns and verbs that guide the graphics you want to create.


Cairo nouns are more abstract. I want them to be more specific, including drawing how they interact with each other. The first three nouns you see in this section are three levels in the figure. The fourth noun, the path, is inhaled on the middle layer when it is relevant. The last noun, context, is not shown.

[In construction] Cairo Tutorials

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.