summaryrefslogtreecommitdiff
path: root/src/draw/ao_text.c
diff options
context:
space:
mode:
authorKeith Packard <keithp@keithp.com>2016-11-20 00:04:27 -0800
committerKeith Packard <keithp@keithp.com>2016-11-20 00:04:27 -0800
commite6518cf1ddfc087ca25fa1494f993ce03e43e138 (patch)
tree8351ae428fcfcc70c210803eba8bc4fb912b8302 /src/draw/ao_text.c
parent86f1c4b04946956f40755286bd9554828d5c8728 (diff)
altos/stm-vga: Implement VGA out from the STM processor
Generates vsync/hsync using timers and pixel data using the SPI port. 320x240 video using 640x480 mode and a 24MHz "pixel" clock. Includes the beginings of rendering code for the frame buffer, including bitblt, solid fill and text with a 5x7 font. Signed-off-by: Keith Packard <keithp@keithp.com>
Diffstat (limited to 'src/draw/ao_text.c')
-rw-r--r--src/draw/ao_text.c44
1 files changed, 44 insertions, 0 deletions
diff --git a/src/draw/ao_text.c b/src/draw/ao_text.c
new file mode 100644
index 00000000..68d6c2cf
--- /dev/null
+++ b/src/draw/ao_text.c
@@ -0,0 +1,44 @@
+/*
+ * Copyright © 2016 Keith Packard <keithp@keithp.com>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * General Public License for more details.
+ */
+
+#include "ao.h"
+#include "ao_draw.h"
+#include "ao_font.h"
+
+void
+ao_text(char *string,
+ uint32_t *dst_line,
+ int16_t dst_stride,
+ int16_t dst_x)
+{
+ char c;
+ uint32_t src[GLYPH_HEIGHT];
+
+ while ((c = *string++)) {
+ uint8_t *bytes = &glyph_bytes[glyph_pos[(uint8_t) c]];
+ int h;
+
+ for (h = 0; h < GLYPH_HEIGHT; h++)
+ src[h] = bytes[h];
+
+ ao_blt(src, 1, 0,
+ dst_line, dst_stride,
+ dst_x,
+ GLYPH_WIDTH,
+ GLYPH_HEIGHT,
+ AO_AND_INVERTED,
+ 0, 0);
+ dst_x += GLYPH_WIDTH;
+ }
+}