📄 qscreen_qws.cpp
字号:
Returns the logical width of the framebuffer in pixels. \sa deviceWidth(), physicalWidth(), height()*//*! \fn int QScreen::height() const Returns the logical height of the framebuffer in pixels. \sa deviceHeight(), physicalHeight(), width()*//*! \fn QScreen::depth() const Returns the depth of the framebuffer, in bits per pixel. Note that the returned depth is the number of bits each pixel fills rather than the number of significant bits, so 24bpp and 32bpp express the same range of colors (8 bits of red, green and blue). \sa clut(), pixmapDepth()*//*! \fn int QScreen::pixmapDepth() const Returns the preferred depth for pixmaps, in bits per pixel. \sa depth()*//*! \fn QScreen::linestep() const Returns the length of each scanline of the framebuffer in bytes. \sa isInterlaced()*//*! \fn QScreen::deviceWidth() const Returns the physical width of the framebuffer device in pixels. Note that the returned width can differ from the width which \l {Qtopia Core} will actually use, that is if the display is centered within the framebuffer. \sa width(), physicalWidth(), deviceHeight()*//*! \fn QScreen::deviceHeight() const Returns the full height of the framebuffer device in pixels. Note that the returned height can differ from the height which \l {Qtopia Core} will actually use, that is if the display is centered within the framebuffer. \sa height(), physicalHeight(), deviceWidth()*//*! \fn uchar *QScreen::base() const Returns a pointer to the beginning of the framebuffer. \sa onCard(), region(), totalSize()*//*! \fn uchar *QScreen::cache(int) \internal This function is used to store pixmaps in graphics memory for the use of the accelerated drivers. See QLinuxFbScreen (where the caching is implemented) for more information.*//*! \fn QScreen::uncache(uchar *) \internal This function is called on pixmap destruction to remove them from graphics card memory.*//*! \fn QScreen::screenSize() const 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. \sa base(), region()*//*! \fn QScreen::totalSize() const Returns the size of the available graphics card memory (including the screen) in bytes. \sa onCard()*/// Unaccelerated screen/driver setup. Can be overridden by accelerated// drivers/*! \fn QScreen::QScreen(int displayId) Constructs a new screen driver. The \a displayId identifies the \l {Qtopia Core} server to connect to.*//*! \fn QScreen::clut() Returns a pointer to the screen's color lookup table (i.e. its color palette). Note that this function only apply in paletted modes like 8-bit, i.e. in modes where only the palette indexes (and not the actual color values) are stored in memory. \sa alloc(), depth(), numCols()*//*! \fn int QScreen::numCols() Returns the number of entries in the screen's color lookup table (i.e. its color palette). A pointer to the color table can be retrieved using the clut() function. \sa clut(), alloc()*/QScreen::QScreen(int display_id) : d_ptr(new QScreenPrivate(this)){ w = 0; lstep = 0; h = 0; d = 1; pixeltype = NormalPixel; grayscale = false; dw = 0; dh = 0; size = 0; mapsize = 0; data = 0; displayId = display_id; entries = 0; entryp = 0; lowest = 0; clearCacheFunc = 0; grayscale = false; screencols = 0; physWidth = 0; physHeight = 0;}/*! Destroys this screen driver.*/QScreen::~QScreen(){ delete d_ptr;}/*! This function is called by the \l {Qtopia Core} server before it calls the disconnect() function when exiting. Note that the default implementation only hides the mouse cursor; reimplement this function to do the necessary graphics card specific cleanup. \sa initDevice(), disconnect()*/void QScreen::shutdownDevice(){#ifndef QT_NO_QWS_CURSOR qt_screencursor->hide();#endif}extern bool qws_accel; //in qapplication_qws.cpp/*! \fn PixelType QScreen::pixelType() const Returns the pixel storage format of the screen.*//*! Returns the pixel format of the screen, or \c QImage::Format_Invalid if the pixel format is not a supported image format.*///#### Must be able to distinguish between 565 and 1555 and between Indexed8 and 8-bit grayscaleQImage::Format QScreen::pixelFormat() const{ return d_ptr->pixelFormat;}/*! Sets the screen's pixel format to \a format. */void QScreen::setPixelFormat(QImage::Format format){ d_ptr->pixelFormat = format;}/*! \fn int QScreen::alloc(unsigned int red, unsigned int green, unsigned int blue) Returns the index in the screen's palette which is the closest match to the given RGB value (\a red, \a green, \a blue). Note that this function only apply in paletted modes like 8-bit, i.e. in modes where only the palette indexes (and not the actual color values) are stored in memory. \sa clut(), numCols()*/int QScreen::alloc(unsigned int r,unsigned int g,unsigned int b){ int ret = 0; if (d == 8) { if (grayscale) return qGray(r, g, b); // First we look to see if we match a default color const int pos = (r + 25) / 51 * 36 + (g + 25) / 51 * 6 + (b + 25) / 51; if (pos < screencols && screenclut[pos] == qRgb(r, g, b)) { return pos; } // search for nearest color unsigned int mindiff = 0xffffffff; unsigned int diff; int dr,dg,db; for (int loopc = 0; loopc < screencols; ++loopc) { dr = qRed(screenclut[loopc]) - r; dg = qGreen(screenclut[loopc]) - g; db = qBlue(screenclut[loopc]) - b; diff = dr*dr + dg*dg + db*db; if (diff < mindiff) { ret = loopc; if (!diff) break; mindiff = diff; } } } else if (d == 4) { ret = qGray(r, g, b) >> 4; } else if (d == 1) { ret = qGray(r, g, b) >= 128; } else { qFatal("cannot alloc %dbpp color", d); } return ret;}/*! Saves the current state of the graphics card. For example, hardware screen drivers should reimplement the save() and restore() functions to save and restore its registers, enabling swintching between virtual consoles. Note that the default implementation does nothing. \sa restore()*/void QScreen::save(){}/*! Restores the previously saved state of the graphics card. For example, hardware screen drivers should reimplement the save() and restore() functions to save and restore its registers, enabling swintching between virtual consoles. Note that the default implementation does nothing. \sa save()*/void QScreen::restore(){}void QScreen::blank(bool){}/*! \internal*/void QScreen::set(unsigned int, unsigned int, unsigned int, unsigned int){}/*! \fn bool QScreen::supportsDepth(int depth) const Returns true if the screen supports the specified color \a depth; otherwise returns false. \sa clut()*/bool QScreen::supportsDepth(int d) const{ if (false) { //Just to simplify the ifdeffery#ifdef QT_QWS_DEPTH_1 } else if(d==1) { return true;#endif#ifdef QT_QWS_DEPTH_4 } else if(d==4) { return true;#endif#ifdef QT_QWS_DEPTH_8 } else if(d==8) { return true;#endif#ifdef QT_QWS_DEPTH_16 } else if(d==16) { return true;#endif#ifdef QT_QWS_DEPTH_18 } else if(d==18 || d==19) { return true;#endif#ifdef QT_QWS_DEPTH_24 } else if(d==24) { return true;#endif#ifdef QT_QWS_DEPTH_32 } else if(d==32) { return true;#endif } return false;}/*! \fn bool QScreen::onCard(const unsigned char *buffer) const Returns true if the specified \a buffer is within the graphics card's memory; otherwise returns false (i.e. if it's in main RAM). \sa base(), totalSize()*/bool QScreen::onCard(const unsigned char * p) const{ long t=(unsigned long)p; long bmin=(unsigned long)data; if (t < bmin) return false; if(t >= bmin+mapsize) return false; return true;}/*! \fn bool QScreen::onCard(const unsigned char * buffer, ulong& offset) const \overload If the specified \a buffer is within the graphics card's memory, this function stores the offset from the start of graphics card memory (in bytes), in the location specified by the \a offset parameter.*/bool QScreen::onCard(const unsigned char * p, ulong& offset) const{ long t=(unsigned long)p; long bmin=(unsigned long)data; if (t < bmin) return false; long o = t - bmin; if (o >= mapsize) return false; offset = o; return true;}/*#if !defined(QT_NO_QWS_REPEATER) { "Repeater", qt_get_screen_repeater, 0 },#endif#if defined(QT_QWS_EE) { "EE", qt_get_screen_ee, 0 },#endif*//*Given a display_id (number of the \l {Qtopia Core} server to connect to)and a spec (e.g. Mach64:/dev/fb0) return a QScreen-descendant.The QScreenDriverFactory is queried for a suitable driver and, if found,asked to create a driver.People writing new graphics drivers should either hook their ownQScreen-descendant into QScreenDriverFactory or use the QScreenDriverPluginto make a dynamically loadable driver.*/Q_GUI_EXPORT QScreen* qt_get_screen(int display_id, const char *spec){ QString displaySpec = QString::fromAscii(spec); QString driver = displaySpec; int colon = displaySpec.indexOf(QLatin1Char(':')); if (colon >= 0)
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -