当前位置: 首页>>代码示例>>C++>>正文


C++ QPixmap::x11Info方法代码示例

本文整理汇总了C++中QPixmap::x11Info方法的典型用法代码示例。如果您正苦于以下问题:C++ QPixmap::x11Info方法的具体用法?C++ QPixmap::x11Info怎么用?C++ QPixmap::x11Info使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在QPixmap的用法示例。


在下文中一共展示了QPixmap::x11Info方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: paint

// Qt has qt_toX11Pixmap(), but that's sadly not public API. So the only
// option seems to be to create X11-based QPixmap using QPixmap::fromX11Pixmap()
// and draw the non-native pixmap to it.
// NOTE: The alpha-channel is not preserved if it exists, but for X pixmaps it generally should not be needed anyway.
QPixmap X11EmbedContainer::toX11Pixmap(const QPixmap& pix)
{
    if(pix.handle() != 0)   // X11 pixmap
        return pix;
    Pixmap xpix = XCreatePixmap(pix.x11Info().display(), RootWindow(pix.x11Info().display(), pix.x11Info().screen()),
                                pix.width(), pix.height(), QX11Info::appDepth());
    QPixmap wrk = QPixmap::fromX11Pixmap(xpix);
    QPainter paint(&wrk);
    paint.drawPixmap(0, 0, pix);
    paint.end();
    QPixmap ret = wrk.copy();
    wrk = QPixmap(); // reset, so that xpix can be freed (QPixmap does not own it)
    XFreePixmap(pix.x11Info().display(), xpix);
    return ret;
}
开发者ID:mgottschlag,项目名称:kwin-tiling,代码行数:19,代码来源:x11embedcontainer.cpp

示例2: backingStore

/*!
  \return A pixmap that can be used as backing store

  \param widget Widget, for which the backinstore is intended
  \param size Size of the pixmap
 */
QPixmap QwtPainter::backingStore( QWidget *widget, const QSize &size )
{
    QPixmap pm;

#define QWT_HIGH_DPI 1

#if QT_VERSION >= 0x050000 && QWT_HIGH_DPI
    qreal pixelRatio = 1.0;

    if ( widget && widget->windowHandle() )
    {
        pixelRatio = widget->windowHandle()->devicePixelRatio();
    }
    else
    {
        if ( qApp )
            pixelRatio = qApp->devicePixelRatio();
    }

    pm = QPixmap( size * pixelRatio );
    pm.setDevicePixelRatio( pixelRatio );
#else
    Q_UNUSED( widget )
    pm = QPixmap( size );
#endif

#if 0
#ifdef Q_WS_X11
    if ( pm.x11Info().screen() != x11Info().screen() )
         pm.x11SetScreen( x11Info().screen() );
#endif
#endif

    return pm;
}
开发者ID:,项目名称:,代码行数:41,代码来源:


注:本文中的QPixmap::x11Info方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。