Results 1 to 4 of 4

Thread: Accessing alpha channel of QImage directly

Threaded View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Join Date
    Nov 2008
    Posts
    38
    Thanks
    4
    Thanked 1 Time in 1 Post
    Qt products
    Qt4
    Platforms
    Unix/X11

    Default Accessing alpha channel of QImage directly

    Hi. I'm trying to create a QImage and set the alpha channel to some value on a per-pixel basis. setAlphaChannel is no good because it sets the whole image at once.

    Ideally, I'd have brushes treat the alpha component as non-special, i.e. the operation wouldn't be
    pixel = (old_r,old_g,old_b)*(1-alpha) + (new_r,new_g,new_b)*alpha
    but instead
    pixel = (new_r, new_g, new_b, new_a)
    or even
    pixel = (old_r,old_g,old_b,old_a)*(1-beta) + (new_r,new_g,new_b,new_a)*beta

    In the short term, however, setting pixels' alphas individually would be acceptable.
    Last edited by spraff; 19th March 2009 at 15:40.

Similar Threads

  1. How to set Qt window transparent?
    By montylee in forum Qt Programming
    Replies: 17
    Last Post: 24th December 2013, 20:11
  2. Replies: 12
    Last Post: 7th September 2011, 16:37
  3. How can I create a transparent image with QImage?
    By learning_qt in forum Qt Programming
    Replies: 1
    Last Post: 28th January 2009, 15:06
  4. Multiple QPainters on QImage
    By fire in forum Qt Programming
    Replies: 3
    Last Post: 14th August 2008, 13:10
  5. leaveEvent on transparent area issue
    By nooky59 in forum Qt Programming
    Replies: 10
    Last Post: 8th January 2008, 13:22

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.