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
- 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:
- Data stored in frame buffer
- Video controller scans it
- Image displayed on screen
Points and Lines
Point
- Basic unit → represented as (x, y)
Line
- Straight connection between two points
- Defined using slope:
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
- Calculate slope (m)
- Increment x or y
- 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:
Methods
- Direct method (slow)
- Polar coordinates
- Midpoint algorithm (most efficient)
Midpoint Circle Algorithm
- Choose between two pixels based on midpoint
Key Concept
- Uses 8-way symmetry
- Only calculate one octant
Steps:
- Start at (0, r)
- Calculate decision parameter
- Choose next pixel
- 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
| Topic | Key Idea | Advantage |
|---|---|---|
| Raster Display | Pixel-based | Supports images |
| Random Scan | Line-based | Smooth lines |
| DDA | Incremental | Simple |
| Bresenham | Integer-based | Fast |
| Midpoint Circle | Symmetry | Efficient |
| Parallel Algorithms | Multi-processing | High speed |
Concept Flow
Graphics System → Display → Frame Buffer → Algorithms → Shapes (Lines & Circles)