DC_BitmapTransparentColor()

This forum is for eXpress++ general support.
Post Reply
Message
Author
User avatar
unixkd
Posts: 565
Joined: Thu Feb 11, 2010 1:39 pm

DC_BitmapTransparentColor()

#1 Post by unixkd »

Hi Roger/ALL

What value should I set DC_BitmapTransparentColor() to completely remove background around the bitmaps of my application toolbar ?

I sed DC_BitmapTransparentColor(XBPSYSCLR_TRANSPARENT) but some small background still exist around the bitmaps of our application menu

Thanks

Joe

User avatar
Auge_Ohr
Posts: 1405
Joined: Wed Feb 24, 2010 3:44 pm

Re: DC_BitmapTransparentColor()

#2 Post by Auge_Ohr »

have a look at \Source\SYS\axctrls.prg and search for "TransparentColor"

Code: Select all

METHOD XbpToolBar:GetTransparentColor()
METHOD XbpToolBar:SetTransparentColor( Value )
greetings by OHR
Jimmy

User avatar
Tom
Posts: 1165
Joined: Thu Jan 28, 2010 12:59 am
Location: Berlin, Germany

Re: DC_BitmapTransparentColor()

#3 Post by Tom »

Set it to the color you used for the background. For instance, if the background is black, use DC_BitmapTransparentColor( { 0, 0, 0 } ), and if it's white, use DC_BitmapTransparentColor( { 255, 255, 255 } ). All pixels with this color will be transparent if a bitmap is shown. So, white or black may not be good ideas. 8-) Use a color for the bitmap background which is not used elsewhere in the bitmap(s).
Best regards,
Tom

"Did I offend you?"
"No."
"Okay, give me a second chance."

User avatar
unixkd
Posts: 565
Joined: Thu Feb 11, 2010 1:39 pm

Re: DC_BitmapTransparentColor()

#4 Post by unixkd »

Hi Jimmy

I have studied your suggestion but do not know how to apply it to solve my problem

Joe

User avatar
Auge_Ohr
Posts: 1405
Joined: Wed Feb 24, 2010 3:44 pm

Re: DC_BitmapTransparentColor()

#5 Post by Auge_Ohr »

unixkd wrote:I have studied your suggestion but do not know how to apply it to solve my problem
Bitmap does not have Transparency ... only PNG or GIF

as Tom say you can set DC_BitMapTransparentColor() for a Image.
you can change o:transparentClr default GRA_CLR_INVALID when display Image

you have to do it for each Image

---

XbpToolBar() have o:transparentColor, like o:transparentClr, but for all "Additem" or "Image" (read help file)

Code: Select all

     ACCESS METHOD          GetTransparentColor    VAR TransparentColor
     ASSIGN METHOD          SetTransparentColor    VAR TransparentColor

METHOD XbpToolBar:SetTransparentColor( Value )
...
   ::ImageList:MaskColor := Value

METHOD XbpToolBar:GetTransparentColor()
...
   ValuePrev := ::ImageList:MaskColor
it change o:MaskColor of ImageList() for all Image when display.
greetings by OHR
Jimmy

User avatar
Tom
Posts: 1165
Joined: Thu Jan 28, 2010 12:59 am
Location: Berlin, Germany

Re: DC_BitmapTransparentColor()

#6 Post by Tom »

Joe, the bitmaps of your toolbar artwork don't have a background in a technical manner. Bitmaps are just maps of pixels, and those pixels are nothing else but color information for picture points. A 200 x 200 pixel bitmap consists of 40,000 pixels, which are represented by 40,000 numbers for the color of each point of the picture - from left to right and top to bottom. The number is between 0 and 16777216, where 0 is black and 16777216 is white. In Xbase++, this is a little differnent, since the numbers below 16777216 are reserved for constant colors, so the values there are between 16777216 (black) and 33554431 (white). The Xbase++-function GraMakeRGBColor() gives you those numbers for RGB-color-codes like 0,0,0 (black) or 255,255,255 (white) with ? GraMakeRGBColor({0, 0, 0 }) which returns 16777216.

Your bitmaps must have one single color in common for the background area. That means, you may have to fill the backgrounds of all bitmaps with the same color, like maybe black (0, 0, 0). If done so, you can set black to the bitmap transparency color from now on (DC_BitmapTransparentColor({0, 0, 0}). The Xbase++ image processor will remove all pixels having this color code and show the color of the background - the objects behind the bitmaps, maybe of the owner. If black is not the bitmap background, but somewhere else in the bitmaps, those pixels will (also) be transparent. If the transparency color is not in your bitmaps, they will not have any transparency.

Maybe you show some of your bitmaps. A simple painting program with a color picker will help to find the background color.
Best regards,
Tom

"Did I offend you?"
"No."
"Okay, give me a second chance."

Post Reply