PieDock 1.6.0

src/Surface.h

00001 /*
00002  *   O         ,-
00003  *  ° o    . -´  '     ,-
00004  *   °  .´        ` . ´,´
00005  *     ( °   ))     . (
00006  *      `-;_    . -´ `.`.
00007  *          `._'       ´
00008  *
00009  * Copyright (c) 2007-2010 Markus Fisch <mf@markusfisch.de>
00010  *
00011  * Licensed under the MIT license:
00012  * http://www.opensource.org/licenses/mit-license.php
00013  */
00014 #ifndef _PieDock_Surface_
00015 #define _PieDock_Surface_
00016 
00017 namespace PieDock
00018 {
00024     class Surface
00025     {
00026         public:
00027             enum ColorDepth
00028             {
00029                 Indexed = 8,
00030                 HighColor = 16,
00031                 RGB = 24,
00032                 ARGB = 32
00033             };
00034 
00035             Surface( const Surface & );
00036             virtual ~Surface();
00037             inline unsigned char *getData() const { return data; }
00038             inline const int &getWidth() const { return width; }
00039             inline const int &getHeight() const { return height; }
00040             inline const int &getDepth() const { return depth; }
00041             inline const int &getBytesPerPixel() const { return bytesPerPixel; }
00042             inline const int &getBytesPerLine() const { return bytesPerLine; }
00043             inline const int &getPadding() const { return padding; }
00044             inline const int &getSize() const { return size; }
00045             Surface &operator=( const Surface & );
00046 
00047         protected:
00048             Surface();
00049             inline void setData( unsigned char *d ) { data = d; }
00050             virtual void calculateSize( int, int, int = ARGB );
00051             virtual void allocateData();
00052             virtual void freeData();
00053 
00054         private:
00055             unsigned char *data;
00056             int width;
00057             int height;
00058             int depth;
00059             int bytesPerPixel;
00060             int bytesPerLine;
00061             int padding;
00062             int size;
00063     };
00064 }
00065 
00066 #endif