make button glyph have a transparent background in delphi 7? - delphi

I have four TSpeedButton objects, each with a BMP file assigned as a glyph for the button image. For whatever reason, delphi has decided that two of the button images should have a transparent background and two should have a white background. I created the bitmaps myself, so they are all saved at the same color depth and are using pure white (not some shade of almost white) for the background and have background color in all four corner pixels of the image.
Why would some of the glyph images show up with a transparent background and some not? What is the criterion for making the background transparent? How can I make my button images all have transparent backgrounds instead of half of them having transparent backgrounds?

Ken's comment
Delphi's glyph handling uses the pixel in the lower-left corner to determine the transparent color. All pixels that match that color should be shown as transparent. Does the lower-left pixel color match in all of the glyphs, and does it match the areas you want to be transparent? (Without the images, it's hard to tell what the problem is, but I thought I'd post this as a potential for investigation.)
appeared to hold the correct answer (sorry, can't accept a comment as the right answer!). The image I was using had a shadow reaching to the lower left corner so it was almost white in that corner and exactly white in all the other corners.

I had a similar problem with D5 and I cludged a fix for this as I never found out why it was happening.
Define the image size one Row taller than the actual image/glyph is. This will force the image to be written starting at the top left and stop just before the last row. That will force the use of a non-transparent color and the extra row below the image is not visually noticeable.

Related

For a white & transparent UIView, make just the white darker

Imagine you have Icon:UIView which is mainly transparent, but there is some pure white drawing or pixels (say an icon of a "arrow").
Icon sits on top of other material (a photo - whatever)
You want to class Darken:Icon
You want it so that in Darken, quite simply, the arrow is the same but a bit darker - a gray.
(And to be clear, the photo behind, the superview, is totally unaffected. All that changes is the white lines of the "arrow" become gray. The transparent parts of Icon are totally unaffected.)
Obviously you could do this by modifying the code in Icon (of just changing the PNG, if the case) but you don't want to, you want "Darken" to be able to darken any other UIView.
How to do?
I think it's done by adding a CALayer, but I am damned if I can figure out wtah the blend mode (or other issue) would be ..... how to?

GIMP: Setting entire foreground to a particular colour

In GIMP version 2.8, I have an image with a black foreground, and a transparent background. I want to set the entire foreground to red, instead of black. What's the simplest way of doing this?
I have tried using the fuzzy select tool and doing a bucket fill on the selection, but this doesn't seem to select the entire foreground. After the bucket fill, there is still a black line around the edge of the foreground image. So it seems that the fuzzy selector didn't select the entire foreground. On closer inspection, the edges of the foreground are not perfectly black, but have some grey pixels. But when using the fuzzy selection, I set a very high threshold (250), so I would have thought this this would select the entire foreground, including the grey pixels.
Any help? Thanks!
The gray pixels aren't grey, they are partially transparent black pixels. If you replace black, you want to keep that partial transparency because this is what gives smooth edges. And there is an easy solution:
Set the alpha-lock of the layer (this is the checkerboard icon at the top of the Layers list) (or in code: gimp-layer-set-lock-alpha)
Do not use selection.
Bucket-fill the layer with the required color. The alpha-lock will preserve the opacity of the pixels.

Stretch image border uniformly and leave center of image unstretched on iOS

Is it possible to achieve the same thing on iOS as on Android with this 9-patch file?
Result should be something like this. The flower is something on the background. Then I want to apply the gray overlay with transparent (see through, not stretched) logo in the center.
(the file is not a valid 9-patch, because of wider patch areas, but that is only for question clarity)
So basically I'd like to overlay the screen with this semi-transparent gray color and in the center would be unstretched logo - kind of cut-off from the overlay. (Notice that logo in image is completely transparent)
I tried to use image slices, but I can't define multiple slices per dimension, so just one border is resizing.
I'd like to avoid tile-ing the background from multiple views.

Delphi TBitBtn white layer

How can I get rid of the white layer drawn under the bitmap images by Delphi/Windows when Glyph property of TBitBtn is used. I just want to draw the image, no shadow under it, no other layers that comes automatically. I am inserting round shaped 24 bit bitmap images.
Since you have a 24-bit bitmap, there is no alpha transparency, so Delphi uses the bottom left pixel of the image to determine the transparent color. All pixels with that color are treated as transparent. The part of the image with the shadow effect is not an exact match for the designated transparent color, so those pixels are painted normally, just like the rest of the image.
The shadow appears white because there was a white background in the graphic program when your designer applied the shadow effect.
Either edit the image to remove the shadow, or use a 32-bit image with alpha transparency. You'll be hard-pressed to apply alpha transparency after the fact. Fix the source image.

Remove Transparency From Glyph.Data in SpeedButtons

I have an old app (Delphi 5) which I want to give it some changes.
I have set a Glyph.Data for a speedbutton, but some colors are transparent and in some places I see small white dots on my image, I do not want to set transparency for the image, How to remove it (transparency)?
Any help is really appreciated.
Thanks :)
The transparency is a color that is not drawn.
You just have to change the image or set another color as the transparent one.
From Delphi 6 Help
Transparent color
Use the Transparent color drop-down to
specify which color is used to create
a mask for drawing the image
transparently. The default transparent
color is the color of the bitmap's
left-most pixel in the bottom line.
You can also change the transparent
color by clicking directly on a pixel
in the selected image.
When an image has a transparent color,
any pixels in the image of that color
are not rendered in that color, but
instead appear transparent, allowing
whatever is behind the image to show
through.
If the image is an icon, Transparent
color appears grayed and the
transparent color is set to clNone.
This is because icons are already
masked.
Set TSpeedButton.Transparent to False.
I have found the answer, Delphi thinks the transparent color is the color of most left - bottom pixel of this image. So If I set a color which is not used in my image in the most left-bottom of my image, then Delphi only will make that small pixel transparent and other parts of my image will be OK without transparency, So this post is completed by myself :))

Resources