A…………g…………a…………i…………n

解决方案 »

  1.   

    <html xmlns:v="urn:schemas-microsoft-com:vml">
    <head>
    <meta http-equiv="Content-Type" content="text/html;charset=utf-8" />
    <style>
    v\:*{Behavior:url(#default#VML)}
    </style>
    <script language="javascript">
    window.onload = function(){
    document.getElementById("line01").innerHTML = drowLine("100,200 150,50 200,330 250 79 500,240");
    }
    function drowLine(linePoints){
    var str = "<v:PolyLine filled='false' style='z-index:1' strokeColor='#0066CC' strokeWeight='2px' ";
    str += "Points='"+linePoints+"' />";
    return str;
    }
    </script>
    </head>
    <body>
    <v:group ID="group1" style="position:relative;WIDTH:800px;HEIGHT:400px;" coordsize = "800,400">
    <div id="line01"></div>
    </v:group>
    </body>
    </html>
      

  2.   

    51就是无忧,国内最好的JS社区我写的不是什么东西,是一个简单的用VML在网页上画线的实例。
      

  3.   

    加文字之类的实际上是在客户端的一个区域内,实现假定编辑,然后用xmlhttprequest把文字提交到服务器端用graphic组件,根据提交来的数据来生成,现在流行的语言都有这种组件。比如.net就有这种组件。
      

  4.   

    我的思路就是在客户端实现假编辑,然后再将编辑得到的坐标等参数传递到服务器端由图像处理程序来完成合成、叠加一类的操作,目前正在尝试中。至于图片上面写字到底该怎么处理还没有想到,谢谢BlueDestiny提供思路,就是不知道java有没有组件可用。
    还有,在上面画线该怎么搞啊?netWild说的用VML在网页上画线我还是不是很懂,有什么资料可以参考吗?
      

  5.   

    VML是客户端生成网页的,与实质上的图像无关,但可以作为用户假定编辑用。
    生成文字也很简单的,查询API后,调试不久就会有收获,以下是生成文字用。C# code string sFontColor = dd_fontcolor.SelectedItem.Text;
    string sFontFamily = dd_fontsize.SelectedItem.Text;
    string sBgColor = dd_bgcolor.SelectedItem.Text;
    string sText = tb_text.Text;
    string sFontSize = dd_fontsize.SelectedItem.Text;

    #region 生成图片代码
    Bitmap bmp = null; Graphics grc = null;
    try 
    {
    // 首先填充一个1*1像素的图,计算高度和宽度
    int nFontSize = 10;
    try 
    {
    nFontSize = Int32.Parse(sFontSize);
    }catch{}
    Font font = new Font(sFontFamily, nFontSize);
    bmp = new Bitmap(1,1, PixelFormat.Format32bppArgb);
    grc = Graphics.FromImage(bmp);
    SizeF szf = grc.MeasureString(sText, font);
    Color clr_bg = ColorTranslator.FromHtml(sBgColor);
    Color clr_tx = ColorTranslator.FromHtml(sFontColor); int width = (int)szf.Width;
    int height = (int)szf.Height;
    // 释放资源
    grc.Dispose(); bmp.Dispose(); bmp = new Bitmap(width, height, PixelFormat.Format32bppArgb);
    grc = Graphics.FromImage(bmp);
    grc.FillRectangle(new SolidBrush(clr_bg), new Rectangle(0,0,width,height));
    grc.DrawString(sText, font, new SolidBrush(clr_tx), 0, 0);
    MemoryStream temp = new MemoryStream();
    bmp.Save(temp, ImageFormat.Png);
    Response.BinaryWrite(temp.ToArray());

    catch(Exception ex) 
    {
    Response.Write(ex.ToString());

    finally 
    {
    if (grc!=null) grc.Dispose();
    if (bmp!=null) bmp.Dispose();
    }
    #endregion
    }
    }
      

  6.   

    感谢BlueDestiny提供代码!
    目前尝试中!