Java Reference
In-Depth Information
SR 2.37 Assume you already have instantiated a Scanner object named
myScanner and an int variable named value as follows in your
program:
Scanner myScanner = new Scanner (System.in);
int value = 0;
Write program statements that will ask the user to enter their age, and
store their response in value .
2.7 Graphics
Graphics play a crucial role in computer systems. Throughout this topic we explore
various aspects of graphics and discuss how they are accomplished. In fact, the last
one or two sections of each chapter are devoted to graphics topics. We refer to this as
the Graphics Track through the topic. These sections can be skipped without losing
continuity through the rest of the text, incorporated into the
regular flow of the chapters, or explored as a group.
KEY CONCEPT
Graphical data is represented by
dividing it into many small pieces
called pixels.
A picture, like all other information stored on a computer,
must be digitized by breaking the information into pieces
and representing those pieces as numbers. In the case of pic-
tures, we break the picture into pixels (picture elements). A
pixel is a tiny region that represents a very small piece of the picture. The complete
picture is stored by storing the color of each individual pixel.
A digitized picture can be reproduced when needed by reassembling its pixels.
The more pixels used to represent a picture, the more realistic it looks when it is
reproduced. The number of pixels used to represent a picture is called the
picture
resolution . The number of pixels that can be displayed by a monitor is called the
monitor resolution .
A black and white picture can be stored by representing each pixel using a
single bit. If the bit is 0, that pixel is white; if the bit is 1, it is black. Figure 2.8
shows a black and white picture that has been stored digitally and an enlargement
of a portion of that picture, which shows the individual pixels.
Coordinate Systems
When drawn, each pixel of a picture is mapped to a pixel on the monitor screen.
Each computer system and programming language defines a coordinate system so
that we can refer to particular pixels.
 
Search WWH ::




Custom Search