coastline 0.0.4
Loading...
Searching...
No Matches
paintshop.h
Go to the documentation of this file.
1#ifndef COASTLINE_PLATFORM_WIN_PAINTSHOP_H
2#define COASTLINE_PLATFORM_WIN_PAINTSHOP_H
3
8
9#if TGR_PLATFORM == TGR_PLATFORM_WIN
10#include <windows.h>
11#endif
12
13#ifdef __cplusplus
14extern "C" {
15#endif
16
18#define CAR_PAINT_GROUP_COUNT 16
20#define CAR_PAINT_SET_COUNT 30
22#define CAR_PAINT_BITMAP_COUNT 4
24#define PAINT_DAMAGE_BITMAP_COUNT 3
25
36
43
50extern int g_nPaintTextureGroup;
51
59
70void *GetPaintImage(int nGroup, int nSet, int nDamage);
71
84void GetPaintRectangle(int nGroup, int nSet, int *pLeft, int *pRight, int *pTop, int *pBottom);
85
94
107int HasPaintTintPixels(const void *pImage, int nLeft, int nRight, int nTop, int nBottom);
108
124int BlitPaintImageToPixels(const void *pImage,
125 int nLeft,
126 int nRight,
127 int nTop,
128 int nBottom,
129 unsigned char *pDest,
130 int nWidth,
131 int nHeight);
132
140
148
159void ApplyPaintDamageOverlay(int damage, unsigned char *pixels, int width, int height);
160
171void ModulateRgbaByMask(unsigned char *pixels, int width, int height, const unsigned char *mask);
172
179
188void LoadCarPaintTextures(int group, int damageVariants);
189
196extern int g_dwColorTintRed;
197
204extern int g_dwColorTintGreen;
205
212extern int g_dwColorTintBlue;
213
223void SetColorTintMultipliers(int nRed, int nGreen, int nBlue);
224
231extern int g_dwConvertedBitmapWidth;
232
240
253 unsigned char *pDest, const unsigned char *pSrc, int nWidth, int nHeight, int nStride);
254
255#if TGR_PLATFORM == TGR_PLATFORM_WIN
265void *ConvertBitmap24ToRgba32(const BITMAP *pBitmap);
266#endif
267
276void *LoadBitmapFromFile(const char *pszPath);
277
285
293
301
302#ifdef __cplusplus
303}
304#endif
305
306#endif // COASTLINE_PLATFORM_WIN_PAINTSHOP_H
void * LoadBitmapFromFile(const char *pszPath)
Load a bitmap file of 24 bits as pixels of RGBA 8888.
#define PAINT_DAMAGE_BITMAP_COUNT
The number of entries of g_apPaintDamageBitmaps.
Definition paintshop.h:24
void CopyBgr24ToRgba32Flipped(unsigned char *pDest, const unsigned char *pSrc, int nWidth, int nHeight, int nStride)
Copy the rows of a bitmap of 24 bits from the bottom up into pixels of RGBA 8888, opaque.
int g_bCarPaintTexturesEnabled
Whether additional car-paint damage variants are generated when paint textures load.
int BlitPaintImageToPixels(const void *pImage, int nLeft, int nRight, int nTop, int nBottom, unsigned char *pDest, int nWidth, int nHeight)
Copy paint pixels into the destination rectangle, flipping rows and applying the paint tint.
int g_dwColorTintRed
The multiplier of the red of the tint of the paint.
#define CAR_PAINT_GROUP_COUNT
The number of groups of g_CarPaintTextureSets.
Definition paintshop.h:18
int GetSelectedPaintOption(void)
Get the option of the paint set selected last.
int g_nPaintTextureGroup
The group used to prepare car paint textures.
void ApplyPaintDamageOverlay(int damage, unsigned char *pixels, int width, int height)
Scale RGB by the first channel of the selected 64 by 64 damage mask, preserving alpha.
void * g_apPaintDamageBitmaps[PAINT_DAMAGE_BITMAP_COUNT]
The bitmaps of the damage of the paint, from malloc().
#define CAR_PAINT_BITMAP_COUNT
The number of bitmaps of a set of g_CarPaintTextureSets.
Definition paintshop.h:22
void ModulateRgbaByMask(unsigned char *pixels, int width, int height, const unsigned char *mask)
Multiply each pixel's RGB channels by the first channel of its mask pixel, preserving alpha.
#define CAR_PAINT_SET_COUNT
The number of sets of a group of g_CarPaintTextureSets.
Definition paintshop.h:20
CarPaintTextureSet g_CarPaintTextureSets[CAR_PAINT_GROUP_COUNT][CAR_PAINT_SET_COUNT]
The sets of paint of the cars.
void FreeCarPaintTextures(void)
Free the bitmaps of every set of paint of the cars.
int g_dwColorTintGreen
The multiplier of the green of the tint of the paint.
int g_nPaintTextureSetIndex
The paint set index, advanced before preparing each texture.
int g_dwColorTintBlue
The multiplier of the blue of the tint of the paint.
void GetPaintRectangle(int nGroup, int nSet, int *pLeft, int *pRight, int *pTop, int *pBottom)
Get the bounds of the rectangle of a paint set.
void LoadCarPaintTextures(int group, int damageVariants)
Load one car group's paint bitmaps and optionally generate damage variants.
void * ConvertBitmap24ToRgba32(const BITMAP *pBitmap)
Convert a bitmap of 24 bits to pixels of RGBA 8888 from malloc(), and record its size in g_dwConverte...
void * GetPaintImage(int nGroup, int nSet, int nDamage)
Select a paint set and return its bitmap for a damage level.
int g_dwConvertedBitmapWidth
The width of the bitmap ConvertBitmap24ToRgba32() converted last.
int HasPaintTintPixels(const void *pImage, int nLeft, int nRight, int nTop, int nBottom)
Test whether packed paint pixels contain a pixel to tint.
void FreeAllPaintBitmaps(void)
Free the bitmaps of the paint of the cars and of the damage of the paint.
int g_dwConvertedBitmapHeight
The height of the bitmap ConvertBitmap24ToRgba32() converted last.
void LoadPaintDamageBitmaps(void)
Load the bitmaps of the damage of the paint from Paint\damaged.bmp.
int g_nSelectedPaintOption10
The option at offset 16 of the paint set selected last.
void SetColorTintMultipliers(int nRed, int nGreen, int nBlue)
Set the multipliers of the tint of the paint.
The bitmaps, selection option and rectangle of a car paint set.
Definition paintshop.h:27
const char * pszBitmapName
Definition paintshop.h:34
int nLeft
Definition paintshop.h:30
int nRight
Definition paintshop.h:31
int nTop
Definition paintshop.h:32
int nOption10
Definition paintshop.h:29
int nBottom
Definition paintshop.h:33
void * apBitmaps[CAR_PAINT_BITMAP_COUNT]
Definition paintshop.h:28