GUI_BMPfile.h 3.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081
  1. /*****************************************************************************
  2. * | File : GUI_BMPfile.h
  3. * | Author : Waveshare team
  4. * | Function : Hardware underlying interface
  5. * | Info :
  6. * Used to shield the underlying layers of each master
  7. * and enhance portability
  8. *----------------
  9. * | This version: V2.0
  10. * | Date : 2018-11-12
  11. * | Info :
  12. * 1.Change file name: GUI_BMP.h -> GUI_BMPfile.h
  13. * 2.fix: GUI_ReadBmp()
  14. * Now Xstart and Xstart can control the position of the picture normally,
  15. * and support the display of images of any size. If it is larger than
  16. * the actual display range, it will not be displayed.
  17. #
  18. # Permission is hereby granted, free of charge, to any person obtaining a copy
  19. # of this software and associated documnetation files (the "Software"), to deal
  20. # in the Software without restriction, including without limitation the rights
  21. # to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
  22. # copies of the Software, and to permit persons to whom the Software is
  23. # furished to do so, subject to the following conditions:
  24. #
  25. # The above copyright notice and this permission notice shall be included in
  26. # all copies or substantial portions of the Software.
  27. #
  28. # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  29. # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  30. # FITNESS OR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  31. # AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  32. # LIABILITY WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  33. # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  34. # THE SOFTWARE.
  35. #
  36. ******************************************************************************/
  37. #ifndef __GUI_BMPFILE_H
  38. #define __GUI_BMPFILE_H
  39. #include <stdio.h>
  40. #include <fcntl.h>
  41. #include <unistd.h>
  42. #include <stdint.h>
  43. #include "DEV_Config.h"
  44. /*Bitmap file header 14bit*/
  45. typedef struct BMP_FILE_HEADER {
  46. UWORD bType; //File identifier
  47. UDOUBLE bSize; //The size of the file
  48. UWORD bReserved1; //Reserved value, must be set to 0
  49. UWORD bReserved2; //Reserved value, must be set to 0
  50. UDOUBLE bOffset; //The offset from the beginning of the file header to the beginning of the image data bit
  51. } __attribute__ ((packed)) BMPFILEHEADER; // 14bit
  52. /*Bitmap information header 40bit*/
  53. typedef struct BMP_INFO {
  54. UDOUBLE biInfoSize; //The size of the header
  55. UDOUBLE biWidth; //The width of the image
  56. UDOUBLE biHeight; //The height of the image
  57. UWORD biPlanes; //The number of planes in the image
  58. UWORD biBitCount; //The number of bits per pixel
  59. UDOUBLE biCompression; //Compression type
  60. UDOUBLE bimpImageSize; //The size of the image, in bytes
  61. UDOUBLE biXPelsPerMeter; //Horizontal resolution
  62. UDOUBLE biYPelsPerMeter; //Vertical resolution
  63. UDOUBLE biClrUsed; //The number of colors used
  64. UDOUBLE biClrImportant; //The number of important colors
  65. } __attribute__ ((packed)) BMPINFOHEADER;
  66. /*Color table: palette */
  67. typedef struct RGB_QUAD {
  68. UBYTE rgbBlue; //Blue intensity
  69. UBYTE rgbGreen; //Green strength
  70. UBYTE rgbRed; //Red intensity
  71. UBYTE rgbReversed; //Reserved value
  72. } __attribute__ ((packed)) BMPRGBQUAD;
  73. /**************************************** end ***********************************************/
  74. UBYTE GUI_ReadBmp(const char *path, UWORD Xstart, UWORD Ystart);
  75. #endif