~evantj/imgtobraille

8ff9859b5f562fa35380bb7109e6a9d4d0627fa9 — Evan Johnston 1 year, 6 months ago d1e2c9c
style
2 files changed, 9 insertions(+), 9 deletions(-)

M braille.c
M main.c
M braille.c => braille.c +7 -7
@@ 20,7 20,7 @@ output_block(FILE *out, struct block cell)
	fputc('\xe2', out);
	fputc('\xa0' + (cell.pixels[7] << 1) + cell.pixels[6], out);
	char tmp = '\x80';
	for(int i = 0; i < 6; i++) {
	for (int i = 0; i < 6; i++) {
		tmp += cell.pixels[i] << i;
	}
	fputc(tmp, out);


@@ 31,7 31,7 @@ test(uint8_t colors[24])
{
	struct block output = { 0 };

	for(int i = 0; i < 8; i++) {
	for (int i = 0; i < 8; i++) {
		output.pixels[i] = true;
	}



@@ 64,20 64,20 @@ image_to_blocks(uint8_t *image, int w, int h)
		1, 3,
	};

	for(int y = 0; y < h; y++) {
		for(int x = 0; x < w; x++) {
	for (int y = 0; y < h; y++) {
		for (int x = 0; x < w; x++) {
			uint8_t pixel_block[24] = { 0 };

			int top_left = ((x * 2) + (y * w * 8)) * 3;

			for(int i = 0; i < 3; i++) {
				for(int n = 0; n < 8; n++) {
			for (int i = 0; i < 3; i++) {
				for (int n = 0; n < 8; n++) {
					pixel_block[n * 3 + i] =
						image[top_left + ((offsets[n * 2]) + offsets[n * 2 + 1] * w * 2) * 3 + i];
				}

			}
			for(int i = 0; i < 8; i++) {
			for (int i = 0; i < 8; i++) {
				output[y * w + x].pixels[i] = true;
			}


M main.c => main.c +2 -2
@@ 28,8 28,8 @@ main(int argc, char **argv)
	struct block *blocks = image_to_blocks(image, w, h);
	free(image);

	for(int y = 0; y < h; y++) {
		for(int x = 0; x < w; x++) {
	for (int y = 0; y < h; y++) {
		for (int x = 0; x < w; x++) {
			output_block(stdout, blocks[y * w + x]);
		}
		printf("\033[0m\n");