Home · All Classes · Main Classes · Grouped Classes · Modules · Functions |
The QScreen class is a base class for implementing screen drivers in Qtopia Core. More...
#include <QScreen>
Inherited by QLinuxFbScreen, QTransformedScreen, QVFbScreen, and QVNCScreen.
The QScreen class is a base class for implementing screen drivers in Qtopia Core.
Note that this class is only available in Qtopia Core. Custom screen drivers derived from QScreen can be added by subclassing the QScreenDriverPlugin class, using the QScreenDriverFactory class to dynamically load the driver into the application, but there should only be one screen object per application.
The QScreen class provides functions enabling framebuffer and palette management and drawing on screen. The class also provides information about several screen properties, e.g its metrics. Finally, the QScreen class and its descendants act as factories for the screen cursor, creating the cursor whenever required.
When a Qtopia Core application starts, the connect() function will be called to map in the framebuffer and the accelerated drivers that the graphics card control registers, and when initializing the framebuffer, the initDevice() function will be called. The latter function can be reimplemented to set up the graphics card (note that the default implementation does nothing).
Likewise, just before a Qtopia Core application exits, the disconnect() function will be called. This function should be reimplemented to unmap the framebuffer. The shutdownDevice() function is also called on shutdown, and can be reimplemented to support graphics card specific cleanup.
The save() function allows subclasses of QScreen to save the state of the graphics card. Hardware QScreen descendants should save the state of the registers here to enable switching between virtual consoles. The corresponding restore() function enables restoration of a previously saved state of the graphics card. Note that the default implementations of these two functions do nothing.
QScreen also provides the base() function returning a pointer to the beginning of the framebuffer. Use the onCard() function to determine whether the framebuffer is within the graphics card's memory. The totalSize() function returns the size of the available graphics card memory, including the screen.
For palette management, the QScreen class provides the clut() function to retrieve the screen's color lookup table (i.e. its color palette), and the numCols() function to determine the number of entries in this table. The alloc() function can be used to retrieve the index in the screen's palette which is the closest match to a given RGB value, and the supportsDepth() function to determine if the screen supports a given color depth.
When deriving from QScreen, either the blit() or the exposeRegion() function must be reimplemented to enable drawing on screen.
The blit() function copies a given region in a given image to a specified point using device coordinates, and should be reimplemented to make use of accelerated hardware. Note that reimplementing blit() requires that the solidFill() function is reimplemented as well. The solidFill() function allows subclasses of QScreen to fill the given region of the screen with the specified color. The exposeRegion() function paints a given region on screen. Note that normally there is no need to call either of these functions explicitly.
Reimplement the blank() function to control the display of contents on the screen. The setDirty() function can be reimplemented to indicate that a given rectangle of the screen has been altered. Note that the default implementations of these two latter functions do nothing.
QScreen also provides the mapFromDevice() and mapToDevice() function to map an object from the framebuffer coordinate system to the coordinate space used by the application, and vice versa.
See the QDirectPainter and QDecoration class documentation for more information about drawing on screen.
QScreen provides information about several screen properties: The size of the screen can be retrieved using the screenSize() function. Alternatively, its width and height can be retrieved using the width() and height() functions respectively. QScreen also provides the deviceWidth() and deviceHeight() functions which returns the full size of the device. Note that these metrics can differ from the ones used if the display is centered within the framebuffer.
The setMode() function allows subclasses of QScreen to set the framebuffer to a new resolution (width and height) and bit depth. The current depth of the framebuffer can be retrieved using the depth() function.
Use the pixmapDepth() function to obtain the preferred depth for pixmaps. In addition, QScreen provides the pixmapOffsetAlignment() function returning the value to which the start address of pixmaps held in the graphics card's memory, should be aligned. The pixmapLinestepAlignment() returns the value to which the individual scanlines of pixmaps should be aligned.
The isInterlaced() function tells whether the screen is displaying images progressively, and the isTransformed() function whether it is rotated. The transformOrientation() function can be reimplemented to return the current rotation.
The linestep() function returns the length of each scanline of the framebuffer.
The pixelType() returns the screen's pixel storage format as described by the PixelType enum, the opType() function returns the screen's operation type, and the lastOp() function returns the screens last operation.
See also Running Applications and Qtopia Core.
This enum describes the pixel storage format of the screen, i.e. the order of the red (R), green (G) and blue (B) components of a pixel.
Constant | Value | Description |
---|---|---|
QScreen::NormalPixel | 0 | Red-green-blue (RGB) |
QScreen::BGRPixel | 1 | Blue-green-red (BGR) |
See also pixelType().
Constructs a QScreen object. The displayId identifies the the Qtopia Core server to connect to.
Destroys this QScreen object.
Returns the index in the screen's palette which is the closest match to the given RGB value (red, green, blue).
Note that this function only apply in paletted modes, i.e. in modes where only palette indexes (and not actual color values) are stored in memory (e.g. 8-bit mode).
See also clut().
Returns a pointer to the beginning of the framebuffer.
See also onCard().
Avoids displaying any contents on the screen if on is true; otherwise the contents is shown.
The default implementation does nothing.
Copies the given region in the given image to the point specified by topLeft using device coordinates.
Reimplement this function to use accelerated hardware. Note that reimplementing this function requires that the solidFill() function is reimplemented as well.
See also exposeRegion() and Adding an Accelerated Graphics Driver.
Returns the screen's color lookup table (i.e. its color palette).
Note that this function only apply in paletted modes, i.e. in modes where only palette indexes (and not actual color values) are stored in memory (e.g. 8-bit mode).
See also alloc(), depth(), and numCols().
This function is called by every Qtopia Core application on startup, and must be reimplemented to map in the framebuffer and the accelerated drivers that the graphics card control registers.
The displaySpec argument is passed by the QWS_DISPLAY environment variable or the -display command line parameter, and has the following syntax:
[screen driver][:driver specific options][:display number]
For example, to use the mach64 driver on fb1 as display 2:
Mach64:/dev/fb1:2
See also disconnect() and Running Applications.
Returns the depth of the framebuffer, in bits per pixel.
Note that the returned depth is the number of bits each pixel takes up rather than the number of significant bits, so 24bpp and 32bpp express the same range of colors (8 bits of red, green and blue).
See also clut() and pixmapDepth().
Returns the full height of the framebuffer device.
Note that the returned height can differ from the height which Qtopia Core will actually use, that is if the display is centered within the framebuffer.
See also deviceWidth() and height().
Returns the full width of the framebuffer device.
Note that the returned width can differ from the width which Qtopia Core will actually use, that is if the display is centered within the framebuffer.
See also deviceHeight() and width().
This function is called by every Qtopia Core application just before exiting, and should be reimplemented to unmap the framebuffer.
See also connect().
Paints the given region on screen. The windowIndex parameter refer to the affected windows.
Note that there is no need to call this function explicitly, but it must be reimplemented in derived classes. It can also be reimplemented to make use of accelerated hardware, but this is typically done by reimplementing the blit() function instead.
See also blit().
Returns the height of the framebuffer, in pixels.
See also deviceHeight() and width().
This function is called by the Qtopia Core server when initializing the framebuffer.
Reimplement this function to make accelerated drivers set up the graphics card. The default implementation does nothing.
See also Adding an Accelerated Graphics Driver.
Returns true if the display is interlaced (for instance a television screen); otherwise returns false.
If true, drawing is altered to look better on such displays.
Returns true if the screen is transformed (for instance, rotated 90 degrees); otherwise returns false.
See also QTransformedScreen::transformation().
Returns the screens last operation.
See also opType().
Returns the length of each scanline of the framebuffer, in bytes.
See also QDirectPainter::linestep().
This virtual function allows subclasses of QScreen to map the given object from the framebuffer coordinate system to the coordinate space used by the application.
In the case of a size object, this means switching its height and width. Note that the default implementation simply returns the given size as it is.
See also mapToDevice().
This is an overloaded member function, provided for convenience.
This virtual function allows subclasses of QScreen to map the given object from the framebuffer coordinate system to the coordinate space used by the application, passing the device's screenSize as argument.
Note that the default implementation returns the given point as it is.
This is an overloaded member function, provided for convenience.
This virtual function allows subclasses of QScreen to map the given object from the framebuffer coordinate system to the coordinate space used by the application, passing the device's screenSize as argument.
The default implementation returns the given rectangle as it is.
This is an overloaded member function, provided for convenience.
This virtual function allows subclasses of QScreen to map the given object from the framebuffer coordinate system to the coordinate space used by the application.
The default implementation returns the given image as it is.
This is an overloaded member function, provided for convenience.
This virtual function allows subclasses of QScreen to map the given object from the framebuffer coordinate system to the coordinate space used by the application, passing the device's screenSize as argument .
The default implementation returns the given region as it is.
This virtual function allows subclasses of QScreen to map the given object from the coordinate space used by the application to the framebuffer coordinate system.
In the case of a size object, this means switching its height and width. Note that the default implementation simply returns the given size as it is.
See also mapFromDevice().
This is an overloaded member function, provided for convenience.
This virtual function allows subclasses of QScreen to map the given object from the coordinate space used by the application to the framebuffer coordinate system, passing the device's screenSize as argument.
Note that the default implementation returns the given point as it is.
This is an overloaded member function, provided for convenience.
This virtual function allows subclasses of QScreen to map the given object from the coordinate space used by the application to the framebuffer coordinate system, passing the device's screenSize as argument.
Note that the default implementation returns the given rectangle as it is.
This is an overloaded member function, provided for convenience.
This virtual function allows subclasses of QScreen to map the given object from the coordinate space used by the application to the framebuffer coordinate system.
The default implementation returns the given image as it is.
This is an overloaded member function, provided for convenience.
This virtual function allows subclasses of QScreen to map the given object from the coordinate space used by the application to the framebuffer coordinate system, passing the device's screenSize as argument.
The default implementation returns the given region as it is.
Returns the number of entries in the screen's color lookup table (i.e. its color palette). The color table can be retrieved using the clut() function.
See also clut().
Returns true if the specified buffer is within the graphics card's memory; otherwise returns false (i.e. if it's in main RAM).
See also base() and totalSize().
This is an overloaded member function, provided for convenience.
If the specified buffer is within the graphics card's memory, this function stores the offset (in bytes) from the start of graphics card memory, in the location specified by the offset parameter.
Returns the screen's operation type.
See also lastOp().
Returns the pixel storage format of the screen.
See also PixelType.
Returns the preferred depth for pixmaps, in bits per pixel.
See also depth().
Returns the value (in bits) to which individual scanlines of pixmaps held in the graphics card's memory, should be aligned.
The default implementation returns 64. Reimplement this function to override the return value when implementing an accelerated driver.
See also pixmapOffsetAlignment() and Adding an Accelerated Graphics Driver.
Returns the value (in bits) to which the start address of pixmaps held in the graphics card's memory, should be aligned.
The default implementation returns 64. Reimplement this function to override the return value when implementing an accelerated driver.
See also pixmapLinestepAlignment() and Adding an Accelerated Graphics Driver.
This virtual function allows subclasses of QScreen to restore a previously saved state of the graphics card.
Note that the default implementation does nothing.
See also save().
This virtual function allows subclasses of QScreen to save the state of the graphics card, and be able to restored it later.
Hardware QScreen descendants should save the state of the registers here, if necessary, to enable switching between virtual consoles (for example to and from X).
Note that the default implementation does nothing.
See also restore().
Returns the size of the screen, in bytes.
The screen size is always located at the beginning of framebuffer memory, i.e. it can also be retrieved using the base() function.
See also base().
This virtual function allows subclasses of QScreen to indicate that the given rectangle of the screen has been altered.
Note that the default implementation does nothing.
This virtual function allows subclasses of QScreen to set the framebuffer to a new resolution (width and height) and bit depth.
After doing this any currently-existing paint engines will be invalid and the screen should be completely redrawn. In a multiple-process situation, all other applications must be notified to set the same mode and redraw.
Note that the default implementation does nothing.
This virtual function is called by the Qtopia Core server on shutdown, and allows subclasses of QScreen to support graphics card specific cleanup.
The default implementation simply hides the mouse cursor.
This virtual function allows subclasses of QScreen to fill the given region of the screen with the specified color. Note that this function is not intended to be called explicitly.
See also blit().
Returns true if the screen supports the specified color depth; otherwise returns false.
Possible values are 1,4,8,16 and 32.
See also clut().
Returns the size of the available graphics card memory, including the screen, in bytes.
Offscreen memory is only used by the accelerated drivers.
See also onCard().
This virtual function allows subclasses of QScreen to return the current rotation of the screeen as an integer value.
The default implementation returns 0.
See also isTransformed().
Returns the width of the framebuffer, in pixels.
See also deviceWidth() and height().
Copyright © 2006 Trolltech | Trademarks | Qt 4.1.3 |