Pen Opacity

This is a discussion on Pen Opacity within the Windows Programming forums, part of the Platform Specific Boards category; hi, is there anyway to change the opacity of lines and stuff [i guess it would be some sort of ...

  1. #1
    dug
    dug is offline
    Registered User dug's Avatar
    Join Date
    Jun 2003
    Posts
    66

    Pen Opacity

    hi,

    is there anyway to change the opacity of lines and stuff [i guess it would be some sort of setting with the CPen thing..] that you draw onto a CPaintDC?

    for instance if you are drawing lines on top of an image you are displaying, is there a simple way to change the amount you can see through the lines and onto the image?

    thanks.
    "take the long road.... and walk it."

  2. #2
    It's full of stars adrianxw's Avatar
    Join Date
    Aug 2001
    Posts
    4,831
    There is not an attribute in the normal GDI interface for opacity, there may be in GDI+, but I don't have access to a system with that loaded.

    One way to simulate this may be by drawing a long thin rectangle linking the start and end points of the "line" and fill the rectangle with a pattern that combines your chosen colour and "transparent" in some combination. Never tried it, but it may look okay.
    Wave upon wave of demented avengers march cheerfully out of obscurity unto the dream.

  3. #3
    dug
    dug is offline
    Registered User dug's Avatar
    Join Date
    Jun 2003
    Posts
    66
    yeah, i had thought of an answer like that, but that would require overhead in terms of calculating the 'colour' of each pixel in each line... which is OK, for static stuff but potentially crippling if there are many lines and you are moving the images and lines...

    thanks for the suggestion though.
    "take the long road.... and walk it."

  4. #4
    dug
    dug is offline
    Registered User dug's Avatar
    Join Date
    Jun 2003
    Posts
    66
    anybody know anything about MultipleLayerWindows?

    could this be a possible solution to the problem?
    "take the long road.... and walk it."

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Tutle graphic pen problem
    By swgh in forum C++ Programming
    Replies: 2
    Last Post: 11-22-2007, 07:04 AM
  2. Changing color of pen
    By Gordon in forum Windows Programming
    Replies: 4
    Last Post: 04-13-2007, 11:26 AM
  3. pen spinning
    By h_howee in forum A Brief History of Cprogramming.com
    Replies: 2
    Last Post: 10-17-2006, 10:28 PM
  4. GDI: Creating a pen VS taking it as a stock object.
    By limacat in forum Windows Programming
    Replies: 5
    Last Post: 03-31-2003, 10:14 AM
  5. 2d array help!
    By cpp4ever in forum C++ Programming
    Replies: 2
    Last Post: 12-04-2001, 02:29 PM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21