[Development] Qt 'minimal' platform no rendering alpha/opacity.

Agocs Laszlo laszlo.agocs at theqtcompany.com
Sat Apr 18 20:14:25 CEST 2015


The code snippet has no relation whatsoever to what setWindowOpacity is doing. If you are only after having transparent (alpha == 0) areas on the window, then there is no difference with 'minimal' compared to any other platform. In fact it's much easier since you won't need to worry about having transparency functional on the windowing system level. Just writing out pixels with an alpha of 0 is good enough, f.ex.:

tlw.setAutoFillBackground(true);
tlw.setBrush(QPalette::Window, Qt::transparent);

See http://doc.qt.io/qt-5.4/qwidget.html#transparency-and-double-buffering

Cheers,
Laszlo

From: Paul Knopf <theonlylawislove at gmail.com<mailto:theonlylawislove at gmail.com>>
Date: Friday 17 April 2015 17:45
To: Agocs Laszlo <laszlo.agocs at theqtcompany.com<mailto:laszlo.agocs at theqtcompany.com>>
Cc: "development at qt-project.org<mailto:development at qt-project.org>" <development at qt-project.org<mailto:development at qt-project.org>>
Subject: Re: [Development] Qt 'minimal' platform no rendering alpha/opacity.

What do you mean when you say "compositor"? Are you referring to a window system?

Is this something that is possible to implement with the minimal project? What would have to change?

I have need a custom platform that encodes the ARGB (proprietary, vendor specific) to the linux framebuffer, but the alpha channel has to actually be correct.

How come I can do this without a compositor?


    QImage bitmap(widget.size(), QImage::Format_ARGB32);

    bitmap.fill(Qt::transparent);

    QPainter painter(&bitmap);

    widget.render(&painter, QPoint(), QRegion(), QWidget::DrawChildren);

    bitmap.save("file.png");

There must be a way to achieve the same result using a platform plugin.

If all else fails, I could create my own thread loop that renders the QWidget with the above code and outputs it to my driver manually, instead of going through the platform plugins, but I would like to support the platform plugin so that I can then switch it out to develop locally using standard Qt platforms (X11, etc).

On Fri, Apr 17, 2015 at 10:32 AM, Agocs Laszlo <laszlo.agocs at theqtcompany.com<mailto:laszlo.agocs at theqtcompany.com>> wrote:
You do have alpha because the minimal's backingstore uses ARGB32_Premultiplied for the backing QImage.

What you do not have is setWindowOpacity(). You would need to implement QPlatformWindow::setOpacity() for that, but that is not possible with minimal since there is no compositor that could apply the opacity to the window contents during the composition step.

Best regards,
Laszlo

From: Paul Knopf <theonlylawislove at gmail.com<mailto:theonlylawislove at gmail.com>>
Date: Friday 17 April 2015 16:20
To: "development at qt-project.org<mailto:development at qt-project.org>" <development at qt-project.org<mailto:development at qt-project.org>>
Subject: [Development] Qt 'minimal' platform no rendering alpha/opacity.

I am testing the 'minimal' platform (mine is based off of it), and it seems that is doesn't render the alpha channel (setting opacity).

Here is a gist<https://gist.github.com/anonymous/544e84fbcde5022a6878> of my main function testing the opacity.

The saved images seems to have a tan background and no transparency.

Any ideas on how to get the alpha channel represented in the platform backing store?

--
Thanks!

~Paul



--
Thanks!

~Paul
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.qt-project.org/pipermail/development/attachments/20150418/069b9ac5/attachment.html>


More information about the Development mailing list