PDA

View Full Version : QPixmap's background



Dopt
29th May 2012, 11:00
Hey guys.I have a problem when I draw a pixmap(human shape) into my widget with a background image.My pixmap looks like a rectangle box because my pixmap's background is not same as my background image's colour. How do I make them same, so that my pixmap look like a human shape,not a rect picture.:confused:

aamer4yu
29th May 2012, 11:42
Where do you get the pixmap from ? Is it some png file ? Or you draw using QPixmap ?
If you are using QPixmap to draw your own image, first draw the pixmap with transparent color. Then draw the relevant areas.

Next if you are using png or image file, that file needs to have proper transparent areas.

Dopt
29th May 2012, 16:35
Where do you get the pixmap from ? Is it some png file ? Or you draw using QPixmap ?
If you are using QPixmap to draw your own image, first draw the pixmap with transparent color. Then draw the relevant areas.

Next if you are using png or image file, that file needs to have proper transparent areas.

I am using png file.I just found out some image editor that help making transparent background.I don't know that it can be done outside. thanks btw =)

Spitfire
31st May 2012, 15:20
If the background color of the png image is seamless (no gradients etc) then you can do it on the fly just by masking pixels of certaint color out.