Bug 47675

Summary: Wrong shadow color for Shape
Product: POI Reporter: Jie Han <jie.han>
Component: HSLFAssignee: POI Developers List <dev>
Status: RESOLVED INVALID    
Severity: major CC: jie.han
Priority: P2    
Version: 3.5-dev   
Target Milestone: ---   
Hardware: PC   
OS: Windows XP   

Description Jie Han 2009-08-11 08:51:32 UTC
I use "shape.getEscherProperty(EscherProperties.SHADOWSTYLE__COLOR)" to get the shadow color but the result seems wrong.

//////////////////////////////////////
v = shape.getEscherProperty(EscherProperties.SHADOWSTYLE__COLOR)";
Color color = new Color(v);
//////////////////////////////////////

and then print out the rgb value.
Comment 1 Yegor Kozlov 2009-09-07 09:56:11 UTC
Creating AWT Color from Escher properties is a bit more complicated. The correct code is below.

int val = shape.getEscherProperty(EscherProperties.SHADOWSTYLE__COLOR)";
int opc = shape.getEscherProperty(EscherProperties.SHADOWSTYLE__OPACITY)";
int alpha =  opc == 0 ? 255 : ((opc >> 8) & 0xFF);

Color color = shape.getColor(rgb, alpha);

Yegor