2011-10-30 01:51:43 +04:00
|
|
|
/*
|
2013-02-07 06:05:00 +04:00
|
|
|
* Copyright 2011 Haiku, Inc. All rights reserved.
|
|
|
|
* Distributed under the terms of the MIT License.
|
2011-10-30 01:51:43 +04:00
|
|
|
*
|
2013-02-07 06:05:00 +04:00
|
|
|
* Authors:
|
2011-10-30 01:51:43 +04:00
|
|
|
* Stefano Ceccherini, burton666@libero.it
|
|
|
|
* Axel Dörfler, axeld@pinc-software.de
|
|
|
|
* John Scipione, jscipione@gmail.com
|
2013-02-07 06:05:00 +04:00
|
|
|
*
|
2011-10-30 01:51:43 +04:00
|
|
|
* Corresponds to:
|
2013-02-08 06:19:06 +04:00
|
|
|
* headers/os/interface/Screen.h rev 42759
|
|
|
|
* src/kits/interface/Screen.cpp rev 42759
|
2011-10-30 01:51:43 +04:00
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
|
|
/*!
|
|
|
|
\file Screen.h
|
2013-02-07 06:05:00 +04:00
|
|
|
\ingroup interface
|
|
|
|
\ingroup libbe
|
2011-10-30 01:51:43 +04:00
|
|
|
\brief Defines the BScreen class and support structures.
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
|
|
/*!
|
|
|
|
\class BScreen
|
|
|
|
\ingroup interface
|
2013-02-07 06:05:00 +04:00
|
|
|
\ingroup libbe
|
2011-10-30 01:51:43 +04:00
|
|
|
\brief The BScreen class provides methods to retrieve and change display
|
2014-06-14 01:25:02 +04:00
|
|
|
settings.
|
2011-10-30 01:51:43 +04:00
|
|
|
|
|
|
|
Each BScreen object describes one display connected to the computer.
|
|
|
|
Multiple BScreen objects can represent the same physical display.
|
|
|
|
|
|
|
|
\attention Haiku currently supports only a single display. The main
|
|
|
|
screen with id \c B_MAIN_SCREEN_ID contains the origin in its top left
|
|
|
|
corner. Additional displays, when they become supported, will extend
|
|
|
|
the coordinates of the main screen.
|
|
|
|
|
|
|
|
Some utility methods provided by this class are ColorSpace() to get the
|
|
|
|
color space of the screen, Frame() to get the frame rectangle, and ID()
|
|
|
|
to get the identifier of the screen.
|
|
|
|
|
|
|
|
Methods to convert between 8-bit and 32-bit colors are provided by
|
|
|
|
IndexForColor() and ColorForIndex().
|
|
|
|
|
|
|
|
You can also use this class to take a screenshot of the entire screen or
|
|
|
|
a particular portion of it. To take a screenshot use either the GetBitmap()
|
|
|
|
or ReadBitmap() method.
|
|
|
|
|
|
|
|
Furthermore, you can use this class get and set the background color of a
|
|
|
|
workspace. To get the background color call DesktopColor() or to set the
|
|
|
|
background color use SetDesktopColor().
|
|
|
|
|
|
|
|
This class provides methods to get and set the resolution, pixel depth,
|
|
|
|
and color map of a display. To get a list of the display modes supported
|
|
|
|
by the graphics card use the GetModeList() method. You can get and set
|
|
|
|
the screen resolution by calling the GetMode() and SetMode() methods.
|
|
|
|
The color map of the display can be retrieved by calling the ColorMap()
|
|
|
|
method.
|
|
|
|
|
|
|
|
You can use this class to get information about the graphics card and
|
|
|
|
monitor connected to the computer by calling the GetDeviceInfo() and
|
|
|
|
GetMonitorInfo() methods.
|
|
|
|
|
|
|
|
VESA Display Power Management Signaling support allow you to put the
|
|
|
|
monitor into a low-power mode. Call DPMSCapabilites() to check what
|
|
|
|
modes are supported by your monitor. DPMSState() tells you what state
|
|
|
|
your monitor is currently in and SetDPMS() allows you to change it.
|
2014-06-14 01:25:02 +04:00
|
|
|
|
|
|
|
\since BeOS R3
|
2011-10-30 01:51:43 +04:00
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
|
|
/*!
|
|
|
|
\fn BScreen::BScreen(screen_id id)
|
|
|
|
\brief Creates a BScreen object which represents the display
|
2014-06-14 01:25:02 +04:00
|
|
|
connected to the computer with the given screen_id.
|
2011-10-30 01:51:43 +04:00
|
|
|
|
|
|
|
In the current implementation, there is only one display
|
|
|
|
(\c B_MAIN_SCREEN_ID). To be sure that the object was constructed
|
|
|
|
correctly, call IsValid().
|
|
|
|
|
|
|
|
\param id The screen_id of the screen to create a BScreen object from.
|
2014-06-14 01:25:02 +04:00
|
|
|
|
|
|
|
\since BeOS R3
|
2011-10-30 01:51:43 +04:00
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
|
|
/*!
|
|
|
|
\fn BScreen::BScreen(BWindow* window)
|
|
|
|
\brief Creates a BScreen object which represents the display that
|
2014-06-14 01:25:02 +04:00
|
|
|
contains \a window.
|
2011-10-30 01:51:43 +04:00
|
|
|
|
|
|
|
In the current implementation, there is only one display
|
|
|
|
(\c B_MAIN_SCREEN_ID). To be sure that the object was constructed
|
|
|
|
correctly, call IsValid().
|
|
|
|
|
|
|
|
\param window A BWindow object.
|
2014-06-14 01:25:02 +04:00
|
|
|
|
|
|
|
\since BeOS R3
|
2011-10-30 01:51:43 +04:00
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
|
|
/*!
|
|
|
|
\fn BScreen::~BScreen()
|
|
|
|
\brief Frees the resources used by the BScreen object and unlocks the
|
2014-06-14 01:25:02 +04:00
|
|
|
screen.
|
2011-10-30 01:51:43 +04:00
|
|
|
|
|
|
|
\note The main screen object will never go away, even if you disconnect
|
2014-06-14 01:25:02 +04:00
|
|
|
all monitors.
|
|
|
|
|
|
|
|
\since BeOS R3
|
2011-10-30 01:51:43 +04:00
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
|
|
/*!
|
|
|
|
\name Utility Methods
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
|
|
//! @{
|
|
|
|
|
|
|
|
|
|
|
|
/*!
|
|
|
|
\fn bool BScreen::IsValid()
|
|
|
|
\brief Checks that the BScreen object represents a real display that is
|
2014-06-14 01:25:02 +04:00
|
|
|
connected to the computer.
|
2011-10-30 01:51:43 +04:00
|
|
|
|
|
|
|
\return \c true if the BScreen object is valid, \c false otherwise.
|
2014-06-14 01:25:02 +04:00
|
|
|
|
|
|
|
\since BeOS R3
|
2011-10-30 01:51:43 +04:00
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
|
|
/*!
|
|
|
|
\fn status_t BScreen::SetToNext()
|
|
|
|
\brief Sets the BScreen object to the next display in the screen list.
|
|
|
|
|
|
|
|
\return \c B_OK if successful, otherwise \c B_ERROR.
|
2014-06-14 01:25:02 +04:00
|
|
|
|
|
|
|
\since BeOS R5
|
2011-10-30 01:51:43 +04:00
|
|
|
*/
|
|
|
|
|
|
|
|
|
2013-02-07 06:05:00 +04:00
|
|
|
/*!
|
|
|
|
\fn color_space BScreen::ColorSpace()
|
2014-06-14 01:25:02 +04:00
|
|
|
\brief Returns the color_space of the display.
|
2011-10-30 01:51:43 +04:00
|
|
|
|
|
|
|
\return \c B_CMAP8, \c B_RGB15, \c B_RGB32, or \c B_NO_COLOR_SPACE
|
2014-06-14 01:25:02 +04:00
|
|
|
if the BScreen object is invalid.
|
|
|
|
|
|
|
|
\since BeOS R3
|
2011-10-30 01:51:43 +04:00
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
|
|
/*!
|
|
|
|
\fn BRect BScreen::Frame()
|
|
|
|
\brief Gets the frame of the screen in the screen's coordinate system.
|
|
|
|
|
|
|
|
For example if the BScreen object points to the main screen with a
|
|
|
|
resolution of 1,366x768 then this method returns
|
|
|
|
BRect(0.0, 0.0, 1365.0, 767.0). If the BScreen object is invalid then
|
|
|
|
this method returns an empty rectangle i.e. BRect(0.0, 0.0, 0.0, 0.0)
|
|
|
|
|
|
|
|
You can set the frame programmatically by calling the SetMode() method.
|
|
|
|
|
|
|
|
\return a BRect frame of the screen in the screen's coordinate system.
|
2014-06-14 01:25:02 +04:00
|
|
|
|
|
|
|
\since BeOS R3
|
2011-10-30 01:51:43 +04:00
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
|
|
/*!
|
|
|
|
\fn screen_id BScreen::ID()
|
|
|
|
\brief Gets the identifier of the display.
|
|
|
|
|
|
|
|
In the current implementation this method returns \c B_MAIN_SCREEN_ID
|
|
|
|
even if the object is invalid.
|
|
|
|
|
|
|
|
\return A screen_id that identifies the screen.
|
2014-06-14 01:25:02 +04:00
|
|
|
|
|
|
|
\since BeOS R3
|
2011-10-30 01:51:43 +04:00
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
|
|
/*!
|
|
|
|
\fn status_t BScreen::WaitForRetrace()
|
|
|
|
\brief Blocks until the monitor has finished its current vertical retrace.
|
|
|
|
|
|
|
|
\return \c B_OK or \c B_ERROR if the screen object is invalid.
|
2014-06-14 01:25:02 +04:00
|
|
|
|
|
|
|
\since BeOS R3
|
2011-10-30 01:51:43 +04:00
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
|
|
/*!
|
|
|
|
\fn status_t BScreen::WaitForRetrace(bigtime_t timeout)
|
|
|
|
\brief Blocks until the monitor has finished its current vertical retrace
|
2014-06-14 01:25:02 +04:00
|
|
|
or until \a timeout has expired.
|
2011-10-30 01:51:43 +04:00
|
|
|
|
|
|
|
\param timeout The amount of time to wait before returning.
|
|
|
|
|
|
|
|
\return \c B_OK if the monitor has retraced in the given \a timeout
|
2014-06-14 01:25:02 +04:00
|
|
|
duration, \c B_ERROR otherwise.
|
|
|
|
|
|
|
|
\since BeOS R5
|
2011-10-30 01:51:43 +04:00
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
|
|
//! @}
|
|
|
|
|
|
|
|
|
|
|
|
/*!
|
2014-06-14 01:25:02 +04:00
|
|
|
\name Color
|
2011-10-30 01:51:43 +04:00
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
|
|
//! @{
|
|
|
|
|
|
|
|
|
|
|
|
/*!
|
|
|
|
\fn inline uint8 BScreen::IndexForColor(rgb_color color)
|
2014-06-14 01:25:02 +04:00
|
|
|
\brief Returns the 8-bit color index that most closely matches a
|
|
|
|
32-bit \a color.
|
2011-10-30 01:51:43 +04:00
|
|
|
|
|
|
|
\param color The 32-bit \a color to get the 8-bit index of.
|
|
|
|
|
|
|
|
\return An 8-bit color index in the screen's color_map.
|
2014-06-14 01:25:02 +04:00
|
|
|
|
|
|
|
\since BeOS R3
|
2011-10-30 01:51:43 +04:00
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
|
|
/*!
|
|
|
|
\fn uint8 BScreen::IndexForColor(uint8 red, uint8 green, uint8 blue,
|
2014-06-14 01:25:02 +04:00
|
|
|
uint8 alpha)
|
|
|
|
\brief Returns the 8-bit color index that most closely matches a set of
|
|
|
|
\a red, \a green, \a blue, and \a alpha values.
|
2011-10-30 01:51:43 +04:00
|
|
|
|
|
|
|
\param red The \a red value.
|
|
|
|
\param green The \a green value.
|
|
|
|
\param blue The \a blue value.
|
|
|
|
\param alpha The \a alpha value.
|
|
|
|
|
|
|
|
\return An 8-bit color index in the screen's color_map.
|
2014-06-14 01:25:02 +04:00
|
|
|
|
|
|
|
\since BeOS R3
|
2011-10-30 01:51:43 +04:00
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
|
|
/*!
|
|
|
|
\fn rgb_color BScreen::ColorForIndex(const uint8 index)
|
|
|
|
\brief Gets the 32-bit color representation of an 8-bit color \a index.
|
|
|
|
|
|
|
|
\param index The 8-bit color \a index to convert to a 32-bit color.
|
|
|
|
|
|
|
|
\return A 32-bit rgb_color structure.
|
2014-06-14 01:25:02 +04:00
|
|
|
|
|
|
|
\since BeOS R3
|
2011-10-30 01:51:43 +04:00
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
|
|
/*!
|
|
|
|
\fn uint8 BScreen::InvertIndex(uint8 index)
|
|
|
|
\brief Gets the "Inversion" of an 8-bit color \a index.
|
|
|
|
|
|
|
|
Inverted colors are useful for highlighting.
|
|
|
|
|
|
|
|
\param index The 8-bit color \a index.
|
|
|
|
|
|
|
|
\return An 8-bit color \a index that represents the "Inversion" of the
|
2014-06-14 01:25:02 +04:00
|
|
|
given color in the screen's color_map.
|
|
|
|
|
|
|
|
\since BeOS R3
|
2011-10-30 01:51:43 +04:00
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
|
|
/*!
|
|
|
|
\fn const color_map* BScreen::ColorMap()
|
|
|
|
\brief Gets the color_map of the BScreen.
|
|
|
|
|
|
|
|
\return A pointer to the BScreen object's color_map.
|
2014-06-14 01:25:02 +04:00
|
|
|
|
|
|
|
\since BeOS R3
|
2011-10-30 01:51:43 +04:00
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
|
|
//! @}
|
|
|
|
|
|
|
|
|
|
|
|
/*!
|
2014-06-14 01:25:02 +04:00
|
|
|
\name Bitmap
|
2011-10-30 01:51:43 +04:00
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
|
|
//! @{
|
|
|
|
|
|
|
|
|
|
|
|
/*!
|
|
|
|
\fn status_t BScreen::GetBitmap(BBitmap** _bitmap, bool drawCursor,
|
2014-06-14 01:25:02 +04:00
|
|
|
BRect* bounds)
|
2011-10-30 01:51:43 +04:00
|
|
|
\brief Allocates a BBitmap and copies the contents of the screen into it.
|
|
|
|
|
|
|
|
\note GetBitmap() will allocate a BBitmap object for you while
|
2014-06-14 01:25:02 +04:00
|
|
|
ReadBitmap() requires you to pre-allocate a BBitmap object first.
|
2011-10-30 01:51:43 +04:00
|
|
|
|
|
|
|
\note The caller is responsible for freeing the BBitmap object.
|
|
|
|
|
|
|
|
\param _bitmap A pointer to a BBitmap pointer where this method will
|
2014-06-14 01:25:02 +04:00
|
|
|
store the contents of the display.
|
2011-10-30 01:51:43 +04:00
|
|
|
\param drawCursor Specifies whether or not to draw the cursor.
|
|
|
|
\param bounds Specifies the screen area that you want copied. If
|
2014-06-14 01:25:02 +04:00
|
|
|
\a bounds is \c NULL then the entire screen is copied.
|
2011-10-30 01:51:43 +04:00
|
|
|
|
|
|
|
\return \c B_OK if the operation was successful, \c B_ERROR otherwise.
|
2014-06-14 01:25:02 +04:00
|
|
|
|
|
|
|
\since BeOS R4
|
2011-10-30 01:51:43 +04:00
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
|
|
/*!
|
|
|
|
\fn status_t BScreen::ReadBitmap(BBitmap* bitmap, bool drawCursor,
|
2014-06-14 01:25:02 +04:00
|
|
|
BRect* bounds)
|
2011-10-30 01:51:43 +04:00
|
|
|
\brief Copies the contents of the screen into a BBitmap.
|
|
|
|
|
|
|
|
\note ReadBitmap() requires you to pre-allocate a BBitmap object first,
|
2014-06-14 01:25:02 +04:00
|
|
|
while GetBitmap() will allocate a BBitmap object for you.
|
2011-10-30 01:51:43 +04:00
|
|
|
|
|
|
|
\param bitmap A pointer to a pre-allocated BBitmap where this
|
2014-06-14 01:25:02 +04:00
|
|
|
method will store the contents of the display.
|
2011-10-30 01:51:43 +04:00
|
|
|
\param drawCursor Specifies whether or not to draw the cursor.
|
|
|
|
\param bounds Specifies the screen area that you want copied. If
|
2014-06-14 01:25:02 +04:00
|
|
|
\a bounds is \c NULL then the entire screen is copied.
|
2011-10-30 01:51:43 +04:00
|
|
|
|
|
|
|
\return \c B_OK if the operation was successful, \c B_ERROR otherwise.
|
2014-06-14 01:25:02 +04:00
|
|
|
|
|
|
|
\since BeOS R4
|
2011-10-30 01:51:43 +04:00
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
|
|
//! @}
|
|
|
|
|
|
|
|
|
|
|
|
/*!
|
2014-06-14 01:25:02 +04:00
|
|
|
\name Desktop Color
|
2011-10-30 01:51:43 +04:00
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
|
|
//! @{
|
|
|
|
|
|
|
|
|
|
|
|
/*!
|
|
|
|
\fn rgb_color BScreen::DesktopColor()
|
|
|
|
\brief Gets the background color of the current workspace.
|
|
|
|
|
|
|
|
\return A 32-bit rgb_color structure containing the background color
|
|
|
|
of the current workspace.
|
2014-06-14 01:25:02 +04:00
|
|
|
|
|
|
|
\since BeOS R3
|
2011-10-30 01:51:43 +04:00
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
|
|
/*!
|
|
|
|
\fn rgb_color BScreen::DesktopColor(uint32 workspace)
|
|
|
|
\brief Gets the background color of the specified \a workspace.
|
|
|
|
|
|
|
|
\param workspace The \a workspace index to get the desktop background
|
|
|
|
color of.
|
|
|
|
|
|
|
|
\return An 32-bit rgb_color structure containing the background color
|
|
|
|
of the specified \a workspace.
|
2014-06-14 01:25:02 +04:00
|
|
|
|
|
|
|
\since Haiku R1
|
2011-10-30 01:51:43 +04:00
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
|
|
/*!
|
|
|
|
\fn void BScreen::SetDesktopColor(rgb_color color, bool stick)
|
|
|
|
\brief Set the background \a color of the current workspace.
|
|
|
|
|
|
|
|
\param color The 32-bit \a color to paint the desktop background.
|
|
|
|
\param stick Whether or not the \a color will stay after a reboot.
|
2014-06-14 01:25:02 +04:00
|
|
|
|
|
|
|
\since BeOS R3
|
2011-10-30 01:51:43 +04:00
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
|
|
/*!
|
|
|
|
\fn void BScreen::SetDesktopColor(rgb_color color, uint32 workspace,
|
2014-06-14 01:25:02 +04:00
|
|
|
bool stick)
|
2011-10-30 01:51:43 +04:00
|
|
|
\brief Set the background \a color of the specified \a workspace.
|
|
|
|
|
|
|
|
\param color The 32-bit \a color to paint the desktop background.
|
|
|
|
\param workspace The \a workspace index to update.
|
|
|
|
\param stick Whether or not the \a color will stay after a reboot.
|
2014-06-14 01:25:02 +04:00
|
|
|
|
|
|
|
\since Haiku R1
|
2011-10-30 01:51:43 +04:00
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
|
|
//! @}
|
|
|
|
|
|
|
|
|
|
|
|
/*!
|
2014-06-14 01:25:02 +04:00
|
|
|
\name Display Mode
|
2011-10-30 01:51:43 +04:00
|
|
|
|
|
|
|
The following methods retrieve and alter the display_mode structure
|
|
|
|
of a screen. The display_mode structure contains screen size,
|
|
|
|
pixel depth, and display timings settings.
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
|
|
//! @{
|
|
|
|
|
|
|
|
|
|
|
|
/*!
|
|
|
|
\fn status_t BScreen::ProposeMode(display_mode* target,
|
2014-06-14 01:25:02 +04:00
|
|
|
const display_mode* low, const display_mode* high)
|
2011-10-30 01:51:43 +04:00
|
|
|
\brief Adjust the \a target mode to make it a supported mode.
|
|
|
|
|
|
|
|
The list of supported modes for the graphics card is supplied by
|
|
|
|
the GetModeList() method.
|
|
|
|
|
|
|
|
\param target The mode you want adjust.
|
|
|
|
\param low The lower display mode limit.
|
|
|
|
\param high The higher display mode limit.
|
|
|
|
|
2014-06-14 01:25:02 +04:00
|
|
|
\returns A status code.
|
2011-10-30 01:51:43 +04:00
|
|
|
\retval B_OK if \a target is supported and falls within the
|
2014-06-14 01:25:02 +04:00
|
|
|
\a low and \a high limits.
|
2011-10-30 01:51:43 +04:00
|
|
|
\retval B_BAD_VALUE if \a target is supported but does not
|
2014-06-14 01:25:02 +04:00
|
|
|
fall within the \a low and \a high limits.
|
2011-10-30 01:51:43 +04:00
|
|
|
\retval B_ERROR if the target mode isn't supported.
|
2014-06-14 01:25:02 +04:00
|
|
|
|
|
|
|
\since BeOS R5
|
2011-10-30 01:51:43 +04:00
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
|
|
/*!
|
|
|
|
\fn status_t BScreen::GetModeList(display_mode** _modeList, uint32* _count)
|
|
|
|
\brief Allocates and returns a list of the display modes supported by the
|
|
|
|
graphics card into \a _modeList.
|
|
|
|
|
|
|
|
\warning The monitor may not be able to display all of the modes that
|
2014-06-14 01:25:02 +04:00
|
|
|
GetModeList() retrieves.
|
2011-10-30 01:51:43 +04:00
|
|
|
|
|
|
|
\note The caller is responsible for freeing the display_mode object.
|
|
|
|
|
|
|
|
\param _modeList A pointer to a display_mode pointer, where the function
|
2014-06-14 01:25:02 +04:00
|
|
|
will allocate an array of display_mode structures.
|
2011-10-30 01:51:43 +04:00
|
|
|
\param _count A pointer to an integer used to store the count of
|
2014-06-14 01:25:02 +04:00
|
|
|
available display modes.
|
2011-10-30 01:51:43 +04:00
|
|
|
|
|
|
|
\retval B_OK if the operation was successful.
|
|
|
|
\retval B_ERROR for all other errors.
|
2014-06-14 01:25:02 +04:00
|
|
|
|
|
|
|
\since BeOS R5
|
2011-10-30 01:51:43 +04:00
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
|
|
/*!
|
|
|
|
\fn status_t BScreen::GetMode(display_mode* mode)
|
|
|
|
\brief Fills out the display_mode struct from the current workspace.
|
|
|
|
|
|
|
|
\param mode A pointer to a display_mode struct to copy into.
|
|
|
|
|
|
|
|
\retval B_OK if the operation was successful.
|
|
|
|
\retval B_BAD_VALUE if \a mode is invalid.
|
|
|
|
\retval B_ERROR for all other errors.
|
2014-06-14 01:25:02 +04:00
|
|
|
|
|
|
|
\since BeOS R5
|
2011-10-30 01:51:43 +04:00
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
|
|
/*!
|
|
|
|
\fn status_t BScreen::GetMode(uint32 workspace, display_mode* mode)
|
|
|
|
\brief Fills out the display_mode struct from the specified
|
2014-06-14 01:25:02 +04:00
|
|
|
\a workspace.
|
2011-10-30 01:51:43 +04:00
|
|
|
|
|
|
|
\param workspace The index of the \a workspace to query.
|
|
|
|
\param mode A pointer to a display_mode structure to copy into.
|
|
|
|
|
|
|
|
\retval B_OK if the operation was successful
|
|
|
|
\retval B_BAD_VALUE if \a mode is invalid.
|
|
|
|
\retval B_ERROR for all other errors.
|
2014-06-14 01:25:02 +04:00
|
|
|
|
|
|
|
\since Haiku R1
|
2011-10-30 01:51:43 +04:00
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
|
|
/*!
|
|
|
|
\fn status_t BScreen::SetMode(display_mode* mode, bool makeDefault)
|
|
|
|
\brief Sets the screen in the current workspace to the given \a mode.
|
|
|
|
|
|
|
|
\param mode A pointer to a display_mode struct.
|
|
|
|
\param makeDefault Whether or not \a mode is set as the default.
|
|
|
|
|
|
|
|
\return \c B_OK if the operation was successful, \c B_ERROR otherwise.
|
2014-06-14 01:25:02 +04:00
|
|
|
|
|
|
|
\since BeOS R5
|
2011-10-30 01:51:43 +04:00
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
|
|
/*!
|
|
|
|
\fn status_t BScreen::SetMode(uint32 workspace, display_mode* mode,
|
2014-06-14 01:25:02 +04:00
|
|
|
bool makeDefault)
|
2011-10-30 01:51:43 +04:00
|
|
|
\brief Set the screen in the specified \a workspace to the given \a mode.
|
|
|
|
|
|
|
|
\param workspace The index of the workspace to set the \a mode of.
|
|
|
|
\param mode A pointer to a display_mode struct.
|
|
|
|
\param makeDefault Whether or not the \a mode is set as the default
|
2014-06-14 01:25:02 +04:00
|
|
|
for the specified \a workspace.
|
2011-10-30 01:51:43 +04:00
|
|
|
|
|
|
|
\return \c B_OK if the operation was successful, \c B_ERROR otherwise.
|
2014-06-14 01:25:02 +04:00
|
|
|
|
|
|
|
\since Haiku R1
|
2011-10-30 01:51:43 +04:00
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
|
|
//! @}
|
|
|
|
|
|
|
|
|
|
|
|
/*!
|
2014-06-14 01:25:02 +04:00
|
|
|
\name Display and Graphics Card Info
|
2011-10-30 01:51:43 +04:00
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
|
|
//! @{
|
|
|
|
|
|
|
|
|
|
|
|
/*!
|
|
|
|
\fn status_t BScreen::GetDeviceInfo(accelerant_device_info* info)
|
|
|
|
\brief Fills out the \a info struct with information about a graphics card.
|
|
|
|
|
|
|
|
\param info An accelerant_device_info struct to store the device
|
2014-06-14 01:25:02 +04:00
|
|
|
\a info.
|
2011-10-30 01:51:43 +04:00
|
|
|
|
|
|
|
\retval B_OK if the operation was successful.
|
|
|
|
\retval B_BAD_VALUE if \a info is invalid.
|
|
|
|
\retval B_ERROR for all other errors.
|
2014-06-14 01:25:02 +04:00
|
|
|
|
|
|
|
\since BeOS R5
|
2011-10-30 01:51:43 +04:00
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
|
|
/*!
|
|
|
|
\fn status_t BScreen::GetMonitorInfo(monitor_info* info)
|
|
|
|
\brief Fills out the \a info struct with information about a monitor.
|
|
|
|
|
|
|
|
\param info A monitor_info struct to store the monitor \a info.
|
|
|
|
|
|
|
|
\retval B_OK if the operation was successful.
|
|
|
|
\retval B_BAD_VALUE if \a info is invalid.
|
|
|
|
\retval B_ERROR for all other errors.
|
2014-06-14 01:25:02 +04:00
|
|
|
|
|
|
|
\since Haiku R1
|
2011-10-30 01:51:43 +04:00
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
|
|
/*!
|
|
|
|
\fn status_t BScreen::GetPixelClockLimits(display_mode* mode,
|
2014-06-14 01:25:02 +04:00
|
|
|
uint32* _low, uint32* _high)
|
2011-10-30 01:51:43 +04:00
|
|
|
\brief Gets the minimum and maximum pixel clock rates that are possible
|
|
|
|
for the specified \a mode.
|
|
|
|
|
|
|
|
\param mode A pointer to a display_mode structure.
|
|
|
|
\param _low A pointer to a uint32 where the method stores the lowest
|
|
|
|
available pixel clock.
|
|
|
|
\param _high A pointer to a uint32 where the method stores the highest
|
|
|
|
available pixel clock.
|
|
|
|
|
|
|
|
\retval B_OK if the operation was successful.
|
|
|
|
\retval B_BAD_VALUE if \a mode, \a low, or \a high is invalid.
|
|
|
|
\retval B_ERROR for all other errors.
|
2014-06-14 01:25:02 +04:00
|
|
|
|
|
|
|
\since BeOS R5
|
2011-10-30 01:51:43 +04:00
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
|
|
/*!
|
2014-06-14 01:25:02 +04:00
|
|
|
\fn status_t BScreen::GetTimingConstraints(
|
|
|
|
display_timing_constraints* constraints)
|
2011-10-30 01:51:43 +04:00
|
|
|
\brief Fills out the \a constraints structure with the timing constraints
|
2014-06-14 01:25:02 +04:00
|
|
|
of the current display mode.
|
2011-10-30 01:51:43 +04:00
|
|
|
|
|
|
|
\param constraints A pointer to a display_timing_constraints structure
|
2014-06-14 01:25:02 +04:00
|
|
|
to store the timing constraints.
|
2011-10-30 01:51:43 +04:00
|
|
|
|
|
|
|
\retval B_OK if the operation was successful.
|
|
|
|
\retval B_BAD_VALUE if \a constraints is invalid.
|
|
|
|
\retval B_ERROR for all other errors.
|
2014-06-14 01:25:02 +04:00
|
|
|
|
|
|
|
\since BeOS R5
|
2011-10-30 01:51:43 +04:00
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
|
|
//! @}
|
|
|
|
|
|
|
|
|
|
|
|
/*!
|
|
|
|
\name VESA Display Power Management Signaling Settings
|
|
|
|
|
|
|
|
VESA Display Power Management Signaling (or DPMS) is a standard from the
|
|
|
|
VESA consortium for managing the power usage of displays through the
|
|
|
|
graphics card. DPMS allows you to shut off the display after the computer
|
|
|
|
has been unused for some time to save power.
|
|
|
|
|
|
|
|
DPMS states include:
|
|
|
|
- \c B_DPMS_ON Normal display operation.
|
|
|
|
- \c B_DPMS_STAND_BY Image not visible normal operation and returns to
|
|
|
|
normal after ~1 second.
|
|
|
|
- \c B_DPMS_SUSPEND Image not visible, returns to normal after ~5
|
|
|
|
seconds.
|
|
|
|
- \c B_DPMS_OFF Image not visible, display is off except for power to
|
|
|
|
monitoring circuitry. Returns to normal after ~8-20 seconds.
|
|
|
|
|
|
|
|
Power usage in each of the above states depends on the monitor used. CRT
|
|
|
|
monitors typically receive larger power savings than LCD monitors in
|
|
|
|
low-power states.
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
|
|
//! @{
|
|
|
|
|
|
|
|
|
|
|
|
/*!
|
|
|
|
\fn status_t BScreen::SetDPMS(uint32 dpmsState)
|
|
|
|
\brief Sets the VESA Display Power Management Signaling (DPMS) state for
|
2014-06-14 01:25:02 +04:00
|
|
|
the display.
|
2011-10-30 01:51:43 +04:00
|
|
|
|
2014-06-14 01:25:02 +04:00
|
|
|
\param dpmsState The DPMS state to set, valid values are:
|
|
|
|
- \c B_DPMS_ON
|
|
|
|
- \c B_DPMS_STAND_BY
|
|
|
|
- \c B_DPMS_SUSPEND
|
|
|
|
- \c B_DPMS_OFF
|
2011-10-30 01:51:43 +04:00
|
|
|
|
|
|
|
\return \c B_OK if the operation was successful, otherwise an error code.
|
2014-06-14 01:25:02 +04:00
|
|
|
|
|
|
|
\since BeOS R5
|
2011-10-30 01:51:43 +04:00
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
|
|
/*!
|
|
|
|
\fn uint32 BScreen::DPMSState()
|
|
|
|
\brief Gets the current VESA Display Power Management Signaling (DPMS)
|
2014-06-14 01:25:02 +04:00
|
|
|
state of the screen.
|
2011-10-30 01:51:43 +04:00
|
|
|
|
|
|
|
\return The current VESA Display Power Management Signaling (DPMS) state
|
2014-06-14 01:25:02 +04:00
|
|
|
of the display or 0 in the case of an error.
|
|
|
|
|
|
|
|
\since BeOS R5
|
2011-10-30 01:51:43 +04:00
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/*!
|
|
|
|
\fn uint32 BScreen::DPMSCapabilites()
|
|
|
|
\brief Gets the VESA Display Power Management Signaling (DPMS)
|
2014-06-14 01:25:02 +04:00
|
|
|
modes that the display supports as a bit mask.
|
2011-10-30 01:51:43 +04:00
|
|
|
|
|
|
|
- \c B_DPMS_ON is worth 1
|
|
|
|
- \c B_DPMS_STAND_BY is worth 2
|
|
|
|
- \c B_DPMS_SUSPEND is worth 4
|
|
|
|
- \c B_DPMS_OFF is worth 8
|
|
|
|
|
|
|
|
\return A bit mask of the VESA Display Power Management Signaling (DPMS)
|
2014-06-14 01:25:02 +04:00
|
|
|
modes that the display supports or 0 in the case of an error.
|
|
|
|
|
|
|
|
\since BeOS R5
|
2011-10-30 01:51:43 +04:00
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
|
|
//! @}
|
|
|
|
|
|
|
|
|
|
|
|
/*!
|
2014-06-14 01:25:02 +04:00
|
|
|
\name Deprecated Methods
|
2011-10-30 01:51:43 +04:00
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
|
|
//! @{
|
|
|
|
|
|
|
|
|
|
|
|
/*!
|
|
|
|
\fn BPrivate::BPrivateScreen* BScreen::private_screen()
|
|
|
|
\brief Returns the BPrivateScreen used by the BScreen object.
|
|
|
|
|
2014-06-14 01:25:02 +04:00
|
|
|
\return A pointer to the BPrivateScreen class internally used by the
|
|
|
|
BScreen object.
|
|
|
|
|
|
|
|
\since Haiku R1
|
2011-10-30 01:51:43 +04:00
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
|
|
/*!
|
|
|
|
\fn status_t BScreen::ProposeDisplayMode(display_mode* target,
|
2014-06-14 01:25:02 +04:00
|
|
|
const display_mode* low, const display_mode* high)
|
2011-10-30 01:51:43 +04:00
|
|
|
\brief Deprecated, use ProposeMode() instead.
|
2014-06-14 01:25:02 +04:00
|
|
|
|
|
|
|
\since BeOS R5
|
2011-10-30 01:51:43 +04:00
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
|
|
/*!
|
|
|
|
\fn void* BScreen::BaseAddress()
|
|
|
|
\brief Returns the base address of the frame buffer.
|
2014-06-14 01:25:02 +04:00
|
|
|
|
|
|
|
\since Haiku R1
|
2011-10-30 01:51:43 +04:00
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
|
|
/*!
|
|
|
|
\fn uint32 BScreen::BytesPerRow()
|
|
|
|
\brief Returns the bytes per row of the frame buffer.
|
2014-06-14 01:25:02 +04:00
|
|
|
|
|
|
|
\since Haiku R1
|
2011-10-30 01:51:43 +04:00
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
|
|
//! @}
|