19762338dSopenharmony_ci/*
29762338dSopenharmony_ci * Copyright (c) 2021 Huawei Device Co., Ltd.
39762338dSopenharmony_ci * Licensed under the Apache License, Version 2.0 (the "License");
49762338dSopenharmony_ci * you may not use this file except in compliance with the License.
59762338dSopenharmony_ci * You may obtain a copy of the License at
69762338dSopenharmony_ci *
79762338dSopenharmony_ci *     http://www.apache.org/licenses/LICENSE-2.0
89762338dSopenharmony_ci *
99762338dSopenharmony_ci * Unless required by applicable law or agreed to in writing, software
109762338dSopenharmony_ci * distributed under the License is distributed on an "AS IS" BASIS,
119762338dSopenharmony_ci * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
129762338dSopenharmony_ci * See the License for the specific language governing permissions and
139762338dSopenharmony_ci * limitations under the License.
149762338dSopenharmony_ci */
159762338dSopenharmony_ci
169762338dSopenharmony_ci#ifndef LOAD_BMP_H
179762338dSopenharmony_ci#define LOAD_BMP_H
189762338dSopenharmony_ci#include <stdint.h>
199762338dSopenharmony_ci
209762338dSopenharmony_ci#ifdef __cplusplus
219762338dSopenharmony_ciextern "C" {
229762338dSopenharmony_ci#endif
239762338dSopenharmony_ci
249762338dSopenharmony_ci#define EIGHT_BITS_PER_PIXEL 8
259762338dSopenharmony_ci#define INVALID_BITS 2
269762338dSopenharmony_ci#define ONE_OFFSET 1
279762338dSopenharmony_ci#define TWO_OFFSET 2
289762338dSopenharmony_ci
299762338dSopenharmony_ci#define TWO_BITS_PER_PIXEL 2
309762338dSopenharmony_ci#define THREE_BITS_PER_PIXEL 3
319762338dSopenharmony_ci#define FOUR_BITS_PER_PIXEL 4
329762338dSopenharmony_ci
339762338dSopenharmony_ci#define BITMAP_FILE 0x4d42
349762338dSopenharmony_ci
359762338dSopenharmony_ci/* the color format OSD supported */
369762338dSopenharmony_citypedef enum {
379762338dSopenharmony_ci    OSD_COLOR_FMT_RGB444    = 0,
389762338dSopenharmony_ci    OSD_COLOR_FMT_RGB4444   = 1,
399762338dSopenharmony_ci    OSD_COLOR_FMT_RGB555    = 2,
409762338dSopenharmony_ci    OSD_COLOR_FMT_RGB565    = 3,
419762338dSopenharmony_ci    OSD_COLOR_FMT_RGB1555   = 4,
429762338dSopenharmony_ci    OSD_COLOR_FMT_RGB888    = 6,
439762338dSopenharmony_ci    OSD_COLOR_FMT_RGB8888   = 7,
449762338dSopenharmony_ci    OSD_COLOR_FMT_BUTT
459762338dSopenharmony_ci} OsdColorFmt;
469762338dSopenharmony_ci
479762338dSopenharmony_citypedef struct {
489762338dSopenharmony_ci    OsdColorFmt       colorFmt;      /* color format */
499762338dSopenharmony_ci    uint16_t          height;        /* operation height */
509762338dSopenharmony_ci    uint16_t          width;         /* operation width */
519762338dSopenharmony_ci    uint16_t          stride;        /* esurface stride */
529762338dSopenharmony_ci    uint16_t          reserved;
539762338dSopenharmony_ci} OsdSurface;
549762338dSopenharmony_ci
559762338dSopenharmony_citypedef struct {
569762338dSopenharmony_ci    uint32_t    width;        /* out */
579762338dSopenharmony_ci    uint32_t    height;       /* out */
589762338dSopenharmony_ci    uint32_t    stride;       /* in */
599762338dSopenharmony_ci    uint32_t    len;          /* picBuffer length */
609762338dSopenharmony_ci    uint16_t    bpp;          /* bpp */
619762338dSopenharmony_ci    uint8_t     *picBuffer;   /* in/out */
629762338dSopenharmony_ci} OsdLogo;
639762338dSopenharmony_ci
649762338dSopenharmony_citypedef struct {
659762338dSopenharmony_ci    uint16_t      size;
669762338dSopenharmony_ci    uint32_t      width;
679762338dSopenharmony_ci    uint32_t      height;
689762338dSopenharmony_ci    uint16_t      planes;
699762338dSopenharmony_ci    uint16_t      bitCnt;
709762338dSopenharmony_ci    uint32_t      compress;
719762338dSopenharmony_ci    uint32_t      sizeImage;
729762338dSopenharmony_ci    uint32_t      xPelsPerMeter;
739762338dSopenharmony_ci    uint32_t      yPelsPerMeter;
749762338dSopenharmony_ci    uint32_t      clrUsed;
759762338dSopenharmony_ci    uint32_t      clrImp;
769762338dSopenharmony_ci} OsdBitMapInfoHeader;
779762338dSopenharmony_ci
789762338dSopenharmony_citypedef struct {
799762338dSopenharmony_ci    uint32_t    size;
809762338dSopenharmony_ci    uint16_t    reserved1;
819762338dSopenharmony_ci    uint16_t    reserved2;
829762338dSopenharmony_ci    uint32_t    offBits;
839762338dSopenharmony_ci} OsdBitMapFileHeader;
849762338dSopenharmony_ci
859762338dSopenharmony_citypedef struct {
869762338dSopenharmony_ci    uint8_t    blue;
879762338dSopenharmony_ci    uint8_t    green;
889762338dSopenharmony_ci    uint8_t    red;
899762338dSopenharmony_ci    uint8_t    reserved;
909762338dSopenharmony_ci} OsdRgbQuad;
919762338dSopenharmony_ci
929762338dSopenharmony_citypedef struct {
939762338dSopenharmony_ci    OsdBitMapInfoHeader    header;
949762338dSopenharmony_ci    OsdRgbQuad             colors[1];
959762338dSopenharmony_ci} OsdBitMapInfo;
969762338dSopenharmony_ci
979762338dSopenharmony_citypedef struct {
989762338dSopenharmony_ci    uint8_t aLen;
999762338dSopenharmony_ci    uint8_t rLen;
1009762338dSopenharmony_ci    uint8_t gLen;
1019762338dSopenharmony_ci    uint8_t bLen;
1029762338dSopenharmony_ci} OsdCompInfo;
1039762338dSopenharmony_ci
1049762338dSopenharmony_citypedef struct {
1059762338dSopenharmony_ci    uint8_t r;
1069762338dSopenharmony_ci    uint8_t g;
1079762338dSopenharmony_ci    uint8_t b;
1089762338dSopenharmony_ci} OsdColor;
1099762338dSopenharmony_ci
1109762338dSopenharmony_ciint32_t GetBmpInfo(const int8_t *fileName, OsdBitMapFileHeader *bmpFileHeader, OsdBitMapInfo *bmpInfo);
1119762338dSopenharmony_ciint32_t CreateSurfaceByBitMap(const int8_t *fileName, OsdSurface *pstSurface, uint8_t *virAddr, uint32_t len);
1129762338dSopenharmony_ci
1139762338dSopenharmony_ci#ifdef __cplusplus
1149762338dSopenharmony_ci}
1159762338dSopenharmony_ci#endif
1169762338dSopenharmony_ci
1179762338dSopenharmony_ci#endif /* End of #ifndef LOAD_BMP_H */
118