0% found this document useful (0 votes)
32 views18 pages

CG-Lect 1 - Output Primitives

This document provides an overview of output primitives in computer graphics. It discusses raster and vector representations of pictures and how output primitives are used to describe scenes. The key output primitives covered are points, lines, and polygons. Points are the fundamental element and are defined by coordinates. Lines and polygons are represented by connecting multiple points. Scan conversion is explained as the process of representing graphics objects as pixels on a raster display. Attributes are used to define how primitives are displayed, such as color and size.

Uploaded by

rahul
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
32 views18 pages

CG-Lect 1 - Output Primitives

This document provides an overview of output primitives in computer graphics. It discusses raster and vector representations of pictures and how output primitives are used to describe scenes. The key output primitives covered are points, lines, and polygons. Points are the fundamental element and are defined by coordinates. Lines and polygons are represented by connecting multiple points. Scan conversion is explained as the process of representing graphics objects as pixels on a raster display. Attributes are used to define how primitives are displayed, such as color and size.

Uploaded by

rahul
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 18

CA 301: Computer Graphics and Multimedia

Systems

Dr. Aparna Shukla


Department of Computer Science and Engineering
BIT, Mesra (Lalpur Campus)
Lecture 1
Output Primitives in Computer Graphics
Picture Descriptions
• Raster:
 Completely specified by the set of intensities for the pixels positions in the
display.

 Shapes and colors are described with pixel arrays.

 Scene displayed by loading pixels array into the frame buffer.

• Vector:
 Set of complex objects positioned at specified coordinates locations within the
scene.

 Shapes and colors are described with sets of basic geometric structures.

 Scene is displayed by scan converting the geometric structure specifications


into the pixel patterns.
Output Primitives
• Basic geometric structures are used to describe the scenes

• Can be grouped into more complex structures

• Each one is specified with the input coordinate data and other information about

the way that object is to be drawn.

• Each of the output primitives has its own set of attributes.

• In order to draw the primitive objects, one has to first scan convert the objects.
Attributes Parameter of Output Primitives
• The way a primitive is to be displayed, referred as an attribute parameters.

• Some attribute parameters include color, size etc.

• Example:

• Line Type
Primitive Attributes • Line Width
• Color
Line

Primitives define what to draw and attributes define


how to draw.
Output Primitives - Attributes
Digital Representations
• Display screen is divided into scan lines and columns.

• Pixel Positions are referenced according to scan line number and column
number (column across the scan lines)

• Scan Lines start from 0 at screen bottom, and columns start from 0 at the
screen left side.

• Screen locations (or pixels) are referenced with integer values.

• The frame buffer stores the intensities temporarily

• Video controller reads from the frame buffer and plots the screen pixels.
Points
• Point is the fundamental element of picture representation.

• It is the position in the plan defined as either pair or triplets of number


depending upon the dimension.

• Two points represent line or edge and three or more points represents a polygon.

• Curved lines are represented by the short straight lines

• Point plotting is accomplished by converting a single coordinate position


furnished by an application program into appropriate operations for the output
device in use.
Points (contd.)
 Point plotting is done in CRT monitor by turning on the electron beam to
illuminate at the screen phosphor at the selected location.

 Random-scan systems: stores point plotting instructions in the display list and
co-ordinate values in these instructions are converted into deflection voltages
that position the electron beam at selected

 B/W raster system: Within frame buffer, bit value is set to 1 for specified
screen position. Electron beam then sweeps across each horizontal scan line, it
emits a burst of electrons (plots a point) whenever value of 1 is encountered in
the frame buffer.

 RGB raster system: Frame buffer is loaded with the color codes for the
intensities that are to be displayed at the screen pixel positions.
Points (contd.)
Syntax:

 The formula for the point to be plotted is

putpixel (x, y, color)

 Draws a single pixel on the monitor screen at specified (x, y) position.

Attributes: size, color

 SetPixelSize( n)- Draw pixel of size n * n where 𝑛𝑛 = 1, 2, 3, …

 SetPixelColor (c )- Set the color of line to color 𝑐𝑐 =


