0% found this document useful (0 votes)
74 views

Delhi Technological University: Computer Graphics Assignment 1

This document contains a computer graphics assignment submitted by three students to their professor. It includes four questions about computer graphics topics: 1. The differences between raster scan and random scan displays. 2. Explanations of the RGB and HSV color models. 3. Descriptions of graphics input and output devices. 4. Explanations of antialiasing, character generation, fill styles, and line attributes in computer graphics.

Uploaded by

Devender Baghel
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
74 views

Delhi Technological University: Computer Graphics Assignment 1

This document contains a computer graphics assignment submitted by three students to their professor. It includes four questions about computer graphics topics: 1. The differences between raster scan and random scan displays. 2. Explanations of the RGB and HSV color models. 3. Descriptions of graphics input and output devices. 4. Explanations of antialiasing, character generation, fill styles, and line attributes in computer graphics.

Uploaded by

Devender Baghel
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 8

DELHI TECHNOLOGICAL

UNIVERSITY

COMPUTER GRAPHICS
ASSIGNMENT 1

Submitted by: Submitted to:


DEEPAK (2K17/CO/099)
DEVENDER (2K17/CO/106) Dr. S. K. Saxena
NIKET(2K17/CO/205) Assistant Professor (A3)
Q1) Distinguish between random and raster scan display.
BASIS FOR
RASTER SCAN RANDOM SCAN
COMPARISON

Electron beam Swept across the screen and Directed to the portions of

handles one row at a time and the screen where a picture is

in downward direction. to be rendered.

Resolution Poor, since it generates Good, as this produces even

meander lines which are lines drawing.

organized as distinct point sets.

Picture Stored as the combination of Stored as a group of line

definition intensity values for all screen drawing instructions in a

points. display file.

Realistic Effectively displays realistic Unable to display realistic

display scenes. shaded scenes.

Picture Using pixels With the help of

rendering mathematical functions


Q2) Explain RGB and HSV colour model.
RGB Model:-
The RGB model's approach to colours is important because:

● It directly reflects the physical properties of "Truecolour" displays


● As of 2012, most graphics tools support it, even if they prefer another colour
model
● It is the only means of specifying a specific colour in the CSS2 standard for Web
pages
In the model, a colour is described by specifying the intensity levels of the colours
red, green, and blue. The typical range of intensity values for each colour, 0 - 255, is
based on taking a binary number with 32 bits and breaking it up into four bytes of 8
bits each. 8 bits can hold a value from 0 to 255. The fourth byte is used to specify the
"alpha", or the opacity, of the colour. Opacity comes into play when layers with
different colours are stacked. If the colour in the top layer is less than fully opaque
(alpha < 255), the colour from underlying layers "shows through", producing a
combined colour.
In the RGB model, hues are represented by specifying one colour as full intensity
(255), a second colour with a variable intensity, and the third colour with zero
intensity (0).
The following provides some examples using red as the full-intensity and green as the
partial-intensity colours; blue is always zero.

HSV Model:-

The HSV, or HSB, model describes colours in terms of hue, saturation, and value
(brightness).
Hue corresponds directly to the concept of hue in the Colour Basics section. The
advantages of using hue are

● The relationship between tones around the colour circle is easily identified
● Shades, tints, and tones can be generated easily without affecting the hue
Saturation corresponds directly to the concept of tint in the Colour Basics section,
except that full saturation produces no tint, while zero saturation produces white, a
shade of gray, or black.
Value corresponds directly to the concept of intensity in the Colour Basics section.
The advantage of HSV is that each of its attributes corresponds directly to the basic
colour concepts, which makes it conceptually simple. The perceived disadvantage of
HSV is that the saturation attribute corresponds to tinting, so desaturated colours
have increasing total intensity. For this reason, the CSS3 standard plans to support
RGB and HSL but not HSV.

Q3) Explain graphics input and output devices.


Basically, any device that converts analog information to a digital format that a
computer can “read” is a graphical input device. Mouse, digitizer, digital camera,
laser, measurement device etc.

For graphical output, the routines in the computer convert the (x,y) position, plus the
{r,g,b} colour sequences to points on a monitor. In this case, the computer tells the
graphics card what colours to paint at specific points on the monitor.

With the right program and information, the computer will input graphics
information (mouse, digitizer, distance measurements, etc.) and process this data
and present it in a graphical format to a montior (like Google maps, jpeg picture, DVD
movie, etc.)

