Blamite Game Engine - blam!  00296.01.12.21.0102.blamite
The core library for the Blamite Game Engine.
BlamRendering::DirectX::Utils Namespace Reference

Namespace containing various utilities related to rendering. More...

Functions

BLAM HRESULT IntegerBitmapScale (IWICBitmap *source, int scale_factor, ID2D1Bitmap **destination, ID2D1RenderTarget *target)
 Scales a bitmap using integer scaling. More...
 
BLAM Pixel GetPixelData (BYTE *origin, int x, int y, int width, int height)
 Retrieves a pixel from the specified memory address. More...
 
BLAM HRESULT GetWICBitmapPixelData (IWICBitmap **bitmap, UINT *width, UINT *height, IWICBitmapLock **bitmap_lock, UINT *buffer_size, BYTE **start_address)
 Retrieves the pixel data from a WIC bitmap. More...
 

Detailed Description

Namespace containing various utilities related to rendering.

Function Documentation

◆ GetPixelData()

Pixel BlamRendering::DirectX::Utils::GetPixelData ( BYTE *  origin,
int  x,
int  y,
int  width,
int  height 
)

Retrieves a pixel from the specified memory address.

Used in the Integer Scaler.

Parameters
origin- The address to read pixel data from.
x- The X coordinate of the pixel to read.
y- The Y Coordinate of the pixel to read.
width- The width of the bitmap.
height- The height of the bitmap.
Returns
The pixel data at the specified coordinates.

◆ GetWICBitmapPixelData()

HRESULT BlamRendering::DirectX::Utils::GetWICBitmapPixelData ( IWICBitmap **  bitmap,
UINT *  width,
UINT *  height,
IWICBitmapLock **  bitmap_lock,
UINT *  buffer_size,
BYTE **  start_address 
)

Retrieves the pixel data from a WIC bitmap.

Parameters
bitmap- The bitmap to read data from.
width- A pointer to store the width of the bitmap.
height- A pointer to store the height of the bitmap.
bitmap_lock- A pointer to store a lock to the bitmap. Must be released before the image is drawn.
buffer_size- A pointer to store the buffer size of the image data.
start_address- A pointer to set to the start address of the image data.
Returns
S_OK if the image was locked successfully, otherwise will return an error.

◆ IntegerBitmapScale()

HRESULT BlamRendering::DirectX::Utils::IntegerBitmapScale ( IWICBitmap *  source,
int  scale_factor,
ID2D1Bitmap **  destination,
ID2D1RenderTarget *  target 
)

Scales a bitmap using integer scaling.

This function allows bitmaps to be scaled up and still remain pixel-sharp. Bitmap fonts will use this if the scale factor is set to an even integer. This was done so that any debug UI won't look blurry and messy on higher resolution monitors, while also remaining easy to see.

I'm pretty sure that no other game engine actually does this for it's debug UI, but I could be wrong.

Parameters
source- The original bitmap to scale.
scale_factor- The scale factor to apply to the bitmap.
destination- The destination bitmap to store the upscaled image.
target- The render target that the bitmap will be drawn on.
Returns
S_OK if the bitmap was scaled successfully, otherwise will return an error.