Home | All Classes | Main Classes | Annotated | Grouped Classes | Functions |

# TQScreen Class Reference

The TQScreen class and its descendants manage the framebuffer and palette. More...

`#include <qgfx_qws.h>`

List of all member functions.

## Public Members

- TQScreen ( int display_id )
- virtual ~TQScreen ()
- virtual bool initDevice () = 0
- virtual bool connect ( const TQString & displaySpec ) = 0
- virtual void disconnect () = 0
- virtual int initCursor ( void * end_of_location, bool init = FALSE )
- virtual void shutdownDevice ()
- virtual void setMode ( int, int, int ) = 0
- virtual bool supportsDepth ( int d ) const
- virtual TQGfx * createGfx ( unsigned char * bytes, int w, int h, int d, int linestep )
- virtual TQGfx * screenGfx ()
- virtual void save ()
- virtual void restore ()
- virtual void blank ( bool on )
- virtual int pixmapOffsetAlignment ()
- virtual int pixmapLinestepAlignment ()
- virtual bool onCard ( unsigned char * p ) const
- virtual bool onCard ( unsigned char * p, ulong & offset ) const
- virtual void set ( unsigned int, unsigned int, unsigned int, unsigned int )
- virtual int alloc ( unsigned int r, unsigned int g, unsigned int b )
- int width () const
- int height () const
- int depth () const
- virtual int pixmapDepth () const
- int pixelType () const
- int linestep () const
- int deviceWidth () const
- int deviceHeight () const
- uchar * base () const
- virtual uchar * cache ( int, int )
- virtual void uncache ( uchar * )
- int screenSize () const
- int totalSize () const
- TQRgb * clut ()
- int numCols ()
- virtual TQSize mapToDevice ( const TQSize & s ) const
- virtual TQSize mapFromDevice ( const TQSize & s ) const
- virtual TQPoint mapToDevice ( const TQPoint &, const TQSize & ) const
- virtual TQPoint mapFromDevice ( const TQPoint &, const TQSize & ) const
- virtual TQRect mapToDevice ( const TQRect & r, const TQSize & ) const
- virtual TQRect mapFromDevice ( const TQRect & r, const TQSize & ) const
- virtual TQImage mapToDevice ( const TQImage & i ) const
- virtual TQImage mapFromDevice ( const TQImage & i ) const
- virtual TQRegion mapToDevice ( const TQRegion & r, const TQSize & ) const
- virtual TQRegion mapFromDevice ( const TQRegion & r, const TQSize & ) const
- virtual int transformOrientation () const
- virtual bool isTransformed () const
- virtual bool isInterlaced () const
- virtual void setDirty ( const TQRect & )
- int * opType ()
- int * lastOp ()

## Detailed Description

The TQScreen class and its descendants manage the framebuffer and palette.

TQScreens act as factories for the screen cursor and TQGfx's. TQLinuxFbScreen manages a Linux framebuffer; accelerated drivers subclass TQLinuxFbScreen. There can only be one screen in a TQt/Embedded application.

See also TQt/Embedded.

## Member Function Documentation

### TQScreen::TQScreen ( int display_id )

Create a screen; the display_id is the number of the TQt/Embedded server to connect to.

### TQScreen::~TQScreen ()`[virtual]`

Destroys a TQScreen

### int TQScreen::alloc ( unsigned int r, unsigned int g, unsigned int b )`[virtual]`

Given an RGB value r g b, return an index which is the closest match to it in the screen's palette. Used in paletted modes only.

### uchar * TQScreen::base () const

Returns a pointer to the start of the framebuffer.

### void TQScreen::blank ( bool on )`[virtual]`

If on is true, blank the screen. Otherwise unblank it.

### uchar * TQScreen::cache ( int, int )`[virtual]`

This function is used to store pixmaps in graphics memory for the use of the accelerated drivers. See TQLinuxFbScreen (where the cacheing is implemented) for more information.

### TQRgb * TQScreen::clut ()

Returns the screen's color lookup table (color palette). This is only valid in paletted modes (8bpp and lower).

### bool TQScreen::connect ( const TQString & displaySpec )`[pure virtual]`

This function is called by every TQt/Embedded application on startup. It maps in the framebuffer and in the accelerated drivers the graphics card control registers. displaySpec has the following syntax:

`[gfx driver][:driver specific options][:display number]`

