-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path10. Character Generation Using Bitmap Method
144 lines (131 loc) · 4.74 KB
/
10. Character Generation Using Bitmap Method
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
/********************************************************************************
TITLE : PROGRAM TO IMPLEMENT CHARACTER GENERATION USING THE BITMAP METHOD.
********************************************************************************/
#include <stdio.h>
#include <conio.h>
#include <graphics.h>
int main()
{
int i,j,k,x,y;
int gd=DETECT,gm;//Detects the graphics drivers automatically
initgraph(&gd,&gm,"");//Initialize to graphics mode
/* ch1 ch2 ch3 ch4 are character arrays that display alphabets */
int ch1[][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,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,0,1,0},
{0,0,1,1,1,1,1,1,0,0},
{0,0,0,1,1,1,1,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,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,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,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}};
for(k=0;k<7;k++)
{
for(i=0;i<10;i++)
{
for(j=0;j<10;j++)
{
if(k==0)
{
if(ch1[i][j]==1)
putpixel(j+150,i+230,14);
}
if(k==1)
{
if(ch2[i][j]==1)
putpixel(j+200,i+230,14);
}
if(k==2)
{
if(ch3[i][j]==1)
putpixel(j+250,i+230,14);
}
if(k==3)
{
if(ch4[i][j]==1)
putpixel(j+300,i+230,14);
}
if(k==4)
{
if(ch5[i][j]==1)
putpixel(j+350,i+230,14);
}
if(k==5)
{
if(ch6[i][j]==1)
putpixel(j+400,i+230,14);
}
if(k==6)
{
if(ch7[i][j]==1)
putpixel(j+450,i+230,14);
}
}
//delay(100);
}
}
getch(); //Pauses the Output Console until a key is pressed
closegraph(); //Closes the graphics mode
return 0;
}