Graphics systems and output primitives — Unit 1 Notes (Computer Graphics and Multimedia)

BCS604 · Unit 1

Graphics systems and output primitives notes — Unit 1

Free unit-wise study notes on graphics systems and output primitives for Computer Graphics and Multimedia, Semester 6 of B.Tech — Computer Science & Engineering — key concepts, examples, important questions and a revision checklist for semester exams.

Graphics systems and output primitives

Notebook — 14 pages

Page 1

Wink Notes

B.Tech CSE — 6th Semester

Computer Graphics and Multimedia

Unit - 1

1. Introduction to Computer Graphics

Computer Graphics refers to the methodology and techniques used to create, manipulate, and store geometric objects (modeling) and their images (rendering) using computers.

1.1 Core Components

  • Modeling: The process of describing an object in terms of mathematical coordinates and shapes.
  • Rendering: The process of generating an image from a model (adding color, light, shading).
  • Animation: The process of describing how models change over time.

The primary objective is to communicate information visually and interactively to the user.

Next — Applications

1 of 14

Page 2

Wink Notes

B.Tech CSE — 6th Semester

Computer Graphics and Multimedia

Unit - 1

2. Applications of Computer Graphics

The use cases for computer graphics span across nearly every modern industry.

  • CAD (Computer-Aided Design): Essential for engineering and architectural design. Software like AutoCAD is used to design everything from microchips to skyscrapers and automobiles.
  • Presentation Graphics: Generating charts, bar graphs, and visual reports to summarize data effectively.
  • Entertainment: The most visible application. CGI in movies, real-time 3D rendering in video games, and animated television shows.
  • Education and Training: Flight simulators, medical surgery simulators, and interactive learning environments.
  • Scientific Visualization: Converting massive datasets into visual imagery (e.g., fluid dynamics, weather patterns, molecular structures).

Next — Video Display Devices

2 of 14

Page 3

Wink Notes

B.Tech CSE — 6th Semester

Computer Graphics and Multimedia

Unit - 1

3. Video Display Devices: CRT

Historically, the Cathode Ray Tube (CRT) was the foundation of all computer monitors and televisions.

3.1 How a CRT works

  • 1. An Electron Gun emits a continuous beam of electrons.
  • 2. The beam passes through a Focusing System to narrow it into a sharp point.
  • 3. A Magnetic Deflection Yoke bends the beam to aim it at a specific spot on the screen.
  • 4. The screen is coated with Phosphor. When the electrons strike the phosphor, it absorbs the kinetic energy and emits a flash of light.

Because the light fades quickly, the beam must continuously redraw (refresh) the picture at least 60 times a second to prevent flickering.

Next — Raster vs Random Scan

3 of 14

Page 4

Wink Notes

B.Tech CSE — 6th Semester

Computer Graphics and Multimedia

Unit - 1

4. Raster-Scan vs Random-Scan

There are two fundamental ways a CRT can trace the electron beam to draw a picture.

4.1 Random-Scan (Vector Display)

The electron beam is directed only to the parts of the screen where a line is to be drawn. It draws lines mathematically from endpoint to endpoint. Used in early arcade games like Asteroids. Produces incredibly sharp lines but cannot easily draw solid filled shapes.

4.2 Raster-Scan

The electron beam sweeps horizontally across the entire screen, one row at a time, from top to bottom (like reading a book). As it sweeps, it turns the beam intensity on and off to create pixels. This is the foundation of all modern digital displays.

Next — Color CRT Displays

4 of 14

Page 5

Wink Notes

B.Tech CSE — 6th Semester

Computer Graphics and Multimedia

Unit - 1

5. Color CRT Technologies

Producing color requires manipulating Red, Green, and Blue light.

5.1 Beam-Penetration Method

Used primarily in random-scan monitors. The screen is coated with two layers of phosphor (typically red and green). A slow electron beam only hits the outer red layer. A fast beam penetrates through to the inner green layer. Intermediate speeds produce orange or yellow. It cannot produce full RGB color.

