What is the best way to create a realistic marker in .NET (using GDI +)?
How can I create a realistic marker (simulating a real world highlighter pen) in .NET using GDI +? It is intended to be used on non-text selectable graphics.
Using a transparent brush (with an alpha channel) doesn't get the job done, as everything under the brush area becomes "fuzzy" and I would like the "foreground" (mostly text) to remain clear (keep its color).
Using a ColorMap for the background area only might work, but it would take a lot of code to define the background area and a specific threshold (I could choose the background view of the first pixel or the top right pixel or something).
ColorMatrix for painting the area seems to be an option as well, but I see the same problem as the transparent brush solution (I'm not an expert on ColorMatrices, so I might be missing something).
I think I need a dynamic threshold for the foreground and background colors, but that might decrease the usability of the marker.
I could live with a solution filling the "selected" area as well as a brush.
a source to share
The yellow highligher transmits yellow light while blocking others.
In the RGB color space, this means you skip red and green, and blue skips through.
We can use a sample image to see the effects of the Microsoft Snipping Tool on the channels:
Original Image :

Highlighted

Color channels :

So, you need to set the value blue
to zero wherever you want your marker to appear.
Unfortunately, there is no blend mode, image attributes, or color matrix that can only be used to highlight the color component one . The only way to achieve this in GDI + is to use LockBits
.
a source to share
I think a brush of a given width and height that when it is dragged across an area of ββthe screen grabs the section below it and parses it, setting the non-text color to yellow and leaving only the text color, then placing the updated section back onto the screen. This should be relatively quick and easy to do, although you need to hit every pixel (and use some sort of threshold to determine which text is and what isn't, as you mentioned).
a source to share