Lecture 1
Lecture 1
Lecture 1
Computer Graphics is a rendering tool for the generation and manipulation of images. Thus, by using a
computer as a rendering tool for the generation and manipulation of images is called computer graphics.
Computer graphics is an art of drawing pictures on computer screens with the help of programming. It
involves computations, creation, and manipulation of data. Graphics is a vast field that encompasses almost
any graphical aspect like special effects, simulation and training, games, medical imagery, animations and
much more.
“Computer Graphics refers to any sketch, drawing, special artwork or other material generated with the
help of computer to pictorially depict an object or a process or convey information, as a supplement to
or instead of written descriptions”.
It relies on an internal model of the scene, that is, a
mathematical representation suitable for
graphical computations.
The model describes the 3D shapes, layout, projections to
compute a 2D image from a given viewpoint and rendering which
involves projecting the objects (perspective),handling visibility
(which parts of objects are hidden) and computing their
appearance and lighting interactions and materials of the scene.
Types of Graphics
There are 2 types of Graphics:
◦ Raster Graphics – defined by pixel (picture element)
◦ Vector Graphics – defined by lines
Raster Graphics
Raster graphics or Bitmap image is a dot matrix data structure that represents a generally
rectangular grid of pixels (points of color), viewable via a monitor, paper, or other display
medium. Raster images are stored in image files with varying formats.
A bitmap is a rectangular grid of pixels, with each pixel's color being specified by a number of
bits. A bitmap might be created for storage in the display's video memory or as a device-
independent bitmap file.
A raster is technically characterized by the width and height of the image in pixels and by the
number of bits per pixel (or color depth, which determines the number of colors it can
represent).
Raster Graphics (cont.)
The printing and prepress industries know raster graphics as contones (from "continuous tones
"). The opposite to contones is "line work", usually implemented as vector graphics in digital
systems.
Vector images can be rasterized (converted into pixels), and raster images vectorized (raster
images converted into vector graphics), by software.
In both cases some information is lost, although certain vectorization operations can recreate
salient information, as in the case of optical character recognition.
Raster Graphics (Cont.)
It originates from the raster scan of cathode ray tube (CRT) video monitors,
which paint the image line by line by magnetically or electrostatically steering a
focused electron beam. By association, it can also refer to a rectangular grid of
pixels.
Computer displays
Most modern computers have bitmapped displays, where each on-screen pixel
directly corresponds to a small number of bits in memory. The screen is
refreshed simply by scanning through pixels and coloring them according to
each set of bits. The refresh procedure, being speed critical, is often
implemented by dedicated circuitry, often as a part of a
graphics processing unit.
Raster Graphics (Cont.)
Using this approach, the computer contains an area of memory that holds all the data that are
to be displayed. The central processor writes data into this region of memory and the video
controller collects them from there. The bits of data stored in this block of memory are related
to the eventual pattern of pixels that will be used to construct an image on the display.
An early scanned display with raster computer graphics was invented in the late 1960s by A.
Michael Noll at Bell Labs, but its patent application filed February 5, 1970 was abandoned at
the Supreme Court in 1977 over the issue of the patentability of computer software.
Vector Graphics
Vector graphics are computer graphics images that are defined in terms of points on a
Cartesian plane, which are connected by lines and curves to form polygons and other shapes.
Vector graphics have the unique advantage over raster graphics in that the points, lines, and
curves may be scaled up or down to any resolution with no aliasing.
The points determine the direction of the vector path; each path may have various properties
including values for stroke color, shape, curve, thickness, and fill.
Vector Graphics (cont.)
Instead of sectioning off a large region of computer memory and mapping that to the display
device, vector display devices use a variable number of lines to create images—hence the term
"vector graphics." Since vector display devices can define a line by dealing with just two points
(that is, the coordinates of each end of the line), the device can reduce the total amount of data
it must deal with by organizing the image in terms of pairs of points.
Vector graphics are commonly found today in the SVG, EPS, PDF or AI types of
graphic file formats, and are intrinsically different from the more common raster graphics file
formats such as JPEG, PNG, APNG, GIF, and MPEG4.
Vector Graphics (cont.)
Vector graphic displays were first used in 1958 by the US SAGE air defense system. Vector graphics
systems were retired from the U.S. en route air traffic control in 1999. Vector graphics were also used
on the TX-2 at the MIT Lincoln Laboratory by computer graphics pioneer Ivan Sutherland to run his
program Sketchpad in 1963.
Subsequent vector graphics systems, most of which iterated through dynamically modifiable stored
lists of drawing instructions, include the IBM 2250, Imlac PDS-1, and DEC GT40. There was a video
game console that used vector graphics called Vectrex as well as various arcade games like Asteroids,
Space Wars and many cinematronics titles such as Rip-Off, and Tail Gunner using vector monitors.
Storage scope displays, such as the Tektronix 4014, could display vector images but not modify them
without first erasing the display.
Vector Graphics (cont.)
Standards
The World Wide Web Consortium (W3C) standard for vector graphics is Scalable Vector Graphics
(SVG). The standard is complex and has been relatively slow to be established at least in part owing
to commercial interests. Many web browsers now have some support for rendering SVG data but full
implementations of the standard are still comparatively rare.
Modern displays and printers are raster devices; vector formats have to be converted to raster
format (bitmaps – pixel arrays) before they can be rendered (displayed or printed). The size of the
bitmap/raster-format file generated by the conversion will depend on the resolution required, but
the size of the vector file generating the bitmap/raster file will always remain the same.
Vector Graphics (cont.)
Vector art is ideal for printing since the art is made from a series of mathematical curves, it will print
very crisply even when resized. For instance, one can print a vector logo on a small sheet of copy
paper, and then enlarge the same vector logo to billboard size and keep the same crisp quality. A
low-resolution raster graphic would blur or pixelate excessively if it were enlarged from business card
size to billboard size.
If we regard typographic characters as images, then the same considerations that we have made for
graphics apply even to the composition of written text for printing (typesetting). Older character sets
were stored as bitmaps. Therefore, to achieve maximum print quality they had to be used at a given
resolution only; these font formats are said to be non-scalable. High-quality typography is nowadays
based on character drawings (fonts) which are typically stored as vector graphics, and as such are
scalable to any size. Examples of these vector formats for characters are Postscript fonts and
TrueType fonts.
Advantages of Vector Graphics over
Raster
Advantages to this style of drawing over raster graphics:
Because vector graphics consist of coordinates with lines/curves between them, the size of representation does
not depend on the dimensions of the object. This minimal amount of information translates to a much smaller
file size compared to large raster images which are defined pixel by pixel. This said, a vector graphic with a small
file size is often said to lack detail compared with a real world photo.
Correspondingly, one can infinitely zoom in on e.g., a circle arc, and it remains smooth. On the other hand, a
polygon representing a curve will reveal being not really curved.
On zooming in, lines and curves need not get wider proportionally. Often the width is either not increased or less
than proportional. On the other hand, irregular curves represented by simple geometric shapes may be made
proportionally wider when zooming in, to keep them looking smooth and not like these geometric shapes.
The parameters of objects are stored and can be later modified. This means that moving, scaling, rotating, filling
etc. doesn't degrade the quality of a drawing. Moreover, it is usual to specify the dimensions in device-
independent units, which results in the best possible rasterization on raster devices.
From a 3-D perspective, rendering shadows is also much more realistic with vector graphics, as shadows can be
abstracted into the rays of light from which they are formed. This allows for photorealistic images and renderings.
Vector Graphics (cont.)
For example, consider a circle of radius r.
The main pieces of information a program needs in order to draw this circle are:
an indication that what is to be drawn is a circle
the radius r
the location of the center point of the circle
stroke line style and color (possibly transparent)
fill style and color (possibly transparent)
Disadvantages of Vector Graphics
over Raster
Vector formats are not always appropriate in graphics work and also have numerous disadvantages.
For example, devices such as cameras and scanners produce essentially continuous-tone
raster graphics that are impractical to convert into vectors, and so for this type of work, an image
editor will operate on the pixels rather than on drawing objects defined by mathematical
expressions.
Comprehensive graphics tools will combine images from vector and raster sources, and may
provide editing tools for both, since some parts of an image could come from a camera source, and
others could have been drawn using vector tools.
Some authors have criticized the term vector graphics as being confusing. In particular, vector
graphics does not simply refer to graphics described by Euclidean vectors. Some authors have
proposed to use object-oriented graphics instead. However this term can also be confusing as it can
be read as any kind of graphics implemented using object-oriented programming.
Vector Graphics (cont.)
Typical primitive objects
Any particular vector file format supports only some kinds of primitive objects. Nearly all vector file
formats support simple and fast-rendering primitive objects - Lines, polylines and polygons, Bézier
curves and bezigons, Circles and ellipses
Most vector file formats support:
Text (in computer font formats such as TrueType where each letter is created from Bézier curves) or
quadratics, Color gradients, often, a bitmap image is considered as a primitive object. From the
conceptual view, it behaves as a rectangle.
A few vector file formats support more complex objects as primitives:
Many computer-aided design applications support splines and other curves, such as:
◦ Catmull–Rom splines and NURBS