Skip to content

Commit

Permalink
added color drawIcon example
Browse files Browse the repository at this point in the history
  • Loading branch information
Laurence Bank authored and Laurence Bank committed Mar 30, 2022
1 parent abe890a commit eef1b44
Show file tree
Hide file tree
Showing 5 changed files with 859 additions and 1 deletion.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ Features:<br>
- TIFF G4 image data can come from memory (FLASH/RAM), SDCard or any media you provide.
- CCITT G4 data can be raw (you provide size info), or contained in a TIFF file structure.
- Simple class and callback design allows you to easily add TIFF G4 support to any application.
- Includes simple color icon drawing function to draw images at any scale, color and with antialiasing.
- The C code doing the heavy lifting is completely portable and has no external dependencies.
- Includes fast anti-aliasing options (2 or 4-bits per pixel output).
- Can scale the decoded image by any fractional amount (smaller or larger).
Expand Down
152 changes: 152 additions & 0 deletions examples/g4_color_icon_example/arduino_2clr.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,152 @@
//
// arduino_2clr
// Data size = 2252 bytes
//
// TIFF, Compression=G4, Size: 1024 x 781, 1-Bpp
//
// for non-Arduino builds...
#ifndef PROGMEM
#define PROGMEM
#endif
const uint8_t arduino_2clr[] PROGMEM = {
0x4d,0x4d,0x00,0x2a,0x00,0x00,0x08,0x2a,0x26,0xa0,0x74,0x0d,0xff,0xff,0xff,0xff,
0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,
0xf9,0x05,0xb0,0xcb,0xa8,0x81,0xa0,0x69,0xd5,0x90,0x5b,0x0a,0x0a,0x40,0xd0,0x60,
0xb9,0x05,0xb8,0xd0,0x81,0x98,0x1b,0x9a,0x64,0x32,0x40,0xb3,0x64,0x10,0x33,0x06,
0xdd,0x91,0x90,0xc9,0x02,0x7d,0x84,0x20,0x66,0x19,0xbb,0x09,0x90,0xc9,0x05,0x2d,
0x89,0x10,0x33,0x0c,0xfb,0x12,0xc8,0x64,0x82,0xb6,0xca,0x88,0x19,0x85,0xd9,0x56,
0x43,0x24,0x36,0xb6,0xa4,0x40,0xce,0xda,0x96,0x43,0x24,0x35,0xb6,0xb4,0x41,0x6c,
0x0a,0xf6,0xb5,0x82,0x32,0x35,0x05,0xb0,0x24,0x32,0x35,0x0c,0x90,0x6d,0x90,0xc9,
0x06,0x99,0x79,0x05,0xb0,0x55,0x97,0xe0,0x81,0x82,0x07,0x82,0x06,0x08,0x1e,0x08,
0x18,0x20,0xf0,0x81,0x82,0x07,0x82,0x0c,0x20,0x78,0x40,0xc1,0x06,0x40,0xf0,0x6c,
0xfc,0x10,0x61,0x03,0x04,0x74,0x03,0xc3,0x4e,0x10,0x30,0x41,0x82,0x0f,0x08,0x30,
0x83,0x41,0xe1,0x06,0x10,0x30,0x8d,0x06,0xf0,0x41,0x84,0x1a,0x04,0x0d,0xe1,0x06,
0x10,0x69,0x37,0x84,0x0c,0x10,0x72,0x30,0xde,0x10,0x61,0x06,0x8e,0x20,0x6d,0xe1,
0x06,0x10,0x69,0x5b,0xe9,0xa7,0xdd,0xe1,0x06,0x10,0x69,0x5b,0xe1,0x06,0x10,0x75,
0x3f,0x5b,0xc2,0x0c,0x20,0xd7,0x07,0xf0,0x83,0x09,0xfe,0xfa,0x0c,0x20,0xeb,0xef,
0x09,0xa0,0xff,0xf4,0x18,0x4f,0xff,0x08,0x30,0x83,0xf5,0x7c,0x26,0x83,0xe3,0xf4,
0x18,0x4f,0xaf,0x4d,0x3e,0xbc,0x20,0xc2,0x0f,0xa5,0xd0,0x61,0x3e,0xbc,0x26,0x83,
0xe7,0xe7,0x5a,0x0c,0x27,0x7f,0xe1,0x34,0x1b,0xed,0xae,0x9a,0x77,0xfe,0x83,0x09,
0xfd,0xa5,0x84,0xd3,0x6f,0x7f,0x41,0x84,0x1b,0x7d,0xa5,0xa6,0x9c,0x6c,0x56,0x9a,
0x6c,0xf0,0x11,0xd0,0x61,0x36,0x18,0x4b,0x09,0xa0,0xd8,0x61,0x2d,0x34,0xd8,0x85,
0xa0,0xc2,0x61,0xad,0x34,0xd8,0x5a,0x69,0x83,0x0b,0x4d,0x31,0xc2,0x0c,0x20,0xf4,
0xd3,0xd3,0x4f,0x4d,0x3d,0x34,0xf4,0x18,0x4f,0x4d,0x3d,0x34,0xf4,0xd3,0xd3,0x4f,
0x4d,0x3d,0x34,0xf4,0xd3,0xd0,0x61,0x3d,0x35,0xed,0x3d,0x34,0xf4,0xd3,0xd1,0x91,
0x70,0xcd,0x68,0xc8,0x0c,0x33,0x5e,0x8c,0xb5,0x05,0x46,0x8c,0x82,0x02,0xa3,0xd1,
0x91,0xc0,0xa1,0xa3,0x24,0xe0,0x50,0xf4,0x65,0xc0,0x7e,0xd1,0x96,0x80,0x7e,0xf9,
0x93,0x81,0xe1,0x5a,0x32,0x40,0x1e,0x13,0xa3,0xb3,0x40,0x3c,0x08,0x68,0xca,0x60,
0x78,0x30,0xf4,0x08,0x81,0xe0,0x62,0x58,0x8c,0xb0,0x0f,0x03,0x0f,0x40,0x81,0xb4,
0x08,0x1b,0xd0,0x20,0x6d,0x02,0x06,0xf8,0x41,0xb4,0x10,0x7d,0x02,0x06,0xd0,0x20,
0x6f,0x41,0x07,0x41,0x06,0xf4,0x08,0x1b,0x82,0x0d,0xf0,0x83,0x68,0x20,0x7d,0x04,
0x1b,0x41,0x06,0xf4,0x10,0x6d,0x04,0x1b,0xd0,0x41,0xb4,0x10,0x6f,0x84,0x1b,0x41,
0x3e,0x90,0x6d,0x04,0x1b,0xd0,0x41,0xb4,0x10,0x6f,0x84,0x1b,0x41,0x07,0xd2,0x0e,
0x82,0x6f,0x41,0x37,0x41,0xbe,0x83,0x68,0x27,0xd0,0x41,0xb4,0x10,0x6f,0x49,0xb4,
0x9b,0xe1,0x06,0xd0,0x41,0xf4,0x9b,0x49,0xbe,0x10,0x78,0x41,0xf4,0x9b,0x49,0xbd,
0x20,0xda,0x09,0xbe,0x9b,0x49,0xf4,0x13,0x69,0x06,0xfa,0x0f,0x09,0xf4,0x9b,0x49,
0xbe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76,0xd2,0x6d,0x2e,0xc2,0xc3,0x5d,0x86,0x93,0x61,0x2e,0xd2,0x6d,0x76,
0xc2,0x4c,0x34,0xb6,0xd2,0x6c,0x25,0xc3,0x0b,0x0d,0x76,0xd2,0x6d,0x2e,0x18,0x49,
0x86,0x17,0x6c,0x24,0xc3,0x4b,0x61,0xa4,0xd8,0x4b,0xb0,0x93,0x0d,0x76,0x18,0x49,
0xb0,0x96,0xda,0xc3,0x4b,0x86,0x12,0x61,0x85,0xd8,0x61,0x26,0x18,0x4b,0x61,0x84,
0x98,0x61,0x2e,0xc2,0x4c,0x35,0xd8,0x61,0x26,0x18,0x4b,0x61,0x84,0x98,0x61,0x2d,
0x86,0x12,0x61,0x84,0xb8,0x30,0x93,0x0c,0x17,0x61,0x82,0x4c,0x18,0x4b,0x61,0x84,
0xa1,0x84,0xb6,0x0c,0x15,0x83,0x04,0xb8,0x60,0x93,0x06,0x0b,0xb0,0x60,0x93,0x06,
0x12,0xd8,0x30,0x49,0x83,0x04,0xb6,0x64,0x6a,0x07,0x83,0x09,0x83,0x20,0x78,0x31,
0x23,0x5d,0x83,0x20,0x78,0x49,0x21,0x99,0x20,0x0f,0x08,0xb9,0x97,0x81,0xe9,0x33,
0x2d,0x00,0xf5,0xd9,0x91,0xc0,0xa1,0x33,0x24,0xe0,0x50,0xb6,0x65,0xa8,0x2a,0x26,
0x64,0x10,0x15,0x16,0xcc,0x81,0x86,0x62,0x66,0x40,0x61,0x98,0xb6,0x29,0x8a,0xda,
0x6b,0x69,0xae,0x9a,0xd8,0x41,0xf6,0x9a,0xda,0x6b,0x69,0xad,0xa6,0xb6,0x9a,0xda,
0x6b,0x69,0xad,0xa6,0xb6,0x10,0x6b,0x69,0xad,0xa6,0xb6,0x9a,0xda,0x6b,0x0c,0x20,
0xc2,0xda,0x6b,0x69,0xad,0xa6,0xb6,0x10,0x6b,0x69,0xac,0x34,0xc2,0xd8,0x41,0xad,
0xa6,0xb6,0x9a,0xc3,0x08,0x30,0xb6,0x9a,0xd8,0x41,0xad,0xa6,0xb0,0xc2,0x0c,0x2d,
0xa6,0xb0,0xc2,0x61,0x6d,0x06,0xb0,0xc2,0x0c,0x2d,0xa6,0xb6,0x10,0x61,0x61,0xa6,
0xb0,0xc2,0x0c,0x2d,0x84,0x1a,0xc3,0x4c,0x2c,0x30,0x83,0x0b,0x61,0x06,0xb0,0xc2,
0x0c,0x2c,0x30,0x83,0x0b,0x0c,0x20,0xc2,0xd8,0x41,0xac,0x34,0xc2,0xc3,0x04,0x0c,
0x2c,0x30,0x83,0x0b,0x0c,0x20,0xc2,0xc1,0x84,0x18,0x2c,0x30,0x83,0x0b,0x0c,0x10,
0x61,0x61,0x84,0x0c,0x2c,0x18,0x41,0x82,0xc3,0x04,0x0c,0x2c,0x18,0x40,0xc1,0x60,
0xc1,0x06,0x0b,0x0c,0x10,0x30,0xb0,0x60,0x81,0x82,0xc1,0x82,0x06,0x0b,0x21,0x92,
0x1a,0x72,0x35,0x20,0xb6,0x04,0x92,0x35,0xc1,0x9d,0xad,0x02,0xd8,0x15,0x9d,0xad,
0x06,0x48,0x2a,0xc8,0x64,0x86,0xd6,0xd4,0x88,0x19,0xdb,0x52,0xc8,0x64,0x82,0xb6,
0xca,0x88,0x19,0x85,0xd9,0x56,0x43,0x24,0x14,0xb6,0x24,0x40,0xcc,0x33,0xec,0x4b,
0x21,0x92,0x04,0xfb,0x08,0x40,0xcc,0x33,0x76,0x13,0x21,0x92,0x0b,0x5b,0x41,0x03,
0x30,0x6d,0xda,0x32,0x0b,0x71,0xa1,0x03,0x30,0x37,0x34,0xc8,0x2d,0x85,0x05,0x20,
0x68,0x30,0x5c,0x82,0xd8,0x66,0x68,0x40,0xd0,0x35,0x74,0xc4,0x7f,0xff,0xff,0xff,
0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xfc,0x81,0x34,0x0c,0x27,0xc8,
0x13,0x43,0x38,0xd6,0x43,0x20,0x41,0x42,0x04,0xe6,0x44,0x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0x5a,0x7b,0xe1,0x2b,0xff,0xd7,0xfb,0xc1,0x6d,0x7d,0xed,0x7f,0x7c,0x82,
0xe0,0x8d,0x85,0xf7,0x61,0x84,0xb5,0xee,0x38,0x61,0x22,0x19,0x9b,0x31,0xf0,0xc2,
0xf2,0x06,0x0d,0x6f,0x7a,0x92,0xa0,0x9f,0x78,0x30,0x4b,0xdf,0xbd,0x8f,0xf6,0x3e,
0xbd,0xea,0xbd,0xeb,0x5b,0xef,0xff,0x7f,0x7d,0xba,0x6b,0xde,0xbf,0xfa,0xff,0x7d,
0x2b,0xdb,0xa6,0xbd,0xda,0xff,0xeb,0xfe,0xbd,0xfb,0xa6,0xbd,0xdf,0x5b,0xde,0x9a,
0xfd,0xae,0xbe,0xea,0xbd,0xeb,0xfd,0xe9,0xff,0x6b,0x56,0xfb,0xa6,0xbd,0xda,0xff,
0x7a,0x6b,0xdd,0xae,0xbe,0xe1,0x35,0xfb,0x5a,0xb7,0xbd,0x35,0xee,0xd7,0xfd,0xc2,
0x61,0x7e,0xd7,0xfb,0xc2,0x0d,0x7b,0x86,0x17,0x57,0xdc,0x26,0x17,0xed,0x6a,0xfb,
0x70,0x83,0x5e,0xe1,0x85,0xff,0xc1,0x06,0x17,0xe1,0x85,0xfe,0xdc,0x99,0x01,0xe0,
0xb8,0x5e,0xe1,0x85,0xa5,0x7f,0x2b,0x40,0x78,0x37,0x05,0xf8,0x61,0x7b,0xef,0x2a,
0x60,0x78,0x35,0x02,0xf7,0x06,0x0b,0x11,0x11,0x12,0x07,0x86,0xa0,0x18,0x88,0x90,
0x38,0x02,0xc8,0x1a,0x81,0xbd,0x64,0x0c,0xc3,0x45,0x58,0x8f,0xff,0xff,0xff,0xff,
0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,
0xff,0xff,0xff,0xff,0xff,0xff,0xc0,0x04,0x00,0x40,0x00,0x0d,0x01,0x00,0x00,0x03,
0x00,0x00,0x00,0x01,0x04,0x00,0x00,0x00,0x01,0x01,0x00,0x03,0x00,0x00,0x00,0x01,
0x03,0x0d,0x00,0x00,0x01,0x02,0x00,0x03,0x00,0x00,0x00,0x01,0x00,0x01,0x00,0x00,
0x01,0x03,0x00,0x03,0x00,0x00,0x00,0x01,0x00,0x04,0x00,0x00,0x01,0x06,0x00,0x03,
0x00,0x00,0x00,0x01,0x00,0x00,0x00,0x00,0x01,0x0a,0x00,0x03,0x00,0x00,0x00,0x01,
0x00,0x01,0x00,0x00,0x01,0x11,0x00,0x04,0x00,0x00,0x00,0x01,0x00,0x00,0x00,0x08,
0x01,0x12,0x00,0x03,0x00,0x00,0x00,0x01,0x00,0x01,0x00,0x00,0x01,0x15,0x00,0x03,
0x00,0x00,0x00,0x01,0x00,0x01,0x00,0x00,0x01,0x16,0x00,0x03,0x00,0x00,0x00,0x01,
0x03,0x0d,0x00,0x00,0x01,0x17,0x00,0x04,0x00,0x00,0x00,0x01,0x00,0x00,0x08,0x22,
0x01,0x1c,0x00,0x03,0x00,0x00,0x00,0x01,0x00,0x01,0x00,0x00,0x01,0x29,0x00,0x03,
0x00,0x00,0x00,0x02,0x00,0x00,0x00,0x01,0x00,0x00,0x00,0x00};
92 changes: 92 additions & 0 deletions examples/g4_color_icon_example/g4_color_icon_example.ino
Original file line number Diff line number Diff line change
@@ -0,0 +1,92 @@
#include <TIFF_G4.h>
#include <bb_spi_lcd.h>
#include "weather_icons.h"
#include "arduino_2clr.h"