for example if you want to use the mach64 driver on fb1 as display 2:

`Mach64:/dev/fb1:2`

displaySpec is passed in via the TQWS_DISPLAY environment variable or the -display command line parameter.

### TQGfx * TQScreen::createGfx ( unsigned char * bytes, int w, int h, int d, int linestep )`[virtual]`

Creates a gfx on an arbitrary buffer bytes, width w and height h in pixels, depth d and linestep (length in bytes of each line in the buffer). Accelerated drivers can check to see if bytes points into graphics memory and create an accelerated Gfx.

### int TQScreen::depth () const

Gives the depth in bits per pixel of the framebuffer. This 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)

### int TQScreen::deviceHeight () const

Gives the full height of the framebuffer device, as opposed to the height which TQt/Embedded will actually use. These can differ if the display is centered within the framebuffer.

### int TQScreen::deviceWidth () const

Gives the full width of the framebuffer device, as opposed to the width which TQt/Embedded will actually use. These can differ if the display is centered within the framebuffer.

### void TQScreen::disconnect ()`[pure virtual]`

This function is called by every TQt/Embedded application just before exitting; it's normally used to unmap the framebuffer.

### int TQScreen::height () const

Gives the height in pixels of the framebuffer.

### int TQScreen::initCursor ( void * end_of_location, bool init = FALSE )`[virtual]`

This is used to initialize the software cursor - end_of_location points to the address after the area where the cursor image can be stored. init is true for the first application this method is called from (the TQt/Embedded server), false otherwise.

### bool TQScreen::initDevice ()`[pure virtual]`

This function is called by the TQt/Embedded server when initializing the framebuffer. Accelerated drivers use it to set up the graphics card.

### bool TQScreen::isInterlaced () const`[virtual]`

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.

### bool TQScreen::isTransformed () const`[virtual]`

Returns TRUE if the screen is transformed (for instance, rotated 90 degrees); otherwise returns FALSE. TQScreen's version always returns FALSE.

### int * TQScreen::lastOp ()

Returns the screens last operation.

### int TQScreen::linestep () const

Returns the length in bytes of each scanline of the framebuffer.

### TQSize TQScreen::mapFromDevice ( const TQSize & s ) const`[virtual]`

Map a framebuffer coordinate to the coordinate space used by the application. Used by the rotated driver; the TQScreen implementation simply returns s.

### TQPoint TQScreen::mapFromDevice ( const TQPoint &, const TQSize & ) const`[virtual]`

This is an overloaded member function, provided for convenience. It behaves essentially like the above function.

Map a framebuffer coordinate to the coordinate space used by the application. Used by the rotated driver; the TQScreen implementation simply returns the point.

### TQRect TQScreen::mapFromDevice ( const TQRect & r, const TQSize & ) const`[virtual]`

This is an overloaded member function, provided for convenience. It behaves essentially like the above function.

Map a framebuffer coordinate to the coordinate space used by the application. Used by the rotated driver; the TQScreen implementation simply returns r.

### TQImage TQScreen::mapFromDevice ( const TQImage & i ) const`[virtual]`

This is an overloaded member function, provided for convenience. It behaves essentially like the above function.

Transforms an image so that it matches the application coordinate space (e.g. rotating it 90 degrees counter-clockwise). The TQScreen implementation simply returns i.

### TQRegion TQScreen::mapFromDevice ( const TQRegion & r, const TQSize & ) const`[virtual]`

This is an overloaded member function, provided for convenience. It behaves essentially like the above function.

Transforms a region so that it matches the application coordinate space (e.g. rotating it 90 degrees counter-clockwise). The TQScreen implementation simply returns r.

### TQSize TQScreen::mapToDevice ( const TQSize & s ) const`[virtual]`

Map a user coordinate to the one to actually draw. Used by the rotated driver; the TQScreen implementation simply returns s.

### TQPoint TQScreen::mapToDevice ( const TQPoint &, const TQSize & ) const`[virtual]`

This is an overloaded member function, provided for convenience. It behaves essentially like the above function.

Map a user coordinate to the one to actually draw. Used by the rotated driver; the TQScreen implementation simply returns the point passed in.

### TQRect TQScreen::mapToDevice ( const TQRect & r, const TQSize & ) const`[virtual]`

This is an overloaded member function, provided for convenience. It behaves essentially like the above function.

