On Sonntag, 25. Februar 2018 20:23:32 CET maitai wrote:
> Hello,
> Seems quite basic, but I need a **fast** way to know if a QImage is just
> full transparent. I know the size in advance (256x256). If it were a
> QPixmap I would use cacheKey() and compare with the cacheKey of a full
> transparent image. For a QImage I can compare it with a preset
> transparent image, or extract the alpha channel, or etc of course. But I
> need a really fast way.
> 
> Any idea?
> 
There is a private API for that which QPixmap uses 
QImageData::checkForAlphaPixels() can be accessed via QImage::d_ptr()-
>checkForAlphaPixels(). 

Of course being private API there is not guarantee it will keep working, and 
if you use it you might not be able to link with newer Qt versions.

You can ofcourse also just look at the code in qimage.cpp and do something 
similar.

`Allan


_______________________________________________
Interest mailing list
Interest@qt-project.org
http://lists.qt-project.org/mailman/listinfo/interest

Reply via email to