PixelLightAPI
.
|
00001 /*********************************************************\ 00002 * File: ImagePart.h * 00003 * 00004 * Copyright (C) 2002-2012 The PixelLight Team (http://www.pixellight.org/) 00005 * 00006 * This file is part of PixelLight. 00007 * 00008 * PixelLight is free software: you can redistribute it and/or modify 00009 * it under the terms of the GNU Lesser General Public License as published by 00010 * the Free Software Foundation, either version 3 of the License, or 00011 * (at your option) any later version. 00012 * 00013 * PixelLight 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 PixelLight. If not, see <http://www.gnu.org/licenses/>. 00020 \*********************************************************/ 00021 00022 00023 #ifndef __PLGRAPHICS_IMAGEPART_H__ 00024 #define __PLGRAPHICS_IMAGEPART_H__ 00025 #pragma once 00026 00027 00028 //[-------------------------------------------------------] 00029 //[ Includes ] 00030 //[-------------------------------------------------------] 00031 #include <PLCore/Container/Array.h> 00032 #include "PLGraphics/PLGraphics.h" 00033 00034 00035 //[-------------------------------------------------------] 00036 //[ Namespace ] 00037 //[-------------------------------------------------------] 00038 namespace PLGraphics { 00039 00040 00041 //[-------------------------------------------------------] 00042 //[ Forward declarations ] 00043 //[-------------------------------------------------------] 00044 class ImageBuffer; 00045 class ImageEffect; 00046 00047 00048 //[-------------------------------------------------------] 00049 //[ Classes ] 00050 //[-------------------------------------------------------] 00051 /** 00052 * @brief 00053 * Image part 00054 * 00055 * @note 00056 * - An image part has usually at least one mipmap - the base map 00057 */ 00058 class ImagePart { 00059 00060 00061 //[-------------------------------------------------------] 00062 //[ Public functions ] 00063 //[-------------------------------------------------------] 00064 public: 00065 /** 00066 * @brief 00067 * Constructor 00068 */ 00069 inline ImagePart(); 00070 00071 /** 00072 * @brief 00073 * Copy constructor 00074 * 00075 * @param[in] cSource 00076 * Source to copy from 00077 */ 00078 PLGRAPHICS_API ImagePart(const ImagePart &cSource); 00079 00080 /** 00081 * @brief 00082 * Destructor 00083 */ 00084 inline ~ImagePart(); 00085 00086 /** 00087 * @brief 00088 * Assignment operator 00089 * 00090 * @param[in] cSource 00091 * Source to copy from 00092 * 00093 * @return 00094 * Reference to this object 00095 */ 00096 PLGRAPHICS_API ImagePart &operator =(const ImagePart &cSource); 00097 00098 /** 00099 * @brief 00100 * Clear data 00101 */ 00102 PLGRAPHICS_API void Clear(); 00103 00104 /** 00105 * @brief 00106 * Apply image effect 00107 * 00108 * @param[in] cEffect 00109 * Image effect 00110 */ 00111 PLGRAPHICS_API void ApplyEffect(const ImageEffect &cEffect); 00112 00113 /** 00114 * @brief 00115 * Check image for possible problems 00116 * 00117 * @return 00118 * Error code describing any problem found, 'CheckOk' if everything is fine 00119 */ 00120 PLGRAPHICS_API ECheckConsistency CheckConsistency() const; 00121 00122 /** 00123 * @brief 00124 * Get semantics 00125 * 00126 * @return 00127 * Semantics ID 00128 */ 00129 inline PLCore::uint32 GetSemantics() const; 00130 00131 /** 00132 * @brief 00133 * Set semantics 00134 * 00135 * @param[in] nSemantics 00136 * Semantics ID 00137 */ 00138 inline void SetSemantics(PLCore::uint32 nSemantics); 00139 00140 /** 00141 * @brief 00142 * Check if the layer has mipmaps 00143 * 00144 * @return 00145 * 'true' if the frame contains more than one mipmap 00146 */ 00147 inline bool HasMipmaps() const; 00148 00149 /** 00150 * @brief 00151 * Get number of mipmaps 00152 * 00153 * @return 00154 * Number of mipmaps 00155 */ 00156 inline PLCore::uint32 GetNumOfMipmaps() const; 00157 00158 /** 00159 * @brief 00160 * Get mipmap 00161 * 00162 * @param[in] nIndex 00163 * Index of mipmap 00164 * 00165 * @return 00166 * Image buffer, or a null pointer if it doesn't exist 00167 */ 00168 inline ImageBuffer *GetMipmap(PLCore::uint32 nIndex) const; 00169 00170 /** 00171 * @brief 00172 * Get mipmaps 00173 * 00174 * @return 00175 * List of mipmaps 00176 */ 00177 inline const PLCore::Container<ImageBuffer*> &GetMipmaps() const; 00178 00179 /** 00180 * @brief 00181 * Build mipmaps 00182 * 00183 * @return 00184 * 'true' on success, else 'false' 00185 */ 00186 PLGRAPHICS_API bool BuildMipmaps(); 00187 00188 /** 00189 * @brief 00190 * Create new mipmap 00191 * 00192 * @return 00193 * Image buffer of mipmap, or a null pointer on error 00194 */ 00195 PLGRAPHICS_API ImageBuffer *CreateMipmap(); 00196 00197 /** 00198 * @brief 00199 * Delete mipmap 00200 * 00201 * @param[in] cImageBuffer 00202 * Image buffer of mipmap 00203 * 00204 * @return 00205 * 'true' on success, ('cImageBuffer' is now no longer valid!) else 'false' 00206 */ 00207 PLGRAPHICS_API bool DeleteMipmap(ImageBuffer &cImageBuffer); 00208 00209 /** 00210 * @brief 00211 * Deletes all mipmaps besides the first one (the base map) 00212 */ 00213 PLGRAPHICS_API void DeleteMipmaps(); 00214 00215 00216 //[-------------------------------------------------------] 00217 //[ Private data ] 00218 //[-------------------------------------------------------] 00219 private: 00220 PLCore::uint32 m_nSemantics; /**< Semantics ID */ 00221 PLCore::Array<ImageBuffer*> m_lstMipmaps; /**< Mipmaps */ 00222 00223 00224 }; 00225 00226 00227 //[-------------------------------------------------------] 00228 //[ Namespace ] 00229 //[-------------------------------------------------------] 00230 } // PLGraphics 00231 00232 00233 //[-------------------------------------------------------] 00234 //[ Implementation ] 00235 //[-------------------------------------------------------] 00236 #include "PLGraphics/Image/ImagePart.inl" 00237 00238 00239 #endif // __PLGRAPHICS_IMAGEPART_H__
|