[Webinar] Streamline your web hosting managementRegister Today

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 190
  • Last Modified:

Question About TRANSPARENT Bitmaps

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
Snurre
Asked:
Snurre
  • 2
1 Solution
 
PlanetCppCommented:
why would you use more then one? the other color can just be made the transparent color, no?
0
 
SnurreAuthor Commented:
So I coulden't use like COLORREF RGB(255, 255, 255) | RGB(255, 1, 255);

0
 
PlanetCppCommented:
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
 
bcladdCommented:
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

Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now