coastline 0.0.4
Loading...
Searching...
No Matches
texture.h
Go to the documentation of this file.
1#pragma once
2
8
9#include <windows.h>
10// The headers below need the types of windows.h.
11#include <ddraw.h>
12
14
15#ifdef __cplusplus
16extern "C" {
17#endif
18
20#define TEXTURE_PIXEL_FORMAT_COUNT 5
21
28
37
45int CountBitWidth(unsigned nMask);
46
54int CountTrailingZeroBits32(unsigned nMask);
55
63int PopCount32(unsigned nMask);
64
79
89void UnpackRgba5551ToRgba8(unsigned char *pDest, const unsigned short *pSrc, int nCount);
90
98unsigned ConvertN64Rgba5551ToRgba8(unsigned nColor);
99
110int ConvertRGBAToPixelFormat(void *pDest, const void *pSrc, int nSize, int nPixelFormatId);
111
124 void *pDest, const void *pSrc, int nSize, int nPixelFormatId, unsigned *pColorKey);
125
138void *
139LoadRgba5551ImageFile(const char *pszPath, unsigned nAdlerExpected, int *pnWidth, int *pnHeight);
140
141#ifdef __cplusplus
142}
143#endif
DDPIXELFORMAT * LookupPixelFormatById(int nId)
Find a pixel format of textures by its identifier.
void UnpackRgba5551ToRgba8(unsigned char *pDest, const unsigned short *pSrc, int nCount)
Unpack pixels of RGBA 5551 to RGBA 8888.
int CountTrailingZeroBits32(unsigned nMask)
Count the clear bits below the lowest set bit of a mask.
int CountBitWidth(unsigned nMask)
Count the bits up to and including the highest set bit of a mask.
int ConvertRGBAToPixelFormatWithColorKey(void *pDest, const void *pSrc, int nSize, int nPixelFormatId, unsigned *pColorKey)
Convert RGBA pixels, replacing alpha below 128 with the lowest green bit of the device format.
int ConvertRGBAToPixelFormat(void *pDest, const void *pSrc, int nSize, int nPixelFormatId)
Convert pixels of RGBA 8888 to a pixel format of the device.
unsigned ConvertN64Rgba5551ToRgba8(unsigned nColor)
Convert a host-loaded N64 RGBA 5551 word to four RGBA bytes.
int PopCount32(unsigned nMask)
Count the set bits of a mask.
HRESULT CALLBACK EnumTextureFormatsCallback_MatchPreset(DDSURFACEDESC *pDesc, void *pContext)
Store a texture format of the device in an entry of g_aTexturePixelFormats when it suits the entry be...
void * LoadRgba5551ImageFile(const char *pszPath, unsigned nAdlerExpected, int *pnWidth, int *pnHeight)
Load an image file of RGBA 5551 pixels and convert it to pixel format 0xb.
A pixel format of textures the game requests by its identifier.
Definition texture.h:23
int nId
Definition texture.h:24
unsigned short wMaxBitCount
Definition texture.h:25
DDPIXELFORMAT ddpf
Definition texture.h:26
typedef CALLBACK
typedef HRESULT