Delhi Technological University: Computer Graphics Assignment 1
Delhi Technological University: Computer Graphics Assignment 1
UNIVERSITY
COMPUTER GRAPHICS
ASSIGNMENT 1
Electron beam Swept across the screen and Directed to the portions of
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.
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.
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)
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:
-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.