Results 1 to 6 of 6

Thread: QImage, PNG ad Transparency

Threaded View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Join Date
    May 2011
    Posts
    2
    Qt products
    Qt4

    Default QImage, PNG ad Transparency

    Hi!

    I'm new to the forum and quite new to the Qt Programming.

    I've a problem with QImage.
    I need to draw an image (.png) with transparency.
    I've serched and read a lot of thread on this forum, but I did'nt found any solution.

    This is the code I used to load the image:

    Qt Code:
    1. imm=QImage(53,48,QImage::Format_ARGB32_Premultiplied);
    2. immGL=QImage(53,48,QImage::Format_ARGB32_Premultiplied);
    3.  
    4. imm.load("image.png", "PNG");
    5. immGL = QGLWidget::convertToGLFormat(imm);
    To copy to clipboard, switch view to plain text mode 


    This is the code to draw the image:


    Qt Code:
    1. glRasterPos2i(x0,y0);
    2. glDrawPixels(w, h, GL_RGBA, GL_UNSIGNED_BYTE, immGL.bits());
    To copy to clipboard, switch view to plain text mode 


    As a result, the image is drawn with all pixel that should be transparent converted to black.

    Any solutions?

    Thanks in advance,
    Rebe
    Last edited by high_flyer; 6th May 2011 at 10:09. Reason: code tags

Similar Threads

  1. QWinWidget & transparency
    By kinju in forum Qt Programming
    Replies: 1
    Last Post: 8th June 2010, 12:07
  2. Transparency over video
    By Luc4 in forum Qt Programming
    Replies: 3
    Last Post: 20th May 2010, 10:38
  3. Transparency ... Again
    By EricF in forum Qt Programming
    Replies: 4
    Last Post: 1st December 2007, 19:52
  4. Replies: 3
    Last Post: 15th March 2006, 11:44
  5. transparency
    By roms18 in forum Qt Programming
    Replies: 2
    Last Post: 16th February 2006, 19:38

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
  •  
Qt is a trademark of The Qt Company.