2 * Copyright 2003-2009, Haiku Inc.
3 * Distributed under the terms of the MIT License.
6 * Stefano Ceccherini (burton666@libero.it)
7 * Axel Dörfler, axeld@pinc-software.de
15 #include <PrivateScreen.h>
18 using namespace BPrivate
;
21 BScreen::BScreen(screen_id id
)
23 fScreen
= BPrivateScreen::Get(id
.id
);
27 BScreen::BScreen(BWindow
* window
)
29 fScreen
= BPrivateScreen::Get(window
);
35 BPrivateScreen::Put(fScreen
);
42 return fScreen
!= NULL
&& fScreen
->IsValid();
49 if (fScreen
!= NULL
) {
50 BPrivateScreen
* screen
= BPrivateScreen::GetNext(fScreen
);
64 return fScreen
->ColorSpace();
66 return B_NO_COLOR_SPACE
;
74 return fScreen
->Frame();
76 return BRect(0, 0, 0, 0);
83 if (fScreen
!= NULL
) {
84 screen_id id
= { fScreen
->ID() };
88 return B_MAIN_SCREEN_ID
;
93 BScreen::WaitForRetrace()
95 return WaitForRetrace(B_INFINITE_TIMEOUT
);
100 BScreen::WaitForRetrace(bigtime_t timeout
)
103 return fScreen
->WaitForRetrace(timeout
);
110 BScreen::IndexForColor(uint8 red
, uint8 green
, uint8 blue
, uint8 alpha
)
113 return fScreen
->IndexForColor(red
, green
, blue
, alpha
);
120 BScreen::ColorForIndex(const uint8 index
)
123 return fScreen
->ColorForIndex(index
);
130 BScreen::InvertIndex(uint8 index
)
133 return fScreen
->InvertIndex(index
);
143 return fScreen
->ColorMap();
150 BScreen::GetBitmap(BBitmap
** _bitmap
, bool drawCursor
, BRect
* bounds
)
153 return fScreen
->GetBitmap(_bitmap
, drawCursor
, bounds
);
160 BScreen::ReadBitmap(BBitmap
* bitmap
, bool drawCursor
, BRect
* bounds
)
163 return fScreen
->ReadBitmap(bitmap
, drawCursor
, bounds
);
170 BScreen::DesktopColor()
173 return fScreen
->DesktopColor(B_CURRENT_WORKSPACE_INDEX
);
180 BScreen::DesktopColor(uint32 workspace
)
183 return fScreen
->DesktopColor(workspace
);
190 BScreen::SetDesktopColor(rgb_color color
, bool stick
)
193 fScreen
->SetDesktopColor(color
, B_CURRENT_WORKSPACE_INDEX
, stick
);
198 BScreen::SetDesktopColor(rgb_color color
, uint32 workspace
, bool stick
)
201 fScreen
->SetDesktopColor(color
, workspace
, stick
);
206 BScreen::ProposeMode(display_mode
* target
, const display_mode
* low
,
207 const display_mode
* high
)
210 return fScreen
->ProposeMode(target
, low
, high
);
217 BScreen::GetModeList(display_mode
** _modeList
, uint32
* _count
)
220 return fScreen
->GetModeList(_modeList
, _count
);
227 BScreen::GetMode(display_mode
* mode
)
230 return fScreen
->GetMode(B_CURRENT_WORKSPACE_INDEX
, mode
);
237 BScreen::GetMode(uint32 workspace
, display_mode
* mode
)
240 return fScreen
->GetMode(workspace
, mode
);
247 BScreen::SetMode(display_mode
* mode
, bool makeDefault
)
250 return fScreen
->SetMode(B_CURRENT_WORKSPACE_INDEX
, mode
, makeDefault
);
257 BScreen::SetMode(uint32 workspace
, display_mode
* mode
, bool makeDefault
)
260 return fScreen
->SetMode(workspace
, mode
, makeDefault
);
267 BScreen::GetDeviceInfo(accelerant_device_info
* info
)
270 return fScreen
->GetDeviceInfo(info
);
277 BScreen::GetMonitorInfo(monitor_info
* info
)
280 return fScreen
->GetMonitorInfo(info
);
287 BScreen::GetPixelClockLimits(display_mode
* mode
, uint32
* _low
, uint32
* _high
)
290 return fScreen
->GetPixelClockLimits(mode
, _low
, _high
);
297 BScreen::GetTimingConstraints(display_timing_constraints
* constraints
)
300 return fScreen
->GetTimingConstraints(constraints
);
307 BScreen::SetDPMS(uint32 dpmsState
)
310 return fScreen
->SetDPMS(dpmsState
);
320 return fScreen
->DPMSState();
327 BScreen::DPMSCapabilites()
330 return fScreen
->DPMSCapabilites();
337 BScreen::GetBrightness(float* brightness
)
340 return fScreen
->GetBrightness(brightness
);
346 BScreen::SetBrightness(float brightness
)
349 return fScreen
->SetBrightness(brightness
);
354 // #pragma mark - Deprecated methods
357 BPrivate::BPrivateScreen
*
358 BScreen::private_screen()
365 BScreen::ProposeDisplayMode(display_mode
* target
, const display_mode
* low
,
366 const display_mode
* high
)
368 return ProposeMode(target
, low
, high
);
373 BScreen::BaseAddress()
376 return fScreen
->BaseAddress();
383 BScreen::BytesPerRow()
386 return fScreen
->BytesPerRow();