Important: Please read the Qt Code of Conduct -

Composition mode help...

  • I'm writing a driver for a graphics system so it can be ported to X, and QT seemed to help out in a lot of ways, but I can't get my head around how to set the composition mode to get the various effects that the old system could do.

    The old system can do:

    Replace - All pixels from source replace corresponding pixels in destination - this I think is QPainter::CompositionMode_Source

    Transparent - Only non-black (ie: 0) pixels from source will replace corresponding pixels in destination. I can't find a corresponding mode for this.

    XOR - standard XOR, I can do this with QPainter::RasterOp_SourceXorDestination

    Reverse transparent - Only the black pixels (ie: 0) from the source will replace the corresponding pixels in destination. The pixels will be coloured as the current foreground colour.

    I can't really see how to do (2) and (4) without creating QImages to get masks and playing with alpha values and doing multiple blits. The old system doesn't have alpha, so all the colours it draws effectively have alpha=1. Any help gratefully received :)


  • Lifetime Qt Champion


    Since you are getting pretty low level, I think you should bring this question to the interest mailing list. You'll find Qt's developers/maintainers there (this forum is more user oriented)

Log in to reply