CIE AS & A Level Computer Science, section 1.2 (Multimedia)
How a vector graphic works
A vector graphic is not stored as pixels. It is stored as a list of geometric shapes (a drawing list), and the picture is calculated when it is displayed.
- Drawing object: a shape such as a line, rectangle, circle or curve.
- Property: an attribute of an object, such as its position, size, line colour, line thickness or fill colour.
- Drawing list: the list of all the objects and their properties.
Example drawing list
| Object | Properties |
|---|---|
| Rectangle | x = 10, y = 10, width = 100, height = 50, fill = red |
| Circle | centre = (60, 35), radius = 20, fill = white, line = black |
Changing a property (such as the radius) just changes a number in the list, and the image is redrawn.
Advantages of vector graphics
- They can be scaled to any size without losing quality, because the shapes are recalculated.
- Files are usually small for simple images.
- Each object can be edited separately.
Disadvantages
- They are not suited to photographs, where each pixel can be a different colour.
- Complex drawings can need a lot of calculation to display.
Choosing between bitmap and vector
| Use | Best type | Reason |
|---|---|---|
| Photograph | Bitmap | Each pixel can be a different colour |
| Company logo, printed at many sizes | Vector | Scales without losing quality |
| Technical drawing | Vector | Precise shapes, editable objects |
| Scanned document | Bitmap | Made from a scanner's pixels |
Common mistake: saying vector graphics are "made of pixels" or that they "lose quality when enlarged". A vector graphic keeps its quality at any size. Bitmaps are the type that become pixelated.
Exam tip: when asked to justify a choice, name the task, give the image type, and give the reason (such as "needs to be resized without loss of quality, so a vector graphic is suitable").
Check yourself
What is a drawing list?
A list of the objects in a vector graphic together with the properties of each.
Why is a logo usually a vector graphic?
It can be scaled to any size without losing quality, and the file is small.
Why are photographs stored as bitmaps?
Each pixel can have a different colour, which shapes in a drawing list cannot describe efficiently.