nokkie
3rd May 2010, 19:18
Hello, I've been trying to create a simple alpha mask from a QImage using CreateAlphaMask but for some reason I can't get the mask to work correctly. I only want the simplest mask possible, if there is any alpha at all then set the bit for that pixel in the alpha mask to be 1.
My problem with QImage::CreateAlphaMask is that no matter what Qt::ImageConversionFlags I try to use, it seems to not detect pixels with only a slight alpha.
Here's a list of the flags I've tried already:
Image.createAlphaMask(); // Qt::AutoColor | Qt::DiffuseDither
Image.createAlphaMask( Qt::ThresholdAlphaDither );
Image.createAlphaMask( Qt::DiffuseAlphaDither );
Image.createAlphaMask( Qt::AvoidDither );
Image.createAlphaMask( Qt::NoOpaqueDetection );
Is Qt designed to do what I want to do? or should I loop through the pixels myself and find the true alpha mask? It seems what I need is to use "Qt::ThresholdAlphaDither" but be able to set the threshhold to 0.
My problem with QImage::CreateAlphaMask is that no matter what Qt::ImageConversionFlags I try to use, it seems to not detect pixels with only a slight alpha.
Here's a list of the flags I've tried already:
Image.createAlphaMask(); // Qt::AutoColor | Qt::DiffuseDither
Image.createAlphaMask( Qt::ThresholdAlphaDither );
Image.createAlphaMask( Qt::DiffuseAlphaDither );
Image.createAlphaMask( Qt::AvoidDither );
Image.createAlphaMask( Qt::NoOpaqueDetection );
Is Qt designed to do what I want to do? or should I loop through the pixels myself and find the true alpha mask? It seems what I need is to use "Qt::ThresholdAlphaDither" but be able to set the threshhold to 0.