?
Solved

Question About TRANSPARENT Bitmaps

Posted on 2003-02-24
4
Medium Priority
?
187 Views
Last Modified: 2010-05-18
Is it Possible to use more than one Transparent COlor when I Paint the Bitmap??

I trying with the TransparentBlt() Function for the moment.

But can I Use more than one COLORREF??
0
Comment
Question by:Snurre
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
4 Comments
 
LVL 6

Expert Comment

by:PlanetCpp
ID: 8013887
why would you use more then one? the other color can just be made the transparent color, no?
0
 
LVL 2

Author Comment

by:Snurre
ID: 8014692
So I coulden't use like COLORREF RGB(255, 255, 255) | RGB(255, 1, 255);

0
 
LVL 6

Accepted Solution

by:
PlanetCpp earned 80 total points
ID: 8017821
that's a bit-wise or you'll be creating a new color from that
that should make white still cause your bit-wise or'ing a full colorref variable
0x00ffffff with 0x00ff01ff
colorref is stored backwards like:
0x00bbggrr (that has nothing to do with it im just stating that :o\)
what im saying is why not load the image into a paint program and use a colorreplacer, replace all 255,1,255 with 255,255,255
there should only be one transparent color.
the only other option you have (besides writing code to getpixel and setpixel each one if they arent one of those two colors) is to use bitblt and mask the image on. i think it'd be better to do what your doing just change the color on that image though, but if you want.
make a copy of that image in a paint program and set all the areas you DON'T want to be visisble (the transparent areas) to white, all areas that will be visible will be set to black. some paint programs do this for you with a little touchup needed maybe.
that's you mask image, what you do is use bitblt and set that mask image on the hdc first in the same spot as you want the regular image.
BitBlt(hdc,0,0,width,height,maskhdc,0,0,SRCAND);
now you put the regualr one on
BitBlt(hdc,0,0,width,height,reghdc,0,0,SRCPAINT);
all that will show is what was in the black area of the mask image from the regular image, a transparent bitmap.
0
 
LVL 11

Expert Comment

by:bcladd
ID: 9845901
No comment has been added lately, so it's time to clean up this TA. I will
leave a recommendation in the Cleanup topic area that this question is:

Answered: Points to PlanetCpp: Grade A

Please leave any comments here within the next seven days.

Experts: Silence means you don't care. Grading recommendations are made in light
of the posted grading guidlines (http://www.experts-exchange.com/help.jsp#hi73).

PLEASE DO NOT ACCEPT THIS COMMENT AS AN ANSWER!

-bcl (bcladd)
EE Cleanup Volunteer
0

Featured Post

VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

In days of old, returning something by value from a function in C++ was necessarily avoided because it would, invariably, involve one or even two copies of the object being created and potentially costly calls to a copy-constructor and destructor. A…
IntroductionThis article is the second in a three part article series on the Visual Studio 2008 Debugger.  It provides tips in setting and using breakpoints. If not familiar with this debugger, you can find a basic introduction in the EE article loc…
The goal of the tutorial is to teach the user how to use functions in C++. The video will cover how to define functions, how to call functions and how to create functions prototypes. Microsoft Visual C++ 2010 Express will be used as a text editor an…
The viewer will be introduced to the technique of using vectors in C++. The video will cover how to define a vector, store values in the vector and retrieve data from the values stored in the vector.
Suggested Courses
Course of the Month14 days, 9 hours left to enroll

770 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question