[Interest] QImage detect full transparent

maitai maitai at virtual-winds.org
Sun Feb 25 21:35:41 CET 2018


Just what I was looking for. I already live with using qt private stuff 
:)
Many thanks.

Le 25-02-2018 20:55, Allan Sandfeld Jensen a écrit :
> 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 at qt-project.org
> http://lists.qt-project.org/mailman/listinfo/interest



More information about the Interest mailing list