views:

140

answers:

1

I have an application that needs to highlight individual pixels on an image. I don't want to edit the image, I just want to temporarily display red dots on top of certain pixels in the image. So far I have been using a Canvas to draw a whole lot of really small rectangles to highlight those pixels, but that has performance issues, and I was wanting to know if there was a better way to do it.

+1  A: 

You can place another image layer over the original one with a transparent background and simply put red pixels on it.

idursun
What do you mean? Are you talking about using a WriteableBitmap?
Phil
If I understand idursun, a WritableBitmap could work as an overlay image. You'd make one the same size as your original image, which has all transparent pixels and position it at the same place, but with a higher z-order. When a dot needs to be added, you calculate where it should be, then write a colored pixel(s) into that spot on your overlay.
Ed Gonzalez
I was talking about dynamically creating an overlay image with a transparent background at the same size as the background image you are displaying. They just have to be located at the same position. Like: ` <Grid><Image x:Name="backgroundImage" Source="{Binding BackgroundImage}" /><Image x:Name="overlayImage" Source="{Binding OverlayImage}" Panel.ZIndex="99" /></Grid>`
idursun
So brilliantly simple. Now, just run everything through a scale transformer so a 'pixel' is really a 'pixel'...
pst
Which would be better/easier? Dynamically create an image, or use a WriteableBitmap? I ask because I haven't done either before.
Phil
I haven't used WriteableBitmap either, but I'd choose creating overlay image dynamically because it is trivial to implement.
idursun