<html xmlns:v="urn:schemas-microsoft-com:vml" xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:w="urn:schemas-microsoft-com:office:word" xmlns:m="http://schemas.microsoft.com/office/2004/12/omml" xmlns="http://www.w3.org/TR/REC-html40"><head><meta http-equiv=Content-Type content="text/html; charset=utf-8"><meta name=Generator content="Microsoft Word 12 (filtered medium)"><style><!--
/* Font Definitions */
@font-face
        {font-family:"Cambria Math";
        panose-1:2 4 5 3 5 4 6 3 2 4;}
@font-face
        {font-family:Calibri;
        panose-1:2 15 5 2 2 2 4 3 2 4;}
@font-face
        {font-family:Consolas;
        panose-1:2 11 6 9 2 2 4 3 2 4;}
@font-face
        {font-family:"Segoe UI";
        panose-1:2 11 5 2 4 2 4 2 2 3;}
/* Style Definitions */
p.MsoNormal, li.MsoNormal, div.MsoNormal
        {margin:0cm;
        margin-bottom:.0001pt;
        font-size:12.0pt;
        font-family:"Times New Roman","serif";}
a:link, span.MsoHyperlink
        {mso-style-priority:99;
        color:blue;
        text-decoration:underline;}
a:visited, span.MsoHyperlinkFollowed
        {mso-style-priority:99;
        color:purple;
        text-decoration:underline;}
