xref: /haiku/headers/private/interface/PrivateScreen.h (revision 51978af14a173e7fae0563b562be5603bc652aeb)
1 #ifndef __PRIVATESCREEN_H
2 #define __PRIVATESCREEN_H
3 
4 #include <Accelerant.h>
5 #include <GraphicsDefs.h>
6 
7 struct screen_desc;
8 class BApplication;
9 class BWindow;
10 
11 class BPrivateScreen
12 {
13 	// Constructor and destructor are private. Use the static methods
14 	// CheckOut() and Return() instead.
15 public:
16 	static BPrivateScreen* CheckOut(BWindow *win);
17 	static BPrivateScreen* CheckOut(screen_id id);
18 	static void Return(BPrivateScreen *screen);
19 
20 	status_t SetToNext();
21 
22 	color_space ColorSpace();
23 	BRect Frame();
24 	screen_id ID();
25 
26 	status_t WaitForRetrace(bigtime_t timeout);
27 	sem_id RetraceSemaphore();
28 
29 	uint8 IndexForColor(uint8 red, uint8 green, uint8 blue, uint8 alpha);
30 	rgb_color ColorForIndex(const uint8 index);
31 	uint8 InvertIndex(uint8 index);
32 
33 	const color_map *ColorMap();
34 
35 	status_t GetBitmap(BBitmap **bitmap, bool drawCursor, BRect *bound);
36 	status_t ReadBitmap(BBitmap *bitmap, bool drawCursor, BRect *bound);
37 
38 	rgb_color DesktopColor(uint32 index);
39 	void SetDesktopColor(rgb_color, uint32, bool);
40 
41 	status_t ProposeMode(display_mode *target, const display_mode *low, const display_mode *high);
42 
43 	status_t GetModeList(display_mode **mode_list, uint32 *count);
44 	status_t GetMode(uint32 workspace, display_mode *mode);
45 	status_t SetMode(uint32 workspace, display_mode *mode, bool makeDefault);
46 	status_t GetDeviceInfo(accelerant_device_info *info);
47 	status_t GetPixelClockLimits(display_mode *mode, uint32 *low, uint32 *high);
48 	status_t GetTimingConstraints(display_timing_constraints *dtc);
49 	status_t SetDPMS(uint32 dpmsState);
50 	uint32 DPMSState();
51 	uint32 DPMSCapabilites();
52 
53 	void* BaseAddress();
54 	uint32 BytesPerRow();
55 
56 	status_t get_screen_desc(screen_desc *desc);
57 
58 private:
59 
60 	friend class BApplication;
61 
62 	color_map *fColorMap;
63 	sem_id fRetraceSem;
64 	int32 fOwnsColorMap;
65 
66 	static int32 sOpenCount;
67 
68 	BPrivateScreen();
69 	~BPrivateScreen();
70 };
71 
72 #endif // __PRIVATESCREEN_H
73