1
votes

I am currently developing metro apps and I need to write text On images.

I found this http://writeablebitmapex.codeplex.com/

But I am new to XAML and dosent know how to use it specifically. So can anyone say me how do I use it in order to write text on image.

As I have asked this question on MSDN but I have no reply yet.

Edit:

If I use as Muad'Dib I am getting the error as seen in below screenshot:

enter image description here

The Error is: 'Writeable Bitmap Extensions' is ambiguous in the namespace 'System.Windows.Media.Imaging'

1
the WriteableBitmapEx library is also on NuGet - Muad'Dib

1 Answers

0
votes

there is one possible solution in the Discussions area for WriteableBitmapEx

here is the code from that "article":

 public static void DrawText(this WriteableBitmap wBmp,Point at, string text,double fontSize,Color textColor)
    {        
        TextBlock lbl = new TextBlock();
        lbl.Text = text;
        lbl.FontSize = fontSize;
        lbl.Foreground = new SolidColorBrush(textColor);
        WriteableBitmap tBmp = new WriteableBitmap(lbl, null);
        wBmp.Blit(at, tBmp, new Rect(0, 0, tBmp.PixelWidth, tBmp.PixelHeight), Colors.White, System.Windows.Media.Imaging.WriteableBitmapExtensions.BlendMode.Alpha);
    }