Introduction to Computer Graphics



Introduction to Computer Graphics

Computer Graphics is the branch of computing that deals with creating, storing, and manipulating visual images using computers.

Applications

  • Games 🎮
  • CAD (Computer-Aided Design)
  • Animation & Movies
  • Data Visualization
  • User Interfaces

Types of Computer Graphics

1. Raster Graphics (Bitmap)

  • Image made of pixels
  • Resolution dependent
  • Example: Photos
  • Realistic images
  • Quality decreases when zoomed

2. Vector Graphics

  • Image made of mathematical equations
  • Resolution independent
  • Scalable without loss
  • Less realistic

3. 2D Graphics

  • Flat images (x, y coordinates)

4. 3D Graphics

  • Includes depth (x, y, z)

Graphic Displays

A. Random Scan Display (Vector Display)

Working

  • Electron beam draws lines directly
  • No pixel grid

Advantages

  • High resolution for lines
  • Smooth edges

Disadvantages

  • Not suitable for filled images
  • Expensive

B. Raster Scan Display

Working

  • Screen divided into pixels
  • Beam scans line by line (top to bottom)

Advantages

  • Supports images, colors, shading
  • Widely used (TV, monitors)

Disadvantages

  • Aliasing (jagged edges)

Frame Buffer & Video Controller

Frame Buffer

  • Memory that stores pixel values
  • Each pixel has color/intensity info

Video Controller

  • Reads data from frame buffer
  • Sends signals to display device

Process:

  1. Data stored in frame buffer
  2. Video controller scans it
  3. Image displayed on screen

Points and Lines

Point

  • Basic unit → represented as (x, y)

Line

  • Straight connection between two points
  • Defined using slope:
m=y2y1x2x1m = \frac{y_2 - y_1}{x_2 - x_1

Line Drawing Algorithms

Why Needed?

To efficiently determine which pixels to turn ON to draw a line.

A. DDA (Digital Differential Analyzer)

Idea

  • Increment x and y step by step

Steps

  1. Calculate slope (m)
  2. Increment x or y
  3. Round values to nearest pixel

Advantages

  • Simple

Disadvantages

  • Floating point calculations
  • Less efficient

B. Bresenham’s Line Algorithm

Idea

  • Uses integer calculations only

Key Concept

  • Decision parameter to choose nearest pixel

Advantages

  • Faster than DDA
  • No floating-point operations

Disadvantages

  • Slightly complex

Circle Generating Algorithms

Equation of Circle:

x2+y2=r2x^2 + y^2 =

Methods

  • Direct method (slow)
  • Polar coordinates
  • Midpoint algorithm (most efficient)

Midpoint Circle Algorithm

Idea

  • Choose between two pixels based on midpoint

Key Concept

  • Uses 8-way symmetry
  • Only calculate one octant

Steps:

  1. Start at (0, r)
  2. Calculate decision parameter
  3. Choose next pixel
  4. Reflect to other octants

Advantages

  • Fast
  • Uses integer arithmetic

Parallel Version of Algorithms

Running algorithms simultaneously on multiple processors to improve speed.

Why Needed?

  • Graphics require real-time rendering

Examples

1. Parallel Line Drawing

  • Different segments drawn simultaneously

2. Parallel Circle Drawing

  • Each octant processed in parallel

Advantages

  • Faster rendering
  • Efficient for large graphics

Challenges

  • Synchronization
  • Load balancing

Final Summary Table

TopicKey IdeaAdvantage
Raster DisplayPixel-basedSupports images
Random ScanLine-basedSmooth lines
DDAIncrementalSimple
BresenhamInteger-basedFast
Midpoint CircleSymmetryEfficient
Parallel AlgorithmsMulti-processingHigh speed

Concept Flow

Graphics System → Display → Frame Buffer → Algorithms → Shapes (Lines & Circles)