Introduction to Computer Graphics

Computer Graphics

Computer graphics is the art of drawing pictures, lines, and charts on a computer screen using programming languages. It involves creating images with the help of a computer, resulting in various outputs such as business graphs, drawings, and engineering designs. Computer graphics encompasses the representation and manipulation of image data by a computer in a graphical manner.

Computer graphics can be broadly classified into five categories:

  1. Business graphics (e.g., bar charts, pie charts)
  2. Scientific graphics (e.g., curve fittings, system program flowcharts)
  3. Scale drawings (e.g., architectural representations, machine designs)
  4. Cartoon and art
  5. Graphical User Interface (GUI)

Computer graphics have applications in various fields, including:

  • Digital photography
  • Film
  • Entertainment
  • Electronic gadget animation
  • Geometric object representation
  • Core technologies

Basic Elements of Computer Graphics

1. Lines

Lines are the fundamental building blocks of design. They can be continuous or broken, straight or curved, smooth or zigzag. Lines are used for outlining and dividing content. They can be easily defined using CSS or other graphical tools.

2. Shapes

Shapes are the second most used element in web design. Common shapes include circles, squares, rectangles, triangles, and various abstract forms.

3. Texture

Texture can make a design appear similar to a solid background color. Texture styles include paper, stone, concrete, fabric, natural elements, and flat or smooth colors.

4. Color

Color has a significant impact on design as it provides the most powerful visual impact at a glance.

5. Value

Value represents the darkness or lightness of a design. It plays a crucial role in creating contrast and depth in visual compositions.

Applications of Computer Graphics

Computer graphics have numerous applications, including:

1. Computer-Aided Design (CAD)

Used in engineering and architecture for designing systems, electrical components, automobiles, and electronic devices. Examples include gears and bolts.

2. Computer Art

Software like MS Paint enables users to create digital art.

3. Presentation Graphics

Used to present financial, statistical, scientific, or economic data through visual aids like bar charts, pie charts, and line graphs.

4. Entertainment

Widely used in motion pictures, music videos, television, and gaming.

5. Education and Training

Used to illustrate complex systems and provide simulations for training purposes, such as flight simulators for pilots.

Advantages of Computer Graphics

Computer graphics offer several advantages:

  • Effective communication tool.
  • Ability to create animations and moving pictures.
  • Dynamic updates allow for easy modification of object properties.
  • Immersive and realistic virtual experiences.
  • Increased productivity and time savings.

Display Devices

Display devices, also known as output devices, are essential for visualizing computer-generated graphics. The most common display device is the video monitor.

1. Refreshing Display Device: CRT

Cathode Ray Tube (CRT) monitors create images by storing electrons and controlling their flow. The display is continuously refreshed, typically 40 to 50 times per second, to maintain the image.

2. Liquid Crystal Display (LCD)

LCDs are commonly used in smaller devices like calculators and laptops. They are non-emissive displays that use polarized light passing through liquid crystal material to create images. LCD technology is also used in data projectors for displaying images on large screens.

Types of Display Systems

1. Random Scan Display Device

Random scan systems, also known as vector displays, use an electron beam to draw lines on a CRT screen. The image is constructed by a sequence of straight-line segments. Random scan monitors are well-suited for line-drawing applications but may not be ideal for displaying complex images.

2. Raster Scan Display

Raster scan displays, like televisions, create images by controlling the intensity of pixels arranged in a rectangular grid called a raster. Information about pixel states is stored in a refresh buffer or frame buffer. Raster scan displays are suitable for realistic image representation due to their ability to store pixel-specific information.

Frame Buffer

The frame buffer, also known as a raster or bit map, stores the pixel information for a raster scan display. Each position in the frame buffer corresponds to a pixel on the screen.

Difference Between Random and Raster Scan Displays

FeatureRandom ScanRaster Scan
ResolutionHighLow
CostMore expensiveLess expensive
ModificationEasyTough
Solid Pattern FillDifficultEasy
Refresh RateDepends on resolutionIndependent of picture complexity
Screen CoverageOnly the viewed area is displayedWhole screen is scanned
TechnologyBeam penetrationShadow mask
InterlacingNot usedUsed
ApplicationsLine drawing applicationsRealistic image display

Fundamental Techniques of Computer Graphics: Point and Line Drawing

Points and lines are the most basic elements in computer graphics. Lines are versatile and serve as the foundation for various other graphics primitives, such as polylines and simple geometric shapes.

Point plotting involves converting coordinate positions into corresponding operations for the output device, such as a CRT monitor.

Line drawing involves calculating intermediate positions along the line path between two specified endpoints.

Line Drawing Algorithms

1. Straight Line Equation

The equation y = mx + b represents a straight line, where:

  • m is the slope of the line.
  • b is the y-intercept.

2. Slope (m)

Calculated as: m = (y2 – y1) / (x2 – x1)

3. Y-intercept (b)

Calculated as: b = y1 – m * x1

4. Interval Calculation

Δy = m * Δx or Δx = Δy / m

DDA Algorithm

.

Algorithm:- Procedure / starting point(x0,y0) / Ending point(xn,yn)/ The point generation using bresenthams line drawing algorithm/ step 1 :-calclute Δx and  Δy / from the given input the parameter are calcluted as / Δx =   xn,yo /  Δ y =   yn,yo   / step 2 :- calclute the decision parameter (pk)/   pk   = 2Δy – Δx /     step 3 :- suppose the current point is ( axk  , yk) and the next point is/ (xk,    yk)   / next (xk+1,    yk+1) find the next point depending on the value of desecion parameter pk . /    fallow to below cases :- /   case 1:- if pk+1  k = pk+ 2Δy /   xk+1  = xk+1 /   yk+1 = xk  / case 2 :- if (pk>=0)   /    pk+1  = pk+2Δy – 2Δx /  xk+1 = xk+1  /  yk+1  = xk +1  / step 4 :- keep repating step 3until the end point is reached or number of interaction equal to (Δx – 1) times.