2007-10-15 15:41:47 +04:00
|
|
|
/*
|
2009-08-27 15:12:41 +04:00
|
|
|
* Copyright 2007-2009, Haiku, Inc. All rights reserved.
|
2007-10-15 15:41:47 +04:00
|
|
|
* Distributed under the terms of the MIT License.
|
|
|
|
*/
|
2002-10-23 17:54:44 +04:00
|
|
|
#ifndef _SCREEN_H
|
|
|
|
#define _SCREEN_H
|
|
|
|
|
2007-10-15 15:41:47 +04:00
|
|
|
|
2002-10-23 17:54:44 +04:00
|
|
|
#include <Accelerant.h>
|
|
|
|
#include <GraphicsDefs.h>
|
|
|
|
#include <Rect.h>
|
|
|
|
#include <OS.h>
|
|
|
|
|
|
|
|
|
2007-10-16 00:13:55 +04:00
|
|
|
class BBitmap;
|
2002-10-23 17:54:44 +04:00
|
|
|
class BWindow;
|
|
|
|
|
2007-10-15 15:41:47 +04:00
|
|
|
namespace BPrivate {
|
|
|
|
class BPrivateScreen;
|
|
|
|
}
|
2002-10-23 17:54:44 +04:00
|
|
|
|
2009-08-27 15:12:41 +04:00
|
|
|
|
2002-10-23 17:54:44 +04:00
|
|
|
class BScreen {
|
2009-08-27 15:12:41 +04:00
|
|
|
public:
|
|
|
|
BScreen(screen_id id = B_MAIN_SCREEN_ID);
|
|
|
|
BScreen(BWindow* window);
|
|
|
|
~BScreen();
|
|
|
|
|
|
|
|
bool IsValid();
|
|
|
|
status_t SetToNext();
|
|
|
|
|
|
|
|
color_space ColorSpace();
|
|
|
|
BRect Frame();
|
|
|
|
screen_id ID();
|
|
|
|
|
|
|
|
status_t WaitForRetrace();
|
|
|
|
status_t WaitForRetrace(bigtime_t timeout);
|
|
|
|
|
|
|
|
uint8 IndexForColor(rgb_color color);
|
|
|
|
uint8 IndexForColor(uint8 red, uint8 green,
|
|
|
|
uint8 blue, uint8 alpha = 255);
|
|
|
|
rgb_color ColorForIndex(uint8 index);
|
|
|
|
uint8 InvertIndex(uint8 index);
|
|
|
|
|
|
|
|
const color_map* ColorMap();
|
|
|
|
|
|
|
|
status_t GetBitmap(BBitmap** _bitmap,
|
|
|
|
bool drawCursor = true,
|
|
|
|
BRect* frame = NULL);
|
|
|
|
status_t ReadBitmap(BBitmap* bitmap,
|
|
|
|
bool drawCursor = true,
|
|
|
|
BRect* frame = NULL);
|
|
|
|
|
|
|
|
rgb_color DesktopColor();
|
2011-10-30 01:51:43 +04:00
|
|
|
rgb_color DesktopColor(uint32 workspace);
|
2009-08-27 15:12:41 +04:00
|
|
|
void SetDesktopColor(rgb_color color,
|
2011-10-30 01:51:43 +04:00
|
|
|
bool stick = true);
|
2009-08-27 15:12:41 +04:00
|
|
|
void SetDesktopColor(rgb_color color,
|
2011-10-30 01:51:43 +04:00
|
|
|
uint32 workspace, bool stick = true);
|
2009-08-27 15:12:41 +04:00
|
|
|
|
|
|
|
status_t ProposeMode(display_mode* target,
|
|
|
|
const display_mode* low,
|
|
|
|
const display_mode* high);
|
|
|
|
status_t GetModeList(display_mode** _modeList,
|
|
|
|
uint32* _count);
|
2011-10-30 01:51:43 +04:00
|
|
|
status_t GetMode(display_mode* mode);
|
2009-08-27 15:12:41 +04:00
|
|
|
status_t GetMode(uint32 workspace,
|
2011-10-30 01:51:43 +04:00
|
|
|
display_mode* mode);
|
2009-08-27 15:12:41 +04:00
|
|
|
status_t SetMode(display_mode* mode,
|
|
|
|
bool makeDefault = false);
|
|
|
|
status_t SetMode(uint32 workspace,
|
|
|
|
display_mode* mode,
|
|
|
|
bool makeDefault = false);
|
|
|
|
status_t GetDeviceInfo(accelerant_device_info* info);
|
|
|
|
status_t GetMonitorInfo(monitor_info* info);
|
|
|
|
status_t GetPixelClockLimits(display_mode* mode,
|
2011-10-30 01:51:43 +04:00
|
|
|
uint32* _low, uint32* _high);
|
2009-08-27 15:12:41 +04:00
|
|
|
status_t GetTimingConstraints(
|
|
|
|
display_timing_constraints*
|
|
|
|
timingConstraints);
|
|
|
|
status_t SetDPMS(uint32 state);
|
|
|
|
uint32 DPMSState();
|
|
|
|
uint32 DPMSCapabilites();
|
|
|
|
|
2017-11-21 13:53:18 +03:00
|
|
|
status_t GetBrightness(float* brightness);
|
|
|
|
status_t SetBrightness(float brightness);
|
2017-11-21 11:12:18 +03:00
|
|
|
|
2009-08-27 15:12:41 +04:00
|
|
|
private:
|
|
|
|
// Forbidden and deprecated methods
|
|
|
|
BScreen(const BScreen& other);
|
|
|
|
BScreen& operator=(const BScreen& other);
|
|
|
|
|
|
|
|
BPrivate::BPrivateScreen* private_screen();
|
|
|
|
status_t ProposeDisplayMode(display_mode* target,
|
|
|
|
const display_mode* low,
|
|
|
|
const display_mode* high);
|
|
|
|
void* BaseAddress();
|
|
|
|
uint32 BytesPerRow();
|
|
|
|
|
|
|
|
private:
|
|
|
|
BPrivate::BPrivateScreen* fScreen;
|
2002-10-23 17:54:44 +04:00
|
|
|
};
|
|
|
|
|
|
|
|
|
2007-10-15 15:41:47 +04:00
|
|
|
inline uint8
|
|
|
|
BScreen::IndexForColor(rgb_color color)
|
|
|
|
{
|
|
|
|
return IndexForColor(color.red, color.green, color.blue, color.alpha);
|
|
|
|
}
|
2002-10-23 17:54:44 +04:00
|
|
|
|
2009-08-27 15:12:41 +04:00
|
|
|
#endif // _SCREEN_H
|