xref: /haiku/src/add-ons/translators/wonderbrush/Layer.h (revision 3cb015b1ee509d69c643506e8ff573808c86dcfc)
1 /*
2  * Copyright 2006, Haiku. All rights reserved.
3  * Distributed under the terms of the MIT License.
4  *
5  * Authors:
6  *		Stephan Aßmus <superstippi@gmx.de>
7  */
8 
9 #ifndef LAYER_H
10 #define LAYER_H
11 
12 #include <Rect.h>
13 #include <String.h>
14 
15 // property flags
16 enum {
17 	FLAG_INVISIBLE		= 0x01,
18 };
19 
20 // blending modes (as of WonderBrush 2.0)
21 enum {
22 	MODE_NORMAL					= 0,
23 	MODE_MULTIPLY				= 1,
24 	MODE_INVERSE_MULTIPLY		= 2,
25 	MODE_LUMINANCE				= 3,
26 	MODE_MULTIPLY_ALPHA			= 4,
27 	MODE_MULTIPLY_INVERSE_ALPHA	= 5,
28 
29 	MODE_REPLACE_RED			= 6,
30 	MODE_REPLACE_GREEN			= 7,
31 	MODE_REPLACE_BLUE			= 8,
32 
33 	MODE_DARKEN					= 9,
34 	MODE_LIGHTEN				= 10,
35 
36 	MODE_HARD_LIGHT				= 11,
37 	MODE_SOFT_LIGHT				= 12,
38 };
39 
40 class BBitmap;
41 class BMessage;
42 
43 class Layer {
44  public:
45 								Layer();
46 								~Layer();
47 
48 	// active area of layer
49 	inline	BRect				ActiveBounds() const
50 									{ return fBounds; }
51 
52 	// composing
53 			status_t			Compose(const BBitmap* into,
54 										BRect area);
55 
56 	// loading
57 			status_t			Unarchive(const BMessage* archive);
58 
59  protected:
60 			BBitmap*			fBitmap;
61 			BRect				fBounds;
62 
63 			float				fAlpha;
64 			uint32				fMode;
65 			uint32				fFlags;
66 };
67 
68 #endif // LAYER_H
69