ATS/Cairo Tutorial

Hongwei Xi

This tutorial focuses on employing types in ATS to facilitate safe and reliable programming with cairo, a comprehensive drawing package supporting 2D graphics, through the API for cairo in ATS. In particular, it is demonstrated concretely that linear types can be used effectively to prevent resources (such as contexts and surfaces created for drawing) from being leaked due to programming errors. It is assumed that the reader have already acquired certain level of familiarity with ATS.

Permission is granted to copy, distribute and/or modify this document under the terms of the GNU Free Documentation License, Version 1.1 or any later version published by the Free Software Foundation; with no Invariant Sections, with no Front-Cover texts, and with no Back-Cover Texts. A copy of the license is included in the section entitled "GNU Free Documentation License".


Table of Contents
Preface
I. Basic Tutorial Topics
1. A Simple Example: Hello, world!
2. Types for Some Objects in Cairo
3. Types for Some Functions in Cairo
4. Drawing Lines
5. Drawing Rectangles and Circles
6. Drawing Text