void Object::exportX(int frameStart, int frameEnd, QMatrix view, QSize exportSize, QString filePath, bool antialiasing, int gradients) { QSettings settings("Pencil","Pencil"); qreal curveOpacity = (100-settings.value("curveOpacity").toInt())/100.0; // default value is 1.0 int page; page=0; for(int j = frameStart; j <= frameEnd; j=j+15) { QImage xImg(QSize(2300,3400), QImage::Format_ARGB32_Premultiplied); QPainter xPainter(&xImg); xPainter.fillRect(0,0,2300,3400,Qt::white); int y = j-1; for(int i=j;i<15+page*15 && i<=frameEnd;i++) { QRect source = QRect( QPoint(0,0) , exportSize ); QRect target = QRect ( QPoint((y%3)*800+30, (y/3)*680+50-page*3400) , QSize(640,480) ); QMatrix thumbView = view * Editor::map(source, target); xPainter.setWorldMatrix( thumbView ); xPainter.setClipRegion( thumbView.inverted().map( QRegion(target) ) ); paintImage(xPainter, i, false, curveOpacity, antialiasing, gradients); xPainter.resetMatrix(); xPainter.setClipping(false); xPainter.setPen( Qt::black ); xPainter.setFont(QFont("helvetica",50)); xPainter.drawRect( target ); xPainter.drawText(QPoint((y%3)*800+35, (y/3)*680+65-page*3400), QString::number(i)); y++; } if(filePath.endsWith(".jpg", Qt::CaseInsensitive)) { filePath = filePath.remove(".jpg", Qt::CaseInsensitive); } xImg.save(filePath+QString::number(page)+".jpg", "JPG", 60); page++; } }
bool Object::exportX( int frameStart, int frameEnd, QTransform view, QSize exportSize, QString filePath, bool antialiasing ) { QSettings settings( "Pencil", "Pencil" ); int page; page = 0; for ( int j = frameStart; j <= frameEnd; j = j + 15 ) { QImage xImg( QSize( 2300, 3400 ), QImage::Format_ARGB32_Premultiplied ); QPainter xPainter( &xImg ); xPainter.fillRect( 0, 0, 2300, 3400, Qt::white ); int y = j - 1; for ( int i = j; i < 15 + page * 15 && i <= frameEnd; i++ ) { QRect source = QRect( QPoint( 0, 0 ), exportSize ); QRect target = QRect( QPoint( ( y % 3 ) * 800 + 30, ( y / 3 ) * 680 + 50 - page * 3400 ), QSize( 640, 480 ) ); QTransform thumbView = view * RectMapTransform( source, target ); xPainter.setWorldTransform( thumbView ); xPainter.setClipRegion( thumbView.inverted().map( QRegion( target ) ) ); paintImage( xPainter, i, false, antialiasing ); xPainter.resetMatrix(); xPainter.setClipping( false ); xPainter.setPen( Qt::black ); xPainter.setFont( QFont( "helvetica", 50 ) ); xPainter.drawRect( target ); xPainter.drawText( QPoint( ( y % 3 ) * 800 + 35, ( y / 3 ) * 680 + 65 - page * 3400 ), QString::number( i ) ); y++; } if ( filePath.endsWith( ".jpg", Qt::CaseInsensitive ) ) { filePath.chop( 4 ); } if ( !xImg.save( filePath + QString::number( page ) + ".jpg", "JPG", 60 ) ) { return false; } page++; } return true; }