AQA 7517, section 4.5.6.5
A vector graphic doesn't store pixels. Instead, it stores a list of geometric objects (shapes), and the properties of each one. When the image is displayed, the computer draws each shape from its description.
Objects and properties
The basic shapes are called primitives: lines, rectangles, circles, ellipses, polygons and curves. Each object in the list has properties that define it.
| Object | Typical properties |
|---|---|
| Line | Start point, end point, line colour, line thickness |
| Rectangle | Position of a corner, width, height, line colour, fill colour |
| Circle | Centre point (x, y), radius, line colour, line thickness, fill colour |
| Ellipse | Centre, horizontal radius, vertical radius, colours |
| Polygon | List of corner points, line colour, fill colour |
| Text | Position, font, size, colour, the text itself |
The picture is just the list of objects, stored in the order they are drawn, so later objects appear on top of earlier ones.
A simple example
Here is a small drawing described as a list:
| # | Object | Properties |
|---|---|---|
| 1 | Rectangle | x = 10, y = 60, width = 100, height = 50, line = black, fill = yellow |
| 2 | Polygon | points = (10,60), (60,20), (110,60), line = black, fill = red |
| 3 | Circle | centre = (85, 100), radius = 8, line = black, fill = blue |
That's a small house: a yellow body, a red roof and a blue round window. Changing any value, such as the radius of the circle, changes the picture.
Real vector file formats such as SVG are text files that list the shapes:
<svg width="120" height="120">
<rect x="10" y="60" width="100" height="50"
stroke="black" fill="yellow" />
<polygon points="10,60 60,20 110,60"
stroke="black" fill="red" />
<circle cx="85" cy="100" r="8"
stroke="black" fill="blue" />
</svg>
How a vector image is stored
The file contains:
- a list of objects, with their properties;
- the order in which to draw them;
- some metadata, such as the size of the drawing area.
Because it stores descriptions, the file is often small. A circle takes a few numbers whether it is tiny or huge.
Key features
- Scalable. The image can be enlarged to any size with no loss of quality, because the computer simply recalculates the shapes at the new size. A bitmap would show blocky pixels.
- Editable. Each object can be selected, moved, resized or recoloured separately, even after the drawing is finished.
- Small files for simple images, which are mostly flat colours and shapes.
- Drawn by calculation. Rendering can be slower for very complex drawings, because every shape must be computed.
Where vector graphics are used
- logos and icons, which must look sharp at any size;
- diagrams, charts and maps;
- fonts (each letter is a set of curves);
- technical and architectural drawings (CAD);
- animation and cartoons.
Worked example
Task: write a list of objects for a simple traffic light: a black rectangle 40 wide and 100 high with its top-left corner at (20, 10), and three circles of radius 15 stacked inside it, in red, amber and green, centred at x = 40.
| # | Object | Properties |
|---|---|---|
| 1 | Rectangle | x = 20, y = 10, width = 40, height = 100, fill = black |
| 2 | Circle | centre = (40, 30), radius = 15, fill = red |
| 3 | Circle | centre = (40, 60), radius = 15, fill = orange |
| 4 | Circle | centre = (40, 90), radius = 15, fill = green |
The rectangle comes first so that the circles are drawn on top of it. To make the whole traffic light twice the size, you would just double every number, and there would be no loss of quality.
Exam tip: say that a vector graphic is stored as a list of objects, each with properties (such as position, size, line colour and fill colour). Give examples of the properties for the shape that the question mentions.
Check yourself
How does a vector graphic store an image?
As a list of geometric objects (shapes), with the properties of each one stored in the list.
Give three properties of a circle in a vector graphic
Any three of: the centre position, the radius, the line colour, the line thickness, the fill colour.
Why can a vector graphic be enlarged without losing quality?
The shapes are recalculated at the new size from their descriptions, so there are no pixels to become blocky.