本文整理汇总了C++中QBitmap::save方法的典型用法代码示例。如果您正苦于以下问题:C++ QBitmap::save方法的具体用法?C++ QBitmap::save怎么用?C++ QBitmap::save使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类QBitmap
的用法示例。
在下文中一共展示了QBitmap::save方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: main
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" );
}
}
示例2: paintEvent
void rectangle::paintEvent(QPaintEvent *)
{
QBitmap bmp (this->rect().width(), this->height());
QPainter paint(&bmp);
QPen pen(Qt::black);
pen.setWidth(4);
paint.setPen(pen);
paint.setBrush(Qt::white);
paint.drawRect(1,1,bmp.rect().width()-2, bmp.rect().height()-2);
this->setMask(bmp);
bmp.save("c:/1.bmp");
}