gds_image.h 1.1 KB

1234567891011121314151617181920212223242526272829303132
  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. // Fit options for GDS_DrawJPEG
  14. #define GDS_IMAGE_LEFT 0x00
  15. #define GDS_IMAGE_CENTER_X 0x01
  16. #define GDS_IMAGE_RIGHT 0x04
  17. #define GDS_IMAGE_TOP 0x00
  18. #define GDS_IMAGE_BOTTOM 0x08
  19. #define GDS_IMAGE_CENTER_Y 0x02
  20. #define GDS_IMAGE_CENTER (GDS_IMAGE_CENTER_X | GDS_IMAGE_CENTER_Y)
  21. #define GDS_IMAGE_FIT 0x10 // re-scale by a factor of 2^N (up to 3)
  22. // Width and Height can be NULL if you already know them (actual scaling is closest ^2)
  23. void* GDS_DecodeJPEG(uint8_t *Source, int *Width, int *Height, float Scale, int RGB_Mode); // can be 8, 16 or 24 bits per pixel in return
  24. void GDS_GetJPEGSize(uint8_t *Source, int *Width, int *Height);
  25. bool GDS_DrawJPEG( struct GDS_Device* Device, uint8_t *Source, int x, int y, int Fit);
  26. void GDS_DrawRGB( struct GDS_Device* Device, uint8_t *Image, int x, int y, int Width, int Height, int RGB_Mode );