Documentation | InterfaceKit | Screen
SYNOPSIS
Perl
use HaikuR1::Screen []; my $screen = HaikuR1::Screen->new($window); my $bgcolor = $screen->DesktopColor(); my $mode = $screen->GetMode();
Python
from HaikuR1.InterfaceKit import Screen screen = Screen(window) bgcolor = screen.DesktopColor() mode = screen.GetMode()
DESCRIPTION
Exposes the BScreen
object.
For more information on Screen, see the Be Book class description, the Be Book overview, and the Haiku Book class description.
METHODS
Constructor
Creates a Screen object.
Perl
HaikuR1::Screen->new(); HaikuR1::Screen->new($id); HaikuR1::Screen->new($window);
Python
Screen() Screen(id) Screen(window)
id
A screen_id, defaults to
B_MAIN_SCREEN_ID
.window
A Window; gets the screen that the Window is displayed on.
Bitmap
GetBitmap
ReadBitmap
Gets the current contents of the screen (or part of it) as a Bitmap.
GetBitmap
will create a new Bitmap, while ReadBitmap
will read the data
into an existing Bitmap.
When reading into an existing Bitmap, it must be the proper size, or an error will be generated.
Perl
$screen->GetBitmap($drawCursor, $bounds); $screen->ReadBitmap($bitmap, $drawCursor, $bounds);
Python
screen.GetBitmap(drawCursor, bounds) screen.ReadBitmap(bitmap, drawCursor, bounds)
bitmap
A Bitmap object.
drawCursor
A boolean; if true the cursor will be drawn in addition to any Windows, Views, etc.
bounds
A Rect indicating the portion of the screen to be copied to the bitmap; defaults to the entire screen.
ColorMap
IndexForColor
ColorForIndex
InvertIndex
The 8-bit color space supports 256 predetermined colors. Each screen has a map
of such colors. ColorMap
returns this map.
IndexForColor
returns the index within the color map of the closest match to
the given color. ColorForIndex
returns the color mapped to the given index.
InvertIndex
returns the index of the inverse of the color located at the
given index. That is, it finds the color at the given index, determines the
invorse of that color, and the returns the index of that inverse color.
Perl
$screen->ColorMap(); $screen->IndexForColor($color); $screen->IndexForColorFromRGB( red => $red, green => $green, blue => $blue, alpha => $alpha, ); $screen->ColorForIndex($index); $screen->InvertIndex($index);
Python
screen.ColorMap() screen.IndexForColor(color) screen.IndexForColorFromRGB( red = red, green = green, blue = blue, alpha = alpha, ) screen.ColorForIndex(index) screen.InvertIndex(index)
color
An rgb_color object.
red
,green
,blue
,alpha
Integers from
0
to255
representing the RGBA color;alpha
defaults to 255 (fully opaque).index
An integer from
0
to255
, the index of the color.
ColorSpace
Returns the color space used by the screen.
Perl
$screen->ColorSpace();
Python
screen.ColorSpace()
DesktopColor
SetDesktopColor
Gets or sets the desktop color
Perl
$screen->DesktopColor($index); $screen->SetDesktopColor( $color, workspace => $workspace, makeDefault => $makeDefault, );
Python
screen.DesktopColor(index) screen.SetDesktopColor( color, workspace = workspace, makeDefault = makeDefault )
workspace
An integer representing the workspace; defaults to the current workspace.
color
An rgb_color, the new color.
makeDefault
A boolean; if true (the default), the change will be permanent.
Device info
GetDeviceInfo
GetMonitorInfo
GetPixelClockLimits
GetTimingConstraints
Returns the given data in the appropiate form.
GetDeviceInfo
=> accelerant_device_infoGetMonitorInfo
=> monitor_infoGetPixelClockLimits
=> two integers representing lower and upper limitsGetTimingConstraints
=> display_timing_constraints
Perl
$screen->GetDeviceInfo(); $screen->GetMonitorInfo(); $screen->GetPixelClockLimits($mode); $screen->GetTimingConstraints();
Python
screen.GetDeviceInfo() screen.GetMonitorInfo() screen.GetPixelClockLimits(mode) screen.GetTimingConstraints()
mode
The display_mode to get the pixel clock limits for.
DPMS
DPMSState
SetDPMS
DPMSCapabilities
Manages the Display Power Management Settings for the screen, using the DPMS state constants.
DPMSCapabilities
returns a single integer consisting of the supported
states OR'd together.
Perl
$screen->DPMSState(); $screen->SetDPMS($state); $screen->DPMSCapabilities();
Python
screen.DPMSState() screen.SetDPMS(state) screen.DPMSCapabilities()
Frame
Returns a Rect indicating the extent of the screen.
Perl
$screen->Frame();
Python
screen.Frame()
ID
Returns the Screen's screen_id.
Perl
$screen->ID();
Python
screen.ID()
IsValid
Returns true if the Screen is valid.
Perl
$screen->IsValid();
Python
screen.IsValid()
Modes
GetMode
SetMode
GetModeList
ProposeMode
GetMode
and SetMode
get the set the screen's mode.
GetModeList
returns a native list of the
modes supported by the screen.
ProposeMode
attempts to adjust the given mode so that it will be a supported
mode. (According to the Be Book, "It's expected that the function will adjust
candidate
's screen size fields while holding the color space constant".) It
may or may not actually change the candidate. After any adjustment, it
compares the candidate to the limits provided.
It then generates an error if the (possibly adjusted) candidate is not a supported mode, returns true if it is supported and falls within the limits, and returns false if it is supported but does not fall within the limits.
Perl
$screen->GetMode($workspace); $screen->SetMode( $mode, workspace => $workspace, makeDefault => $makeDefault, ); $screen->GetModeList(); $screen->ProposeMode($target, $low, $high);
Python
screen.GetMode(workspace) screen.SetMode( mode, workspace = workspace, makeDefault = makeDefault ) screen.GetModeList() screen.ProposeMode(target, low, high)
workspace
An integer representing the workspace; defaults to the current workspace.
mode
A display_mode, the new mode.
makeDefault
A boolean; if true (the default), the change will be permanent.
target
The candidate display_mode.
low
,high
display_mode structures representing the comparison limits.
SetToNext
Sets the Screen object to the next screen.
Perl
$screen->SetToNext();
Python
screen.SetToNext()
WaitForRetrace
Blocks until the screen has completed the current vertical retrace. There will be a small gap (a few milliseconds) before the next retrace begins. Drawing operations during this gap will not cause flicker.
Not all screen hardware supports this operation; an error will be generated if it is not supported.
Perl
$screen->WaitForRetrace($timeout);
Python
screen.WaitForRetrace(timeout)
timeout
An integer timeout in microseconds, defaults to
B_INFINTE_TIMEOUT
CONSTANTS
DPMS states
Perl
include HaikuR1::Screen [:dpms]
Python
Python does not support export tags.
B_DPMS_ON
Normal screen operation. (All screens should support at least this.)
B_DPMS_STAND_BY
Standby mode; screen is dark but can be restored "instantly". (The precise meaning of "instantly" depends on the hardware.
B_DPMS_SUSPEND
Sleep mode; screen is dark but can be restores within 5 seconds.
B_DPMS_OFF
Screen is off. This does not mean the hardware is turned off, but that the display is at extremely low power; typically, the only thing it is doing is watching for the DPMS state to change.