Jump to content
  • Advertisement
Sign in to follow this  
flashinpan

SharpDX and image annotation?

This topic is 2263 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Does anyone know how you would do simple text annotation using "SharpDX" library (for C#)?


Here is how GDI+ does it currently in my app (in particular, the bold red lines are of interest):


using (Graphics g = Graphics.FromImage(bm))
using (SolidBrush solidWhiteBrush = new SolidBrush(Color.White))
using (SolidBrush solidBlackBrush = new SolidBrush(Color.Black))
{
// Write out annotation text



[color=#ff0000] g.FillRectangle(solidWhiteBrush, 0, 0, bm.Width, bm.Height);
[color=#ff0000] g.DrawString(AnnotationText, AnnotationFont, solidBlackBrush, new PointF(7f, 2f));


Thank you for sample code showing how this would be done using SharpDX! :)

Tom

Share this post


Link to post
Share on other sites
Advertisement

Does anyone know how you would do simple text annotation using "SharpDX" library (for C#)?

You would have to use DirectWrite, Direct2D and WIC to do that, but that's lots of low level code... I advice you to stick with System.Drawing code unless you have others requirements...

Share this post


Link to post
Share on other sites
We're trying to increase the speed of the annotation. It has been using GDI+. It seems the next gen technology is Direct2D and that the C# version is a wrapper named SharpDX.

Would it really take that much code to do what GDI+ is able to do in 2 lines? I'm not familiar with SharpDX, so I'm asking. :)

Share this post


Link to post
Share on other sites

Would it really take that much code to do what GDI+ is able to do in 2 lines?

Yes. But with all the samples in SharpDX already using DirectWrite, Direct2D1 and WIC and the samples from msdn + doc, you should be able to do it. This would be a simple exercise, but as I said, more verbose, as you have 3 low-level APIs to play with it.

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

Participate in the game development conversation and more when you create an account on GameDev.net!

Sign me up!