static uint8_t ucTXBuf[4096];
static SPILCD lcd;
static TIFFG4 tiff;

// Set up for ILI9341 240x320 LCD on Teensy 4.0 + display board
#define DC_PIN 9
#define RESET_PIN -1
#define LED_PIN -1
#define CS_PIN 10
#define TFT_MOSI_PIN -1
#define TFT_MISO_PIN -1
#define TFT_CLK_PIN 13
#define SD_CS 4

#define DISPLAY_WIDTH 320
#define DISPLAY_HEIGHT 240
//
// Callback function for TIFF_G4 library which is called for each scanline emitted
//
void TIFFDraw(TIFFDRAW *pDraw)
{
// Serial.printf("x,y=%d,%d, cx,cy=%d,%d\n", pDraw->iDestX, pDraw->y, pDraw->iScaledWidth, pDraw->iScaledHeight);
if (pDraw->y == 0) {
spilcdSetPosition(&lcd, pDraw->iDestX, pDraw->iDestY, pDraw->iScaledWidth, pDraw->iScaledHeight, DRAW_TO_LCD);
}
spilcdWriteDataBlock(&lcd, (uint8_t *)pDraw->pPixels, pDraw->iScaledWidth*2, DRAW_TO_LCD);
} /* TIFFDraw() */

