Hello, I need a linear gradient paint where the color interpolation is gamma corrected. Ideally the gamma exponent/function could be specified. The GradientPaint javadocs strangely don't specify how the colors are interpolated, but from visual inspection they are not gamma corrected. You can see an example of what I'm talking about here (GDI+ reference):
http://msdn.microsoft.com/library/en-us/gdicpp/GDIPlus/usingGDIPlus/fillingshapeswithagradientbrush/applyinggammacorrectiontoagradient.asp I've tried to emulate this by rendering to a BufferedImage and then post-processing the result. Because the end-points are required to be the exact colors specified, they must be run backwards through the gamma function before drawing the gradient. Due to the nature of a gamma function this can end up reducing the range across which the gradient is produced, which produces visible banding in the final image. The only solutions I can think of are to use a temporary image with 16-bit samples, or implement my own GradientPaint, neither of which is very appealing. This is for a pure-Java library that displays PowerPoint slides, so I actually do need to emulate the GDI+ behavior. Although IMHO gamma-corrected interpolation looks better anyway. On another note, about a quarter of our *total* CPU time is spent in LineBreakMeasurer.nextLayout. From profiling it spends about half of that time in sun.font.FileFont.getGlyphMetrics(long, int, Point2D$Float). I haven't been able to find any applicable bug reports. Any tips here would be appreciated. Thanks, Chris =========================================================================== To unsubscribe, send email to [EMAIL PROTECTED] and include in the body of the message "signoff JAVA2D-INTEREST". For general help, send email to [EMAIL PROTECTED] and include in the body of the message "help".
