Hi I have a BitmapSource which is 150x150 pixels. I would like to invert the pixel colour from position (x=0, y=75) to position (x=75, y=75) so basically just a 1 pixel thick line from the center left to center center.
The closest I have managed so far is by using:
The line appears to be getting drawn in the correct place. But my Bitmap changes as the mouse moves across the screen and the color of the line does not reflect what is at the mouse position. I am also not sure how to properly invert the color since every example I have found is different from every other so it is just confusing me.
Thanks,
Jay
The closest I have managed so far is by using:
Code:
Dim BMP As New WriteableBitmap(BitmapSource)
Dim Stride As Integer = CInt(75 * (BMP.Format.BitsPerPixel + 7) / 8)
Dim PixelData(Stride) As Integer
BMP.CopyPixels(New Int32Rect(0, 75, 75, 1), PixelData, Stride, 0)
For i As Integer = 0 To PixelData.Count - 1
PixelData(i) = 255 - PixelData(i)
Next i
BMP.WritePixels(New Int32Rect(0, 74, 75, 1), PixelData, Stride, 0)
Thanks,
Jay