How can I draw a pixmap with a background color after the pixmap is constructed from an image?

You can create a second pixmap, fill it with your background color, then draw the original pixmap on top. For example:

  1.     QPixmap filled(original.size());
  2.     QPainter paint(&filled);
  3.     paint.fillRect(0,0,original.width(), original.height(), backgroundColor);
  4.     paint.drawPixmap(0,0,original);
  5.     paint.end();
  6.  

No comments

Write a comment

Sorry, you must be logged in to post a comment.