dcsimg
Results 1 to 4 of 4

Thread: Transparent Colors

  1. #1

    Thread Starter
    Hyperactive Member
    Join Date
    Apr 2017
    Posts
    457

    Transparent Colors

    I know that you can select a color and make it the transparent color in a user control. Without using user controls can it be done in a regular VB6 program.

    Let's say I have a table of several color values that are in the image and I need to switch from one color to another from the table and use it as a transparent color then select another color from the table and use it as the transparent color. I want to use these different colors to mask out certain parts of the image, do some stuff then mask out another part etc, etc

  2. #2
    VB-aholic & Lovin' It LaVolpe's Avatar
    Join Date
    Oct 2007
    Location
    Beside Waldo
    Posts
    18,095

    Re: Transparent Colors

    Maybe TransparentBlt is what you are after?
    https://docs.microsoft.com/en-us/win...transparentblt
    http://allapi.mentalis.org/apilist/TransparentBlt.shtml has a sample link at bottom of page
    Insomnia is just a byproduct of, "It can't be done"

    Classics Enthusiast? Here's my 1969 Mustang Mach I Fastback. Her sister '67 Coupe has been adopted

    Newbie? Novice? Bored? Spend a few minutes browsing the FAQ section of the forum.
    Read the HitchHiker's Guide to Getting Help on the Forums.
    Here is the list of TAGs you can use to format your posts
    Here are VB6 Help Files online


    {Alpha Image Control} {Memory Leak FAQ} {Unicode Open/Save Dialog} {Resource Image Viewer/Extractor}
    {VB and DPI Tutorial} {Manifest Creator} {UserControl Button Template} {stdPicture Render Usage}

  3. #3

    Thread Starter
    Hyperactive Member
    Join Date
    Apr 2017
    Posts
    457

    Re: Transparent Colors

    OK, thanks for the links. Maybe I want to do just the opposite. Let's say I have a pictures of chess pieces on a solid background and I want to make a mask of the pieces so this means need to keep the background as is but make the chess pieces one solid color, probably black but I guess any color will do. So, how do I take the piece details out of the picture and make it a solid black for example. Seems like I did this years ago but have long forgotten what I did or where the code is.

  4. #4

    Thread Starter
    Hyperactive Member
    Join Date
    Apr 2017
    Posts
    457

    Re: Transparent Colors

    Never mind. I found the program and code I was referring to and it turns out to be a very simple thing. I just place all the pieces on a bitmap and color the background a solid color that does not appear in any of the pieces and then I scan the picture using .Point and .PSet and if any color is not the background color then change it to black and that gives me a mask for all the pieces.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Featured


Click Here to Expand Forum to Full Width