Professional Documents
Culture Documents
LAB Manual
PART A
Experiment No.12
A.1 Aim:
A.2 Prerequisite:
1. C Language.
2. Geometric Concepts.
3. Concept of 2D and 3Dbasic Transformations.
4. Projection Concepts.
A.3 Outcome:
After successful completion of this experiment students will be able to,
When the pattern in the figure copied to the area of the frame buffer, the 1 bits
designate which pixel positions to displayed on the monitor.
Bitmap fonts the simplest to define and display as character grid only need to be
mapped to a framebuffer position.
Bitmap fonts require more space because each variation (size and format) must
stored in a font cache.
It possible to generate different size and other variation from one set but this
usually does not produce the good result.
Outline Font: Character Generation
In this Character Generation method, a character generated using curve section and
straight line as combine assembly. The figure shows how it generated.
To display the character shown in the figure we need to fill interior region of the
character.
This method requires less storage since each variation does not require a distinct
font cache.
We can produce boldface, italic, or different sizes by manipulating the curve
definitions for the character outlines.
But this will take more time to process the outline fonts because they must scan
converted into the frame buffer.
Stroke Method: Character Generation
It uses small line segments to generate a character.
The small series of line segments drawn like a stroke of a pen to form a character as
shown in the figure.
We can generate our own stroke method by calling line drawing algorithm.
Here it is necessary to decide which line segments are needs for each character and
then draw that line to display character.
It supports scaling by changing a length of the line segment.
#include<stdio.h>
#include<conio.h>
#include<graphics.h>
void main()
{
intgd=DETECT,gm,i,j;
int a[20][20]=
{{0,0,0,1,1,1,0,0,0,0,0,0,0,0,1,1,1,1,0,0},
{0,0,1,0,0,0,1,0,0,0,0,0,0,1,0,0,0,0,1,0},
{0,1,0,0,0,0,0,1,0,0,0,0,1,0,0,0,0,0,0,1},
{1,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0},
{1,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0},
{1,0,0,0,0,0,0,0,0,0,0,1,0,0,0,1,1,1,1,0},
{1,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,1,0},
{0,1,0,0,0,0,0,1,0,0,0,1,0,0,0,0,0,0,1,0},
{0,0,1,0,0,0,1,0,0,0,0,0,1,0,0,0,0,1,0,0},
{0,0,0,1,1,1,0,0,0,0,0,0,0,1,1,1,1,0,0,0}};
initgraph(&gd,&gm,"c:\\tc\\bgi");
for(i=0;i<19;i++)
{
for(j=0;j<19;j++)
{
if(a[i][j]==1)
putpixel(100+j,200+i,WHITE);
}
}
getch();
}
PART B
BITMAP Method :-
#include<stdio.h>
#include<conio.h>
#include<graphics.h>
void main()
{
intgd=DETECT,gm,i,j;
int a[20][20]=
{{0,0,0,1,1,1,0,0,0,0,0,0,0,0,1,1,1,1,0,0},
{0,0,1,0,0,0,1,0,0,0,0,0,0,1,0,0,0,0,1,0},
{0,1,0,0,0,0,0,1,0,0,0,0,1,0,0,0,0,0,0,1},
{1,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0},
{1,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0},
{1,0,0,0,0,0,0,0,0,0,0,1,0,0,0,1,1,1,1,0},
{1,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,1,0},
{0,1,0,0,0,0,0,1,0,0,0,1,0,0,0,0,0,0,1,0},
{0,0,1,0,0,0,1,0,0,0,0,0,1,0,0,0,0,1,0,0},
{0,0,0,1,1,1,0,0,0,0,0,0,0,1,1,1,1,0,0,0}};
initgraph(&gd,&gm,"c:\\tc\\bgi");
for(i=0;i<19;i++)
{
for(j=0;j<19;j++)
{
if(a[i][j]==1)
putpixel(100+j,200+i,WHITE);
}
}
getch();
}
Stroke method -
#include <stdio.h>
#include <conio.h>
#include <graphics.h>
void main()
{
inti,j,k,x,y;
intgd=DETECT,gm;//DETECT is macro defined in graphics.h
/* ch1 ch2 ch3 ch4 are character arrays that display alphabets */
int ch1[][10]={ {1,1,1,1,1,1,1,1,1,1},
{1,1,1,1,1,1,1,1,1,1},
{0,0,0,0,1,1,0,0,0,0},
{0,0,0,0,1,1,0,0,0,0},
{0,0,0,0,1,1,0,0,0,0},
{0,0,0,0,1,1,0,0,0,0},
{0,0,0,0,1,1,0,0,0,0},
{0,1,1,0,1,1,0,0,0,0},
{0,1,1,0,1,1,0,0,0,0},
{0,0,1,1,1,0,0,0,0,0}};
int ch2[][10]={ {0,0,0,1,1,1,1,0,0,0},
{0,0,1,1,1,1,1,1,0,0},
{1,1,0,0,0,0,0,0,1,1},
{1,1,0,0,0,0,0,0,1,1},
{1,1,0,0,0,0,0,0,1,1},
{1,1,0,0,0,0,0,0,1,1},
{1,1,0,0,0,0,0,0,1,1},
{1,1,0,0,0,0,0,0,1,1},
{0,0,1,1,1,1,1,1,0,0},
{0,0,0,1,1,1,1,0,0,0}};
int ch3[][10]={ {1,1,0,0,0,0,0,0,1,1},
{1,1,0,0,0,0,0,0,1,1},
{1,1,0,0,0,0,0,0,1,1},
{1,1,0,0,0,0,0,0,1,1},
{1,1,1,1,1,1,1,1,1,1},
{1,1,1,1,1,1,1,1,1,1},
{1,1,0,0,0,0,0,0,1,1},
{1,1,0,0,0,0,0,0,1,1},
{1,1,0,0,0,0,0,0,1,1},
{1,1,0,0,0,0,0,0,1,1}};
int ch4[][10]={ {1,1,0,0,0,0,0,0,1,1},
{1,1,1,1,0,0,0,0,1,1},
{1,1,0,1,1,0,0,0,1,1},
{1,1,0,1,1,0,0,0,1,1},
{1,1,0,0,1,1,0,0,1,1},
{1,1,0,0,1,1,0,0,1,1},
{1,1,0,0,0,1,1,0,1,1},
{1,1,0,0,0,1,1,0,1,1},
{1,1,0,0,0,0,1,1,1,1},
{1,1,0,0,0,0,0,0,1,1}};
initgraph(&gd,&gm,"D:\\TC\\BGI");//initialize graphic mode
setbkcolor(LIGHTGRAY);//set color of background to darkgray
for(k=0;k<4;k++)
{
for(i=0;i<10;i++)
{
for(j=0;j<10;j++)
{
if(k==0)
{
if(ch1[i][j]==1)
putpixel(j+250,i+230,RED);
}
if(k==1)
{
if(ch2[i][j]==1)
putpixel(j+300,i+230,RED);
}
if(k==2)
{
if(ch3[i][j]==1)
putpixel(j+350,i+230,RED);
}
if(k==3)
{
if(ch4[i][j]==1)
putpixel(j+400,i+230,RED);
}
}
delay(200);
}
}
getch();
closegraph();
}
B.3 Observations and learning:
B.4 Conclusion:
Ans :-
Advantages :-
1. Allows you to roll another dice once you have finished rolled the initial eight and
substitute one of your initial rolls. The new number can not be lower than your
lowest initial roll.
Disadvantages :-
************************