2020-11-07 16:41:14 +01:00
|
|
|
#pragma once
|
2020-11-08 16:37:59 +01:00
|
|
|
|
2021-09-09 10:40:54 +02:00
|
|
|
enum class BitmapTypes : char
|
2020-11-08 16:37:59 +01:00
|
|
|
{
|
2020-11-13 17:04:58 +01:00
|
|
|
None = 0,
|
|
|
|
RawBitmap = 1,
|
2021-01-29 14:42:05 +01:00
|
|
|
DibBitmap = 2,
|
2021-01-31 15:29:53 +01:00
|
|
|
Spliced = 4,
|
2020-11-08 16:37:59 +01:00
|
|
|
};
|
|
|
|
|
2021-01-29 14:42:05 +01:00
|
|
|
struct gdrv_bitmap8
|
2020-11-08 16:37:59 +01:00
|
|
|
{
|
|
|
|
char* BmpBufPtr1;
|
|
|
|
int Width;
|
|
|
|
int Height;
|
|
|
|
int Stride;
|
2021-09-09 10:40:54 +02:00
|
|
|
BitmapTypes BitmapType;
|
2020-11-08 16:37:59 +01:00
|
|
|
int XPosition;
|
|
|
|
int YPosition;
|
|
|
|
};
|
2020-11-13 17:04:58 +01:00
|
|
|
|
2021-09-01 10:02:57 +02:00
|
|
|
struct Rgba
|
|
|
|
{
|
|
|
|
uint8_t peRed;
|
|
|
|
uint8_t peGreen;
|
|
|
|
uint8_t peBlue;
|
|
|
|
uint8_t peFlags;
|
|
|
|
};
|
|
|
|
union ColorRgba
|
|
|
|
{
|
|
|
|
uint32_t Color;
|
|
|
|
Rgba rgba;
|
|
|
|
};
|
|
|
|
static_assert(sizeof(ColorRgba) == 4, "Wrong size of RGBA color");
|
|
|
|
|
2020-11-08 16:37:59 +01:00
|
|
|
|
2020-11-07 16:41:14 +01:00
|
|
|
class gdrv
|
|
|
|
{
|
|
|
|
public:
|
2021-09-05 09:47:05 +02:00
|
|
|
static SDL_Rect DestinationRect;
|
|
|
|
|
2021-09-01 10:02:57 +02:00
|
|
|
static int init(int width, int height);
|
2020-11-13 17:04:58 +01:00
|
|
|
static int uninit();
|
2020-11-08 16:37:59 +01:00
|
|
|
static void get_focus();
|
|
|
|
static int create_bitmap(gdrv_bitmap8* bmp, int width, int height);
|
|
|
|
static int create_raw_bitmap(gdrv_bitmap8* bmp, int width, int height, int flag);
|
2021-01-31 15:29:53 +01:00
|
|
|
static int create_spliced_bitmap(gdrv_bitmap8* bmp, int width, int height, int size);
|
2020-11-13 17:04:58 +01:00
|
|
|
static int destroy_bitmap(gdrv_bitmap8* bmp);
|
2021-09-01 10:02:57 +02:00
|
|
|
static int display_palette(ColorRgba* plt);
|
2021-02-09 16:09:44 +01:00
|
|
|
static void start_blit_sequence();
|
2020-11-13 17:04:58 +01:00
|
|
|
static void end_blit_sequence();
|
2021-09-01 10:02:57 +02:00
|
|
|
static void blit(gdrv_bitmap8* bmp, int xSrc, int ySrc, int xDest, int yDest, int width, int height);
|
2020-11-13 17:04:58 +01:00
|
|
|
static void blat(gdrv_bitmap8* bmp, int xDest, int yDest);
|
|
|
|
static void fill_bitmap(gdrv_bitmap8* bmp, int width, int height, int xOff, int yOff, char fillChar);
|
|
|
|
static void copy_bitmap(gdrv_bitmap8* dstBmp, int width, int height, int xOff, int yOff, gdrv_bitmap8* srcBmp,
|
|
|
|
int srcXOff, int srcYOff);
|
|
|
|
static void copy_bitmap_w_transparency(gdrv_bitmap8* dstBmp, int width, int height, int xOff, int yOff,
|
|
|
|
gdrv_bitmap8* srcBmp, int srcXOff, int srcYOff);
|
2020-12-03 15:47:36 +01:00
|
|
|
static void grtext_draw_ttext_in_box(LPCSTR text, int xOff, int yOff, int width, int height, int a6);
|
2021-09-01 10:02:57 +02:00
|
|
|
static void BlitScreen();
|
2020-11-08 16:37:59 +01:00
|
|
|
private:
|
2021-09-01 10:02:57 +02:00
|
|
|
static SDL_Texture* vScreenTex;
|
|
|
|
static char* vScreenPixels;
|
|
|
|
static int vScreenWidth, vScreenHeight;
|
|
|
|
static ColorRgba current_palette[256];
|
2021-02-09 16:09:44 +01:00
|
|
|
|
2021-09-01 10:02:57 +02:00
|
|
|
static int StretchDIBitsScaled(int xSrc, int ySrc, int xDst, int yDst,
|
|
|
|
int width, int height, gdrv_bitmap8* bmp);
|
2020-11-07 16:41:14 +01:00
|
|
|
};
|