Thread: Transparency

  1. #1
    Registered User
    Join Date
    Apr 2007
    Posts
    162

    Transparency

    Hi

    Is there a function that creates for e.g. 50% transparent color?
    Is this function in windows GUI or shall I use some other interface for this?

    I am looking for some very simple function like CreateSolidBrush() or something like that.

    THX

  2. #2
    Cat without Hat CornedBee's Avatar
    Join Date
    Apr 2003
    Posts
    8,895
    You need the Windows Presentation Foundation to have transparent windows. Prior to that, you can mask out parts or you can copy the background and do your own alpha blending, but you can't make windows transparent.

    For simple transparent drawing, you can draw in an offscreen buffer and use AlphaBlend to copy the result to the target.
    All the buzzt!
    CornedBee

    "There is not now, nor has there ever been, nor will there ever be, any programming language in which it is the least bit difficult to write bad code."
    - Flon's Law

  3. #3
    train spotter
    Join Date
    Aug 2001
    Location
    near a computer
    Posts
    3,868
    Depending on what _exactly_ you want to do....

    Have a look at SetBkMode() using TRANSPARENT.
    "Man alone suffers so excruciatingly in the world that he was compelled to invent laughter."
    Friedrich Nietzsche

    "I spent a lot of my money on booze, birds and fast cars......the rest I squandered."
    George Best

    "If you are going through hell....keep going."
    Winston Churchill

  4. #4
    Unregistered User Yarin's Avatar
    Join Date
    Jul 2007
    Posts
    2,158

  5. #5
    Reverse Engineer maxorator's Avatar
    Join Date
    Aug 2005
    Location
    Estonia
    Posts
    2,318
    "The Internet treats censorship as damage and routes around it." - John Gilmore

  6. #6
    Registered User
    Join Date
    Apr 2007
    Posts
    162
    I need the transparecy because I am creating a sort of aplication which work similarly as Windows desktop (but working with bitmaps not icons) when I click and hold the left button a rectangle should appear... When I move the mouse the rectangle should change its shape... This all works just fine but I need the rectangle to be about 50% transparent so the bitmaps under it are seen...

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Replies: 1
    Last Post: 06-17-2008, 04:00 PM
  2. Are these possible - transparency and colors
    By ulillillia in forum Windows Programming
    Replies: 10
    Last Post: 05-17-2007, 12:57 AM
  3. How do you print on a transparency ?
    By Zeeshan in forum A Brief History of Cprogramming.com
    Replies: 8
    Last Post: 02-25-2003, 02:29 PM
  4. Transparency
    By Hunter2 in forum Windows Programming
    Replies: 25
    Last Post: 07-29-2002, 10:58 AM
  5. GIF Transparency
    By dbaryl in forum A Brief History of Cprogramming.com
    Replies: 17
    Last Post: 04-20-2002, 05:46 PM