aiie/images.cpp

89 lines
2.0 KiB
C++
Raw Normal View History

2018-01-07 19:43:17 +00:00
#include "images.h"
#ifdef TEENSYDUINO
#include <Arduino.h>
#else
#define PROGMEM
#endif
2022-01-24 02:39:45 +00:00
/* This is the wrapper for retrieving all the static images. It has
* const static arrays for each image's data, and then a function that
* knows all of the metadata for each one.
*
* To create the data array for a PNG or JPG image...
* use ImageMagick's "stream" utility to generate raw RGB
* $ stream -map rgb -storage-type char newimg.png newimg.raw
2022-01-30 21:03:38 +00:00
* then use util/genimage16.pl to generate the bytestream and copy/paste
2022-01-24 02:39:45 +00:00
*/
2022-01-16 20:51:24 +00:00
2022-01-24 02:39:45 +00:00
#include "image-8875-bg.h"
#include "image-8875-apple.h"
#include "image-8875-drivelatches.h"
2022-01-26 18:49:28 +00:00
#include "image-9341-bg.h"
#include "image-9341-drivelatches.h"
#include "image-9341-applebitmap.h"
2022-01-16 20:51:24 +00:00
2022-01-26 18:49:28 +00:00
bool getImageInfoAndData(uint8_t imgnum, uint16_t *width, uint16_t *height, uint8_t **dataptr)
2022-01-24 02:39:45 +00:00
{
switch (imgnum) {
2022-01-26 18:49:28 +00:00
case IMG_8875_SHELL:
2022-01-24 02:39:45 +00:00
*width = 800;
*height = 480;
2022-01-26 18:49:28 +00:00
*dataptr = (uint8_t *)image_8875_bg;
2022-01-24 02:39:45 +00:00
break;
2022-01-26 18:49:28 +00:00
case IMG_8875_D1OPEN:
2022-01-24 02:39:45 +00:00
*width = 62;
*height = 11;
2022-01-26 18:49:28 +00:00
*dataptr = (uint8_t *)image_d1_open;
2022-01-24 02:39:45 +00:00
break;
2022-01-26 18:49:28 +00:00
case IMG_8875_D1CLOSED:
2022-01-24 02:39:45 +00:00
*width = 62;
*height = 11;
2022-01-26 18:49:28 +00:00
*dataptr = (uint8_t *)image_d1_closed;
2022-01-24 02:39:45 +00:00
break;
2022-01-26 18:49:28 +00:00
case IMG_8875_D2OPEN:
2022-01-24 02:39:45 +00:00
*width = 62;
*height = 11;
2022-01-26 18:49:28 +00:00
*dataptr = (uint8_t *)image_d2_open;
2022-01-24 02:39:45 +00:00
break;
2022-01-26 18:49:28 +00:00
case IMG_8875_D2CLOSED:
2022-01-24 02:39:45 +00:00
*width = 62;
*height = 11;
2022-01-26 18:49:28 +00:00
*dataptr = (uint8_t *)image_d2_closed;
2022-01-24 02:39:45 +00:00
break;
2022-01-26 18:49:28 +00:00
case IMG_8875_APPLEBATTERY:
2022-01-24 02:39:45 +00:00
// FIXME
return false;
break;
2022-01-26 18:49:28 +00:00
case IMG_9341_SHELL:
*width = 320;
*height = 240;
*dataptr = (uint8_t *)img_9341_bg;
break;
case IMG_9341_D1OPEN: // d2 is the same constant
*width = 43;
*height = 20;
*dataptr = (uint8_t *)image_9341_driveopen;
break;
case IMG_9341_D1CLOSED: // d2 is the same constant
*width = 43;
*height = 20;
*dataptr = (uint8_t *)image_9341_driveclosed;
break;
case IMG_9341_APPLEBATTERY:
// FIXME
return false;
break;
2022-01-24 02:39:45 +00:00
default:
// Don't know what this one is...
return false;
break;
}
2018-01-07 19:43:17 +00:00
2022-01-24 02:39:45 +00:00
return true;
}
2018-01-07 19:43:17 +00:00