git repos / blockattack-game

commit 00127e1a

sago007 · 2011-06-13 11:50
00127e1a84e37face6d01fb23b04ab7ca81984a9 patch · browse files
parent c83d3d11f016e6ae58fcfbef4671aee02703a363

Some comments


git-svn-id: https://blockattack.svn.sourceforge.net/svnroot/blockattack/trunk@122 9d7177f8-192b-0410-8f35-a16a89829b06

Changed files

M source/code/CppSdl/CppSdlImageHolder.hpp before
diff --git a/source/code/CppSdl/CppSdlImageHolder.hpp b/source/code/CppSdl/CppSdlImageHolder.hpp index 73607bf..ad42bfb 100644 --- a/source/code/CppSdl/CppSdlImageHolder.hpp +++ b/source/code/CppSdl/CppSdlImageHolder.hpp
@@ -16,19 +16,61 @@ namespace CppSdl {
class CppSdlImageHolder {
public:
+ /**
+ * Creates a nulled ImageHolder (without data)
+ */
CppSdlImageHolder();
+ /**
+ * Creates an image from a file
+ * @param filename to be loaded
+ */
CppSdlImageHolder(std::string filename);
+ /**
+ * Creates a copy. The new copy shares raw data with the original but is otherwise independent.
+ * @param orig
+ */
CppSdlImageHolder(const CppSdlImageHolder& orig);
CppSdlImageHolder(char *rawdata, int datasize);
virtual ~CppSdlImageHolder();
+ /**
+ * This gives access direct access to the internal data.
+ * Careful, the data might be shared between multiple ImageHolders,
+ * chaing one will change them all.
+ * @return A pointer
+ */
SDL_Surface *GetRawDataInsecure();
CppSdlImageHolder & operator=(const CppSdlImageHolder &rhs);
void Cut(Uint32 x,Uint32 y,Sint32 w,Sint32 h);
+ /**
+ * The width of the image
+ * 0 if the image is nulled
+ * @return The width of the image in pizels
+ */
Uint32 GetWidth();
+ /**
+ * The height of the image
+ * 0 if the image is nulled
+ * @return The height of the image
+ */
Uint32 GetHeight();
+ /**
+ * Draws an image to surface at a given position.
+ * If the image is nulled nothing is drawn
+ * @param target Destination surface
+ * @param x horizontal placement on destination surface
+ * @param y vertical placement on destination surface
+ */
void PaintTo(SDL_Surface *target, int x, int y);
void OptimizeForBlit(bool allowAlpha = true);
+ /**
+ * Tests if there are data in the object
+ * @return true if where are data in the object
+ */
bool IsNull();
+ /**
+ * Removes the data in the object.
+ * Once all ImageHolders pointing to the same data has been freed the internal data will be freed too
+ */
void MakeNull();
private:
void Initialized(); //throws an exception if *data is null