Main Page | Namespace List | Class Hierarchy | Class List | File List | Namespace Members | Class Members | File Members

RageSurfaceUtils.h

Go to the documentation of this file.
00001 /* Utility functions for RageSurfaces. */ 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 /* Get the number of bits representing each color channel in fmt. */ 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 /* The surface contains no transparent pixels and/or never uses its color 00040 * key, so it doesn't need any alpha bits at all. */ 00041 enum { TRAIT_NO_TRANSPARENCY = 0x0001 }; /* 0alpha */ 00042 00043 /* The surface contains only transparent values of 0 or 1; no translucency. 00044 * It only needs one bit of alpha. */ 00045 enum { TRAIT_BOOL_TRANSPARENCY = 0x0002 }; /* 1alpha */ 00046 00047 void BlitTransform( const RageSurface *src, RageSurface *dst, 00048 const float fCoords[8] /* TL, BR, BL, TR */ ); 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 /* Quickly palettize to an gray/alpha texture. */ 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 * (c) 2001-2004 Glenn Maynard, Chris Danford 00069 * All rights reserved. 00070 * 00071 * Permission is hereby granted, free of charge, to any person obtaining a 00072 * copy of this software and associated documentation files (the 00073 * "Software"), to deal in the Software without restriction, including 00074 * without limitation the rights to use, copy, modify, merge, publish, 00075 * distribute, and/or sell copies of the Software, and to permit persons to 00076 * whom the Software is furnished to do so, provided that the above 00077 * copyright notice(s) and this permission notice appear in all copies of 00078 * the Software and that both the above copyright notice(s) and this 00079 * permission notice appear in supporting documentation. 00080 * 00081 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS 00082 * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 00083 * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT OF 00084 * THIRD PARTY RIGHTS. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR HOLDERS 00085 * INCLUDED IN THIS NOTICE BE LIABLE FOR ANY CLAIM, OR ANY SPECIAL INDIRECT 00086 * OR CONSEQUENTIAL DAMAGES, OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS 00087 * OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR 00088 * OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR 00089 * PERFORMANCE OF THIS SOFTWARE. 00090 */

Generated on Thu Jan 27 20:57:29 2005 for StepMania by doxygen 1.3.7