Color issue

Jan 7, 2011 at 10:34 AM

Hi Guys,

I'm trying to write kind of a repeater (like in html when you can say something like repeat-x and repeat-y).

So here is how I do it right now:

 

WriteableBitmap target = new WriteableBitmap((int)ActualWidth, (int)ActualHeight);
WriteableBitmap source = new WriteableBitmap(bitmapImage);

target.ForEach((x, y, c) => { return source.GetPixel(x % imageWidth, y % imageHeight); });

Image img = new Image { Source = target };
drawingCanvas.Children.Add(img);

 

issue being that the color is not the same from source to target.

I used the following image:

And result looks like:

 

If you look closely, the pattern is respected but colors are quite off...

 

Any idea how to solve it ??

Thanks a lot!

 

Georges

Coordinator
Jan 7, 2011 at 11:11 AM

Hmm, seems like a bug. I will have a look at this.

I would also encourage you to not use the ForEach and GetPixel methods for this. Really inefficient. Do it manually with the Pixels array of the WriteableBitmap class or use the WriteableBitmapEx Blit method with the BlendMode.None.

 

- Rene Schulte

Jan 7, 2011 at 11:44 AM

Thanks for this quick answer !

I found my way with the Blit method, thanks for the hint !!

Great project with great support, congratz !!

 

Georges

Coordinator
Feb 10, 2011 at 7:36 PM

I can't reproduce the issue you describe. Have you used the latest built binary or the source code from the repository? I know that I fixed the code after the last binary, so it might have been fixed already.

 

- Rene

Feb 10, 2011 at 8:28 PM

Hello,

It looks like we are using the version 0.9.5.0

We should maybe update to a later version then.

Anyway, as I told you in the previous mail, I achieved my goal using the Blit method and it's quite performant.

 

Thanks you very much for the support,

 

Georges