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 CANVAS_H
10#define CANVAS_H
11
12#include <List.h>
13#include <Rect.h>
14#include <String.h>
15
16struct entry_ref;
17
18class BBitmap;
19class BMessage;
20class Layer;
21
22class Canvas : private BList {
23 public:
24								Canvas(BRect frame);
25								~Canvas();
26
27			bool				IsValid() const;
28			void				MakeEmpty();
29
30	// list functionality
31			bool				AddLayer(Layer* layer);
32			bool				AddLayer(Layer* layer, int32 index);
33
34			Layer*				RemoveLayer(int32 index);
35			bool				RemoveLayer(Layer* layer);
36
37			Layer*				LayerAt(int32 index) const;
38			Layer*				LayerAtFast(int32 index) const;
39			int32				IndexOf(Layer* layer) const;
40			int32				CountLayers() const;
41			bool				HasLayer(Layer* layer) const;
42
43			void				SetBounds(BRect bounds);
44			BRect				Bounds() const;
45
46								// composes layers on top of passed bitmap
47			void				Compose(BBitmap* into, BRect area) const;
48								// returns entire composition in new bitmap
49			BBitmap*			Bitmap() const;
50
51	// loading
52			status_t			Unarchive(const BMessage* archive);
53
54 private:
55	BRect						fBounds;
56};
57
58#endif // CANVAS_H
59