Theory
Where the picture lives in memory
A raster display refreshes by reading the picture from memory many times a second. That memory is the frame buffer (or refresh buffer): the place where the colour of every pixel is stored.
When you 'draw' on a raster screen, you are really writing pixel values into the frame buffer, and the display hardware turns whatever the buffer holds into the image you see. This lesson explains the frame buffer, how bit depth sets the number of colours, and the simple formula for its size. It is the bridge between your drawing code and the pixels on screen.
Theory
One buffer, one value per pixel
The frame buffer holds one colour value per pixel. Each pixel on the screen corresponds to a location in this memory, so setting pixel (x, y) to a colour means storing that colour at the matching spot in the buffer.
How many colours a pixel can be depends on its bit depth, the number of bits per pixel: 1 bit stores 2 values (monochrome, black or white), 8 bits store 256 colours, and 24 bits store about 16 million colours (called true colour, enough for realistic images). More bits per pixel means more possible colours, but also more memory. The display continuously reads this buffer to refresh, which is why the picture you see is exactly what the frame buffer contains.
Formula
Frame buffer size = pixels times bits per pixel
The memory a frame buffer needs is easy to compute: size = number of pixels x bits per pixel (then convert to bytes).
Take a 640 x 480 screen. That is 640 x 480 = 307200 pixels. At 8 bits (1 byte) per pixel, the buffer is 307200 x 1 = 307200 bytes = 300 KB. At 24 bits (3 bytes) per pixel, it is 307200 x 3 = 921600 bytes, about 0.88 MB. So higher resolution and higher bit depth both increase the frame buffer's size, which is why richer images need more memory. This calculation is a common exam question, master it.
Quiz
A display is 640 x 480 pixels with 8 bits (1 byte) per pixel. How large is its frame buffer?
- About 1120 bytes (640 + 480)
- 307200 bytes (about 300 KB): 640 x 480 = 307200 pixels, times 1 byte each
- About 30 bytes
- 8 bytes, one per bit
Show the answer
307200 bytes (about 300 KB): 640 x 480 = 307200 pixels, times 1 byte each
Frame buffer size = number of pixels x bytes per pixel. The pixel count is 640 x 480 = 307200, and at 8 bits (1 byte) per pixel that is 307200 x 1 = 307200 bytes, which is 300 KB (307200 / 1024). Option A wrongly ADDS the dimensions (640 + 480) instead of multiplying them; a screen has width times height pixels, not width plus height. Option C and D are far too small and misuse the numbers. The method: multiply width by height for the pixel count, then multiply by the bytes per pixel; here 640 x 480 x 1 = 307200 bytes = 300 KB.
Think first
Why does more bit depth mean more memory, and does it matter?
Why does going from 8-bit to 24-bit colour triple the frame buffer, and when is that trade worth it? Then tap.
Show the answer
Because the frame buffer stores a colour value for EVERY pixel, and bit depth is how many bits each of those values takes, so tripling the bits per pixel triples the whole buffer, since it multiplies across all the pixels. At 8 bits per pixel, each of the 307200 pixels on a 640x480 screen uses 1 byte, for 300 KB. At 24 bits (3 bytes) per pixel, each pixel now uses three times as much, so the buffer becomes 921600 bytes, about 0.88 MB, exactly three times larger. The benefit you buy with those extra bits is COLOUR RANGE: 8 bits gives only 256 distinct colours, which is fine for simple graphics but shows visible banding on smooth gradients and cannot represent a realistic photograph, while 24 bits gives about 16 million colours (true colour), enough for photographic images with smooth, natural tones. So the trade is memory versus colour fidelity. Historically, when memory was scarce and expensive, lower bit depths were common to keep the frame buffer small, and clever tricks (like colour palettes) squeezed more apparent colour out of few bits. As memory got cheap, 24-bit (and higher) became standard because the richer colour is well worth the extra bytes for realistic displays. The same reasoning scales with RESOLUTION: more pixels also multiply the buffer. So designers balance resolution and bit depth against available memory and bandwidth, choosing enough of each for the images they need without wasting memory. More bits per pixel equals more colours equals more memory, a direct, multiplicative trade.
Summary
Key takeaways
- The frame buffer (refresh buffer) is the memory holding the colour of every pixel; the display reads it to refresh the screen.
- Each pixel maps to a location in the buffer; drawing means writing pixel values into it.
- Bit depth (bits per pixel) sets the number of colours: 1 bit = 2, 8 bits = 256, 24 bits = about 16 million (true colour).
- Frame buffer size = number of pixels x bits per pixel (converted to bytes).
- Example: 640 x 480 = 307200 pixels; at 8 bits = 300 KB; at 24 bits = about 0.88 MB.
- Higher resolution and higher bit depth both increase the frame buffer's memory needs.
- Memory hook: the frame buffer is one colour value per pixel; size = pixels times bits per pixel.