You are on page 1of 7

Terna Engineering College

Computer Engineering Department


Program: Sem III

Course: Computer Graphics

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

A.4 Theory and Procedure:

Bitmap Font/ Bitmapped Font: Character Generation


A simple method for representing the character shapes in a particular typeface is to
use rectangular grid patterns.
The figure below shows the pattern for the particular letter.
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.

Starburst Method: Character Generation

In this Character Generation method, a fixed pattern of line segments used to


generate characters.
As shown in the figure there are 24 line segments.
We highlight those lines which are necessary to draw a particular character.
The pattern for the particular character stored in the form of 24-bit code. In which
each bit represents the corresponding line having that number.
That code contains 0 or 1 based online segment need to highlight. We put bit value 1
for highlighted line and 0 for other lines.
Code for letter V is
10011100001001100000000
This technique not used now a days because:
It requires more memory to store 24 bit code for single character.
Moreover, It requires conversion from code to character.
It doesn’t provide curve shapes.
For example

#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)

Roll No. C28 Name: Prathmesh Krishna Gaikwad


Class : SE-C Batch : B-1
Date of Experiment: 01/12/2021 Date of Submission: 01/12/2021
Grade :
B.1 Document created by the student:
OUTPUT:

B.3 Observations and learning:


Ans- By using the bit map font we generated characters and observed it on output
screen.

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

Q.1] Discuss different advantages and disadvantages of character generation techniques.


Ans-
Advantages-
-Bitmap fonts the simplest to define and display as character grid only need to be mapped
to a framebuffer position.
-With the help of character generation techniques like storke , starbust and bitmap
character can be generated using software.
-Various styles of characters can be created with the help of this techniques.

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.

You might also like