Plugins that have the capability flag HWPLUG_CAPS_DISPLAYADAPTER
set can replace Hollywood's
inbuilt display handler with a custom display handler. This is a very powerful feature and
allows you to reroute Hollywood's complete graphics output and event handler through an entirely
different toolkit or display driver, thus making it possible to use Hollywood scripts in
completely new environments.
Optionally, display adapters can also choose to override Hollywood's inbuilt bitmap handler with custom implementations and it is also possible to offer support for custom hardware bitmaps and double buffers from display adapters. This allows you to take full advantage of device dependent bitmaps for optimized drawing.
If you're just starting out with display adapters, it is advised that you begin with a pretty basic display adapter first and then you may choose to add support for advanced features later. Functions like BltBitMap() can get quite complex if your display adapter supports all the advanced functionality that Hollywood makes available, so it might be a better idea to first implement a barebones display adapter that doesn't support video bitmaps or hardware double buffers but just reroutes all of Hollywood's graphics through a custom device. You can then use this implementation as a basis to add support for more advanced features.
Also, be sure to benchmark raw performance of scripts with your display adapter and compare them to the performance of Hollywood's inbuilt display handler to see if your adapter needs optimizing. See HandleEvents for details.
Please note that display adapters are not automatically initialized when Hollywood loads
the plugin. Instead, you have to manually call hw_SetDisplayAdapter()
in your RequirePlugin() function to activate the display adapter.
The display adapter will then only be activated if the user calls @REQUIRE
on your
plugin. Otherwise, Hollywood will use its default display handler. See Auto and manual plugin initialization for details.
You don't have to implement all functions offered by the display adapter API. Many functions are optional and only have to be implemented if you explicitly request their use in your call to hw_SetDisplayAdapter(). However, it is mandatory that all functions defined by the display adapter API are declared so that Hollywood can import their symbols when it loads the plugin. Functions that are optional and that you don't enable via hw_SetDisplayAdapter() can just be dummies then. Here is an overview of all display adapter APIs that are optional:
Sleep()
HWSDAFLAGS_SLEEP
.
VWait()
HWSDAFLAGS_VWAIT
.
GetMonitorInfo()
HWSDAFLAGS_MONITORINFO
.
FreeMonitorInfo()
HWSDAFLAGS_MONITORINFO
.
GrabScreenPixels()
HWSDAFLAGS_GRABSCREEN
.
FreeGrabScreenPixels()
HWSDAFLAGS_GRABSCREEN
.
BeginDoubleBuffer()
HWSDAFLAGS_DOUBLEBUFFER
.
EndDoubleBuffer()
HWSDAFLAGS_DOUBLEBUFFER
.
Flip()
HWSDAFLAGS_DOUBLEBUFFER
.
Cls()
HWSDAFLAGS_DOUBLEBUFFER
.
AllocBitMap()
HWSDAFLAGS_BITMAPADAPTER
.
FreeBitMap()
HWSDAFLAGS_BITMAPADAPTER
.
LockBitMap()
HWSDAFLAGS_BITMAPADAPTER
.
UnLockBitMap()
HWSDAFLAGS_BITMAPADAPTER
.
GetBitMapAttr()
HWSDAFLAGS_BITMAPADAPTER
.
AllocVideoBitMap()
HWSDAFLAGS_VIDEOBITMAPADAPTER
.
FreeVideoBitMap()
HWSDAFLAGS_VIDEOBITMAPADAPTER
.
ReadVideoPixels()
HWSDAFLAGS_VIDEOBITMAPADAPTER
.
FreeVideoPixels()
HWSDAFLAGS_VIDEOBITMAPADAPTER
.
DoVideoBitMapMethod()
HWSDAFLAGS_VIDEOBITMAPADAPTER
.
AdapterMainLoop()
HWEXT_DISPLAYADAPTER_MAINLOOP
extension flag.
See Extension plugins to learn how to use plugin extension bits.
SetPalette()
HWEXT_DISPLAYADAPTER_PALETTE
extension flag.
See Extension plugins to learn how to use plugin extension bits.
SetMenuBar()
HWEXT_DISPLAYADAPTER_MENUADAPTER
extension flag.
See Extension plugins to learn how to use plugin extension bits.
SetMenuAttributes()
HWEXT_DISPLAYADAPTER_MENUADAPTER
extension flag.
See Extension plugins to learn how to use plugin extension bits.
GetMenuAttributes()
HWEXT_DISPLAYADAPTER_MENUADAPTER
extension flag.
See Extension plugins to learn how to use plugin extension bits.
SetTrayIcon()
HWEXT_DISPLAYADAPTER_TRAYICON
extension flag.
See Extension plugins to learn how to use plugin extension bits.
OpenPopupMenu()
HWEXT_DISPLAYADAPTER_POPUPMENU
extension flag.
See Extension plugins to learn how to use plugin extension bits.
See hw_SetDisplayAdapter for information on how to install your display adapter.
This plugin type is supported since Hollywood 6.0.