summaryrefslogtreecommitdiff
path: root/src/draw/ao_text.c
diff options
context:
space:
mode:
authorKeith Packard <keithp@keithp.com>2016-11-20 21:02:59 -0800
committerKeith Packard <keithp@keithp.com>2016-11-20 21:02:59 -0800
commitc5734e9e38bc583aff305e3c534cfb8b9088bc71 (patch)
treef02f3dafea7e704a7164011700c56289ab9fed0a /src/draw/ao_text.c
parent83cfc271e37f568cb1d821cf6a96750f3ca3854c (diff)
altos/draw: Add a reasonable API for drawing, add lines.lisp
Also, move the demo drawing into the stm-vga app and out of the vga driver. Signed-off-by: Keith Packard <keithp@keithp.com>
Diffstat (limited to 'src/draw/ao_text.c')
-rw-r--r--src/draw/ao_text.c51
1 files changed, 36 insertions, 15 deletions
diff --git a/src/draw/ao_text.c b/src/draw/ao_text.c
index 68d6c2cf..18e3924d 100644
--- a/src/draw/ao_text.c
+++ b/src/draw/ao_text.c
@@ -14,31 +14,52 @@
#include "ao.h"
#include "ao_draw.h"
+#include "ao_draw_int.h"
#include "ao_font.h"
+const struct ao_font ao_font = {
+ .width = GLYPH_WIDTH,
+ .height = GLYPH_HEIGHT,
+ .ascent = GLYPH_ASCENT,
+ .descent = GLYPH_HEIGHT - GLYPH_ASCENT,
+};
+
void
-ao_text(char *string,
- uint32_t *dst_line,
- int16_t dst_stride,
- int16_t dst_x)
+ao_text(const struct ao_bitmap *dst,
+ int16_t x,
+ int16_t y,
+ char *string,
+ uint32_t fill,
+ uint8_t rop)
{
- char c;
uint32_t src[GLYPH_HEIGHT];
+ char c;
+ int h;
+
+ struct ao_bitmap src_bitmap = {
+ .base = src,
+ .stride = 1,
+ .width = GLYPH_WIDTH,
+ .height = GLYPH_HEIGHT
+ };
+
+ y -= GLYPH_ASCENT;
+
+ rop = (rop & 3) | 0x4;
+
+ if ((fill&1) == 0)
+ rop ^= 3;
while ((c = *string++)) {
- uint8_t *bytes = &glyph_bytes[glyph_pos[(uint8_t) c]];
- int h;
+ uint8_t *bytes = &glyph_bytes[glyph_pos[(uint8_t) c]];
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;
+ ao_copy(dst,
+ x, y, GLYPH_WIDTH, GLYPH_HEIGHT,
+ &src_bitmap,
+ 0, 0, rop);
+ x += GLYPH_WIDTH;
}
}