coastline 0.0.4
Loading...
Searching...
No Matches
rgb565image.h File Reference

The images of 16-bit RGB 565 pixels the Glide renderer loads from bitmaps and copies to the frame buffer, with a colour key. More...

#include <stdint.h>
#include <windows.h>
Include dependency graph for rgb565image.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

struct  Rgb565Image
 A bitmap of RGB 565 pixels with a transparent colour key. More...

Macros

#define RGB565_BLIT_COLOR_KEYED   0x1
 The flag of BlitRgb565ImageRegion() that skips the pixels of the colour key of the source.

Typedefs

typedef struct Rgb565Image Rgb565Image
 A bitmap of RGB 565 pixels with a transparent colour key.

Functions

Rgb565Image * CreateRgb565Image (int width, int height)
 Allocate an RGB 565 image and an uninitialised pixel buffer.
void FreeRgb565Image (Rgb565Image *image)
 Free image and its pixel buffer, accepting NULL.
void ConvertBgr24ToRgb565FlipVertical (uint16_t *destination, const uint8_t *source, int width, int height, int sourceStride)
 Convert 24-bit BGR rows to RGB 565 while reversing their vertical order.
Rgb565Image * CreateRgb565ImageFromBitmap (const BITMAP *bitmap)
 Convert a 24-bit Windows bitmap to an RGB 565 image.
Rgb565Image * LoadBitmapToRgb565Image (const char *name, int width, int height)
 Load a bitmap resource or file at the requested dimensions and convert it to RGB 565.
void BlitRgb565ImageRegion (Rgb565Image *destination, unsigned x, unsigned y, const Rgb565Image *source, const RECT *rect, DWORD flags)
 Copy a rectangle of an image into another at a position, clipped to the right and bottom edges of the destination.
void CopyRgb565Rect (void *destination, int destinationStride, unsigned width, int height, const void *source, int sourceStride)
 Copy RGB 565 rows without clipping or interpreting colour keys.
void CopyRgb565RectColorKeyed (uint16_t *destination, int destinationStride, int width, int height, const uint16_t *source, int sourceStride, uint16_t colorKey)
 Copy RGB 565 rows, omitting source pixels equal to colorKey.
void SetRgb565ImageColorKey (Rgb565Image *image, COLORREF color)
 Convert a Windows RGB colour to the image's RGB 565 transparency key.
void WriteRgb565ImageToGlideLfb (const Rgb565Image *image)
 Write an image to the back buffer of Glide at its top left.

Detailed Description

The images of 16-bit RGB 565 pixels the Glide renderer loads from bitmaps and copies to the frame buffer, with a colour key.

Macro Definition Documentation

◆ RGB565_BLIT_COLOR_KEYED

#define RGB565_BLIT_COLOR_KEYED   0x1

The flag of BlitRgb565ImageRegion() that skips the pixels of the colour key of the source.

Typedef Documentation

◆ Rgb565Image

typedef struct Rgb565Image Rgb565Image

A bitmap of RGB 565 pixels with a transparent colour key.

Function Documentation

◆ CreateRgb565Image()

Rgb565Image * CreateRgb565Image ( int width,
int height )

Allocate an RGB 565 image and an uninitialised pixel buffer.

Returns
The image, or NULL when allocation fails.
Ghidra address:
BRGlide: 0x10001130

◆ FreeRgb565Image()

void FreeRgb565Image ( Rgb565Image * image)

Free image and its pixel buffer, accepting NULL.

Ghidra address:
BRGlide: 0x10001190

◆ ConvertBgr24ToRgb565FlipVertical()

void ConvertBgr24ToRgb565FlipVertical ( uint16_t * destination,
const uint8_t * source,
int width,
int height,
int sourceStride )

Convert 24-bit BGR rows to RGB 565 while reversing their vertical order.

Parameters
destinationOutput pixels, with no row padding.
sourceInput bitmap pixels.
widthPixels per row.
heightNumber of rows.
sourceStrideBytes between source rows.
Ghidra address:
BRGlide: 0x100011c0

◆ CreateRgb565ImageFromBitmap()

Rgb565Image * CreateRgb565ImageFromBitmap ( const BITMAP * bitmap)

Convert a 24-bit Windows bitmap to an RGB 565 image.

Returns
The image, or NULL for another bit depth or failed allocation.
Ghidra address:
BRGlide: 0x10001240

◆ LoadBitmapToRgb565Image()

Rgb565Image * LoadBitmapToRgb565Image ( const char * name,
int width,
int height )

Load a bitmap resource or file at the requested dimensions and convert it to RGB 565.

Returns
The image with a green colour key, or NULL when loading or conversion fails.
Ghidra address:
BRGlide: 0x10001290

◆ BlitRgb565ImageRegion()

void BlitRgb565ImageRegion ( Rgb565Image * destination,
unsigned x,
unsigned y,
const Rgb565Image * source,
const RECT * rect,
DWORD flags )

Copy a rectangle of an image into another at a position, clipped to the right and bottom edges of the destination.

Parameters
destinationThe image copied into.
xThe left of the copy in the destination.
yThe top of the copy in the destination.
sourceThe image copied from.
rectThe rectangle of the source.
flagsRGB565_BLIT_COLOR_KEYED or 0.
Ghidra address:
BRGlide: 0x10001320

◆ CopyRgb565Rect()

void CopyRgb565Rect ( void * destination,
int destinationStride,
unsigned width,
int height,
const void * source,
int sourceStride )

Copy RGB 565 rows without clipping or interpreting colour keys.

Parameters
destinationOutput pixels.
destinationStrideBytes between destination rows.
widthPixels per row.
heightNumber of rows.
sourceInput pixels.
sourceStrideBytes between source rows.
Ghidra address:
BRGlide: 0x100013f0

◆ CopyRgb565RectColorKeyed()

void CopyRgb565RectColorKeyed ( uint16_t * destination,
int destinationStride,
int width,
int height,
const uint16_t * source,
int sourceStride,
uint16_t colorKey )

Copy RGB 565 rows, omitting source pixels equal to colorKey.

Parameters
destinationOutput pixels.
destinationStrideBytes between destination rows.
widthPixels per row.
heightNumber of rows.
sourceInput pixels.
sourceStrideBytes between source rows.
colorKeySource pixel value to omit.
Ghidra address:
BRGlide: 0x10001440

◆ SetRgb565ImageColorKey()

void SetRgb565ImageColorKey ( Rgb565Image * image,
COLORREF color )

Convert a Windows RGB colour to the image's RGB 565 transparency key.

Ghidra address:
BRGlide: 0x100014a0

◆ WriteRgb565ImageToGlideLfb()

void WriteRgb565ImageToGlideLfb ( const Rgb565Image * image)

Write an image to the back buffer of Glide at its top left.

Parameters
imageThe image, its pixels in RGB 565.
Ghidra address:
BRGlide: 0x100014e0