aboutsummaryrefslogtreecommitdiff
path: root/brailleboi.c
blob: e04d17cebfc58ce41c7597ad987c8ec3942061e8 (plain)
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
#include <stdlib.h>
#include <stdio.h>
#include <wchar.h>
#include <locale.h>

#include "brailleboi.h"

int brailleInit(int width, int height, image_buffer* buf)
{
	setlocale(LC_ALL, "");
	buf->contents = malloc((width * height) * sizeof(int));
	buf->width = width;
	buf->height = height;
	return 0;
}

int brailleStop(image_buffer* buf)
{
	free(buf->contents);
	return 0;
}

int brailleReorganizeBits(int old)
{
	int new =	(old&0b10000111) |
				(old&0b01110000)>>1 |
				(old&0b00001000)<<3;
	return new;
}

void braillePrint(int data)
{
	wprintf(L"%lc", (0x2800|data));
}