1

I'm writing an application where I need a crosshair cursor to pick points on an arbitrary image. Being as the image may contain both light and dark regions, I'm looking to XOR the cursor on top of the image, thus inverting the colours of the pixels where the cursor lies. In order to illustrate what I mean, please see the following image...

Example of XOR cursor

My application will be written using WPF and C#.NET. The image will be displayed in a Canvas within a ScrollViewer, where the cursor will be contained within a .png file. The cursor image file contains a white cursor on a black background so that it will produce the correct results once it's "blitted" onto the image with an XOR operation. I've also gone with the approach of having the cursor as an image file because I will need to show instances of the cursor at selected points within the image.

Of course, another important requirement is that the drawing operation should run as fast as possible, as it's basically a cursor that will move constantly as the user moves the mouse.

Thanks in advance!

Lee.J.Baxter
  • 495
  • 4
  • 12
  • 2
    Why bother with such a complicated approach instead of just putting a thin white crosshair on top of a thicker black one (or the other way round)? It will be visible on both light and dark regions of an image. – Clemens Jan 09 '17 at 23:08
  • @Clemens You've got a good point there! It seems that great minds think alike, as after a sighing-face-palm moment I've done just that! Please could you re-post your comment as an answer so that I can mark it and give you the due credit! :-) – Lee.J.Baxter Jan 09 '17 at 23:22
  • 1
    "Why bother" is not an answer to the question of "How can I". – devRicher Jan 09 '17 at 23:26
  • @devRicher That's why I wrote a comment. Besides that, on StackOverflow we often see answers that do not directly answer the exact question, but instead give OP a hint how to solve their problem in a cleaner way. – Clemens Jan 10 '17 at 06:32
  • @Lee.J.Baxter You could probably better write that answer yourself, and show some code how you created the crosshair cursor. – Clemens Jan 10 '17 at 06:57
  • @devRicher I'll just throw in the [XY Problem](http://mywiki.wooledge.org/XyProblem). Have a look at [this Meta Post](https://meta.stackexchange.com/a/66378/310143). Also some [explanations by various people](http://www.perlmonks.org/?node=XY+Problem) – Mischa Jul 25 '17 at 10:08

0 Answers0