SharpDX and image annotation?

Started by
2 comments, last by AlexandreMutel 12 years ago
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
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...
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. :)

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.

This topic is closed to new replies.

Advertisement