00001 /* 00002 * Metaphrasis is a static conversion class for transforming RGBA image 00003 * buffers into verious GX texture formats for Wii homebrew development. 00004 * Copyright (C) 2008 Armin Tamzarian 00005 * 00006 * This file is part of Metaphrasis. 00007 * 00008 * Metaphrasis is free software: you can redistribute it and/or modify 00009 * it under the terms of the GNU Lesser General Public License as published 00010 * by the Free Software Foundation, either version 3 of the License, or 00011 * (at your option) any later version. 00012 * 00013 * Metaphrasis is distributed in the hope that it will be useful, 00014 * but WITHOUT ANY WARRANTY; without even the implied warranty of 00015 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00016 * GNU Lesser General Public License for more details. 00017 * 00018 * You should have received a copy of the GNU Lesser General Public License 00019 * along with Metaphrasis. If not, see <http://www.gnu.org/licenses/>. 00020 */ 00021 00022 /** \mainpage Metaphrasis 00023 * 00024 * \section sec_intro Introduction 00025 * 00026 * Metaphrasis is a static conversion class for transforming RGBA image buffers into verious GX texture formats for Wii homebrew development. 00027 * <br> 00028 * Metaphrasis is written in C++ and makes use of a community standard and newly developed algorithms for conversion of 32-bit RGBA data buffers into various GX texture formats common to both the Gamecube and Wii platforms. 00029 * <p> 00030 * This library was developed in-full by Armin Tamzarian with the support of developers in \#wiibrew on EFnet, Chaosteil of libwiisprite, and DrTwox of GRRLIB. 00031 * 00032 * \section sec_installation_source Installation (Source Code) 00033 * 00034 * -# Extract the Metaphrasis archive. 00035 * -# Copy the contents of the <i>src</i> directory into your project's development path. 00036 * -# Include the Metaphrasis header file in your code using syntax such as the following: 00037 * \code 00038 * #include "Metaphrasis.h" 00039 * \endcode 00040 * 00041 * \section sec_installation_library Installation (Library) 00042 * 00043 * -# Extract the Metaphrasis archive. 00044 * -# Copy the contents of the <i>lib</i> directory into your <i>devKitPro/libogc</i> directory. 00045 * -# Include the Metaphrasis header file in your code using syntax such as the following: 00046 * \code 00047 * #include "Metaphrasis.h" 00048 * \endcode 00049 * 00050 * \section sec_usage Usage 00051 * 00052 * -# Create a buffer full of 32-bit RGBA values noting both the pixel height and width of the buffer. 00053 * -# Call one of the many conversion routines from within your code. (Note: All methods within the Metaphrasis class are static and thus no class instance need be allocated) 00054 * \code 00055 * uint32_t* rgba8Buffer = Metaphrasis::convertBufferToRGBA8(rgbaBuffer, bufferWidth, bufferHeight); 00056 * \endcode 00057 * -# Free your temporary RGBA value buffer if you no longer need said values. 00058 * 00059 * Currently supported conversion routines are as follows: 00060 * \li convertBufferToI4 00061 * \li convertBufferToI8 00062 * \li convertBufferToIA4 00063 * \li convertBufferToIA8 00064 * \li convertBufferToRGBA8 00065 * \li convertBufferToRGB565 00066 * \li convertBufferToRGB5A3 00067 * 00068 * \section sec_license License 00069 * 00070 * Metaphrasis is distributed under the GNU Lesser General Public License. 00071 * 00072 * \section sec_contact Contact 00073 * 00074 * If you have any suggestions, questions, or comments regarding this library feel free to e-mail me at tamzarian1989 [at] gmail [dawt] com. 00075 */ 00076 00077 #ifndef METAPHRASIS_H_ 00078 #define METAPHRASIS_H_ 00079 00080 #include <gccore.h> 00081 #include <stdint.h> 00082 #include <malloc.h> 00083 #include <string.h> 00084 00085 /*! \class Metaphrasis 00086 * \brief A static conversion class for transforming RGBA image buffers into verious GX texture formats for 00087 * Wii homebrew development. 00088 * \author Armin Tamzarian 00089 * \version 0.1.0 00090 * 00091 * Metaphrasis is a static conversion class for transforming RGBA image buffers into verious GX texture formats for 00092 * Wii homebrew development. Metaphrasis is written in C++ and makes use of a community standard and newly developed 00093 * algorithms for conversion of 32-bit RGBA data buffers into various GX texture formats common to both the Gamecube 00094 * and Wii platforms. 00095 */ 00096 class Metaphrasis { 00097 public: 00098 Metaphrasis(); 00099 virtual ~Metaphrasis(); 00100 00101 static uint32_t* convertBufferToI4(uint32_t* rgbaBuffer, uint16_t bufferWidth, uint16_t bufferHeight); 00102 static uint32_t* convertBufferToI8(uint32_t* rgbaBuffer, uint16_t bufferWidth, uint16_t bufferHeight); 00103 static uint32_t* convertBufferToIA4(uint32_t* rgbaBuffer, uint16_t bufferWidth, uint16_t bufferHeight); 00104 static uint32_t* convertBufferToIA8(uint32_t* rgbaBuffer, uint16_t bufferWidth, uint16_t bufferHeight); 00105 static uint32_t* convertBufferToRGBA8(uint32_t* rgbaBuffer, uint16_t bufferWidth, uint16_t bufferHeight); 00106 static uint32_t* convertBufferToRGB565(uint32_t* rgbaBuffer, uint16_t bufferWidth, uint16_t bufferHeight); 00107 static uint32_t* convertBufferToRGB5A3(uint32_t* rgbaBuffer, uint16_t bufferWidth, uint16_t bufferHeight); 00108 00109 static uint8_t convertRGBAToIA4(uint32_t rgba); 00110 static uint16_t convertRGBAToIA8(uint32_t rgba); 00111 static uint16_t convertRGBAToRGB565(uint32_t rgba); 00112 static uint16_t convertRGBAToRGB5A3(uint32_t rgba); 00113 00114 }; 00115 00116 #endif /*METAPHRASIS_H_*/