-
Notifications
You must be signed in to change notification settings - Fork 0
/
imgtransform.c
64 lines (56 loc) · 4.22 KB
/
imgtransform.c
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
// Convert normal raw image output (ie. GIMP C array output) to the vertical striped format of the SSD1306.
#include <stdio.h>
unsigned char src[512] = {
0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x07, 0xff, 0x3d, 0xff,
0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xbf, 0xff, 0x7d, 0xff,
0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xb7, 0xec, 0x3b, 0xff,
0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xcf, 0xf2, 0xbb, 0xff,
0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xdf, 0xff, 0xd3, 0xff,
0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xda, 0xe3, 0xdb, 0xfc,
0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xc9, 0x59, 0xdb, 0xf8,
0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xc7, 0x5d, 0xdb, 0xf1,
0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xb1, 0xa0, 0xdc, 0xe3,
0xfc, 0x00, 0x3f, 0xf9, 0xf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ff,
0xff, 0xe7, 0xcf, 0x39, 0xc6, 0x79, 0xff, 0x3c, 0x71, 0xce, 0x78, 0xff, 0x40, 0x58, 0x1d, 0xff,
0xff, 0xe7, 0xc0, 0x39, 0xe6, 0x78, 0x03, 0x00, 0x70, 0x0f, 0x01, 0xff, 0x98, 0x78, 0x01, 0xff,
0xff, 0xe7, 0xf0, 0xf9, 0xe2, 0x78, 0x03, 0x83, 0x32, 0x1f, 0x83, 0xff, 0xf0, 0x00, 0x0f, 0xff,
0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xf0, 0x7c, 0x0f, 0xff,
0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xe8, 0x00, 0x07, 0xff,
0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xec, 0x7e, 0x30, 0xff,
0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xf0, 0x00, 0x26, 0x7f,
0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xf8, 0xa2, 0x0f, 0x3f,
0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xf5, 0x01, 0x3e, 0xbf,
0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xfa, 0x00, 0x99, 0x7f,
0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xfc, 0x00, 0x03, 0xff
};
void main() {
for (unsigned int row_block = 0; row_block < 4; row_block++) {
for (unsigned int column = 0; column < 16; column++) {
for (unsigned int bitpos = 0; bitpos < 8; bitpos++) {
printf("0x%02x, ",
(((src[row_block * 8 * 16 + 0 * 16 + column] >> (7 - bitpos)) & 1) << 0) |
(((src[row_block * 8 * 16 + 1 * 16 + column] >> (7 - bitpos)) & 1) << 1) |
(((src[row_block * 8 * 16 + 2 * 16 + column] >> (7 - bitpos)) & 1) << 2) |
(((src[row_block * 8 * 16 + 3 * 16 + column] >> (7 - bitpos)) & 1) << 3) |
(((src[row_block * 8 * 16 + 4 * 16 + column] >> (7 - bitpos)) & 1) << 4) |
(((src[row_block * 8 * 16 + 5 * 16 + column] >> (7 - bitpos)) & 1) << 5) |
(((src[row_block * 8 * 16 + 6 * 16 + column] >> (7 - bitpos)) & 1) << 6) |
(((src[row_block * 8 * 16 + 7 * 16 + column] >> (7 - bitpos)) & 1) << 7));
}
if (column % 2 == 1) {
printf("\n");
}
}
}
}