gabm / Satty

Satty - Modern Screenshot Annotation. A tool inspired by Swappy and Flameshot.
Mozilla Public License 2.0
385 stars 18 forks source link

feat: add highlighter tool #72

Closed DerpDays closed 3 months ago

DerpDays commented 3 months ago

Currently this is an initial attempt at adding a highlighter tool, currently there are two styles that I created, however the second one (which is used in sharex) doesn't really work very well with most colors (an example of a good color is #FFFF00), however i've included it incase you prefer it.

First Style (better imo): satty_style_1 Second Style: satty_style_2

However, there is an issue with my current implementation, which is that to apply the filter I take a screenshot of the canvas and then create a new image with the filter applied from the pixels from the screenshot, however canvas.screenshot() does not result in a full resolution image, meaning that the result is blurry if the highlight is applied when the size of satty is a different resolution. And this overall is not a great solution. Also if the satty is open in a different aspect ratio it also is misaligned due to the coordinates being relative to the actual screenshot with no way to get the offset (that I found).

I tried looking for a while but didn't notice any way to get a full resolution image to be able to apply the highlight, so I was wondering if you have any ideas on other approaches, and also your opinion on which highlighter you prefer.

gabm commented 3 months ago

Thank you for your contribution!

Am I seeing this correctly, that you do the alpha channel mixing manually?

Isn't it the same as drawing a rectangle that has a colour with an alpha channel on top - just like what the rectangle tool does?

DerpDays commented 3 months ago

Yep, didn't realise yesterday since I originally did it the sharex way which was to get the min of the color used and the pixel color.

I've updated the PR to just use a colored rectangle with alpha now, which solves all of the problems I mentioned before and looks the same.

gabm commented 3 months ago

I just tested it and it looks fine.. I'll ask the original issue author for review as well..

Notes for the future:

DerpDays commented 3 months ago

The recent commits use a transparent fill yes, but I feel like having a dedicated highlight tool fits the simplicity better since it's such a common action, imo it's a lot easier in contrast to having to manually having to set an alpha on a color, unless maybe there was an easy way to set the alpha in the rectangle tool that doesn't require going through a color picker?

As for drawing a fixed size, do you mean like if they single click or drag only on the x axis that we'd want to make a guess on their area and then provide them handles to change it similar to the crop tool? EDIT: Sorry misread, that would probably be nice, I can try it out later. Still, having handles might be good if they choose to use shift, this would mean that they can extend the highlight in order to highlight large paragraphs easier? Or, what i'm more included to do is that if they move the selection too far away from a straight line we'd allow them to do a rectangle highlight like how it is now? What's your opinion on this

As for contrast I'll look more into it later on! Thanks for the feedback

gabm commented 3 months ago

I'll merge that.. if @sdooweloc wants to give feedback, we can still incorporate that later