CHAPTER 9: Android Graphic Design: Making Your UI Designs Visual 305
A medium color depth image, which is not supported in Android, but which I will discuss here, for
continuity of learning, will feature the 16-bit “high color” color depth. A high color image will contain
65,536 colors. This would be calculated as 256 times 256 (8-bit and 8-bit is 16-bit), and is supported
using TARGA (TGA) and Tagged Image File Format (TIFF) image formats, as well as the Windows
BMP digital image file format.
A 24-bit truecolor color depth image will feature the full 8-bit color data values for each RGB color
plate (color plane) and will be capable of displaying more than 16.7 million potential colors per
pixel. This is calculated as 256 times 256 times 256 (8-bit and 8-bit and 8-bit is 24-bit), and equals
16,777,216 colors. Android file formats which are capable of supporting 24-bit color include JPEG
(using a .jpg file extension), PNG24 and PNG32 (using a .png file extension), and WebP (using the
.webp extension).
Using 24-bit color depth will give you the highest digital image quality level, which is why Android
prefers the use of the PNG24 or the JPEG image file format. Since PNG24 is lossless, which means
that it loses no quality (and none of the original image’s data) during the compression process, it
has the highest quality compression (and the lowest original image data loss), along with the highest
quality color depth. This is the reason why PNG24 is the preferred digital image format to use as far
as the Android OS is concerned, because its usage will ultimately produce the highest quality visual
result for your Android applications.
It is important to note that there are higher color depth images out there, called HDRI, or High
Dynamic Range Images, that use 32-bit, 48-bit, and even 64-bit color depths. The hope is that the
Android OS (and device hardware) will probably move to support these extremely high digital image
color depth standards, which are currently being utilized for advanced i3D console games.
Representing Colors in Android: Hexadecimal Notation
Now that you know what color depth is, and that colors are represented as a combination of three
different red, green, and blue (RGB) color channels within any given image, we need to look at how,
as programmers, we are going to represent these three RGB color channel values inside of our
Android applications to create any single one of these 16,777,216 colors.
It is important to note that in the Android OS, color is not only used in digital images, commonly
called bitmap images, but also in 2D illustration, which is commonly referred to as shapes or
vector images, as well as in color settings, such as the background color value utilized in your user
interface screen, or for your textColor values, for instance, that define what color your text will be.
In Android, different levels of RGB color intensity are represented as data values using hexadecimal
notation. Hexadecimal notation is based on the original Base-16 computer notation used decades
ago to represent 16 bits of data value. Unlike Base-10, which counts from zero through 9, Base-16
counts from zero through F, where F would represent a Base-10 value of 15 (zero through 15 gives
you 16 data values).
To tell the Android OS that we are giving it a hexadecimal value, we preface these Base-16 values
using the pound sign, also known as a hash tag, like this: #FFFFFF. Because each slot in this 24-bit
hexadecimal representation represents one Base-16 value, to get the 256 values we need for each
RGB color will take 2 of these slots, as 16 times 16 equals 256. Thus, for a 24-bit image, we would
need 6 slots after the hash tag, and for a 32-bit image, we would need 8 slots after the hash tag. We
will be covering what these 32-bit type of digital images are, and what they are used for, during the
next section of this chapter.