VirtualBox Main API
Public Member Functions | List of all members
IDisplay Interface Reference

The IDisplay interface represents the virtual machine's display. More...

Public Member Functions

void getScreenResolution (in unsigned long screenId, out unsigned long width, out unsigned long height, out unsigned long bitsPerPixel)
 Queries display width, height and color depth for given screen.
void setFramebuffer (in unsigned long screenId, in IFramebuffer framebuffer)
 Sets the framebuffer for given screen.
void getFramebuffer (in unsigned long screenId, out IFramebuffer framebuffer, out long xOrigin, out long yOrigin)
 Queries the framebuffer for given screen.
void setVideoModeHint (in unsigned long width, in unsigned long height, in unsigned long bitsPerPixel, in unsigned long display)
 Asks VirtualBox to request the given video mode from the guest.
void setSeamlessMode (in boolean enabled)
 Enables or disables seamless guest display rendering (seamless desktop integration) mode.
void takeScreenShot (in unsigned long screenId, in octetPtr address, in unsigned long width, in unsigned long height)
 Takes a screen shot of the requested size and copies it to the 32-bpp buffer allocated by the caller and pointed to by address.
void takeScreenShotToArray (in unsigned long screenId, in unsigned long width, in unsigned long height,[retval] out octet[] screenData)
 Takes a guest screen shot of the requested size and returns it as an array of bytes in uncompressed 32-bit RGBA format.
void takeScreenShotPNGToArray (in unsigned long screenId, in unsigned long width, in unsigned long height,[retval] out octet[] screenData)
 Takes a guest screen shot of the requested size and returns it as PNG image in array.
void drawToScreen (in unsigned long screenId, in octetPtr address, in unsigned long x, in unsigned long y, in unsigned long width, in unsigned long height)
 Draws a 32-bpp image of the specified size from the given buffer to the given point on the VM display.
void invalidateAndUpdate ()
 Does a full invalidation of the VM display and instructs the VM to update it.
void resizeCompleted (in unsigned long screenId)
 Signals that a framebuffer has completed the resize operation.
void completeVHWACommand (in octetPtr command)
 Signals that the Video HW Acceleration command has completed.

Detailed Description

The IDisplay interface represents the virtual machine's display.

  The object implementing this interface is contained in each
  @link IConsole::display IConsole::display@endlink<b></b> attribute and represents the visual
  output of the virtual machine.

  The virtual display supports pluggable output targets represented by the
  IFramebuffer interface. Examples of the output target are a window on
  the host computer or an RDP session's display on a remote computer.
Interface ID:
{09EED313-CD56-4D06-BD56-FAC0F716B5DD}

Member Function Documentation

void IDisplay::getScreenResolution ( in unsigned long  screenId,
out unsigned long  width,
out unsigned long  height,
out unsigned long  bitsPerPixel 
)

Queries display width, height and color depth for given screen.

void IDisplay::setFramebuffer ( in unsigned long  screenId,
in IFramebuffer  framebuffer 
)

Sets the framebuffer for given screen.

void IDisplay::getFramebuffer ( in unsigned long  screenId,
out IFramebuffer  framebuffer,
out long  xOrigin,
out long  yOrigin 
)

Queries the framebuffer for given screen.

void IDisplay::setVideoModeHint ( in unsigned long  width,
in unsigned long  height,
in unsigned long  bitsPerPixel,
in unsigned long  display 
)

Asks VirtualBox to request the given video mode from the guest.

This is just a hint and it cannot be guaranteed that the requested resolution will be used. Guest Additions are required for the request to be seen by guests. The caller should issue the request and wait for a resolution change and after a timeout retry.

Specifying 0 for either width, height or bitsPerPixel parameters means that the corresponding values should be taken from the current video mode (i.e. left unchanged).

If the guest OS supports multi-monitor configuration then the display parameter specifies the number of the guest display to send the hint to: 0 is the primary display, 1 is the first secondary and so on. If the multi-monitor configuration is not supported, display must be 0.

