Quantcast
Channel: WriteableBitmapEx
Viewing all 360 articles
Browse latest View live

New Post: Library doesn't work properly

$
0
0
Thanks a lot for the solution. I haven't found it...
I'll test it as soon as I can.

Bye.

Jymmy097

New Post: Library doesn't work properly

$
0
0
IT WORKS!!!!!!

I used the code from smiron86 to access the image (I modified the function: now it requests an URI) and I enabled CLR exception from Debug -> Exception -> Enable ALL CLR Exception.

And now... IT WORKS!!

Thanks a lot for your support!

Jymmy097

New Post: Changelog?

$
0
0
Hi,

Is there any way to know the changes on the latest version?

Thanks.

New Post: Changelog?

New Post: Changelog?

Created Unassigned: Crash when using WriteableBitmapEx.Clear in parallel. [20005]

$
0
0
Using WriteableBitmapEx 1.0.8.0 from NuGet, I have some code where I'm creating a bunch of images in parrel. However, inside BitmapContext there's a static Dictionary used in the ctor - which leads to crashes when calling methods such as WriteableBitmapExtensions.Clear on different images concurrently.

Here's some code to reproduce the problem

```
Parallel.For(0, 1000, i =>
{
var bitmap = new WriteableBitmap(100, 100, 96, 96, PixelFormats.Gray16, null);
var converted = BitmapFactory.ConvertToPbgra32Format(bitmap);
converted.Clear(Colors.Aqua);
});
```

Commented Unassigned: Crash when using WriteableBitmapEx.Clear in parallel. [20005]

$
0
0
Using WriteableBitmapEx 1.0.8.0 from NuGet, I have some code where I'm creating a bunch of images in parrel. However, inside BitmapContext there's a static Dictionary used in the ctor - which leads to crashes when calling methods such as WriteableBitmapExtensions.Clear on different images concurrently.

Here's some code to reproduce the problem

```
Parallel.For(0, 1000, i =>
{
var bitmap = new WriteableBitmap(100, 100, 96, 96, PixelFormats.Gray16, null);
var converted = BitmapFactory.ConvertToPbgra32Format(bitmap);
converted.Clear(Colors.Aqua);
});
```
Comments: ** Comment from web user: AndreyH **

We experienced the same issue in a multi-threading context, in a WPF application. It appears when calling
e.g. WriteableBitmap.Clear() or WriteableBitmap.DrawPolyline(int[] points, Color color)

An exception was coming from the UpdateCountByBmp-Dictionary in the 'BitmapContext.cs' (line 60).

```
private readonly static IDictionary<WriteableBitmap, int> UpdateCountByBmp = new Dictionary<WriteableBitmap, int>()
```

We changed the dictionary to a thread-safe collection and it fixed the issue for us:

```
private static readonly IDictionary<WriteableBitmap, int> UpdateCountByBmp = new System.Collections.Concurrent.ConcurrentDictionary<WriteableBitmap, int>();
```

Commented Unassigned: Crash when using WriteableBitmapEx.Clear in parallel. [20005]

$
0
0
Using WriteableBitmapEx 1.0.8.0 from NuGet, I have some code where I'm creating a bunch of images in parrel. However, inside BitmapContext there's a static Dictionary used in the ctor - which leads to crashes when calling methods such as WriteableBitmapExtensions.Clear on different images concurrently.

Here's some code to reproduce the problem

```
Parallel.For(0, 1000, i =>
{
var bitmap = new WriteableBitmap(100, 100, 96, 96, PixelFormats.Gray16, null);
var converted = BitmapFactory.ConvertToPbgra32Format(bitmap);
converted.Clear(Colors.Aqua);
});
```
Comments: ** Comment from web user: wilka **

The changes I made were to add locking (which is obviously a perf hit), otherwise it would leave the possibility of incorrectly changing the reference count.

I haven't submitted a patch because I don't think many people would be in favour of the perf-hit for the locking, but you can see a diff of my change to BitmapContext.cs here https://gist.github.com/WilkaH/6220090

It's only been tested in the context of .NET 4.0 WPF


Commented Unassigned: Crash when using WriteableBitmapEx.Clear in parallel. [20005]

$
0
0
Using WriteableBitmapEx 1.0.8.0 from NuGet, I have some code where I'm creating a bunch of images in parrel. However, inside BitmapContext there's a static Dictionary used in the ctor - which leads to crashes when calling methods such as WriteableBitmapExtensions.Clear on different images concurrently.

Here's some code to reproduce the problem

```
Parallel.For(0, 1000, i =>
{
var bitmap = new WriteableBitmap(100, 100, 96, 96, PixelFormats.Gray16, null);
var converted = BitmapFactory.ConvertToPbgra32Format(bitmap);
converted.Clear(Colors.Aqua);
});
```
Comments: ** Comment from web user: teichgraf **

Thanks for raising that and providing some solutions.
As you noted the lib is currently not really designed for multi-threaded scenarios. Most importantly since the WB ctor needs to be called on the UI thread anyway.
There was never a high demand for this. Actually it started with this issue report here. :) For now we won't invest in a redesign of the lib for various reasons including perf hits due to locking, etc.
If this issue report here receives more votes we might reconsider it.

Thanks!

- Rene

Commented Unassigned: Crash when using WriteableBitmapEx.Clear in parallel. [20005]

$
0
0
Using WriteableBitmapEx 1.0.8.0 from NuGet, I have some code where I'm creating a bunch of images in parrel. However, inside BitmapContext there's a static Dictionary used in the ctor - which leads to crashes when calling methods such as WriteableBitmapExtensions.Clear on different images concurrently.

Here's some code to reproduce the problem

