amiga-mui / thebar

Next generation MUI buttons bar custom class (TheBar.mcc) which provides application programmers with an advanced, high-level Toolbar-alike class.
GNU Lesser General Public License v2.1
12 stars 3 forks source link

Improve graying out algorithm for toolbars with no explicit disabled images #5

Closed afalkenhahn closed 8 years ago

afalkenhahn commented 8 years ago

When creating a toolbar which doesn't specify separate images for disabled buttons, the standard "graying out" algorithm used by TheBar doesn't look so attractive. See here:

os4

IMHO it would be nicer to use a different algorithm that converts the icon to grayscale or something like that. The current algorithm doesn't look so nice for alphachannel images. It was probably designed for palette based graphics.

tboeckel commented 8 years ago

Can you provide a suitable algorithm for this purpose? The current implementation is the original one done by Alfonso Ranieri. But I doubt that a specific algorithm can produce a better result for arbitrary images. Specially designed ghosted images will always look far better than algorithmically computed ones. All an algorithm can do is to apply a specific generic effect. But there is no guarantee that this effect produces perfectly matching ghosted images for arbitrary normal images. If you want a perfect match then you need to provide all images.

afalkenhahn commented 8 years ago

If you have the ARGB data, it's really simple to make disabled images. You could just mix 50% white into the data, or 50% black or convert the color channels to grey and then darken it a little. Here is a case study quickly made in Hollywood:

study

I think each of the three looks better than the current algorithm. Of course, there is no perfect algorithm, e.g. the algorithms based on blackening won't look significantly different from toolbar images which are already mostly grey while the whitening one won't look so good on images which are mostly white.

There is no perfect generic solution so people who really care should use custom images for the disabled state. Still, I think that the current algorithm is really ugly and should use an enhancement, e.g. one from the ones presented above or your custom idea...

afalkenhahn commented 8 years ago

By the way: Why not just use MUI's inbuilt graying algorithm? This would probably be the best solution because it's consistent with MUI. When disabling a button that has an image in it, MUI also uses some sort of graying out algorithm. This algorithm could be used by TheBar for disabling images as well.

tboeckel commented 8 years ago

MUI just draws a grey rectangle with transparency across the complete rectangular area. This is definitely something different to the current approach where the manipulation is applied to visible pixels only. But now that I come to think more about this the latter wouldn't be a real problem, because an additional grey shade has no influence on fully transparent pixels. The only problem are colormapped screens, as this effect works on truecolor screens only.

tboeckel commented 8 years ago

Test binaries with new disabled/ghosting style. Please keep in mind that you might need to adjust your settings for the disabled button mode to "Grey" instead of "Shape", otherwise you won't see any difference. Please let me know whether this fullfils your expectations of "not ugly".

thebar_ghost_mos.zip thebar_ghost_os3.zip thebar_ghost_os4.zip

afalkenhahn commented 8 years ago

Yes, this looks much better. Problem solved, thanks!