Game Development Reference
In-Depth Information
An aspect ratio should always be expressed as the
smallest pair of numbers
that
can be achieved (reduced) on either side of the
colon
. If you paid attention in high
school while you were learning about the lowest common denominator, then an aspect
ratio will be very easy for you to calculate. I usually do aspect ratio calculation by con-
tinuing to divide each side of the colon by two. For example, if you take the
SXGA
1,280 × 1,024
resolution, half of 1,280 × 1,024 is 640 × 512, and half of 640 × 512 is
320 × 256; half of 320 × 256 is 160 × 128, half of that again is 80 × 64, half of that is
40 × 32, and half of that is 20 × 16; half of 20 × 16 is 10 × 8, and half of that gives you
the 5 × 4 aspect ratio for SXGA, which would be signified by using a colon between
the two numbers, as in a 5:4 aspect ratio.
Digital Image Color Theory and Color Depth: Defining
Precise Image Pixel Colors
The color values for each digital image pixel can be defined by the amount of three dif-
ferent colors,
red
,
green
, and
blue
(
RGB
), which are present in different amounts in
every pixel. Consumer electronics display screens leverage additive colors, in which
wavelengths of light for each RGB color channel are added together creating
16.8
mil-
lion different color values.
Additive color
is used in liquid crystal display (LCD),
light-emitting diode (LED), and organic light-emitting diode (OLED) displays. It is the
opposite of subtractive color, which is used in printing. To show you the different res-
ults, under a subtractive color model, mixing red with green (inks) will yield purple
colors, whereas in an additive color model, mixing red with green (light) creates a vi-
brant yellow coloration. Additive color can provide a much broader spectrum of colors
than subtractive color.
There are
256 levels
of brightness for each red, green, and blue color value that is
held for each pixel. This allows you to set
8 bits
of value-controlling color brightness
variation for each of the red, green, and blue values, from a minimum of
0
(
#00
, or off,
all dark, or black) to a maximum of
255
(#FF, or fully on, maximum color contributed).
The number of bits that are used to represent digital image pixel color is referred to as
the
color depth
of the image.
Common color depths used in the digital imaging industry include 8 bit, 16 bit, 24
bit and 32 bit. I will outline these here, along with their formats. The lowest color depth
exists in
8-bit indexed color
images. These feature a maximum of 256 color values
and use
GIF
and
PNG8
image formats to hold this indexed color type of data.
A medium color depth image will feature a 16-bit color depth and will thus contain
65,536 colors (calculated as 256 × 256). It is supported by the TARGA (TGA) and