Page 1 of 1

DC_BitmapTransparentColor()

Posted: Fri Jun 07, 2019 2:40 pm
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

Re: DC_BitmapTransparentColor()

Posted: Fri Jun 07, 2019 4:55 pm
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 )

Re: DC_BitmapTransparentColor()

Posted: Sat Jun 08, 2019 5:15 am
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).

Re: DC_BitmapTransparentColor()

Posted: Sun Jun 09, 2019 8:36 am
by unixkd
Hi Jimmy

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

Joe

Re: DC_BitmapTransparentColor()

Posted: Sun Jun 09, 2019 2:23 pm
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.

Re: DC_BitmapTransparentColor()

Posted: Mon Jun 10, 2019 5:56 am
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.