Chapter 4. Textures

Table of Contents

1. Introduction
2. Drawing 2D graphics onto a texture
2.1. Problem
2.2. Solution
2.3. Discussion
3. Maintaining the aspect ratio when loading an image into a texture
3.1. Problem
3.2. Solution
3.3. Discussion
4. Loading image data into a texture
4.1. Problem
4.2. Solution
4.3. Discussion
5. Creating sub-textures from an existing texture
5.1. Problem
5.2. Solution
5.3. Discussion
5.4. Full example
5.5. Going further
6. Creating a reflection of a texture
6.1. Problem
6.2. Solution
6.3. Discussion
6.4. Full example
7. Cross-fading between two images
7.1. Problem
7.2. Solutions
7.3. Discussion
7.4. Full examples

A rock pile ceases to be a rock pile the moment a single man contemplates it, bearing within him the image of a cathedral.

Antoine de Saint-Exupery

1. Introduction

Textures are one of the most important actors in Clutter. Whether they are employed as the background for a user interface control, or to show the picture of a kitten, a big part of any Clutter-based application is going to involve textures.

A ClutterTexture is an actor that can hold any raw image data and paint it. ClutterTexture can also load image data from a file on disk and convert it.

Note

The actual formats supported by ClutterTexture depend on the platform on which Clutter is being used.