void Editor::clipboardChanged() { if ( clipboardBitmapOk == false ) { g_clipboardBitmapImage.setImage( new QImage( QApplication::clipboard()->image() ) ); g_clipboardBitmapImage.bounds() = QRect( g_clipboardBitmapImage.topLeft(), g_clipboardBitmapImage.image()->size() ); qDebug() << "New clipboard image" << g_clipboardBitmapImage.image()->size(); } else { clipboardBitmapOk = false; qDebug() << "The image has been saved in the clipboard"; } }
void CanvasRenderer::paintBitmapFrame( QPainter& painter, int layerId, int nFrame, bool colorize, bool useLastKeyFrame ) { Layer* layer = mObject->getLayer( layerId ); if ( !layer->visible() ) { return; } LayerBitmap* bitmapLayer = dynamic_cast< LayerBitmap* >( layer ); if ( bitmapLayer == nullptr ) { Q_ASSERT( bitmapLayer ); return; } qCDebug( mLog ) << "Paint Onion skin bitmap, Frame = " << nFrame; BitmapImage* bitmapImage; if (useLastKeyFrame) { bitmapImage = bitmapLayer->getLastBitmapImageAtFrame( nFrame, 0 ); } else { bitmapImage = bitmapLayer->getBitmapImageAtFrame( nFrame ); } if ( bitmapImage == nullptr ) { return; } BitmapImage* tempBitmapImage = new BitmapImage; tempBitmapImage->paste(bitmapImage); if ( colorize ) { QBrush colorBrush = QBrush(Qt::transparent); //no color for the current frame if (nFrame < mFrameNumber) { colorBrush = QBrush(Qt::red); } else if (nFrame > mFrameNumber) { colorBrush = QBrush(Qt::blue); } tempBitmapImage->drawRect( bitmapImage->bounds(), Qt::NoPen, colorBrush, QPainter::CompositionMode_SourceIn, false); } // If the current frame on the current layer has a transformation, we apply it. // if (mRenderTransform && nFrame == mFrameNumber && layerId == mLayerIndex ) { tempBitmapImage->clear(mSelection); paintTransformedSelection(painter); } painter.setWorldMatrixEnabled( true ); if (mRenderTransform && nFrame) { painter.setOpacity( bitmapLayer->getOpacity() ); } tempBitmapImage->paintImage( painter ); delete tempBitmapImage; }