Reputation: 6228
I need to create a function that would receive an alphanumeric letter as parametter and return a NxM sized binary array, in which 1's and 0's would form the letter given.
For example, for letter A and B, the arrays could look like this:
00000110000 11111111100
00001001000 11000000011
00011001100 11000000011
00111111100 11111111110
01100000110 11000000011
11000000011 11000000011
11000000011 11000000011
11000000011 11111111111
tip: if you strech your eyes you can see the letters a bit better
The only way I know how to do this is by manually creating arrays for each character and insert them into switch-case. Which seems extremely dull and unprofessional.
Does anyone have a better idea?
Upvotes: 1
Views: 174
Reputation: 54433
I have answered a similar question here.
The OP there wanted to draw circles as his 'custom pixels'.
The idea is to draw the Characters you want in the size and font you like onto an (invisible) bitmap and then read the set pixels from it and write them in your 'custom pixels', i.e. your digits.
It may sound a bit daunting, but if you look at the code provided you'll see that it really is rather straightforward and it works quite well!
Upvotes: 2
Reputation: 1697
Here, the OCR Algorithms (Optical Character Recognition) are very useful.
You can create as already was suggested a bunch of pixels and than use this kind of algs.
In case you need something that already exists : http://digit.lk/optical-character-recognitionocr-in-c/ or try this one : http://www.codeproject.com/Articles/476142/Optical-Character-Recognition
Upvotes: 1