Results 1 to 4 of 4

Thread: QPixmap's background

  1. #1
    Join Date
    May 2012
    Posts
    16
    Thanks
    8
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Question QPixmap's background

    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.

  2. #2
    Join Date
    Oct 2006
    Location
    New Delhi, India
    Posts
    2,467
    Thanks
    8
    Thanked 334 Times in 317 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: QPixmap's background

    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.

  3. The following user says thank you to aamer4yu for this useful post:

    Dopt (18th June 2012)

  4. #3
    Join Date
    May 2012
    Posts
    16
    Thanks
    8
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: QPixmap's background

    Quote Originally Posted by aamer4yu View Post
    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 =)
    Last edited by Dopt; 29th May 2012 at 18:20.

  5. #4
    Join Date
    Sep 2011
    Location
    Manchester
    Posts
    538
    Thanks
    3
    Thanked 106 Times in 103 Posts
    Qt products
    Qt4 Qt/Embedded
    Platforms
    MacOS X Unix/X11 Windows

    Default Re: QPixmap's background

    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.

Similar Threads

  1. Replies: 0
    Last Post: 5th April 2011, 13:36
  2. Replies: 1
    Last Post: 25th June 2010, 18:31
  3. Replies: 4
    Last Post: 28th August 2008, 13:13
  4. Replies: 1
    Last Post: 21st August 2008, 07:44
  5. Replies: 5
    Last Post: 9th April 2007, 14:26

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.