Open tbonfort opened 12 years ago
Author: sdlime Date: 2007/07/25 - 05:44 Revision 6387 features a fix that resets the alpha channel for the image after rendering vector or chart layers using AGG. I view this as only temporary but it solves the text rendering issue described by Steve Woodbridge.
I think a more permanent solution involves (from the AGG users list):
| Hi all: I'm using AGG to write to a 32-bit rgba buffer managed by another library. | Is it possible to have AGG render only in the rgb channels and leave the alpha | channel unaltered?
Yes, you just need to use pixfmt_rgb24 pixel format (24-bit values), but in rendering_buffer class set the stride to width * 4 (32-bit values).
From http://www.antigrain.com/doc/basic_renderers/basic_renderers.agdoc.html#toc0001
stride — The “stride” (big step) of the rows measured in objects of type T.
Class rendering_buffer is “typedefed” as row_ptr_cache
Date: 2007/07/25 - 16:57 changeset 7f356a7bb4f661dd38092f8fd0391c3a16e5b353 (7f356a7bb4f661dd38092f8fd0391c3a16e5b353 (r6387)) introduces artifacts in rendering - see attachments pie-7f356a7bb4f661dd38092f8fd0391c3a16e5b353 (7f356a7bb4f661dd38092f8fd0391c3a16e5b353 (r6387)).png and pie-d52f1cc06017745e9f40c7fdcb3aa2d66cee4aef (r6378).png[[BR]] this is drawing a 100-opacity layer over another 100-opacity one
Author: sdlime Date: 2007/07/25 - 21:56 Back to the drawing board on this one. What's funny is that the change is done AFTER the rendering. Do you have a test chart dataset I could have access to?
Steve
Date: 2007/07/27 - 18:26 (please ignore agg2gd.diff forget to check that replace button)[[BR]] included patch to convert alpha values from/to agg and gd. these functions are called before and after a call to a function that uses agg to render on an image
the patch also includes a fix to msImageCopyMergeNoAlpha that takes into account the alpha values of the src image when blending it onto the destination one (the name of the function doesn't really make any sense now):[[BR]]
Author: sdlime Date: 2007/07/27 - 19:59 The msImageCopyMergeNoAlpha() function was added when AGG values were absolutely incompatible with GD so it ignored them altogether. We should compare the patched version with msImageCopyMerge() (also in mapgd.c). It may be that we can combine to one function now.
The patch has been applied (rev. 6408).
Two test cases to try:
Thomas, thanks for all the great work on this!
Steve
Author: sdlime Date: 2007/08/01 - 07:19 I'm going to close this one now. We can open up more specific tickets going forward.
Steve
Date: 2007/08/01 - 14:02 sorry reopening :([[BR]] the gd alpha values are 0 to 127 so that negative colors (i.e. with alpha>127) can be treated as special cases (gdTiled and so on).[[BR]] the msAlphaGD2AGG has calls to gdImageSetPixel which treats these special values. when a gd alpha is transformed to something which hits these values, rendering artifacts appear (see black dots in attached file gd2agg.png)[[BR]]
fix: in mapagg.cpp, in function msAlphaGD2AGG at line 1141, replace[[BR]]
gdImageSetPixel(im->img.gd, x, y, ((c)&0x00FFFFFF)|(alpha<<24));
with
(im->img.gd)->tpixels[y][x] = ((c)&0x00FFFFFF)|(alpha<<24);
Author: dmorissette Date: 2007/08/01 - 15:40 Thomas wanted to make sure that this made it in today's beta2, so I have committed a modified version of his latest patch in 6ac8bc7484d97406c0830219910dceea7671d4d8 (r6433) that uses the gdImageTrueColorPixel() macro instead of accessing tpixels[][] directly.
Marking fixed.
Author: sdlime Date: 2007/08/01 - 16:49 I read the change as switching from the macro to the direct array access. Am I wrong? - Steve
Date: 2007/08/01 - 16:51 gdImageSetPixel isn't a macro
gdImageTrueColorPixel is
Author: sdlime Date: 2007/08/01 - 17:00 I see now. I didn't see any reference to the macro in the bug which is why I got confused... Steve
This issue has been closed due to lack of activity. This doesn't mean the issue is invalid, it simply got no attention within the last year. Please reopen if still valid.
Reporter: sdlime Date: 2007/07/25 - 05:40 AGG and GD, it turns out, interpret alpha channel values totally opposite one another. AGG does it correctly, while GD is backwards (and uses a 128 value range for some reason).
We need to work around this limitation.