예제 #1
0
QImage XCursorThemeData::loadImage (const QString &name, int size) const {
  if (size == -1) size = XcursorGetDefaultSize(QX11Info::display());
  // Load the image
  XcursorImage *xcimage = xcLoadImage(name, size);
  if (!xcimage) xcimage = xcLoadImage(findAlternative(name), size);
  // Fall back to a legacy cursor
  //if (!xcimage) return LegacyTheme::loadImage(name);
  if (!xcimage) return QImage();
  // Convert the XcursorImage to a QImage, and auto-crop it
  QImage image((uchar *)xcimage->pixels, xcimage->width, xcimage->height, QImage::Format_ARGB32_Premultiplied);
  image = autoCropImage(image);
  XcursorImageDestroy(xcimage);
  return image;
}
예제 #2
0
QImage XCursorTheme::loadImage(const QString &name, int size) const
{
    if (size <= 0)
        size = autodetectCursorSize();

    // Load the image
    XcursorImage *xcimage = xcLoadImage(name, size);

    if (!xcimage)
        xcimage = xcLoadImage(findAlternative(name), size);

    if (!xcimage) {
        return QImage();
    }

    // Convert the XcursorImage to a QImage, and auto-crop it
    QImage image((uchar *)xcimage->pixels, xcimage->width, xcimage->height,
                 QImage::Format_ARGB32_Premultiplied );

    image = autoCropImage(image);
    XcursorImageDestroy(xcimage);

    return image;
}