Expected result codes:
E_INVALIDARG The display is not associated with any monitor.
void IDisplay::setSeamlessMode ( in boolean  enabled)

Enables or disables seamless guest display rendering (seamless desktop integration) mode.

Note
Calling this method has no effect if IGuest::getFacilityStatus with facility Seamless does not return Active.
void IDisplay::takeScreenShot ( in unsigned long  screenId,
in octetPtr  address,
in unsigned long  width,
in unsigned long  height 
)

Takes a screen shot of the requested size and copies it to the 32-bpp buffer allocated by the caller and pointed to by address.

    A pixel consists of 4 bytes in order: B, G, R, 0.

  @par Expected result codes:
<table>

E_NOTIMPL

Feature not implemented.

VBOX_E_IPRT_ERROR

Could not take a screenshot.

Note
This API can be used only locally by a VM process through the COM/XPCOM C++ API as it requires pointer support. It is not available for scripting langages, Java or any webservice clients. Unless you are writing a new VM frontend use takeScreenShotToArray.
Warning
This method is non-scriptable. In particular, this also means that an attempt to call it from a process other than the process that has created and owns the object will most likely fail or crash your application.
void IDisplay::takeScreenShotToArray ( in unsigned long  screenId,
in unsigned long  width,
in unsigned long  height,
[retval] out octet[]  screenData 
)

Takes a guest screen shot of the requested size and returns it as an array of bytes in uncompressed 32-bit RGBA format.

    A pixel consists of 4 bytes in order: R, G, B, 0xFF.

    This API is slow, but could be the only option to get guest screenshot
    for scriptable languages not allowed to manipulate with addresses
    directly.
Parameters
screenIdMonitor to take screenshot from.
widthDesired image width.
heightDesired image height.
screenDataArray with resulting screen data.
Expected result codes:
E_NOTIMPL Feature not implemented.
VBOX_E_IPRT_ERROR Could not take a screenshot.
void IDisplay::takeScreenShotPNGToArray ( in unsigned long  screenId,
in unsigned long  width,
in unsigned long  height,
[retval] out octet[]  screenData 
)

Takes a guest screen shot of the requested size and returns it as PNG image in array.

Parameters
screenIdMonitor to take the screenshot from.
widthDesired image width.
heightDesired image height.
screenDataArray with resulting screen data.
Expected result codes:
E_NOTIMPL Feature not implemented.
VBOX_E_IPRT_ERROR Could not take a screenshot.
void IDisplay::drawToScreen ( in unsigned long  screenId,
in octetPtr  address,
in unsigned long  x,
in unsigned long  y,
in unsigned long  width,
in unsigned long  height 
)

Draws a 32-bpp image of the specified size from the given buffer to the given point on the VM display.

Parameters
screenIdMonitor to take the screenshot from.
addressAddress to store the screenshot to
xRelative to the screen top left corner.
yRelative to the screen top left corner.
widthDesired image width.
heightDesired image height.
Expected result codes:
E_NOTIMPL Feature not implemented.
VBOX_E_IPRT_ERROR Could not draw to screen.
Warning
This method is non-scriptable. In particular, this also means that an attempt to call it from a process other than the process that has created and owns the object will most likely fail or crash your application.
void IDisplay::invalidateAndUpdate ( )

Does a full invalidation of the VM display and instructs the VM to update it.

  @par Expected result codes:
<table><tr>

VBOX_E_IPRT_ERROR

Could not invalidate and update screen.

void IDisplay::resizeCompleted ( in unsigned long  screenId)

Signals that a framebuffer has completed the resize operation.

  @par Expected result codes:
<table><tr>

VBOX_E_NOT_SUPPORTED

Operation only valid for external frame buffers.

void IDisplay::completeVHWACommand ( in octetPtr  command)

Signals that the Video HW Acceleration command has completed.

Parameters
commandPointer to VBOXVHWACMD containing the completed command.
Warning
This method is non-scriptable. In particular, this also means that an attempt to call it from a process other than the process that has created and owns the object will most likely fail or crash your application.