CG Exp11 C28
CG Exp11 C28
CG Exp11 C28
Faculty:
LAB Manual
PART A
(PART A : TO BE REFFERED BY STUDENTS)
Experiment No.11
A.1 Aim:
Character Generation : Bit Map method and Stroke Method
A.2 Prerequisite:
1. C Language.
2. Geometric Concepts.
3. Concept of 2D and 3D basic Transformations.
4. Projection Concepts.
A.3 Outcome:
After successful completion of this experiment students will be able to,
Apply Character Generation techniques
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()
{
int gd=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
(PART B : TO BE COMPLETED BY STUDENTS)
B.4 Conclusion:
Ans- Hence, we have successfully learned to apply Bit Map method and Stroke Method
& implements in C.
B.5 Question of Curiosity
Disadvantages-
-All the character generation techniques create aliased characters
-In Starbust method 24-bit memory is required to put in memory for generating character
Hence extra memory is required in this method. Character quality is less due to limited
face
-Starbust method does not provide curve shapes
-Bitmap fonts require more space, because each variation must be stored.