Opened 17 years ago
Closed 17 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 |
Description
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)
2017a2018
colorObj sShadowColor;
2019a2021
SWFText oShadowText = NULL;
2020a2023
int drawShadow = 0; /* flag : do we need to draw shadow or not */
2076a2080,2082
sShadowColor.red = 0; sShadowColor.green = 0; sShadowColor.blue = 0;
2090,2095d2095 < else if (MS_VALID_COLOR(label->shadowcolor)) < { < sColor.red = label->shadowcolor.red; < sColor.green = label->shadowcolor.green; < sColor.blue = label->shadowcolor.blue; < } 2100a2101,2109
/* check if a shadow color was defined */ if (MS_VALID_COLOR(label->shadowcolor)) {
sShadowColor.red = label->shadowcolor.red; sShadowColor.green = label->shadowcolor.green; sShadowColor.blue = label->shadowcolor.blue; then draw one drawShadow = 1;
}
2107a2117,2130
/* 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 by , 17 years ago
Owner: | changed from | to
---|---|
Status: | new → assigned |
comment:2 by , 17 years ago
comment:3 by , 17 years ago
Cc: | added |
---|
comment:4 by , 17 years ago
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 by , 17 years ago
Resolution: | → fixed |
---|---|
Status: | assigned → closed |
Thanks Laurent, I have commited the chaned in r6259. Closing the bug.
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.