Click here to Skip to main content
16,018,525 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
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
Posted
Updated 15-Sep-15 23:18pm

1 solution

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
 
Share this answer
 
v3
Comments
Wendelius 19-Sep-15 2:00am    
Really nice!
Sergey Alexandrovich Kryukov 19-Sep-15 2:54am    
Thank you, Mika.
—SA

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900