Ignore:
Timestamp:
Jan 29, 2006, 8:56:21 PM (20 years ago)
Author:
dmik
Message:

Implemented alpha blending for pixmaps.
Improved blitting of masked pixmaps.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/kernel/qpainter_pm.cpp

    r8 r59  
    505505    if ( (pdev->devFlags & QInternal::CompatibilityMode) != 0 )
    506506        setf(Qt2Compat);
    507     else if ( dt == QInternal::Pixmap )         // device is a pixmap
    508         ((QPixmap*)pdev)->detach();             // will modify it
     507    else if ( dt == QInternal::Pixmap ) {       // device is a pixmap
     508        QPixmap *pm = (QPixmap*) pdev;          // will modify it
     509        pm->detach();                           
     510        // Ensure the auxiliary masked bitmap created for masking is destroyed
     511        // (to cause it to be recreated when the pixmap is blitted next time).
     512        // Also ensure the alpha channel of the pixmap is unfolded -- any GPI
     513        // call will clear the high byte that may be storing the alpha bits,
     514        // so the pixmap will appear as fully transparent.
     515        if ( pm->data->mask )
     516            pm->prepareForMasking( FALSE, TRUE );
     517        if ( pm->data->hasRealAlpha )
     518            pm->unfoldAlphaChannel();
     519    }
    509520
    510521    hps = 0;
     
    802813}
    803814
    804 /*
    805   This function adjusts the raster operations for painting into a QBitmap on
    806   Windows.
    807 
    808 //@@TODO (dmik): think of it. should it be the same on OS/2? see also
    809 //  qcolor_pm.cpp, qpixmap.cpp (qt_xForm_helper()), qpaintdevice_pm.cpp (bitBlt())
    810 
    811   For bitmaps und Windows, color0 is 0xffffff and color1 is 0x000000 -- so we
    812   have to use adjusted ROPs in this case to get the same effect as on Unix.
    813 */
    814 //@@TODO (dmik): possibly remove
    815 //Qt::RasterOp qt_map_rop_for_bitmaps( Qt::RasterOp r )
    816 //{
    817 //    static const Qt::RasterOp ropCodes[] = {
    818 //      Qt::CopyROP,    // CopyROP
    819 //      Qt::AndROP,             // OrROP
    820 //      Qt::NotXorROP,  // XorROP
    821 //      Qt::NotOrROP,   // NotAndROP
    822 //      Qt::NotCopyROP, // NotCopyROP
    823 //      Qt::NotAndROP,  // NotOrROP
    824 //      Qt::XorROP,     // NotXorROP
    825 //      Qt::OrROP,      // AndROP
    826 //      Qt::NotROP,     // NotROP
    827 //      Qt::SetROP,     // ClearROP
    828 //      Qt::ClearROP,   // SetROP
    829 //      Qt::NopROP,     // NopROP
    830 //      Qt::OrNotROP,   // AndNotROP
    831 //      Qt::AndNotROP,  // OrNotROP
    832 //      Qt::NorROP,     // NandROP
    833 //      Qt::NandROP     // NorROP
    834 //    };
    835 //    return ropCodes[r];
    836 //}
    837 
    838815void QPainter::setRasterOp( RasterOp r )
    839816{
     
    861838   if ( bg_mode != TransparentMode )
    862839       qt_GpiSetBackMix( hps, qt_ropCodes[r], cpen.style() == NoPen );
    863 
    864 //@@TODO (dmik): remove? see above todo (qt_map_rop_for_bitmaps())
    865 //    if ( pdev->devType()==QInternal::Pixmap && ((QPixmap*)pdev)->isQBitmap() )
    866 //      SetROP2( hdc, ropCodes[ qt_map_rop_for_bitmaps(r) ] );
    867 //    else
    868 //      SetROP2( hdc, ropCodes[r] );
    869840}
    870841
Note: See TracChangeset for help on using the changeset viewer.