Map a user coordinate to the one to actually draw. Used by the rotated driver; the TQScreen implementation simply returns r.

### TQImage TQScreen::mapToDevice ( const TQImage & i ) const`[virtual]`

This is an overloaded member function, provided for convenience. It behaves essentially like the above function.

Transforms an image so that it fits the device coordinate space (e.g. rotating it 90 degrees clockwise). The TQScreen implementation simply returns i.

### TQRegion TQScreen::mapToDevice ( const TQRegion & r, const TQSize & ) const`[virtual]`

This is an overloaded member function, provided for convenience. It behaves essentially like the above function.

Transforms a region so that it fits the device coordinate space (e.g. rotating it 90 degrees clockwise). The TQScreen implementation simply returns r.

### int TQScreen::numCols ()

Returns the number of entries in the color table returned by clut().

### bool TQScreen::onCard ( unsigned char * p ) const`[virtual]`

Returns true if the buffer pointed to by p is within graphics card memory, false if it's in main RAM.

### bool TQScreen::onCard ( unsigned char * p, ulong & offset ) const`[virtual]`

This is an overloaded member function, provided for convenience. It behaves essentially like the above function.

This checks whether the buffer specified by p is on the card (as per the other version of onCard) and returns an offset in bytes from the start of graphics card memory in offset if it is.

### int * TQScreen::opType ()

Returns the screen's operation type.

### int TQScreen::pixelType () const

Returns an integer (taking the same values as TQGfx::PixelType) that specifies the pixel storage format of the screen.

### int TQScreen::pixmapDepth () const`[virtual]`

Gives the preferred depth for pixmaps. By default this is the same as the screen depth, but for the VGA16 driver it's 8bpp.

### int TQScreen::pixmapLinestepAlignment ()`[virtual]`

Returns the value in bits to which individual scanlines of pixmaps held in graphics card memory should be aligned. This is only useful for accelerated drivers. By default the value returned is 64 but it can be overridden by individual accelerated drivers.

### int TQScreen::pixmapOffsetAlignment ()`[virtual]`

Returns the value in bits to which the start address of pixmaps held in graphics card memory should be aligned. This is only useful for accelerated drivers. By default the value returned is 64 but it can be overridden by individual accelerated drivers.

### void TQScreen::restore ()`[virtual]`

Restores the state of the graphics card from a previous save()

### void TQScreen::save ()`[virtual]`

Saves the state of the graphics card - used so that, for instance, the palette can be restored when switching between linux virtual consoles. Hardware TQScreen descendants should save register state here if necessary if switching between virtual consoles (for example to/from X) is to be permitted.

### TQGfx * TQScreen::screenGfx ()`[virtual]`

Returns a TQGfx (normally a TQGfxRaster) initialized to point to the screen, with an origin at 0,0 and a clip region covering the whole screen.

### int TQScreen::screenSize () const

Returns the size in bytes of the screen. This is always located at the beginning of framebuffer memory (i.e. at base()).

### void TQScreen::set ( unsigned int, unsigned int, unsigned int, unsigned int )`[virtual]`

Sets an entry in the color palette.

### void TQScreen::setDirty ( const TQRect & )`[virtual]`

Indicates which section of the screen has been altered. Used by the VNC and VFB displays; the TQScreen version does nothing.

### void TQScreen::setMode ( int, int, int )`[pure virtual]`

This function can be used to set the framebuffer width, height and depth. It's currently unused.

### void TQScreen::shutdownDevice ()`[virtual]`

Called by the TQt/Embedded server on shutdown; never called by a TQt/Embedded client. This is intended to support graphics card specific shutdown; the unaccelerated implementation simply hides the mouse cursor.

### bool TQScreen::supportsDepth ( int d ) const`[virtual]`

Returns true if the screen supports a particular color depth d. Possible values are 1,4,8,16 and 32.

### int TQScreen::totalSize () const

Returns the size in bytes of available graphics card memory, including the screen. Offscreen memory is only used by the accelerated drivers.

### int TQScreen::transformOrientation () const`[virtual]`

Used by the rotated server. The TQScreeen implementation returns 0.

### void TQScreen::uncache ( uchar * )`[virtual]`

This function is called on pixmap destruction to remove them from graphics card memory.

### int TQScreen::width () const

Gives the width in pixels of the framebuffer.

This file is part of the TQt toolkit. Copyright © 1995-2007 Trolltech. All Rights Reserved.