gds_image.h 1.2 KB

1234567891011121314151617181920212223242526272829303132333435
  1. /*
  2. * (c) Philippe G. 2019, philippe_44@outlook.com
  3. *
  4. * This software is released under the MIT License.
  5. * https://opensource.org/licenses/MIT
  6. *
  7. */
  8. #pragma once
  9. #include <stdint.h>
  10. #include "esp_err.h"
  11. // no progressive JPEG handling
  12. struct GDS_Device;
  13. enum { GDS_RGB565, GDS_RGB555, GDS_RGB444, GDS_RGB332, GDS_GRAYSCALE };
  14. // Fit options for GDS_DrawJPEG
  15. #define GDS_IMAGE_LEFT 0x00
  16. #define GDS_IMAGE_CENTER_X 0x01
  17. #define GDS_IMAGE_RIGHT 0x04
  18. #define GDS_IMAGE_TOP 0x00
  19. #define GDS_IMAGE_BOTTOM 0x08
  20. #define GDS_IMAGE_CENTER_Y 0x02
  21. #define GDS_IMAGE_CENTER (GDS_IMAGE_CENTER_X | GDS_IMAGE_CENTER_Y)
  22. #define GDS_IMAGE_FIT 0x10 // re-scale by a factor of 2^N (up to 3)
  23. // Width and Height can be NULL if you already know them (actual scaling is closest ^2)
  24. uint16_t* GDS_DecodeJPEG(uint8_t *Source, int *Width, int *Height, float Scale);
  25. void GDS_GetJPEGSize(uint8_t *Source, int *Width, int *Height);
  26. bool GDS_DrawJPEG( struct GDS_Device* Device, uint8_t *Source, int x, int y, int Fit);
  27. void GDS_DrawRGB16( struct GDS_Device* Device, uint16_t *Image, int x, int y, int Width, int Height, int RGB_Mode );
  28. void GDS_DrawRGB8( struct GDS_Device* Device, uint8_t *Image, int x, int y, int Width, int Height, int RGB_Mode );