Board index » delphi » Image, Hot Image and Disabled Image

Image, Hot Image and Disabled Image

Hi

I've made a button that have 3 different Glyph properties, kind of like a
TToolButton can have via a TToolbar: One normal image, one hot image that is
displayed when the mouse cursor is over the button and one disabled image
that is shown when the button is disabled. What I would like to do is to
just have one property instead of three using just the color bitmap and then
use some algorithms to render the other two. Something like using black &
white for the normal image  and some filter for the disabled image. It would
be great if I could create and maintain just one instead of 3 different
bitmaps for every button i put on my forms.

Does anyone of you graphical wizards have any ideas about how such things
should be done?

;-) Regards LuKa

 

Re:Image, Hot Image and Disabled Image


Quote
"LuKa" <l...@multi.fi> wrote in message

news:8fbvdo$28l6@bornews.borland.com...

Quote
> Something like using black &
> white for the normal image

You could use shades of gray by computing the intensity of each pixel from
the
color RGB components:  I = (R + G + B)/3.  When you compute Intensity,
replace
the R, G and B in the new image with the value of I.  More elaborate ways
could be used to compute the brightness, but intensity will be very quick
and
easy and effective.

Quote
> and some filter for the disabled image.

This isn't a complete answer, but might give you some ideas.

Many disabled images have just outlines of the original icons.  I've never
got around to putting the "Image Filters" Lab Report on my site, but
I have played around with some image filters.  "Laplace filters" might
be good for detecting edges:

0  1  0
1 -4 1
0  1  0

or

-1 -1 -1
-1  8 -1
-1 -1 -1

or

 1 -2  1
-2  4 -2
 1 -2  1

There are numerous filters like these and some work better than others
on any given image.

In such a 3-by-3 convolution kernel, the center pixel is weighted the most
with smaller weights given to neighbors.  You could apply such a filter
to the shades of gray image, and then perhaps use a threshold value
that would force all pixels to be one of two colors.

--
efg

Earl F. Glynn     E-mail:  EarlGl...@att.net
Overland Park, KS  USA

efg's Computer Lab:  http://www.efg2.com/Lab

Other Threads