altos/telelco-v3: Add logo to 'info' page
authorKeith Packard <keithp@keithp.com>
Sun, 28 Jan 2024 06:03:00 +0000 (22:03 -0800)
committerKeith Packard <keithp@keithp.com>
Thu, 1 Feb 2024 01:50:19 +0000 (17:50 -0800)
Make the info page a bit more fun

Signed-off-by: Keith Packard <keithp@keithp.com>
src/draw/ao_draw.h
src/draw/ao_logo.c
src/telelco-v3.0/ao_lco_v3.c

index 6b0bc2cefe72e19a0c3246c3b42d390110c2a30d..7f1a413cd980be8ed87d10b0dcb9fce261194996 100644 (file)
@@ -169,6 +169,12 @@ ao_text(struct ao_bitmap   *dst,
        uint32_t                fill,
        uint8_t                 rop);
 
+void
+ao_logo_poly(struct ao_bitmap          *dst,
+            const struct ao_transform  *transform,
+            uint32_t                   fill,
+            uint8_t                    rop);
+
 void
 ao_logo(struct ao_bitmap               *dst,
        const struct ao_transform       *transform,
index 747332765839ba05bd3da05b4176ecd6a5614685..53b9a3c289400eabde5dcedd0392aadf8545d50b 100644 (file)
 
 #define ARRAYSIZE(a)   (sizeof(a) / sizeof((a)[0]))
 
+void
+ao_logo_poly(struct ao_bitmap          *dst,
+            const struct ao_transform  *transform,
+            uint32_t                   fill,
+            uint8_t                    rop)
+{
+       if (!transform)
+               transform = &ao_identity;
+       ao_poly(dst, ao_logo_top, ARRAYSIZE(ao_logo_top), transform, fill, rop);
+       ao_poly(dst, ao_logo_bottom, ARRAYSIZE(ao_logo_bottom), transform, fill, rop);
+}
+
 void
 ao_logo(struct ao_bitmap               *dst,
        const struct ao_transform       *transform,
@@ -33,8 +45,7 @@ ao_logo(struct ao_bitmap              *dst,
        int16_t name_x = ao_t_xi(ao_logo_width, 0.0f, transform);
        int16_t name_y1 = ao_t_yi(ao_logo_width, 0.5f, transform);
        int16_t name_y2 = ao_t_yi(ao_logo_width, 0.98f, transform);
-       ao_poly(dst, ao_logo_top, ARRAYSIZE(ao_logo_top), transform, fill, rop);
-       ao_poly(dst, ao_logo_bottom, ARRAYSIZE(ao_logo_bottom), transform, fill, rop);
+       ao_logo_poly(dst, transform, fill, rop);
        ao_text(dst, font, name_x, name_y1, "Altus", fill, rop);
        ao_text(dst, font, name_x, name_y2, "Metrum", fill, rop);
 }
index e1a6dcad29de15ff289f822878d4471e93e05076..2055701b7eb48f7c1a5b27b45d67a6909e7195c3 100644 (file)
@@ -44,6 +44,11 @@ static const struct ao_transform logo_transform = {
        .y_scale = 48, .y_off = 0,
 };
 
+static const struct ao_transform show_transform = {
+       .x_scale = 36, .x_off = 100,
+       .y_scale = 36, .y_off = 0,
+};
+
 #define BIG_FONT BitstreamVeraSans_Roman_58_font
 #define VOLT_FONT BitstreamVeraSans_Roman_58_font
 #define SMALL_FONT BitstreamVeraSans_Roman_12_font
@@ -172,6 +177,7 @@ static void
 _ao_lco_show_info(void)
 {
        info_y = INFO_START_Y;
+       ao_logo_poly(&fb, &show_transform, AO_BLACK, AO_COPY);
        _ao_lco_info("%s", ao_product);
        _ao_lco_info("Version: %s", ao_version);
        _ao_lco_info("Serial: %d", ao_serial_number);