00001 /* ----------------------------------------------------------------------------- 00002 00003 Copyright (c) 2006 Simon Brown si@sjbrown.co.uk 00004 00005 Permission is hereby granted, free of charge, to any person obtaining 00006 a copy of this software and associated documentation files (the 00007 "Software"), to deal in the Software without restriction, including 00008 without limitation the rights to use, copy, modify, merge, publish, 00009 distribute, sublicense, and/or sell copies of the Software, and to 00010 permit persons to whom the Software is furnished to do so, subject to 00011 the following conditions: 00012 00013 The above copyright notice and this permission notice shall be included 00014 in all copies or substantial portions of the Software. 00015 00016 THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS 00017 OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 00018 MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. 00019 IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY 00020 CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, 00021 TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE 00022 SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 00023 00024 -------------------------------------------------------------------------- */ 00025 00026 #ifndef SQUISH_H 00027 #define SQUISH_H 00028 00030 namespace squish { 00031 00032 // ----------------------------------------------------------------------------- 00033 00035 typedef unsigned char u8; 00036 00037 // ----------------------------------------------------------------------------- 00038 00039 enum 00040 { 00042 kDxt1 = ( 1 << 0 ), 00043 00045 kDxt3 = ( 1 << 1 ), 00046 00048 kDxt5 = ( 1 << 2 ), 00049 00051 kColourIterativeClusterFit = ( 1 << 8 ), 00052 00054 kColourClusterFit = ( 1 << 3 ), 00055 00057 kColourRangeFit = ( 1 << 4 ), 00058 00060 kColourMetricPerceptual = ( 1 << 5 ), 00061 00063 kColourMetricUniform = ( 1 << 6 ), 00064 00066 kWeightColourByAlpha = ( 1 << 7 ) 00067 }; 00068 00069 // ----------------------------------------------------------------------------- 00070 00100 void Compress( u8 const* rgba, void* block, int flags ); 00101 00102 // ----------------------------------------------------------------------------- 00103 00141 void CompressMasked( u8 const* rgba, int mask, void* block, int flags ); 00142 00143 // ----------------------------------------------------------------------------- 00144 00160 void Decompress( u8* rgba, void const* block, int flags ); 00161 00162 // ----------------------------------------------------------------------------- 00163 00178 int GetStorageRequirements( int width, int height, int flags ); 00179 00180 // ----------------------------------------------------------------------------- 00181 00217 void CompressImage( u8 const* rgba, int width, int height, void* blocks, int flags ); 00218 00219 // ----------------------------------------------------------------------------- 00220 00240 void DecompressImage( u8* rgba, int width, int height, void const* blocks, int flags ); 00241 00242 // ----------------------------------------------------------------------------- 00243 00244 } // namespace squish 00245 00246 #endif // ndef SQUISH_H 00247