-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathValToAscii.cpp
More file actions
29 lines (19 loc) · 814 Bytes
/
ValToAscii.cpp
File metadata and controls
29 lines (19 loc) · 814 Bytes
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
#include "ValToAscii.h"
using namespace cid;
const unsigned char ValToAscii::asciiFull[70] = {
' ', '.', '\'', '`', '^', '"', ',', ':', ';', 'I',
'l', '!', 'i', '>', '<', '~', '+', '_', '-', '?',
']', '[', '}', '{', '1', ')', '(', '|', '\\', '/',
't', 'f', 'j', 'r', 'x', 'n', 'u', 'v', 'c', 'z',
'X', 'Y', 'U', 'J', 'C', 'L', 'Q', '0', 'O', 'Z',
'm', 'w', 'q', 'p', 'd', 'b', 'k', 'h', 'a', 'o',
'*', '#', 'M', 'W', '&', '8', '%', 'B', '@', '$'
};
const unsigned char ValToAscii::asciiShort[10] = {
' ', '.', ':', '-', '=', '+', '*', '#', '%', '@'
};
unsigned char ValToAscii::convert(unsigned char intensity, AsciiSet set) {
return (set == SET_FULL) ?
asciiFull[(unsigned char)(intensity * (70 / 256.))] :
asciiShort[(unsigned char)(intensity * (10 / 256.))];
}