5.2 Shadow-Mask Method

Used in raster-scan monitors. There are three separate electron guns (R, G, B). A metal plate with holes (the shadow mask) sits directly behind the screen. The holes are aligned so that the red gun's beam can only strike the red phosphor dot in a pixel triad. This allows millions of colors.

Next — Flat Panel Displays

5 of 14

Page 6

Wink Notes

B.Tech CSE — 6th Semester

Computer Graphics and Multimedia

Unit - 1

6. Flat-Panel Displays

CRTs were heavy, bulky, and consumed massive amounts of power. Flat-panel displays replaced them.

6.1 Emissive vs Non-Emissive

  • Emissive Displays: Convert electrical energy directly into light. (e.g., Plasma panels, OLEDs).
  • Non-Emissive Displays: Use optical effects to convert sunlight or light from a separate backlight into graphics patterns. (e.g., standard LCDs).

6.2 Liquid Crystal Displays (LCD)

Liquid crystals are materials that share properties of both liquids and solid crystals. When an electrical voltage is applied, the crystals twist, blocking or allowing polarized light from a backlight to pass through color filters.

Next — Frame Buffers

6 of 14

Page 7

Wink Notes

B.Tech CSE — 6th Semester

Computer Graphics and Multimedia

Unit - 1

7. The Frame Buffer

In a raster-scan system, the screen is essentially a massive grid of discrete dots (pixels). The hardware needs to know what color every single pixel should be.

7.1 Definition

The Frame Buffer is a dedicated block of video memory (VRAM) that stores the color value for every pixel on the screen. The video controller constantly reads this memory 60 times a second and sends the signals to the monitor.

7.2 Color Depth

If a frame buffer allocates 1 bit per pixel, the screen can only show black and white. Modern systems allocate 24 bits per pixel (8 bits each for Red, Green, and Blue), allowing for 16.7 million distinct colors ('True Color').

Next — Output Primitives

7 of 14

Page 8

Wink Notes

B.Tech CSE — 6th Semester

Computer Graphics and Multimedia

Unit - 1

8. Output Primitives

To draw a house, you don't manually assign colors to 50,000 individual pixels in the frame buffer. You tell the graphics library to 'Draw a Line' or 'Draw a Polygon'. These basic building blocks are called Output Primitives.

8.1 Basic Primitives

  • Points: A single pixel at (x, y).
  • Lines: A straight path connecting (x1, y1) and (x2, y2).
  • Polygons: Closed shapes with straight edges used to build 3D geometry.
  • Curves and Circles: Mathematically defined arcs.
  • Text: Character strings rendered using bitmap fonts or vector fonts.

Next — Line Drawing Algorithms

8 of 14

Page 9

Wink Notes

B.Tech CSE — 6th Semester

Computer Graphics and Multimedia

Unit - 1

9. Line Drawing Algorithms

The mathematical equation of a line is continuous: `y = mx + c`.

However, a computer monitor is a discrete grid of pixels. You cannot illuminate pixel `(10.5, 7.2)`. You must illuminate either `(10, 7)` or `(11, 7)`. Line drawing algorithms calculate the optimal set of discrete integer pixels that best approximate the continuous mathematical line.

9.1 The Staircase Effect (Aliasing)

Because we are forcing a continuous line onto a grid of squares, diagonal lines will inevitably look jagged, like a staircase. This is called aliasing. (Anti-aliasing techniques attempt to blur these edges to hide it).

Next — DDA Algorithm

9 of 14

Page 10

Wink Notes

B.Tech CSE — 6th Semester

Computer Graphics and Multimedia

Unit - 1

10. The DDA Algorithm

The Digital Differential Analyzer (DDA) is the simplest line-drawing algorithm. It is an incremental method.

