scribblearea.cpp
void ScribbleArea::resizeImage(QImage *image, const QSize &newSize)
{
    // Check if we need to redraw the image
    if (image->size() == newSize)
        return;

    // Create a new image to display and fill it with white
    QImage newImage(newSize, QImage::Format_RGB32);
    newImage.fill(qRgb(255, 255, 255));

    // Draw the image
    QPainter painter(&newImage);
    painter.drawImage(QPoint(0, 0), *image);
    *image = newImage;
}
// When the app is resized create a new image using
// the changes made to the image
When the app is resized create a new image using
the changes made to the image
When the app is resized create a new image using the changes made to the image
void ScribbleArea::resizeImage(QImage *image, const QSize &newSize)
{
    if (image->size() == newSize)
        return;
    QImage newImage(newSize, QImage::Format_RGB32);
    newImage.fill(qRgb(255, 255, 255));
    QPainter painter(&newImage);
    painter.drawImage(QPoint(0, 0), *image);
    *image = newImage;
}
void ScribbleArea :: resizeImage ( QImage * image , const QSize & newSize ) { if ( image -> size ( ) == newSize ) return ; QImage newImage ( newSize , QImage :: Format_RGB32 ) ; newImage . fill ( qRgb ( 255 , 255 , 255 ) ) ; QPainter painter ( & newImage ) ; painter . drawImage ( QPoint ( 0 , 0 ) , * image ) ; * image = newImage ; }
When the app is resized create a new image using
the changes made to the image
When the app is resized create a new image using the changes made to the image
// Check if we need to redraw the image // Create a new image to display and fill it with white // Draw the image