#ifndef SD_TEST_BMP_H
#define SD_TEST_BMP_H
#include<stdio.h>
#include<stdint.h>
#include<string.h>
#include "st7789.h"
#include "math.h"
#include "stm32_hx8347d_lcd.h"
#include "arm_math.h"

#define abs(s) (s)>0?(s):-1*(s)
//#define IMG_WIDTH 288
#define IMG_WIDTH 240
#define IMG_HEIGHT 216
#define IMG_INITIAL_WIDTH 32
#define IMG_INITIAL_HEIGHT 24
#define savefile 0x01
#define notsavefile 0x00
#define GCM_Pseudo1 0x01
#define GCM_Pseudo2 0x02
#define GCM_Rainbow1 0x03
#define GCM_Rainbow2 0x04
#define GCM_Ning 0x05
#define GCM_Rainbow3 0x06
#define GCM_Zhou 0x07
#define GCM_Gray 0x08
#define GCM_Metal1 0x09
#define GCM_Metal2 0x0A

typedef struct RGBQUAD
{
    uint8_t rgbBlue;       //指定蓝色强度
    uint8_t  rgbGreen;      //指定绿色强度
    uint8_t  rgbRed;        //指定红色强度
    uint8_t  rgbReserved;  //保留,设置为0
} RGBQUAD;
typedef struct BMP_8
{
    uint8_t gray_val;
}BMP_8;
typedef struct BMP_24
{
    uint8_t r_val;
    uint8_t g_val;
    uint8_t b_val;

}BMP_24;
typedef struct RGB565
{
    uint8_t r_bit;
    uint8_t g_bit;
    uint8_t b_bit;
}RGB565;

void bmp24_to_rgb565(BMP_24 bmp24[][IMG_WIDTH],RGB565 rgb565[][IMG_WIDTH],uint16_t img[][IMG_WIDTH]);
void bmp8_to_bmp1(BMP_8 bmp8[][IMG_WIDTH],uint8_t img[][IMG_WIDTH/8],uint8_t thre);
uint8_t temp_to_bmp8(BMP_8 bmp8[],const float temp_mat[],int size,float *max_temp,float *min_temp,uint8_t revese);
void Resize_draw(BMP_8 bmp8[],uint8_t method);
uint8_t Besize_draw(BMP_8 input_bmp8[],uint8_t method,uint8_t ifsavefile);
void gray_to_rgb(BMP_8 bmp8[],BMP_24 bmp24[][IMG_INITIAL_WIDTH],uint8_t method);
void bmp8_to_color(uint8_t method,uint8_t gray_val,BMP_24*bmp24);
void draw_spectrum(uint8_t method);

#endif //SD_TEST_BMP_H