PieDock 1.6.0

src/Blender.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_Blender_
00015 #define _PieDock_Blender_
00016 
00017 #include "Surface.h"
00018 #include "ArgbSurface.h"
00019 
00020 namespace PieDock
00021 {
00027     class Blender
00028     {
00029         public:
00030             enum Opacity
00031             {
00032                 Transparent = 0,
00033                 Translucent = 128,
00034                 Opaque = 0xff
00035             };
00036 
00037             Blender( Surface & );
00038             virtual ~Blender() {}
00039 #ifdef HAVE_XRENDER
00040             virtual void setCompositing( bool c ) { compositing = c; }
00041             virtual const bool &useCompositing() const { return compositing; }
00042 #endif
00043             virtual void blend( const ArgbSurface &, int, int, int = Opaque );
00044 
00045         protected:
00046             typedef struct
00047             {
00048                 unsigned char *dest;
00049                 unsigned char *src;
00050                 int length;
00051                 int repeats;
00052                 int srcSkip;
00053                 int destSkip;
00054                 int alpha;
00055             } Details;
00056 
00057             virtual void blendInto32Bit( Details & );
00058             virtual void blendInto24Bit( Details & );
00059             virtual void blendInto16Bit( Details & );
00060 
00061         private:
00062             Surface *canvas;
00063 #ifdef HAVE_XRENDER
00064             bool compositing;
00065 #endif
00066     };
00067 }
00068 
00069 #endif