xref: /haiku/src/servers/app/drawing/Overlay.h (revision e81a954787e50e56a7f06f72705b7859b6ab06d1)
1 /*
2  * Copyright 2006-2007, Haiku, Inc.
3  * Distributed under the terms of the MIT License.
4  *
5  * Authors:
6  *		Axel Dörfler, axeld@pinc-software.de
7  */
8 #ifndef OVERLAY_H
9 #define OVERLAY_H
10 
11 
12 #include <InterfaceDefs.h>
13 
14 #include <video_overlay.h>
15 
16 
17 class HWInterface;
18 class ServerBitmap;
19 struct overlay_client_data;
20 
21 
22 class Overlay {
23 	public:
24 		Overlay(HWInterface& interface, ServerBitmap* bitmap,
25 			overlay_token token);
26 		~Overlay();
27 
28 		status_t InitCheck() const;
29 
30 		status_t Suspend(ServerBitmap* bitmap, bool needTemporary);
31 		status_t Resume(ServerBitmap* bitmap);
32 
33 		void SetClientData(overlay_client_data* clientData);
34 		void SetFlags(uint32 flags);
35 		void TakeOverToken(Overlay* other);
36 
37 		const overlay_buffer* OverlayBuffer() const;
38 		overlay_client_data* ClientData() const;
39 		overlay_token OverlayToken() const;
40 
41 		void SetColorSpace(uint32 colorSpace);
42 
43 		const overlay_window* OverlayWindow() const
44 			{ return &fWindow; }
45 		const overlay_view* OverlayView() const
46 			{ return &fView; }
47 
48 		sem_id Semaphore() const
49 			{ return fSemaphore; }
50 
51 		const rgb_color& Color() const
52 			{ return fColor; }
53 
54 		void Configure(const BRect& source, const BRect& destination);
55 		void Hide();
56 
57 	private:
58 		void _FreeBuffer();
59 		status_t _AllocateBuffer(ServerBitmap* bitmap);
60 
61 		HWInterface&			fHWInterface;
62 		const overlay_buffer*	fOverlayBuffer;
63 		overlay_client_data*	fClientData;
64 		overlay_token			fOverlayToken;
65 		overlay_view			fView;
66 		overlay_window			fWindow;
67 		sem_id					fSemaphore;
68 		rgb_color				fColor;
69 };
70 
71 #endif	// OVERLAY_H
72