PieDock  1.6.3
Blender.h
1 /*
2  * O ,-
3  * ° o . -´ ' ,-
4  * ° .´ ` . ´,´
5  * ( ° )) . (
6  * `-;_ . -´ `.`.
7  * `._' ´
8  *
9  * Copyright (c) 2007-2010 Markus Fisch <mf@markusfisch.de>
10  *
11  * Licensed under the MIT license:
12  * http://www.opensource.org/licenses/mit-license.php
13  */
14 #ifndef _PieDock_Blender_
15 #define _PieDock_Blender_
16 
17 #include "Surface.h"
18 #include "ArgbSurface.h"
19 
20 namespace PieDock
21 {
27  class Blender
28  {
29  public:
30  enum Opacity
31  {
32  Transparent = 0,
33  Translucent = 128,
34  Opaque = 0xff
35  };
36 
37  Blender( Surface & );
38  virtual ~Blender() {}
39 #ifdef HAVE_XRENDER
40  virtual void setCompositing( bool c ) { compositing = c; }
41  virtual const bool &useCompositing() const { return compositing; }
42 #endif
43  virtual void blend( const ArgbSurface &, int, int, int = Opaque );
44 
45  protected:
46  typedef struct
47  {
48  unsigned char *dest;
49  unsigned char *src;
50  int length;
51  int repeats;
52  int srcSkip;
53  int destSkip;
54  int alpha;
55  } Details;
56 
57  virtual void blendInto32Bit( Details & );
58  virtual void blendInto24Bit( Details & );
59  virtual void blendInto16Bit( Details & );
60 
61  private:
62  Surface *canvas;
63 #ifdef HAVE_XRENDER
64  bool compositing;
65 #endif
66  };
67 }
68 
69 #endif