Opened 14 years ago

Closed 14 years ago

#2137 closed defect (fixed)

support shadowcolor for labels

Reported by: assefa Owned by: assefa
Priority: normal Milestone: 5.0 release
Component: Output-SWF Version:
Severity: normal Keywords:
Cc: laurent


e-mail from laurent.baey@…

I wanted some fancy outline on labels in my swfs like in my png output, but i wasn't able to do so, neither was I able to set a background on the labels. If anyone knows a way, please give me a lead I'd be happy to do it... anyway, I ended adding a shadow of size 1 on labels where a shadowcolor is set in the mapfile.

If anyone is interested... maybe some comments, to fit the code better in mapserver source. thank you all here follows the diff from my mapswf.c

Laurent (a french guy trying to write english)


colorObj sShadowColor;


SWFText oShadowText = NULL;


int drawShadow = 0; /* flag : do we need to draw shadow or not */

2076a2080,2082 = 0; = 0; = 0;

2090,2095d2095 < else if (MS_VALID_COLOR(label->shadowcolor)) < { < = label->; < = label->; < = label->; < } 2100a2101,2109

/* check if a shadow color was defined */ if (MS_VALID_COLOR(label->shadowcolor)) { = label->; = label->; = label->; then draw one drawShadow = 1;



/* first draw the shadow with a x+1,y+1 position */ if (drawShadow) { oShadowText = DrawText?(string, 0, 0, msBuildPath(szPath, fontset->filename, font), size, &sShadowColor);

if (oShadowText) {

SWFDisplayItem oShadowDisplay; /* nTmp = ((SWFObj *)image->img.swf)->nCurrentMovie; */ oShadowDisplay = SWFMovie_add(GetCurrentMovie?(map, image), oShadowText); SWFDisplayItem_moveTo(oShadowDisplay, (float)x + 1, (float)y + 1); SWFDisplayItem_rotate(oShadowDisplay, (float)label->angle);


} /* then draw the text */

2111c2134 < SWFDisplayItem oDisplay; ---

SWFDisplayItem oDisplay;

2117d2139 <

Change History (5)

comment:1 Changed 14 years ago by assefa

Owner: changed from mapserverbugs to assefa
Status: newassigned

comment:2 Changed 14 years ago by assefa

I like the change about the shadow color. I did add the patch to see the effects and it seems nice. If there is no other suggestion/comments, I will commit the patch.

comment:3 Changed 14 years ago by laurent

Cc: laurent added

comment:4 Changed 14 years ago by laurent

Thank you
I tested the shadowsizex and shadowsizey and I think the line 2126 can safely become :

SWFDisplayItem_moveTo(oShadowDisplay, (float)x + label->shadowsizex, (float)y + label->shadowsizey);
(with the appropriate comment above it)
it works quite well for me.
if shadowcolor is defined, but shadowsize is not defined, the shadow is drawed x+1,y+1
if both are defined, the shadowsize is taken into account this way.
(same behaviour as GD output)

do you need a diff ?

comment:5 Changed 14 years ago by assefa

Resolution: fixed
Status: assignedclosed

Thanks Laurent, I have commited the chaned in r6259. Closing the bug.

Note: See TracTickets for help on using tickets.