span.StileMessaggioDiPostaElettronica17
        {mso-style-type:personal-reply;
        font-family:"Calibri","sans-serif";
        color:#1F497D;}
.MsoChpDefault
        {mso-style-type:export-only;}
@page WordSection1
        {size:612.0pt 792.0pt;
        margin:70.85pt 2.0cm 2.0cm 2.0cm;}
div.WordSection1
        {page:WordSection1;}
--></style><!--[if gte mso 9]><xml>
<o:shapedefaults v:ext="edit" spidmax="1026" />
</xml><![endif]--><!--[if gte mso 9]><xml>
<o:shapelayout v:ext="edit">
<o:idmap v:ext="edit" data="1" />
</o:shapelayout></xml><![endif]--></head><body lang=IT link=blue vlink=purple><div class=WordSection1><p class=MsoNormal><span lang=EN-US style='font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D'>Hi Tamas,<o:p></o:p></span></p><p class=MsoNormal><span lang=EN-US style='font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D'>the second way is what I used to do before, when I got a map in BMP format. But now I’m using PNG, so I think there is a performance penalty loading the PNG into a .NET image object, drawing and then reconverting it again to PNG.<o:p></o:p></span></p><p class=MsoNormal><span lang=EN-US style='font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D'><o:p>&nbsp;</o:p></span></p><p class=MsoNormal><span lang=EN-US style='font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D'>So (correct me if I’m wrong), I suppose the first method is better from a performance point of view because it avoids PNG-&gt;BMP-&gt;PNG. I tried it, but I’m probably missing something. This is what I do before the map.Draw():<o:p></o:p></span></p><p class=MsoNormal><span lang=EN-US style='font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D'><o:p>&nbsp;</o:p></span></p><p class=MsoNormal style='text-autospace:none'><span lang=EN-US style='font-size:9.5pt;font-family:Consolas'>            <span style='color:#2B91AF'>layerObj</span> layer = <span style='color:blue'>new</span> <span style='color:#2B91AF'>layerObj</span>(userSesson.oGIS);<o:p></o:p></span></p><p class=MsoNormal style='text-autospace:none'><span lang=EN-US style='font-size:9.5pt;font-family:Consolas'>            layer.name = <span style='color:#A31515'>&quot;COPYRIGHT_LAYER&quot;</span>;<o:p></o:p></span></p><p class=MsoNormal style='text-autospace:none'><span lang=EN-US style='font-size:9.5pt;font-family:Consolas'>            layer.type = <span style='color:#2B91AF'>MS_LAYER_TYPE</span>.MS_LAYER_POLYGON;<o:p></o:p></span></p><p class=MsoNormal style='text-autospace:none'><span lang=EN-US style='font-size:9.5pt;font-family:Consolas'>            layer.setMetaData(<span style='color:#A31515'>&quot;type&quot;</span>, <span style='color:#2B91AF'>Convert</span>.ToString((<span style='color:blue'>int</span>)<span style='color:#2B91AF'>MS_LAYER_TYPE</span>.MS_LAYER_ANNOTATION));<o:p></o:p></span></p><p class=MsoNormal style='text-autospace:none'><span lang=EN-US style='font-size:9.5pt;font-family:Consolas'>            layer.status = <span style='color:#2B91AF'>mapscript</span>.MS_ON;  <o:p></o:p></span></p><p class=MsoNormal style='text-autospace:none'><span lang=EN-US style='font-size:9.5pt;font-family:Consolas'><o:p>&nbsp;</o:p></span></p><p class=MsoNormal style='text-autospace:none'><span lang=EN-US style='font-size:9.5pt;font-family:Consolas'>            <span style='color:#2B91AF'>shapeObj</span> polygon = <span style='color:blue'>new</span> <span style='color:#2B91AF'>shapeObj</span>((<span style='color:blue'>int</span>)<span style='color:#2B91AF'>MS_SHAPE_TYPE</span>.MS_SHAPE_POLYGON);<o:p></o:p></span></p><p class=MsoNormal style='text-autospace:none'><span lang=EN-US style='font-size:9.5pt;font-family:Consolas'>            <span style='color:#2B91AF'>lineObj</span> polyLine = <span style='color:blue'>new</span> <span style='color:#2B91AF'>lineObj</span>(); <o:p></o:p></span></p><p class=MsoNormal style='text-autospace:none'><span lang=EN-US style='font-size:9.5pt;font-family:Consolas'>            polyLine.add(<span style='color:blue'>new</span> <span style='color:#2B91AF'>pointObj</span>(12,42, 0, 0));<o:p></o:p></span></p><p class=MsoNormal style='text-autospace:none'><span lang=EN-US style='font-size:9.5pt;font-family:Consolas'>            polyLine.add(<span style='color:blue'>new</span> <span style='color:#2B91AF'>pointObj</span>(12,43,0,0));<o:p></o:p></span></p><p class=MsoNormal style='text-autospace:none'><span lang=EN-US style='font-size:9.5pt;font-family:Consolas'>            polyLine.add(<span style='color:blue'>new</span> <span style='color:#2B91AF'>pointObj</span>(13,43,0,0));<o:p></o:p></span></p><p class=MsoNormal style='text-autospace:none'><span lang=EN-US style='font-size:9.5pt;font-family:Consolas'>            polyLine.add(<span style='color:blue'>new</span> <span style='color:#2B91AF'>pointObj</span>(13,42,0,0));<o:p></o:p></span></p><p class=MsoNormal style='text-autospace:none'><span lang=EN-US style='font-size:9.5pt;font-family:Consolas'>            polyLine.add(<span style='color:blue'>new</span> <span style='color:#2B91AF'>pointObj</span>(12,42,0,0));<o:p></o:p></span></p><p class=MsoNormal style='text-autospace:none'><span lang=EN-US style='font-size:9.5pt;font-family:Consolas'>            polygon.add(polyLine);<o:p></o:p></span></p><p class=MsoNormal style='text-autospace:none'><span lang=EN-US style='font-size:9.5pt;font-family:Consolas'><o:p>&nbsp;</o:p></span></p><p class=MsoNormal style='text-autospace:none'><span lang=EN-US style='font-size:9.5pt;font-family:Consolas'>            <span style='color:#2B91AF'>classObj</span> aclass = <span style='color:blue'>new</span> <span style='color:#2B91AF'>classObj</span>(layer);<o:p></o:p></span></p><p class=MsoNormal style='text-autospace:none'><span lang=EN-US style='font-size:9.5pt;font-family:Consolas'>            aclass.name = <span style='color:#A31515'>&quot;MyClass&quot;</span>;<o:p></o:p></span></p><p class=MsoNormal style='text-autospace:none'><span lang=EN-US style='font-size:9.5pt;font-family:Consolas'>            aclass.setMetaData(<span style='color:#A31515'>&quot;name&quot;</span>,<span style='color:#A31515'>&quot;MyClass&quot;</span>);<o:p></o:p></span></p><p class=MsoNormal style='text-autospace:none'><span lang=EN-US style='font-size:9.5pt;font-family:Consolas'>            <span style='color:green'>// Create a style object defining how to draw features</span><o:p></o:p></span></p><p class=MsoNormal style='text-autospace:none'><span lang=EN-US style='font-size:9.5pt;font-family:Consolas'>            <span style='color:#2B91AF'>styleObj</span> lineStyle = <span style='color:blue'>new</span> <span style='color:#2B91AF'>styleObj</span>(aclass);<o:p></o:p></span></p><p class=MsoNormal style='text-autospace:none'><span lang=EN-US style='font-size:9.5pt;font-family:Consolas'>            lineStyle.color.setRGB(255,0,0);<o:p></o:p></span></p><p class=MsoNormal style='text-autospace:none'><span lang=EN-US style='font-size:9.5pt;font-family:Consolas'>           <span style='color:green'>// lineStyle.</span><o:p></o:p></span></p><p class=MsoNormal style='text-autospace:none'><span lang=EN-US style='font-size:9.5pt;font-family:Consolas'>            layer.addFeature(polygon);<o:p></o:p></span></p><p class=MsoNormal style='text-autospace:none'><span lang=EN-US style='font-size:9.5pt;font-family:Consolas'><o:p>&nbsp;</o:p></span></p><p class=MsoNormal><span lang=EN-US style='font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D'><o:p>&nbsp;</o:p></span></p><p class=MsoNormal><span lang=EN-US style='font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D'>I should see a red colored rectangle, but I only see the other layers.<o:p></o:p></span></p><p class=MsoNormal><span lang=EN-US style='font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D'> Have you got an example of how to do it?<o:p></o:p></span></p><p class=MsoNormal><span lang=EN-US style='font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D'><o:p>&nbsp;</o:p></span></p><p class=MsoNormal><span lang=EN-US style='font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D'><o:p>&nbsp;</o:p></span></p><p class=MsoNormal><span lang=EN-US style='font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D'>Fabrizio<o:p></o:p></span></p><p class=MsoNormal><span lang=EN-US style='font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D'><o:p>&nbsp;</o:p></span></p><p class=MsoNormal><span lang=EN-US style='font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D'> <o:p></o:p></span></p><p class=MsoNormal><span lang=EN-US style='font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D'><o:p>&nbsp;</o:p></span></p><div style='border:none;border-top:solid #B5C4DF 1.0pt;padding:3.0pt 0cm 0cm 0cm'><p class=MsoNormal><b><span style='font-size:10.0pt;font-family:"Segoe UI","sans-serif"'>Da:</span></b><span style='font-size:10.0pt;font-family:"Segoe UI","sans-serif"'> Tamas Szekeres [mailto:szekerest@gmail.com] <br><b>Inviato:</b> giovedì 27 ottobre 2011 21:37<br><b>A:</b> GMail<br><b>Cc:</b> mapserver-dev@lists.osgeo.org<br><b>Oggetto:</b> Re: [mapserver-dev] Writing text to image after map rendering<o:p></o:p></span></p></div><p class=MsoNormal><o:p>&nbsp;</o:p></p><p class=MsoNormal>Fabrizio,<o:p></o:p></p><div><p class=MsoNormal><o:p>&nbsp;</o:p></p></div><div><p class=MsoNormal>The most reasonable approach is to add a new annotation layer to the mapObj with the desired transform, opacity and postlabelcache setting.<o:p></o:p></p></div><div><p class=MsoNormal><o:p>&nbsp;</o:p></p></div><div><p class=MsoNormal>Alternatively you could load the resulting byte array to a .NET Image object then use GDI+ to draw the text over the image.<o:p></o:p></p></div><div><p class=MsoNormal><o:p>&nbsp;</o:p></p></div><div><p class=MsoNormal>Best regards,<o:p></o:p></p></div><div><p class=MsoNormal><o:p>&nbsp;</o:p></p></div><div><p class=MsoNormal>Tamas<o:p></o:p></p></div><div><p class=MsoNormal>&nbsp;<o:p></o:p></p></div><div><p class=MsoNormal style='margin-bottom:12.0pt'><o:p>&nbsp;</o:p></p><div><p class=MsoNormal>2011/10/26 GMail &lt;<a href="mailto:itacasoft@gmail.com">itacasoft@gmail.com</a>&gt;<o:p></o:p></p><p class=MsoNormal>Hello everybody,<br>I'm using MapScript-C# to render PNG map images and send it to a Silverlight<br>client.<br>Is it possible to write some text (e.g.: copyright information) to the<br>imageObj before to send the image stream to the client? How?<br>Thanks<br><br>Fabrizio<br><br>_______________________________________________<br>mapserver-dev mailing list<br><a href="mailto:mapserver-dev@lists.osgeo.org">mapserver-dev@lists.osgeo.org</a><br><a href="http://lists.osgeo.org/mailman/listinfo/mapserver-dev" target="_blank">http://lists.osgeo.org/mailman/listinfo/mapserver-dev</a><o:p></o:p></p></div><p class=MsoNormal><o:p>&nbsp;</o:p></p></div></div></body></html>