forked from kunaaljain/captchproj
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmain.cpp
More file actions
67 lines (56 loc) · 1.14 KB
/
main.cpp
File metadata and controls
67 lines (56 loc) · 1.14 KB
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
// add numbers
// radnomize
// scalable
// add nose
// --- lines,dots,circle use ur imagination
// distortion
// option to hollow font
#include <cstdio>
#include <cstdlib>
#include <iostream>
#include <string>
#include <fstream>
#include "font.hpp"
#include "bitmap_image.hpp"
int letters[26][2];
void init()
{
int i,count=0,j=0;
letters[0][0]=0;
letters[25][1]=1327;
for(i=0;i<1328;i++)
{
if(im[0][i]=='a'){
letters[j++][1]=i-1;
letters[j][0]=i+1;
}
}
}
int main()
{
init();
std::string str="kunal";
int offset=0,x;
const unsigned int dim = 100;
bitmap_image image(180,52); // (w,h)
for (unsigned int y = 0; y < 52; ++y)
{
for (unsigned int x = 0; x < 180; ++x)
{
image.set_pixel(x,y,0,0,100); //(r,g,b)
}
}
for(unsigned int k=0; k<str.length(); ++k)
{
for (unsigned int y = 0; y < 52; ++y)
{
for (x = letters[str[k]-'a'][0]; x < letters[str[k]-'a'][1]; ++x)
{
if(im[y][x]!=' ') image.set_pixel(offset+x-letters[str[k]-'a'][0],y,0,100,0);
}
}
offset=offset+letters[str[k]-'a'][1]-letters[str[k]-'a'][0]-15;
}
image.save_image("myimg.bmp");
return 0;
}