1094332d3Sopenharmony_ci/* 2094332d3Sopenharmony_ci * Copyright (c) 2021 Huawei Device Co., Ltd. 3094332d3Sopenharmony_ci * Licensed under the Apache License, Version 2.0 (the "License"); 4094332d3Sopenharmony_ci * you may not use this file except in compliance with the License. 5094332d3Sopenharmony_ci * You may obtain a copy of the License at 6094332d3Sopenharmony_ci * 7094332d3Sopenharmony_ci * http://www.apache.org/licenses/LICENSE-2.0 8094332d3Sopenharmony_ci * 9094332d3Sopenharmony_ci * Unless required by applicable law or agreed to in writing, software 10094332d3Sopenharmony_ci * distributed under the License is distributed on an "AS IS" BASIS, 11094332d3Sopenharmony_ci * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12094332d3Sopenharmony_ci * See the License for the specific language governing permissions and 13094332d3Sopenharmony_ci * limitations under the License. 14094332d3Sopenharmony_ci */ 15094332d3Sopenharmony_ci 16094332d3Sopenharmony_ci#ifndef LOAD_BMP_H 17094332d3Sopenharmony_ci#define LOAD_BMP_H 18094332d3Sopenharmony_ci#include <stdint.h> 19094332d3Sopenharmony_ci 20094332d3Sopenharmony_ci#ifdef __cplusplus 21094332d3Sopenharmony_ciextern "C" { 22094332d3Sopenharmony_ci#endif 23094332d3Sopenharmony_ci 24094332d3Sopenharmony_ci#define EIGHT_BITS_PER_PIXEL 8 25094332d3Sopenharmony_ci#define INVALID_BITS 2 26094332d3Sopenharmony_ci#define ONE_OFFSET 1 27094332d3Sopenharmony_ci#define TWO_OFFSET 2 28094332d3Sopenharmony_ci 29094332d3Sopenharmony_ci#define TWO_BITS_PER_PIXEL 2 30094332d3Sopenharmony_ci#define THREE_BITS_PER_PIXEL 3 31094332d3Sopenharmony_ci#define FOUR_BITS_PER_PIXEL 4 32094332d3Sopenharmony_ci 33094332d3Sopenharmony_ci#define BITMAP_FILE 0x4d42 34094332d3Sopenharmony_ci 35094332d3Sopenharmony_ci/* the color format OSD supported */ 36094332d3Sopenharmony_citypedef enum { 37094332d3Sopenharmony_ci OSD_COLOR_FMT_RGB444 = 0, 38094332d3Sopenharmony_ci OSD_COLOR_FMT_RGB4444 = 1, 39094332d3Sopenharmony_ci OSD_COLOR_FMT_RGB555 = 2, 40094332d3Sopenharmony_ci OSD_COLOR_FMT_RGB565 = 3, 41094332d3Sopenharmony_ci OSD_COLOR_FMT_RGB1555 = 4, 42094332d3Sopenharmony_ci OSD_COLOR_FMT_RGB888 = 6, 43094332d3Sopenharmony_ci OSD_COLOR_FMT_RGB8888 = 7, 44094332d3Sopenharmony_ci OSD_COLOR_FMT_BUTT 45094332d3Sopenharmony_ci} OsdColorFmt; 46094332d3Sopenharmony_ci 47094332d3Sopenharmony_citypedef struct { 48094332d3Sopenharmony_ci OsdColorFmt colorFmt; /* color format */ 49094332d3Sopenharmony_ci uint16_t height; /* operation height */ 50094332d3Sopenharmony_ci uint16_t width; /* operation width */ 51094332d3Sopenharmony_ci uint16_t stride; /* surface stride */ 52094332d3Sopenharmony_ci uint16_t reserved; 53094332d3Sopenharmony_ci} OsdSurface; 54094332d3Sopenharmony_ci 55094332d3Sopenharmony_citypedef struct { 56094332d3Sopenharmony_ci uint32_t width; /* out */ 57094332d3Sopenharmony_ci uint32_t height; /* out */ 58094332d3Sopenharmony_ci uint32_t stride; /* in */ 59094332d3Sopenharmony_ci uint32_t len; /* picBuffer length */ 60094332d3Sopenharmony_ci uint16_t bpp; /* bpp */ 61094332d3Sopenharmony_ci uint8_t *picBuffer; /* in/out */ 62094332d3Sopenharmony_ci} OsdLogo; 63094332d3Sopenharmony_ci 64094332d3Sopenharmony_citypedef struct { 65094332d3Sopenharmony_ci uint16_t size; 66094332d3Sopenharmony_ci uint32_t width; 67094332d3Sopenharmony_ci uint32_t height; 68094332d3Sopenharmony_ci uint16_t planes; 69094332d3Sopenharmony_ci uint16_t bitCnt; 70094332d3Sopenharmony_ci uint32_t compress; 71094332d3Sopenharmony_ci uint32_t sizeImage; 72094332d3Sopenharmony_ci uint32_t xPelsPerMeter; 73094332d3Sopenharmony_ci uint32_t yPelsPerMeter; 74094332d3Sopenharmony_ci uint32_t clrUsed; 75094332d3Sopenharmony_ci uint32_t clrImp; 76094332d3Sopenharmony_ci} OsdBitMapInfoHeader; 77094332d3Sopenharmony_ci 78094332d3Sopenharmony_citypedef struct { 79094332d3Sopenharmony_ci uint32_t size; 80094332d3Sopenharmony_ci uint16_t reserved1; 81094332d3Sopenharmony_ci uint16_t reserved2; 82094332d3Sopenharmony_ci uint32_t offBits; 83094332d3Sopenharmony_ci} OsdBitMapFileHeader; 84094332d3Sopenharmony_ci 85094332d3Sopenharmony_citypedef struct { 86094332d3Sopenharmony_ci uint8_t blue; 87094332d3Sopenharmony_ci uint8_t green; 88094332d3Sopenharmony_ci uint8_t red; 89094332d3Sopenharmony_ci uint8_t reserved; 90094332d3Sopenharmony_ci} OsdRgbQuad; 91094332d3Sopenharmony_ci 92094332d3Sopenharmony_citypedef struct { 93094332d3Sopenharmony_ci OsdBitMapInfoHeader header; 94094332d3Sopenharmony_ci OsdRgbQuad colors[1]; 95094332d3Sopenharmony_ci} OsdBitMapInfo; 96094332d3Sopenharmony_ci 97094332d3Sopenharmony_citypedef struct { 98094332d3Sopenharmony_ci uint8_t aLen; 99094332d3Sopenharmony_ci uint8_t rLen; 100094332d3Sopenharmony_ci uint8_t gLen; 101094332d3Sopenharmony_ci uint8_t bLen; 102094332d3Sopenharmony_ci} OsdCompInfo; 103094332d3Sopenharmony_ci 104094332d3Sopenharmony_citypedef struct { 105094332d3Sopenharmony_ci uint8_t r; 106094332d3Sopenharmony_ci uint8_t g; 107094332d3Sopenharmony_ci uint8_t b; 108094332d3Sopenharmony_ci} OsdColor; 109094332d3Sopenharmony_ci 110094332d3Sopenharmony_ciint32_t GetBmpInfo(const int8_t *fileName, OsdBitMapFileHeader *bmpFileHeader, OsdBitMapInfo *bmpInfo); 111094332d3Sopenharmony_ciint32_t CreateSurfaceByBitMap(const int8_t *fileName, OsdSurface *pstSurface, uint8_t *virAddr, uint32_t len); 112094332d3Sopenharmony_ci 113094332d3Sopenharmony_ci#ifdef __cplusplus 114094332d3Sopenharmony_ci} 115094332d3Sopenharmony_ci#endif 116094332d3Sopenharmony_ci 117094332d3Sopenharmony_ci#endif /* End of #ifndef LOAD_BMP_H */ 118