Bugzilla – Bug 324503
Alpha values in TextureBrush'es are incorrectly used
Last modified: 2007-09-15 21:24:06 UTC
---- Reported by doc.formatique@gmail.com 2007-06-07 12:00:00 MST ---- Description of Problem: Alpha values in TextureBrush'es are incorrectly used. Steps to reproduce the problem: 1. Draw a solid background. 2. Draw a white rectangle with alpha: g.FillRectangle(new SolidBrush(Color.FromArgb(128, 255, 255, 255)), ...) 3. Draw another rectangle with a TextureBrush generated from a bitmap identically filled: Bitmap bm_for_brush = new Bitmap(1, 1); bm_for_brush.SetPixel(0, 0, Color.FromArgb(128, 255, 255, 255)); TextureBrush tb = new TextureBrush(bm_for_brush); g.FillRectangle(tb, ...); Actual Results: The colors are different. Expected Results: The colors should be the same. Additional Information: Isn't this a missing-alpha-pre-multiply bug (like #80323 and #79297)? Tracing the program, _cairo_pixman_composite_src_8888x8888mmx receives *src=0x80ffffff while the equivalent pycairo program passes 0x80808080 ---- Additional Comments From doc.formatique@gmail.com 2007-06-07 12:01:39 MST ---- Created an attachment (id=172114) C# program exhibiting the bug ---- Additional Comments From sebastien@ximian.com 2007-07-06 09:34:32 MST ---- Yes, it's a (lack of) premultiplication bug. It's easy to fix in texture brush but that seems like the wrong place to make that fix. Generalizing the fix (gdip_bitmap_ensure_surface seems the right candidate) is not much harder but will require much more test (and will have to wait after my vacations). ---- Additional Comments From sebastien@ximian.com 2007-07-06 16:51:00 MST ---- Created an attachment (id=172115) patch ---- Additional Comments From sebastien@ximian.com 2007-07-06 16:54:02 MST ---- Attached is an incomplete(*) patch that fix the issue without regression in the test suite. More testing is required before committing it into SVN (but that'll be later). (*) it only handles WrapModeTile, not the other modes (but that's not the problematic part ;-) ---- Additional Comments From sebastien@ximian.com 2007-07-30 12:15:18 MST ---- Fixed in SVN r82997. Unit tests in r82999. Note that this fix will not be part of the upcoming Mono 1.2.5 because it needs some "in the wild" testing to ensure no regression has occurred. Imported an attachment (id=172114) Imported an attachment (id=172115)