```
Parallel.For(0, 1000, i =>
{
var bitmap = new WriteableBitmap(100, 100, 96, 96, PixelFormats.Gray16, null);
var converted = BitmapFactory.ConvertToPbgra32Format(bitmap);
converted.Clear(Colors.Aqua);
});
```
Comments: ** Comment from web user: wilka **

That seems reasonable, if only a few people need this feature they can just use one of the options mentioned here.

> Most importantly since the WB ctor needs to be called on the UI thread anyway.

The way I'm using, I'm creating the images on background threads and then freezing them so they can be used across on the UI thread. It can takes a while to build the images, and I don't want to block the UI while doing it.

Commented Unassigned: Crash when using WriteableBitmapEx.Clear in parallel. [20005]

$
0
0
Using WriteableBitmapEx 1.0.8.0 from NuGet, I have some code where I'm creating a bunch of images in parrel. However, inside BitmapContext there's a static Dictionary used in the ctor - which leads to crashes when calling methods such as WriteableBitmapExtensions.Clear on different images concurrently.

Here's some code to reproduce the problem

```
Parallel.For(0, 1000, i =>
{
var bitmap = new WriteableBitmap(100, 100, 96, 96, PixelFormats.Gray16, null);
var converted = BitmapFactory.ConvertToPbgra32Format(bitmap);
converted.Clear(Colors.Aqua);
});
```
Comments: ** Comment from web user: AndreyH **

We are glad to contribute!
I didn't notice considerable performance hits with the solution mentioned above (ConcurrentDictionary).
Since we need to render a great number of pictures, we used to build images in a background thread and then freeze then as well, so it was the time issue came up.

Commented Unassigned: Crash when using WriteableBitmapEx.Clear in parallel. [20005]

$
0
0
Using WriteableBitmapEx 1.0.8.0 from NuGet, I have some code where I'm creating a bunch of images in parrel. However, inside BitmapContext there's a static Dictionary used in the ctor - which leads to crashes when calling methods such as WriteableBitmapExtensions.Clear on different images concurrently.

Here's some code to reproduce the problem

```
Parallel.For(0, 1000, i =>
{
var bitmap = new WriteableBitmap(100, 100, 96, 96, PixelFormats.Gray16, null);
var converted = BitmapFactory.ConvertToPbgra32Format(bitmap);
converted.Clear(Colors.Aqua);
});
```
Comments: ** Comment from web user: teichgraf **

Thanks guys. :)

And yes, creating the WB on the UI thread and then simply passing the pixel buffer to fill in background thread(s) is the way to go. I use that in my apps since day one. ;)

- Rene

Created Unassigned: BitmapContext not thread safe [20143]

$
0
0
It seems the dictionaries used in the context class have some thread racing occurring when you have multiple WPF render threads (with own dispatchers). Some locks should fix it.

Created Unassigned: Issue with .FromContent(string) [20158]

$
0
0
Why does this not work?

```
WriteableBitmap temps = BitmapFactory.New(100, 20).FromContent("/Assets/colorscale.png");
```

Get this error:

![Image](https://pbs.twimg.com/media/BS8PfBmCIAAaCnT.png)

Closed Unassigned: Issue with .FromContent(string) [20158]

$
0
0
Why does this not work?

```
WriteableBitmap temps = BitmapFactory.New(100, 20).FromContent("/Assets/colorscale.png");
```

Get this error:

![Image](https://pbs.twimg.com/media/BS8PfBmCIAAaCnT.png)
Comments: Make sure to have the asset set as Build Action Content. Then check that path / uri you pass into the method. It does not look like the right format.
Also, this is not an issue. Next time use the Discussions forum, not the Issue tracker here.

New Post: Blit images of different sizes?

$
0
0
Hi, first thanks for the WriteablebitmapEx library, it has help me write a cool app for Windows Phone and now I'm porting it to Windows RT.

I need to overlay an image on a background image, and am trying to use the blit functions. I've see the example where two images are overlayed, and both are the same size.

Can .blit merge two images of different sizes? In my app I'm adding small graphic elements to a large background image.

FYI, my app is using .Blit today to overlay two images of the same size, and it works perfectly:
            writeableBmp_Bkgrnd.Blit(
                new Rect(0, 0, writeableBmp_Bkgrnd.PixelWidth, writeableBmp_Bkgrnd.PixelHeight), wbAddOnTop,
                new Rect(0, 0, wbAddOnTop.PixelWidth, wbAddOnTop.PixelHeight),
                WriteableBitmapExtensions.BlendMode.Alpha);
Thanks!

New Post: Blit images of different sizes?

$
0
0
Sure, you can do that, but the destination rectangle should fit the size of the source image (wbAddOnTop) since the source is smaller, so check that destRect parameter and use the destination X and Y where the top should be overlayed and use the source rect's width and height.
  • Rene

New Post: Convolute / Invert changes WriteableBitmap DPI

$
0
0
Pretty simple problem here...

I have a 72 DPI WriteableBitmap image. If I run a convolute call or invert the image what is returned is always a 96 DPI image. I need it to stay a 72 DPI image.

Is there a way around this? Or to change the image back to 72 DPI after the image processing?

New Post: Blit images of different sizes?

$
0
0
I got it working, thanks for the tip!

The code:
        writeableBmp_Bkgrnd.Blit(
            new Rect(wherex, wherey, wbAddOnTop.PixelWidth, wbAddOnTop.PixelHeight),
            wbAddOnTop,
            new Rect(0, 0, wbAddOnTop.PixelWidth, wbAddOnTop.PixelHeight),
            WriteableBitmapExtensions.BlendMode.Alpha);

-B

New Post: create polygon with float cordiantes

$
0
0
Is it possible to create a polygon with coordinates of the nodes as floats (not int[]).

thanks
Viewing all 360 articles
Browse latest View live


<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>