[Mono-bugs] [Bug 473660] Disabled button images don't look the same as .NET (grayscale / greyed out)

bugzilla_noreply at novell.com bugzilla_noreply at novell.com
Sun May 17 09:11:44 EDT 2009


User stifu at free.fr added comment

--- Comment #2 from Thomas Goldstein <stifu at free.fr>  2009-05-17 07:11:42 MDT ---
Created an attachment (id=292646)
 --> (http://bugzilla.novell.com/attachment.cgi?id=292646)
Patch that makes Mono's behavior closer to .NET's

I had a good look at this, and I now have a patch to propose.
This isn't a pixel perfect match with .NET, but it's very close (if anyone
wants to try to make it match .NET perfectly, I've made a little solution that
checks if each pixel matches, if you'd like. Let me know).

My changes (to

- A different grayscale_matrix, to match .NET more closely (also removing old
commented code which simply produced a darker grayscale image)
- A different Bitmap creation in CreateDisabledImage. We used to create a new
Bitmap from the original Bitmap (Bitmap b = new Bitmap(normalImage)), then draw
on it. Now we create a blank Bitmap (Bitmap b = new Bitmap(normalImage.Width,
normalImage.Height)), then draw on it. This has 2 consequences: this lets us
make the disabled image 30% transparent rather than fully opaque (just like
NET does) when applying the new matrix, and it also improves perfs a tiny bit
(on my computer, through 10000 iterations through CreateDisabledImage, the old
version consistently takes just below 54 seconds, while the new version takes
just over 51 seconds).

This is my first patch (yay!), let me know if I'm doing it right.

Configure bugmail: http://bugzilla.novell.com/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the QA contact for the bug.
You are the assignee for the bug.

More information about the mono-bugs mailing list