You are on page 1of 139

Computer Graphics and Multimedia

• Computer Graphics involves display, manipulation and storage of


pictures and experimental data for proper visualization using a
computer.
• Computer Graphics =Data Structure + Graphics algorithm + language
• Computer Graphics is the use of computers to create and manipulate
pictures on a display device. It comprises of software techniques to
create, store, modify, represents pictures.
• Pixel is the smallest element of an image.

• A pixel pel, or picture element is the


smallest addressable element in an all points
addressable display device; so it is the
smallest controllable element of a picture
Pixel represented on the screen
Megapixel

• A megapixel means one million pixels.


• The resolution of digital cameras and camera phones is often
measured in megapixels.
• For example, a 12-megapixel camera can produce images with 12
million total pixels.
• We can define pixel resolution of an image as 4500 X 5500.
• We can calculate mega pixels of a camera using pixel resolution.
Column pixels (width ) X row pixels ( height ) / 1 Million.(1,000,000)
THE CMY AND CMYK COLOR MODELS
• Cyan, magenta, and yellow are the secondary colors of light or, alternatively,
they are the primary colors of pigments. For example, when a surface coated
with cyan pigment is illuminated with white light, no red light is reflected from
the surface. That is, cyan subtracts red light from reflected white light, which
itself is composed of equal amounts of red, green, and blue light.

• Most devices that deposit colored pigments on paper, such as color printers
and copiers, require CMY data input or perform an RGB to CMY conversion
internally.

• This conversion is performed using the simple operation


• Equation (6-5) demonstrates that light reflected from a surface coated
with pure cyan does not contain red (that is, C =1-R in the equation).
• Similarly, pure magenta does not reflect green, and pure yellow does not reflect
blue. Equation (6-5) also reveals that RGB values can be obtained easily from a
set of CMY values by subtracting the individual CMY values from 1 .
• Equal amounts of the pigment primaries, cyan, magenta, and yellow, should
produce black.
• In practice, because C, M, and Y inks seldom are pure colors, combining these
colors for printing black produces instead a muddy-looking brown.
• So, in order to produce true black (which is the predominant color in printing), a
fourth color, black, denoted by K, is added, giving rise to the CMYK color model.
The black is added in just the proportions needed to produce true black.
• So when publishers talk about “four-color printing,” they are referring to the
three CMY colors, plus a portion of black.
Aspect Ratio: The Aspect ratio of picture is the ratio of its width to its height. It is normally shown by two
numbers separated by colon, as in 4:3. Here, the primary number tells that the picture is 4 units wide and the
subsequent number tells that the picture is 3 units high.
Image Depth
• Resolution measures the number of pixels in a digital image or
display. It is defined as width by height, or W x H, where W is the
number of horizontal pixels and H is the number of vertical pixels.
• For example, the resolution of an HDTV is 1920 x 1080.
• 1920 pixels wide and 1080 pixels high is expressed as a
resolution of 1920x1080.
• The aspect ratio is derived from this value: 16:9
• Aspect ratio is the ratio of the width of an image to the height of
the image (x:y).
Aspect Ratio
Up to 24 bits per pixel are included in high-quality systems, which can
require several megabytes of storage for the frame buffer, depending on the
resolution of the system.
A system with 24 bits per pixel and a screen resolution of 1024 by 1024
requires 3 megabytes of storage for the frame buffer. On a black-and-white
system with one bit per pixeI, the frame buffer is commonly called a bitmap.
For systems with multiple bits per pixel, the frame buffer is referred to as a
pixmap.
• Refreshing on raster-scan displays is carried out at the rate of 60 to 80
frames per second, although some systems are designed for higher refresh
rates.
• Sometimes, refresh rates are described in units of cycles per second, or Hertz
(Hz), where a cycle corresponds to one frame.
• Using these units, we would describe a refresh rate of 60 frames per second
as simply 60 Hz.
• At the end of each scan line, the electron beam returns to the left side of the
screen to begin displaying the next scan line.
• The return to the left of the screen, after refreshing each scan line, is called
the horizontal retrace of the electron beam.
• And at the end of each frame (displayed in 1/80th to 1/60th of a second),the
electron beam returns(vertical retrace) to the top left comer of the screen to
begin the next frame scan line, is called the horizontal retrace of the electron
beam.
• On some raster-scan systems (and in TV sets), each frame is displayed in two
passes using an interlaced refresh procedure.
• In the first pass, the beam sweeps across every other scan line from top to
bottom. Then after the vertical retrace, the beam sweeps out the remaining
scan lines .
• Interlacing of the scan lines in this way allows us to see the entire screen
displayed in one-half the time it would have taken to sweep all the lines at
once from top to bottom.
• Interlacing is primarily used with slower refreshing rates. On an older, 30
frames per-second, non interlaced display, for instance, some flicker is
noticeable. But
with interlacing, each of the two passes can be accomplished in 1/60th of a
second, which brings the refresh rate nearer to 60 frames per second. This is
an effective technique for avoiding flicker, providing that adjacent scan lines
contain similar display information.
• Image representation is essentially the description of pixel colors.
There are three primary colors: R (red), G (green) and B (blue). Each
primary color can take on intensity levels produces a variety of colors.
Using direct coding, we may allocate 3 bits for each pixel, with one bit
for each primary color. The 3-bit representation allows each primary
to vary independently between two intensity levels: 0 (off) or 1 (on).
Hence each pixel can take on one of the eight colors.
• A widely accepted industry standard uses 3 bytes, or 24 bytes,
per pixel, with one byte for each primary color. The way, we
allow each primary color to have 256 different intensity levels.
Thus a pixel can take on a color from 256 x 256 x 256 or 16.7
million possible choices. The 24-bit format is commonly referred
to as the actual color representation.
True Color System
• A widely accepted industry standard uses 3 bytes, or 24 bytes, per
pixel, with one byte for each primary color.
• The way, we allow each primary color to have 256 different intensity
levels.
• Thus a pixel can take on a color from 256 x 256 x 256 or 16.7 million
possible choices.
• The 24-bit format is commonly referred to as the actual color
representation.
• An RGB color system with 24 bits of storage per pixel is generally
referred to as a full-color system or a true-color system.
Computer Graphics
DDA Algorithm

• The digital deferential analyzer (DDA)is a scan-conversion line


algorithm
• Not smooth
• Using float
Circle Drawing Algorithm
Mid-Point Concept
DDA CIRCLE DRAWING ALGORITHM
Area Filling Algorithm
Inside Test (Even –odd Method)

Fig. 3.6
Fig. 3.8
Seed Fill
Boundary Fill Algorithm
Area Filling Algorithm
Flood Fill Algorithm
Scan Line Algorithm

You might also like