CHARACTER GENERATION IN COMPUTER GRAPHICS

Computer graphics involves display of picture, lines and other graphics like designs.These picture and graph will belongs to some data. Some information and instruction should be given to the user about this data. This is posssible with the help of text display.

Since text consists of string of characters. so a character is a basc unit of text
There are three methods for character generation. These are:
1) Stroke Method
2) Bitmap Method
3) Starbust Method

1)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.

2)BITMAP METHOD

Bitmap method is a called dotmatrix 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.

3)STARBUST METHOD

Starbust method is user in a particular pattern where only 24 strokes are defined for character generation

 

This program is for Character Generation. 

#include<stdio.h>

#include<conio.h>

#include<graphics.h>

main()

{

            int gd,gm,i,j;

            /* Save character map of letter A */

           // You can make your changes in the below array

            int a[13][9] = {

                                    { 0, 0, 0, 0, 1, 0, 0, 0, 0},

                                    { 0, 0, 0, 1, 0, 1, 0, 0, 0},

                                    { 0, 0, 1, 0, 0, 0, 1, 0, 0},

                                    { 0, 1, 0, 0, 0, 0, 0, 1, 0},

                                    { 0, 1, 0, 0, 0, 0, 0, 1, 0},

                                    { 0, 1, 0, 0, 0, 0, 0, 1, 0},

                                    { 0, 1, 1, 1, 1, 1, 1, 1, 0},

                                    { 0, 1, 0, 0, 0, 0, 0, 1, 0},

                                    { 0, 1, 0, 0, 0, 0, 0, 1, 0},

                                    { 0, 1, 0, 0, 0, 0, 0, 1, 0},

                                    { 0, 1, 0, 0, 0, 0, 0, 1, 0},

                                    { 0, 1, 0, 0, 0, 0, 0, 1, 0},

                                    { 0, 1, 0, 0, 0, 0, 0, 1, 0},

                              };

            /* Initialise graphics mode */

            detectgraph(&gd,&gm);

            initgraph(&gd,&gm,”c:\\tc\\bgi”);

            for(i=0;i<13;i++)

            {

                        for(j=0;j<9;j++)

                        {

                                    putpixel(200+j,200+i,15*a[i][j]);

                        }

            }

            getch();

            closegraph();

}

 

Author: Deepak Chahar

Leave a Reply

Your email address will not be published. Required fields are marked *