𝑅𝑅𝑅𝑅𝑅𝑅, 𝐺𝐺𝐺𝐺𝐺𝐺𝐺𝐺𝐺𝐺, 𝑌𝑌𝑌𝑌𝑌𝑌𝑌𝑌𝑌𝑌𝑌𝑌, … . .
Scan Conversion or Rasterization
 Primitives are defined using points, which have been mapped to the screen
coordinates.

 In Vector graphics, connect the points using a pen directly.

 In Raster graphics, create a discretized image of the whole screen onto the frame
buffer first. The image is scanned automatically onto the display periodically.

 It is a process of representing graphics objects a collection of pixels.

 The graphics objects are continuous. The pixels used are discrete. Each pixel can
have either on or off state.
Scan Converting a Point
 A mathematical point 𝑥𝑥, 𝑦𝑦 , where x and y are real numbers within the image area,

needs to be converted to a pixel location 𝑥𝑥 ′ , 𝑦𝑦 ′ .

 This can be done by making 𝑥𝑥 ′ to be the integer part of x and 𝑦𝑦 ′ the integer part of y,

i.e. 𝑥𝑥 ′ = 𝑓𝑓𝑓𝑓𝑓𝑓𝑓𝑓𝑓𝑓 𝑥𝑥 and 𝑦𝑦 ′ = 𝑓𝑓𝑓𝑓𝑓𝑓𝑓𝑓𝑓𝑓 𝑦𝑦 where function 𝑓𝑓𝑓𝑓𝑓𝑓𝑓𝑓𝑓𝑓 returns the

largest integer that is less than or equal to the argument.

 This essences place the origin of a continuous coordinate system 𝑥𝑥, 𝑦𝑦 at the lowest

left corner of the pixel grid in the image space


Scan Converting a Point
 All the points that satisfy 𝑥𝑥 ′ ≤ 𝑥𝑥 < 𝑥𝑥 ′ + 1 𝑎𝑎𝑎𝑎𝑎𝑎 𝑦𝑦 ′ ≤ 𝑦𝑦 < 𝑦𝑦 ′ + 1 are mapped
to the pixel 𝑥𝑥 ′ , 𝑦𝑦 ′ .

 For example:
 Display coordinates points 𝑃𝑃1 1.7, 0.8 is represented by the pixel 1, 0

 Points 𝑃𝑃2 2.2,1.3 be presented pixel (2, 1).


Scan Converting a Point
 Another Approach is to align the integer values in the coordinate system for 𝑥𝑥, 𝑦𝑦

with the pixel coordinates

 In this we scan 𝑥𝑥, 𝑦𝑦 by making 𝑥𝑥 ′ = 𝑓𝑓𝑓𝑓𝑓𝑓𝑓𝑓𝑓𝑓 𝑥𝑥 + 0.5 and 𝑦𝑦 ′ = 𝑓𝑓𝑓𝑓𝑓𝑓𝑓𝑓𝑓𝑓 𝑦𝑦 + 0.5 where

function 𝑓𝑓𝑓𝑓𝑓𝑓𝑓𝑓𝑓𝑓 returns the largest integer that is less than or equal to the

argument.

 This essentially places the origin of a coordinate system 𝑥𝑥, 𝑦𝑦 at the centre of the

pixel 0,0

 All the points that satisfy 𝑥𝑥 ′ − 0.5 ≤ 𝑥𝑥 < 𝑥𝑥 ′ + 0.5 𝑎𝑎𝑎𝑎𝑎𝑎 𝑦𝑦 ′ − 0.5 ≤ 𝑦𝑦 < 𝑦𝑦 ′ + 0.5 are

mapped to the pixel 𝑥𝑥 ′ , 𝑦𝑦 ′ .


Scan Converting a Point
 For example:
 Display coordinates point 𝑃𝑃1 1.7, 0.8 and point 𝑃𝑃2 2.2,1.3 are now both presented
pixel (2, 1) whereas point 𝑃𝑃3 2.8, 1.9 is represented by pixel (2, 1)
Next Lecture Agendas
 Line Output Primitive
Thanks

You might also like