Other types of graphical output would be a printer or plotter for ‘painting’ graphics
onto paper, a 3-d printer for creating blocks, gears, etc.

Q4) Explain the following:-


1) Antialiasing
2) Character generation
3) Fill style
4) Line attributes
1) Antialiasing:-
Antialiasing is a technique used in digital imaging to reduce the visual defects that
occur when high-resolution images are presented in a lower resolution. Aliasing
manifests itself as jagged or stair-stepped lines (otherwise known as jaggies) on
edges and objects that should otherwise be smooth.
Antialiasing makes these curved or slanting lines smooth again by adding a slight
discoloration to the edges of the line or object, causing the jagged edges to blur
and melt together. If the image is zoomed out a bit, the human eye can no longer
notice the slight discoloration that antialiasing creates.

2) Character Generation:-
Computer graphics involves display of picture, lines and other graphics like
designs. These picture and graph will belong to some data. Some information and
instruction should be given to the user about this data. This is possible with the
help of text display.
Since text consists of string of characters. so a character is a basic unit of text
There are three methods for character generation. These are:
1) Stroke Method
2) Bitmap Method
3) Starbust Method
a) STROKE METHOD
Stroke method is based on natural method of text written by human being. In this
method graph is drawing in the form of line by line.
Line drowing algorithm DDA follow this method for line drawing.
b) BITMAP METHOD
Bitmap method is a called dot-matrix method . as the name suggest this method
use array of bits fot generating a character. This dots are the points for array
whose size is fixed.
In bitmatrix method when the dots is stored in the form of array the value 1 in
array represent the characters i.e where the dots appear we represent that
position with numerical value 1 and the value where dots are not present is
reprented by 0 in array.
c) STARBUST METHOD
Starbust method is user in a particular pattern where only 24 strokes are defined
for character generation
3) Fill Style:-
The header file graphics.h contains setfillstyle() function which sets the current fill
pattern and fill colour. floodfill() function is used to fill an enclosed area. Current
fill pattern and fill colour is used to fill the area.

Syntax :
void setfillstyle (int pattern, int colour)
void floodfillstyle (int pattern, int colour)

Input : pattern = LTSLASH_FILL, Colour = RED


rectangle : left = 200, top = 200, right = 450, bottom = 450
floodfill : x = 201, y = 201, border_colour = 15

Output :

Below is the table showing some INT VALUES corresponding to Colours and
Patterns:
COLOR INT VALUES PATTERN INT VALUES

BLACK 0 EMPTY_FILL 0
BLUE 1 SOLID_FILL 1
GREEN 2 LINE_FILL 2
CYAN 3 LTSLASH_FILL 3
RED 4 SLASH_FILL 4
MAGENTA 5 BKSLASH_FILL 5
BROWN 6 LTBKSLASH_FILL 6
LIGHTGRAY 7 HATCH_FILL 7
DARKGRAY 8 XHATCH_FILL 8
4) Line Attributes:-
Line has 3 basic attributes:
-Line width
-Line color
-Line type

Line width:
- The line width depends on capability of the device to display it.
-In raster scan display the standard width line (or default line) is drawn with one
pixel at each sample position.
-To draw thicker line another parallel line is drawn adjacent to the first one.
-The command to set line width is: SetLinewidthScaleFactor (lw)

Line color:
-When we draw a line the default color of the line is displayed like for example the
color of line drawn in Microsoft paint is black.
-The number of color choices depends on the number of bits available per pixel in
the frame buffer.
-Then you can choose the color according to your own choice by setting the value
of the color with the command in PHIGS: SetPolylineColorIndex (lc).
-In Microsoft Paint we are given a drop down area to choose from different color
options.

Line types:

There are 3 types of lines:


-Solid Line

-Dashed Line

-Dotted Line

Solid line is the default line which is drawn with complete solid section for the
length specified.
-To set line type attributes in a PHIGS application the command is
setLinetype (It)
Dashed Line:
-To draw dashed line we generate an inter-dash spacing that is equal to the length
of the solid sections.
-So basically we specify the full length of the line and then length of the dashed
solid section and the length of the spacing which is usually in the color of
background.
-This forms dashed line.

Dotted line:
-To draw a dotted line very short dashes are drawn.
-In this dotted line the spacing between the dots (small dashes) can be equal to or
greater than the dash size.

You might also like