Haiku API Bindings
Screen
Not logged in

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)

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)

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)

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
)

Device info

GetDeviceInfo

GetMonitorInfo

GetPixelClockLimits

GetTimingConstraints

Returns the given data in the appropiate form.

Perl

$screen->GetDeviceInfo();
$screen->GetMonitorInfo();
$screen->GetPixelClockLimits($mode);
$screen->GetTimingConstraints();

Python

screen.GetDeviceInfo()
screen.GetMonitorInfo()
screen.GetPixelClockLimits(mode)
screen.GetTimingConstraints()

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)

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)

CONSTANTS

DPMS states

Perl

include HaikuR1::Screen [:dpms]

Python

Python does not support export tags.