writeablebitmap

How to create WriteableBitmap from BitmapImage?

十年热恋 提交于 2019-12-18 06:13:38
问题 I could create WriteableBitmap from pictures in Assets. Uri imageUri1 = new Uri("ms-appx:///Assets/sample1.jpg"); WriteableBitmap writeableBmp = await new WriteableBitmap(1, 1).FromContent(imageUri1); but, I can't create WriteableBitmap from Pictures Directory,(I'm using WinRT XAML Toolkit) //open image StorageFolder picturesFolder = KnownFolders.PicturesLibrary; StorageFile file = await picturesFolder.GetFileAsync("sample2.jpg"); var stream = await file.OpenReadAsync(); //create bitmap

How can I render text on a WriteableBitmap on a background thread, in Windows Phone 7?

試著忘記壹切 提交于 2019-12-17 17:41:33
问题 I am trying to render text on a bitmap in a Windows Phone 7 application. Code that looks more or less like the following would work fine when it's running on the main thread: public ImageSource RenderText(string text, double x, double y) { var canvas = new Canvas(); var textBlock = new TextBlock { Text = text }; canvas.Children.Add(textBloxk); Canvas.SetLeft(textBlock, x); Canvas.SetTop(textBlock, y); var bitmap = new WriteableBitmap(400, 400); bitmap.Render(canvas, null); bitmap.Invalidate()

How can I render text on a WriteableBitmap on a background thread, in Windows Phone 7?

两盒软妹~` 提交于 2019-12-17 17:41:11
问题 I am trying to render text on a bitmap in a Windows Phone 7 application. Code that looks more or less like the following would work fine when it's running on the main thread: public ImageSource RenderText(string text, double x, double y) { var canvas = new Canvas(); var textBlock = new TextBlock { Text = text }; canvas.Children.Add(textBloxk); Canvas.SetLeft(textBlock, x); Canvas.SetTop(textBlock, y); var bitmap = new WriteableBitmap(400, 400); bitmap.Render(canvas, null); bitmap.Invalidate()

WP8.1 C# Windows Phone 8.1 Background Task WriteableBitmap Thread Error

佐手、 提交于 2019-12-16 18:04:47
问题 I am trying to update the band Me Tile image from a background task and i get the following error at WriteableBitmap: System.Exception: The application called an interface that was marshalled for a different thread. (Exception from HRESULT: 0x8001010E (RPC_E_WRONG_THREAD)) at Windows.UI.Xaml.Media.Imaging.WriteableBitmap..ctor(Int32 pixelWidth, Int32 pixelHeight) at BackgroundTaskCS.UpdateBandTask.<LoadImage>d__f.MoveNext() --- End of stack trace from previous location where exception was

Silverlight WriteableBitmap not converting custom font correctly

混江龙づ霸主 提交于 2019-12-14 02:33:09
问题 We use custom fonts to represent road signs and shapes that we plot on a graph. Initially I plotted everything to a canvas, which worked fine, but was slow to scroll horizontally. Then I fixed the scrolling issue by converting the canvas to a image using the WriteableBitmap, like this: #if SILVERLIGHT ImageSource ConvertCanvas(Canvas canvas) { WriteableBitmap Source = new WriteableBitmap(canvas, /* transform = */ null); Source.Invalidate(); return Source; } #endif This conversion works fine

Create WriteableBitmap in windows phone app 8.1?

吃可爱长大的小学妹 提交于 2019-12-13 07:41:24
问题 iam creating qr code scan in windows phone app. using (IRandomAccessStream fileStream = await file.OpenAsync(FileAccessMode.Read)) { wrb = await Windows.UI.Xaml.Media.Imaging.BitmapFactory.New(1, 1).FromStream(fileStream); } in the above code I am getting error in "BitmapFactory". it shows below error: The type or namespace name 'BitmapFactory' does not exist in the namespace 'Windows.UI.Xaml.Media.Imaging' (are you missing an assembly reference?) 回答1: You are missing the WritableBitmapEx

Converting FileStream to WriteableBitmap to JPEG to Byte Array for SSRS

给你一囗甜甜゛ 提交于 2019-12-13 04:21:02
问题 I'm trying to save an Image to SQL Server so SSRS can read it. I need to convert to WriteableBitmap (and possibly JPEG?) so I can make changes to the image size before saving. However, when I try to pull the converted image out of SQL Server, it will not render in SSRS at all. What am I doing wrong? byte[] m_Bytes = ReadToEnd(fileStream); //this works fine WriteableBitmap bmp1 = new WriteableBitmap(166, 166); bmp1.FromByteArray(m_Bytes); //this works fine ExtendedImage image = bmp1.ToImage();

How to convert WriteableBitmap in RGB24 pixel format into a EmguCV image<Bgr, Byte> format?

和自甴很熟 提交于 2019-12-12 00:38:43
问题 I am trying to convert a WriteableBitmap which is having Rgb24 as a pixelFormat. I want to store the same image into a EmguCV Image having Bgr format. I have written a following code but it is not giving appropriate results. public unsafe void Convert(WriteableBitmap bitmap) { byte[] retVal = new byte[bitmap.PixelWidth * bitmap.PixelHeight * 4]; bitmap.CopyPixels(new Int32Rect(0, 0, bitmap.PixelWidth, bitmap.PixelHeight), retVal, bitmap.PixelWidth * 4, 0); Bitmap b = new Bitmap(bitmap

WriteableBitmap crashes program with no message?

做~自己de王妃 提交于 2019-12-11 05:48:56
问题 I create a WriteableBitmap object, draw a line and try to set it as the source to an Image control. For some reason, the program stops responding and then closes 5 seconds later when I try to set the Source. Anyone have any idea what's wrong? (I am also using WriteableBitmapEx) WriteableBitmap bit = new WriteableBitmap(400, 400, 96, 96, PixelFormats.Bgr32, null); WriteableBitmapExtensions.DrawLine(bit, 10, 10, 300, 300, Core.PrimaryColor.ColorValue); ImageCanvas.Source = bit; // Sets the

How to copy an image from PhotoChooserTask to a Bitmap

旧巷老猫 提交于 2019-12-11 02:08:48
问题 I have been attempting to make a copy of a picture that the user selects from the PhotoChooserTask and use this as a background image for a hubtile in my application, but I cannot figure out the properr way to accomplish this. As of now, I can set the hubtile image to the PhotoChooserTask_Completed response but I do not know how to perform the copy action to a Bitmap so that I may save this image for when the application is launched again or reactivated. So far what I have is as follows: I