void setup() {
int i;
Serial.begin(115200);
while (!Serial && millis() < 3000); // wait up to 3 seconds for Arduino Serial Monitor
Serial.println("Starting...");
// A TX buffer needs to be defined to use DMA for writing
// spilcdSetTXBuffer(ucTXBuf, sizeof(ucTXBuf));
spilcdInit(&lcd, LCD_ILI9341, FLAGS_NONE, 60000000, CS_PIN, DC_PIN, RESET_PIN, LED_PIN, TFT_MISO_PIN, TFT_MOSI_PIN, TFT_CLK_PIN);
spilcdSetOrientation(&lcd, LCD_ORIENTATION_270);
spilcdFill(&lcd, 0, DRAW_TO_LCD);
// A few primary colors for the demo
const uint16_t usColors[] = {0xffff, 0x7e0, 0xffe0, 0xf800, 0x7ff, 0xf81f, 0x1f, 0x00};
// Draw 2 full sized (1.0f) weather icons
for (i=0; i<2; i++) {
if (tiff.openTIFF((uint8_t *)weather_icons, (int)sizeof(weather_icons), TIFFDraw))
{
tiff.drawIcon(1.0f, 46+(i*128), 50, 128, 118, i*128, 0, usColors[i]/*FG_COLOR*/, 0/*BG_COLOR*/);
tiff.close();
}
}
// Draw 5 icons at 50% (0.5f) scale
for (i=0; i<5; i++) {
if (tiff.openTIFF((uint8_t *)weather_icons, (int)sizeof(weather_icons), TIFFDraw))
{
tiff.drawIcon(0.5f, 46+(i*128), 50, 128, 118, i*64, 120, usColors[i]/*FG_COLOR*/, 0/*BG_COLOR*/);
tiff.close();
}
}
// Draw 6 icons at 30% (0.3f) scale
for (int i=0; i<6; i++) {
if (tiff.openTIFF((uint8_t *)weather_icons, (int)sizeof(weather_icons), TIFFDraw))
{
tiff.drawIcon(0.3f, 46+(i*128), 50+118, 128, 118, 32+i*46, 190, usColors[i]/*FG_COLOR*/, 0/*BG_COLOR*/);
tiff.close();
}
}
delay(5000);
spilcdFill(&lcd, 0, DRAW_TO_LCD);
// Draw 2 Arduino logos at 1/8th scale (0.125f)
for (int i=0; i<2; i++) {
if (tiff.openTIFF((uint8_t *)arduino_2clr, (int)sizeof(arduino_2clr), TIFFDraw))
{
tiff.drawIcon(0.125f, 0, 0, tiff.getWidth()-80, tiff.getHeight(), i*128, 0, 0, usColors[i+3]);
tiff.close();
}
}
// Draw 1 Arduino logo at 1/5th (0.2f) scale
if (tiff.openTIFF((uint8_t *)arduino_2clr, (int)sizeof(arduino_2clr), TIFFDraw))
{
tiff.drawIcon(0.2f, 0, 0, tiff.getWidth()-80, tiff.getHeight(), 0, 100, 0xffff, 0x42a);
tiff.close();
}

while (1) {}; // wait forever
} /* setup() */

void loop() {
// nothing to see here
} /* loop() */
Loading

0 comments on commit eef1b44

Please sign in to comment.