/**************************************************************************** ** ** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). ** Contact: Nokia Corporation (qt-info@nokia.com) ** ** This file is part of the test suite of the Qt Toolkit. ** ** $QT_BEGIN_LICENSE:LGPL$ ** No Commercial Usage ** This file contains pre-release code and may not be distributed. ** You may use this file in accordance with the terms and conditions ** contained in the Technology Preview License Agreement accompanying ** this package. ** ** GNU Lesser General Public License Usage ** Alternatively, this file may be used under the terms of the GNU Lesser ** General Public License version 2.1 as published by the Free Software ** Foundation and appearing in the file LICENSE.LGPL included in the ** packaging of this file. Please review the following information to ** ensure the GNU Lesser General Public License version 2.1 requirements ** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. ** ** In addition, as a special exception, Nokia gives you certain ** additional rights. These rights are described in the Nokia Qt LGPL ** Exception version 1.1, included in the file LGPL_EXCEPTION.txt in this ** package. ** ** If you have questions regarding the use of this file, please contact ** Nokia at qt-info@nokia.com. ** ** ** ** ** ** ** ** ** $QT_END_LICENSE$ ** ****************************************************************************/ #include #include #include #include static QColor baseColor( int k, int intensity ) { int r = ( k & 1 ) * intensity; int g = ( (k>>1) & 1 ) * intensity; int b = ( (k>>2) & 1 ) * intensity; return QColor( r, g, b ); } static QPixmap createDestPixmap() { const int colorbands = 3; const int intensities = 4; QPixmap pm( 32, colorbands*intensities*4 ); QPainter painter; painter.begin( &pm ); for ( int i=0; i 0 ) { QBitmap mask( totalSize, totalSize, TRUE ); QPainter painter; painter.begin( &mask ); painter.setPen( QPen( Qt::color1, 1 ) ); painter.setBrush( Qt::color1 ); painter.drawRect( border, border, size, size ); painter.end(); bm.setMask( mask ); } return bm; } int main( int argc, char **argv ) { QApplication a( argc, argv ); // input for tst_QPainter::drawLine_rop_bitmap() { QBitmap dst = createDestBitmap(); dst.save( "../../drawLine_rop_bitmap/dst.xbm", "XBM" ); } // input for tst_QPainter::drawPixmap_rop_bitmap() { QBitmap dst = createDestBitmap(); QBitmap src1 = createSrcBitmap( 4, 2 ); QBitmap src2 = createSrcBitmap( 4, 0 ); dst.save( "../../drawPixmap_rop_bitmap/dst.xbm", "XBM" ); src1.save( "../../drawPixmap_rop_bitmap/src1.xbm", "XBM" ); src1.mask()->save( "../../drawPixmap_rop_bitmap/src1-mask.xbm", "XBM" ); src2.save( "../../drawPixmap_rop_bitmap/src2.xbm", "XBM" ); } // input for tst_QPainter::drawPixmap_rop() { QPixmap dst1 = createDestPixmap(); QPixmap dst2 = createDestPixmap(); dst2.resize( 32, 32 ); QBitmap src1 = createSrcBitmap( 32, 0 ); QBitmap src_tmp = createSrcBitmap( 32, 0 ).xForm( QWMatrix( 1, 0, 0, -1, 0, 0 ) ); src_tmp.resize( 32, 48 ); QBitmap src2 = src_tmp.xForm( QWMatrix( 1, 0, 0, -1, 0, 0 ) ); QBitmap mask( 32, 48, TRUE ); { QPainter painter; painter.begin( &mask ); painter.setPen( QPen( Qt::color1, 1 ) ); painter.setBrush( Qt::color1 ); painter.drawRect( 0, 16, 32, 32 ); painter.end(); } src2.setMask( mask ); QBitmap src3 = createSrcBitmap( 32, 0 ).xForm( QWMatrix( 1, 0, 0, -1, 0, 0 ) ); dst1.save( "../../drawPixmap_rop/dst1.png", "PNG" ); dst2.save( "../../drawPixmap_rop/dst2.png", "PNG" ); src1.save( "../../drawPixmap_rop/src1.xbm", "XBM" ); src2.save( "../../drawPixmap_rop/src2.xbm", "XBM" ); src2.mask()->save( "../../drawPixmap_rop/src2-mask.xbm", "XBM" ); src3.save( "../../drawPixmap_rop/src3.xbm", "XBM" ); } }