00001
00002
00003
#ifndef RAGE_SURFACE_UTILS_H
00004
#define RAGE_SURFACE_UTILS_H
00005
00006
struct RageSurfaceColor;
00007
struct RageSurfacePalette;
00008
struct RageSurfaceFormat;
00009
struct RageSurface;
00010
00011
namespace RageSurfaceUtils
00012 {
00013 uint32_t
decodepixel(
const uint8_t *p,
int bpp );
00014
void encodepixel( uint8_t *p,
int bpp, uint32_t pixel );
00015
00016
void GetRawRGBAV( uint32_t pixel,
const RageSurfaceFormat &fmt, uint8_t *v );
00017
void GetRawRGBAV(
const uint8_t *p,
const RageSurfaceFormat &fmt, uint8_t *v );
00018
void GetRGBAV( uint32_t pixel,
const RageSurface *src, uint8_t *v );
00019
void GetRGBAV(
const uint8_t *p,
const RageSurface *src, uint8_t *v );
00020
00021 uint32_t
SetRawRGBAV(
const RageSurfaceFormat *fmt,
const uint8_t *v );
00022
void SetRawRGBAV( uint8_t *p,
const RageSurface *src,
const uint8_t *v );
00023 uint32_t
SetRGBAV(
const RageSurfaceFormat *fmt,
const uint8_t *v );
00024
void SetRGBAV( uint8_t *p,
const RageSurface *src,
const uint8_t *v );
00025
00026
00027
void GetBitsPerChannel(
const RageSurfaceFormat *fmt, uint32_t bits[4] );
00028
00029
void CopySurface(
const RageSurface *src,
RageSurface *dest );
00030
bool ConvertSurface(
RageSurface *src,
RageSurface *&dst,
00031
int width,
int height,
int bpp, uint32_t R, uint32_t G, uint32_t B, uint32_t A );
00032
void ConvertSurface(
RageSurface *&image,
00033
int width,
int height,
int bpp, uint32_t R, uint32_t G, uint32_t B, uint32_t A );
00034
00035
void FixHiddenAlpha(
RageSurface *img );
00036
00037
int FindSurfaceTraits(
const RageSurface *img );
00038
00039
00040
00041
enum {
TRAIT_NO_TRANSPARENCY = 0x0001 };
00042
00043
00044
00045
enum {
TRAIT_BOOL_TRANSPARENCY = 0x0002 };
00046
00047
void BlitTransform(
const RageSurface *src,
RageSurface *dst,
00048
const float fCoords[8] );
00049
00050
void Blit(
const RageSurface *src,
RageSurface *dst,
int width = -1,
int height = -1 );
00051
void CorrectBorderPixels(
RageSurface *img,
int width,
int height );
00052
00053
bool SaveSurface(
const RageSurface *img, CString file );
00054
RageSurface *
LoadSurface( CString file );
00055
00056
00057
RageSurface *
PalettizeToGrayscale(
const RageSurface *src_surf,
int GrayBits,
int AlphaBits );
00058
00059
RageSurface *
MakeDummySurface(
int height,
int width );
00060
00061
void ApplyHotPinkColorKey(
RageSurface *&img );
00062
void FlipVertically(
RageSurface *img );
00063 };
00064
00065
#endif
00066
00067
00068
00069
00070
00071
00072
00073
00074
00075
00076
00077
00078
00079
00080
00081
00082
00083
00084
00085
00086
00087
00088
00089
00090