writeablebitmapex

WriteableBitmapEx in console application?

Deadly 提交于 2019-12-24 08:58:50
问题 I was wondering if it's possible to use the WriteableBitmap class / the WriteableBitmapEx framework in an ordinary C# console application? I have tried to add it via nuget and also included a using statement for System.Windows.Media.Imaging, but the type is not being recognized. 回答1: The System.Windows.Media.Imaging namespace resides in the PresentationCore.dll. In your project explorer, right click on References and pick "Add Reference...", then chose PresentationCore. 来源: https:/

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

WriteableBitmapEx GetPixel() returns wrong value

北慕城南 提交于 2019-12-10 19:59:34
问题 I need to combine two color values from two WriteableBitmap objects and compute something with them. Therefore I run a ForEach loop on the first object and parse its color value and the color value of the second object into a method. writeableBitmap.ForEach((x, y, color) => MergePixelColor(color, mergedWriteableBitmap.GetPixel(x, y))); The first value I get directly from the delegate, but to access the second color value I use the GetPixel method from the WriteableBitmap extension. This

Sobel operator & Convolution with WriteableBitmapEx

倾然丶 夕夏残阳落幕 提交于 2019-12-10 18:06:40
问题 So I'm using WriteableBitmapEx for an app on Windows RT. I'm trying to implement edge detection on an image using the sobel operator. I have successfully applied both kernels for x and y detection onto the image using .Convolute(), but now I'm stuck adding both images to one. The problem is, that all the pixels of both images seem to have the value 0 for transparency (so the A in ARGB). I can display both images on their own without a Problem, but adding them gives me just a black picture. So

How do I add watermark text to a bitmap in WinRT?

ぐ巨炮叔叔 提交于 2019-12-10 13:54:52
问题 I would like to do something like this http://weblogs.asp.net/broux/archive/2011/02/08/silverlight-how-to-watermark-a-writeablebitmapimage-with-a-text.aspx. I am having a tough time getting this to work in WinRT. I am using the WriteableBitmap extensions to "render" some text but I want it to look exactly like it looks in this example. Any suggestions or help? 回答1: You could render that text to a png asset and blit it on top of the bitmap. Unless the text needs to be dynamic - then you'd need

AccessViolationException when accessing pixel color using WriteableBitmapEx

爱⌒轻易说出口 提交于 2019-12-08 03:10:28
问题 I'm using WriteableBitmapEx library to edit an image taken with tablet's cam with Windows 8 Pro. I'm getting an AccessViolationException every time I call to GetPixel() function, here's the code: Windows.Media.Capture.MediaCapture captureMgr = new MediaCapture(); await captureMgr.InitializeAsync(); IRandomAccessStream memoryStream = new InMemoryRandomAccessStream(); await captureMgr.CapturePhotoToStreamAsync(imageProperties, memoryStream); await memoryStream.FlushAsync(); memoryStream.Seek(0)

AccessViolationException when accessing pixel color using WriteableBitmapEx

十年热恋 提交于 2019-12-06 15:41:05
I'm using WriteableBitmapEx library to edit an image taken with tablet's cam with Windows 8 Pro. I'm getting an AccessViolationException every time I call to GetPixel() function, here's the code: Windows.Media.Capture.MediaCapture captureMgr = new MediaCapture(); await captureMgr.InitializeAsync(); IRandomAccessStream memoryStream = new InMemoryRandomAccessStream(); await captureMgr.CapturePhotoToStreamAsync(imageProperties, memoryStream); await memoryStream.FlushAsync(); memoryStream.Seek(0); WriteableBitmap tmpImage = new WriteableBitmap(1, 1); tmpImage.SetSource(memoryStream); tmpImage

Resize image for Live Tile - WriteableBitmapEx

自古美人都是妖i 提交于 2019-12-01 09:04:50
** Found the solution Because of the fact this is a tile, the image will always be strechted to 173 by 173! To avoid this first create a dummy 173 by 173 and merge this with the resized one! Rect rect = new Rect(0.0, 0.0, width, height); WriteableBitmap bitmapDummy = new WriteableBitmap(173, 173); bitmapDummy.Blit(rect, resized, rect, WriteableBitmapExtensions.BlendMode.None); ** Well I have created a Background agent to update the live tile of my WP7 app. But no matter what I try to resize it, I'm not getting a good result! Any tips? Currently I have following code, but I also tried 135 by

In WinRT, how do I load an image and then wait only as long as is needed for it to load before writing to it?

我与影子孤独终老i 提交于 2019-12-01 07:57:59
问题 I'm using WriteableBitmapEx in a WinRT project. I load an image into a WriteableBitmap from the users Picture library. However, I cannot then immediately write to that image, if I do, it will be overwritten with the image itself (it seems like it's Async loading the image and then it's overwritting my drawing on top of it). I don't know how to stop it from doing that (I tried using Await on the SetSource but that's not an Async method). I've used an "Await Task.Delay(1000)" and that works,

Resize image for Live Tile - WriteableBitmapEx

孤人 提交于 2019-12-01 05:40:54
问题 ** Found the solution Because of the fact this is a tile, the image will always be strechted to 173 by 173! To avoid this first create a dummy 173 by 173 and merge this with the resized one! Rect rect = new Rect(0.0, 0.0, width, height); WriteableBitmap bitmapDummy = new WriteableBitmap(173, 173); bitmapDummy.Blit(rect, resized, rect, WriteableBitmapExtensions.BlendMode.None); ** Well I have created a Background agent to update the live tile of my WP7 app. But no matter what I try to resize