<?xml version="1.0" encoding="iso-8859-1"?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "DTD/xhtml1-strict.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en"> <!-- /tmp/qt-4.2.1-harald-1161357942206/qt-x11-opensource-src-4.2.1/doc/src/emb-qvfb.qdoc --> <head> <title>Qt 4.2: The Virtual Framebuffer</title> <link rel="contents" href="qtopiacore.html" /> <link href="classic.css" rel="stylesheet" type="text/css" /> </head> <body> <table border="0" cellpadding="0" cellspacing="0" width="100%"> <tr> <td align="left" valign="top" width="32"><a href="http://www.trolltech.com/products/qt"><img src="images/qt-logo.png" align="left" width="32" height="32" border="0" /></a></td> <td width="1"> </td><td class="postheader" valign="center"><a href="index.html"><font color="#004faf">Home</font></a> · <a href="classes.html"><font color="#004faf">All Classes</font></a> · <a href="mainclasses.html"><font color="#004faf">Main Classes</font></a> · <a href="groups.html"><font color="#004faf">Grouped Classes</font></a> · <a href="modules.html"><font color="#004faf">Modules</font></a> · <a href="functions.html"><font color="#004faf">Functions</font></a></td> <td align="right" valign="top" width="230"><a href="http://www.trolltech.com"><img src="images/trolltech-logo.png" align="right" width="203" height="32" border="0" /></a></td></tr></table><p> [<a href="qtopiacore.html">Contents</a>] </p> <h1 align="center">The Virtual Framebuffer<br /><small></small></h1> <p><a href="qtopiacore.html">Qtopia Core</a> applications write directly to the framebuffer, eliminating the need for the X Window System and saving memory. For development and debugging purposes, the <a href="qtopiacore.html">Qtopia Core</a> platform provides a virtual framebuffer allowing <a href="qtopiacore.html">Qtopia Core</a> programs to be developed on a desktop machine, without switching between consoles and X11.</p> <p align="center"><img src="images/qtopiacore-virtualframebuffer.png" /></p><p>The virtual framebuffer emulates a framebuffer using a shared memory region and the <tt>qvfb</tt> tool to display the framebuffer in a window. The <tt>qvfb</tt> tool also supports a feature known as a skin which can be used to change the look and feel of the display. The tool is located in Qt's <tt>/tools/qvfb</tt> directory, and provides several additional features accessible through its <b>File</b> and <b>View</b> menus.</p> <p>Please note that the virtual framebuffer is a development tool only. No security issues have been considered in the virtual framebuffer design. It should be avoided in a production environment, i.e. do not configure production libraries with the <tt>-qvfb</tt> option.</p> <ul><li><a href="#displaying-the-virtual-framebuffer">Displaying the Virtual Framebuffer</a></li> <ul><li><a href="#skins">Skins</a></li> <li><a href="#the-file-menu">The File Menu</a></li> <li><a href="#the-view-menu">The View Menu</a></li> </ul> <li><a href="#running-applications-using-the-virtual-framebuffer">Running Applications Using the Virtual Framebuffer</a></li> </ul> <a name="displaying-the-virtual-framebuffer"></a> <h2>Displaying the Virtual Framebuffer</h2> <p>To run the <tt>qvfb</tt> tool displaying the virtual framebuffer, the Qtopia Core library must be configured and compiled with the <tt>-qvfb</tt> option:</p> <pre> cd path/to/Qtopia/Core ./configure -qvfb make</pre> <p>Then compile and run the <tt>qvfb</tt> tool as a normal Qt/X11 application (i.e. do <i>not</i> compile it as a <a href="qtopiacore.html">Qtopia Core</a> application):</p> <pre> cd path/to/Qt/tools/qvfb make ./qvfb</pre> <p>The <tt>qvfb</tt> application supports the following command line options:</p> <p><table align="center" cellpadding="2" cellspacing="1" border="0"> <thead><tr valign="top" class="qt-style"><th>Option</th><th>Description</th></tr></thead> <tr valign="top" class="odd"><td><tt>-width <width></tt></td><td>The width of the virtual framebuffer (default: 240).</td></tr> <tr valign="top" class="even"><td><tt>-height <height></tt></td><td>The height of the virtual framebuffer (default: 320).</td></tr> <tr valign="top" class="odd"><td><tt>-depth <depth></tt></td><td>The depth of the virtual framebuffer (1, 8 or 32; default: 8).</td></tr> <tr valign="top" class="even"><td><tt>-nocursor</tt></td><td>Do not display the X11 cursor in the framebuffer window.</td></tr> <tr valign="top" class="odd"><td><tt>-qwsdisplay <:id></tt></td><td>The <a href="qtopiacore.html">Qtopia Core</a> display ID (default: :0).</td></tr> <tr valign="top" class="even"><td><tt>-skin <name>.skin</tt></td><td>The preferred skin which must be located in Qt's <tt>/tools/qvfb/</tt> directory.</td></tr> <tr valign="top" class="odd"><td><tt>-zoom <factor></tt></td><td>Scales the application view with the given factor.</td></tr> </table></p> <a name="skins"></a> <h3>Skins</h3> <p>A skin is a set of XML and pixmap files that tell the vitual framebuffer how it should look and how it should behave; a skin can change the unrealistic display into a display that is identical to the device being developed. To access the <tt>qvfb</tt> tool's menus when a skin is activated, right-click over the display.</p> <p>Note that a skin can have buttons which (when clicked) send signals to the Qtopia application running inside the virtual framebuffer, just as would happen on a real device.</p> <p><table width="100%" align="center" cellpadding="2" cellspacing="1" border="0"> <tr valign="top" class="odd"><td><b>Target Device Environment</b><p>The <tt>qvfb</tt> tool provides various skins by default, allowing the user to view their application in an environment similar to their target device. The provided skins are:</p> <ul> <li>ClamshellPhone</li> <li>pda</li> <li>PDAPhone</li> <li>QtopiaPDA</li> <li>QtopiaPhone-Advanced</li> <li>QtopiaPhone-Simple</li> <li>SmartPhone</li> <li>SmartPhone2</li> <li>SmartPhoneWithButtons</li> <li>TouchscreenPhone</li> <li>Trolltech-Keypad</li> <li>Trolltech-Touchscreen</li> </ul> <p>In addition, it is possible to create custom skins.</p> </td><td><p align="center"><img src="images/qtopiacore-phone.png" /></p></td><td><p align="center"><img src="images/qtopiacore-pda.png" /></p></td></tr> </table></p> <p><b>Creating Custom Skins</b></p> <p>The XML and pixmap files specifying a custom skin must be located in subdirectory of the Qt's <tt>/tools/qvfb</tt> directory, called <tt>/customskin.skin</tt>. See the ClamshellPhone skin for an example of the file structure:</p> <pre> cd path/to/Qt/tools/qvfb/ClamshellPhone.skin/</pre> <p>The <tt>/ClamshellPhone.skin</tt> directory contains the following files:</p> <ul> <li><tt>ClamshellPhone.skin</tt></li> <li><tt>ClamshellPhone1-5.png</tt></li> <li><tt>ClamshellPhone1-5-pressed.png</tt></li> <li><tt>ClamshellPhone1-5-closed.png</tt></li> <li><tt>defaultbuttons.conf</tt> (only necessary for <a href="http://www.trolltech.com/products/qtopia/">Qtopia</a>)</li> </ul> <p>Note that the <tt>defaultbuttons.conf</tt> file is only necessary if the skin is supposed to be used with <a href="http://www.trolltech.com/products/qtopia/">Qtopia</a> (The file customizes the launch screen applications, orders the soft keys and provides input method hints). See the <a href="http://www.trolltech.com/products/qtopia/">Qtopia</a> documentation for more information.</p> <p><table width="100%" align="center" cellpadding="2" cellspacing="1" border="0"> <thead><tr valign="top" class="qt-style"><th colspan="3">The ClamshellPhone Skin</th></tr></thead> <tr valign="top" class="odd"><td colspan="3"><pre> [SkinFile] Up=ClamshellPhone1-5.png Down=ClamshellPhone1-5-pressed.png Closed=ClamshellPhone1-5-closed.png Screen=72 84 176 208 Areas=22 "Power" 0x0100000a 205 563 249 586 "1" 0x0031 62 414 119 438 "2" 0x0032 130 414 189 438 "3" 0x0033 198 413 257 438 "4" 0x0034 54 444 117 470 "5" 0x0035 128 444 189 471 "6" 0x0036 202 444 264 471 "7" 0x0037 47 477 113 507 "8" 0x0038 126 477 190 507 "9" 0x0039 205 478 270 509 "*" 0x002a 39 515 110 552 "0" 0x0030 122 515 195 553 "#" 0x0023 207 516 280 553 "Context1" 0x01100000 137 360 108 383 123 410 90 409 60 387 63 378 100 362 "Back" 0x01000061 184 361 206 376 213 387 197 410 226 410 256 392 258 381 244 369 "Backspace" 0x01000003 68 563 113 587 "Select" 0x01010000 160 391 172 390 181 386 184 381 180 377 173 373 165 372 155 372 145 375 138 378 136 382 138 387 147 390 "Left" 0x1000012 141 390 136 385 136 381 143 375 132 371 120 380 121 393 129 401 "Down" 0x1000015 143 389 130 402 162 412 191 404 175 390 "Right" 0x1000014 186 370 176 375 184 382 182 387 175 390 190 404 201 396 202 375 "Up" 0x1000013 133 370 143 374 176 374 185 370 169 362 149 362 "Flip" 0x01100006 98 325 225 353</pre> <p>The <tt>ClamShellPhone.skin</tt> file quoted above, specifies three pixmaps: One for the normal skin (<tt>Up</tt>), one for the activated skin (<tt>Down</tt>) and one for the closed skin (<tt>Closed</tt>). In addition, it is possible to specify a pixmap for the cursor (using a <tt>Cursor</tt> variable).</p> <p>The file also specifies the screen size (<tt>Screen</tt>) and the number of available buttons (<tt>Areas</tt>). Then it describes the buttons themselves; each button is specified by its name, keycode and coordinates.</p> <p>The coordinates are a list of at least 2 points in clockwise order that define a shape for the button; a click inside this shape will be treated as a click on that button. While pressed, the pixels for the button are redrawn from the activated skin.</p> </td></tr> <tr valign="top" class="even"></tr> <tr valign="top" class="odd"><td><p align="center"><img src="images/qtopiacore-clamshellphone-closed.png" alt="The ClamshellPhone Skin (closed)" /></p></td><td><p align="center"><img src="images/qtopiacore-clamshellphone.png" alt="The ClamshellPhone Skin" /></p></td><td><p align="center"><img src="images/qtopiacore-clamshellphone-pressed.png" alt="The ClamshellPhone Skin (pressed)" /></p></td></tr> <tr valign="top" class="even"><td><tt>ClamshellPhone1-5-closed.png</tt></td><td><tt>ClamshellPhone1-5.png</tt></td><td><tt>ClamshellPhone1-5-pressed.png</tt></td></tr> </table></p> <a name="the-file-menu"></a> <h3>The File Menu</h3> <p align="center"><img src="images/qtopiacore-qvfbfilemenu.png" /></p><p>The <b>File</b> menu allows the user to configure the virtual framebuffer display (<b>File|Configure...</b>), save a snapshot of the framebuffer contents (<b>File|Save Image...</b>) and record the movements in the framebuffer (<b>File|Animation...</b>).</p> <p>When choosing the <b>File|Configure</b> menu item, the <tt>qvfb</tt> tool provides a configuration dialog allowing the user to customize the display of the virtual framebuffer. The user can modify the size and depth as well as the Gamma values, and also select the preferred skin (i.e. making the virtual framebuffer simulate the target device environment). In addition, it is possible to emulate a touch screen and a LCD screen.</p> <p>Note that when configuring (except when changing the Gamma values only), any applications using the virtual framebuffer will be terminated.</p> <a name="the-view-menu"></a> <h3>The View Menu</h3> <p align="center"><img src="images/qtopiacore-qvfbviewmenu.png" /></p><p>The <b>View</b> menu allows the user to modify the target's refresh rate (<b>View|Refresh Rate...</b>), making <tt>qvfb</tt> check for updated regions more or less frequently.</p> <p>The regions of the display that have changed are updated periodically, i.e. the virtual framebuffer is displaying discrete snapshots of the framebuffer rather than each individual drawing operation. For this reason drawing problems such as flickering may not be apparent until the program is run using a real framebuffer. If little drawing is being done, the framebuffer will not show any updates between drawing events. If an application is displaying an animation, the updates will be frequent, and the application and <tt>qvfb</tt> will compete for processor time.</p> <p>The <b>View</b> menu also allows the user to zoom the view of the application (<b>View|Zoom *</b>).</p> <a name="running-applications-using-the-virtual-framebuffer"></a> <h2>Running Applications Using the Virtual Framebuffer</h2> <p>Once the virtual framebuffer (the <tt>qvfb</tt> application) is running, it is ready for use: Start a Qtopia Core master application (i.e. construct a <a href="qapplication.html">QApplication</a> object with the <a href="qapplication.html#Type-enum">QApplication::GuiServer</a> flag or use the <tt>-qws</tt> command line parameter. See the <a href="qtopiacore-running.html">Running Applications</a> documentation for details). For example:</p> <pre> cd path/to/Qtopia/Core/examples/widgets/analogclock make ./analogclock -qws</pre> <p>Note that as long as the virtual framebuffer is running and the Qtopia Core library supports <tt>qvfb</tt>, Qtopia Core will automatically detect it and use it by default. Alternatively, the <tt>-display</tt> option can be used to specify the virtual framebuffer driver. For example:</p> <pre> cd path/to/Qtopia/Core/examples/widgets/analogclock make ./analogclock -qws -display QVFb:0</pre> <p><b>Warning:</b> If <tt>qvfb</tt> is not running (or the current Qtopia Core library doesn't support it) and the driver is not explicitly specified, Qtopia Core will write to the real framebuffer and the X11 display will be corrupted.</p> <p> [<a href="qtopiacore.html">Contents</a>] </p> <p /><address><hr /><div align="center"> <table width="100%" cellspacing="0" border="0"><tr class="address"> <td width="30%">Copyright © 2006 <a href="trolltech.html">Trolltech</a></td> <td width="40%" align="center"><a href="trademarks.html">Trademarks</a></td> <td width="30%" align="right"><div align="right">Qt 4.2.1</div></td> </tr></table></div></address></body> </html>