如何在图像上写圆形文字 [英] how can write text in round shape on image

查看:101
本文介绍了如何在图像上写圆形文字的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

大家好,



Thanx上次更新,今天我有另外一个问题,我怎么能在圆形图像上写一些文字,



任何帮助



Aditya tyagi

Hi All,

Thanx for last update , today i have another question how i can write some text on image in round shape ,

any help

Aditya tyagi

推荐答案

图形可以在客户端或服务器端生成。一种客户端方式是使用HTML5 Canvas元素, http://en.wikipedia.org/wiki/Html5_canvas [< a href =http://en.wikipedia.org/wiki/Html5_canvastarget =_ blanktitle =New Window> ^ ]。

这是一些工作代码示例: http://jsfiddle.net/rbdszxjv [ ^ ]。



另一种方法是生成SVG,顺便提一下,HTML5本身支持:

https://developer.mozilla.org/en -US / docs / Web / SVG / Element / textPath [ ^ ],

http://bl.ocks .org / jebeck / 196406a3486985d2b92e [ ^ ]。



参见:

https://en.wikipedia.org/wiki/HTML5 [ ^ ],

https://en.wikipedia.org/wiki/Scalable_Vector_Graphics [ ^ ]。




或者,您可以动态生成服务器端的位图图像,并通过HTTP响应将其发回客户端可以在< img> 元素中呈现它。这就是我所说的在服务器端渲染。



这将是一个低质量的解决方案,因为位图图像不是很好的可扩展性,所以他们赢了在嵌入式浏览器的缩放上行为正常,因为它会很慢,特别是如果你想通过多次回发将其缩放回来。



无论如何,如果你想要这样,这是一个基本的代码示例: http ://stackoverflow.com/questions/2803853/how-can-i-render-curved-text-into-a-bitmap [ ^ ]。



除此之外,您还需要知道如何在位图上渲染它。



创建类型系统的空位图.Drawing.Bitmap 所需大小,然后创建 System.Drawing.Graphi的实例cs 用于绘制位图实例;然后使用上面引用的代码示例中显示的方式使用 Graphics 的这个实例进行绘制。请参阅:

https ://msdn.microsoft.com/en-us/library/system.drawing.bitmap%28v=vs.110%29.aspx [ ^ ],

< a href =https://msdn.microsoft.com/en-us/library/system.drawing.graphics.fromimage%28v=vs.110%29.aspx> https://msdn.microsoft.com/en -us / library / system.drawing.graphics.fromimage%28v = vs.110%29.aspx [ ^ ]。



-SA
The graphics can be generated either on client side or server side. One client-side way is using HTML5 Canvas element, http://en.wikipedia.org/wiki/Html5_canvas[^].
This is some working code sample: http://jsfiddle.net/rbdszxjv[^].

Another approach would be generating SVG, which, by the way, is supported in HTML5 natively:
https://developer.mozilla.org/en-US/docs/Web/SVG/Element/textPath[^],
http://bl.ocks.org/jebeck/196406a3486985d2b92e[^].

See also:
https://en.wikipedia.org/wiki/HTML5[^],
https://en.wikipedia.org/wiki/Scalable_Vector_Graphics[^].


Alternatively, you could generate just the bitmap image on server side on the fly and send it back in HTTP response to the client side where it can be rendered in an <img> element. This is what I mean by "rendering on the server side".

It would be a low-quality solution, because bitmap images are not nicely scalable, so they won't behave properly on embedded browser's zoom, and because it will be slow, especially if you want to zoom it back in force through multiple postbacks.

Anyway, if you want to go this way, this is a basic code sample: http://stackoverflow.com/questions/2803853/how-can-i-render-curved-text-into-a-bitmap[^].

In addition to that, you need to know how to render it on a bitmap.

Create an empty bitmap of the type System.Drawing.Bitmap of required size and then create an instance of System.Drawing.Graphics used to draw on an instance of bitmap; then draw using this instance of Graphics the way shown in the code sample referenced above. Please see:
https://msdn.microsoft.com/en-us/library/system.drawing.bitmap%28v=vs.110%29.aspx[^],
https://msdn.microsoft.com/en-us/library/system.drawing.graphics.fromimage%28v=vs.110%29.aspx[^].

—SA


这篇关于如何在图像上写圆形文字的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