10.1 The Logic

  • Calculate `dx = x2 - x1` and `dy = y2 - y1`.
  • Determine the number of steps. If the line is more horizontal than vertical (`abs(dx) > abs(dy)`), take `abs(dx)` steps. Otherwise, take `abs(dy)` steps.
  • Calculate the increment per step: `xIncrement = dx / steps` and `yIncrement = dy / steps`.
  • Loop `steps` times, adding the increments to X and Y. Use the `Round()` function to find the nearest pixel to plot.

DDA is conceptually easy, but calculating `Round()` and doing floating-point division is computationally slow.

Next — Bresenham's Line Algorithm

10 of 14

Page 11

Wink Notes

B.Tech CSE — 6th Semester

Computer Graphics and Multimedia

Unit - 1

11. Bresenham's Line Algorithm

Invented by Jack E. Bresenham at IBM in 1962, this is a vastly superior algorithm because it avoids all floating-point math and division. It uses only integer addition, subtraction, and bit-shifting.

11.1 The Core Concept

Assume a line where X is increasing faster than Y (slope `m < 1`). At every X step, we MUST increment X by 1. The only question is: do we keep Y the same, or do we increment Y by 1?

Bresenham maintains an integer 'Decision Variable' (`P`).

  • If `P < 0`: The true mathematical line is closer to the bottom pixel. We do not increment Y. We update `P = P + 2dy`.
  • If `P >= 0`: The line is closer to the top pixel. We increment Y by 1. We update `P = P + 2dy - 2dx`.

Next — Circle Drawing

11 of 14

Page 12

Wink Notes

B.Tech CSE — 6th Semester

Computer Graphics and Multimedia

Unit - 1

12. Circle Generation Algorithms

Drawing a circle is more complex than drawing a line. The implicit equation is `x^2 + y^2 = r^2`. Solving for y yields `y = sqrt(r^2 - x^2)`. Calculating square roots for every pixel is disastrously slow.

12.1 Eight-Way Symmetry

A circle is perfectly symmetrical. We do not need to calculate all 360 degrees. We only need to calculate one Octant (a 45-degree slice, for example, from `x = 0` to `x = y`).

If we find that the pixel `(x, y)` lies on the circle in the first octant, we can instantly plot the other 7 symmetrical pixels: `(y, x)`, `(y, -x)`, `(x, -y)`, `(-x, -y)`, `(-y, -x)`, `(-y, x)`, and `(-x, y)`. This reduces the computation time by 87.5%.

Next — Mid-Point Circle Algorithm

12 of 14

Page 13

Wink Notes

B.Tech CSE — 6th Semester

Computer Graphics and Multimedia

Unit - 1

13. Mid-Point Circle Algorithm

Similar to Bresenham's line algorithm, this uses a decision parameter to avoid floating-point math and square roots.

13.1 The Logic

Starting at the top of the circle `(0, r)`, we increment X by 1 at each step. We must decide whether Y stays the same, or drops by 1.

The algorithm calculates a decision parameter `P` exactly at the midpoint between the two candidate pixels. If the midpoint falls inside the true circle, the top pixel is closer. If the midpoint falls outside the true circle, the bottom pixel is closer.

Next — Filled-Area Primitives

13 of 14

Page 14

Wink Notes

B.Tech CSE — 6th Semester

Computer Graphics and Multimedia

Unit - 1

14. Filled-Area Primitives

Drawing the outline of a shape is not enough; we often need to fill it with a solid color or pattern.

14.1 Scan-Line Polygon Fill

This algorithm sweeps a horizontal line across the screen from top to bottom. For each row, it calculates where the scan-line intersects the edges of the polygon. It then sorts these intersection points from left to right, and fills the pixels lying between pairs of intersections.

14.2 Boundary-Fill and Flood-Fill

  • Boundary-Fill: Start at an interior 'seed' point. Check the neighbors. If they are not the boundary color, color them, and recursively check their neighbors. (Like the MS Paint bucket tool).
  • Flood-Fill: Similar, but used when the interior has multiple colors, and you want to replace one specific target color with a new replacement color.

14 of 14

Continue in this subject