HaikuArchives / ArtPaint

ArtPaint is a painting and image processing program.
https://haikuarchives.github.io/ArtPaint/
29 stars 18 forks source link

ImageView: draw brush cursor on MouseUp #536

Closed dsizzle closed 1 year ago

dsizzle commented 1 year ago

per discussion in #535, draw the brush cursor on mouseup.

I think it does look better - lmk

humdingerb commented 1 year ago

Yes, very good. It doesn't work for Airbrush and Transparency though. And there's still the outline artifact. Best seen when disabling "Use current brush" and a size of around 50:

ezgif-5-ccf49ecd2b

Myabe some rounding error? New ticket?

dsizzle commented 1 year ago

Yeah, probably a rounding error. You don’t need a new ticket; just add it to #128 which is still open.

odd that this pr doesn’t work for transparency and airbrush… the mouseup should be mouse up for anything??

humdingerb commented 1 year ago

FWIW, the MouseUp() and the call to DrawBrush() is also triggered for these tools. I checked with printf()...

dsizzle commented 1 year ago

another problem I see is that I think the "mouseup" cursor is offset incorrectly when zoom isn't 100%?

dsizzle commented 1 year ago

ok, fixed the offset part

but yeah, for airbrush and transparency, you can see it 'flash' sometimes but seems to get erased immediately. odd. :eyes:

dsizzle commented 1 year ago

this one is a real head-scratcher. It seems to really be something particular to those tools... I did notice that those two tools seem to use a slightly different way of compositing/drawing/updating the view, so I might try making them behave more like the other drawing tools to see if it solves it. :exploding_head:

dsizzle commented 1 year ago

Fixed Transparency tool. Not sure why my changes fixed it, but it seems to be fixed now.

Discovered another issue; if you change tools (to, say, the Selection tool) the brush outline stays drawn for a short bit. Maybe until you mouse over that area again.

humdingerb commented 1 year ago

Discovered another issue; if you change tools (to, say, the Selection tool) the brush outline stays drawn for a short bit. Maybe until you mouse over that area again.

Yes. Not only for a short bit. It stays until you use the tool and select the area with the overlayed brush outline. Or your mouse pointer leaves the canvas area. I switch between tools via shortcut keys, "F" and "S".

dsizzle commented 1 year ago

slow progress, this "simple" issue is a challenge. "Airbrush" mode should work now, but "Spray" mode is just artifacty and weird.

haven't tried to address the "brush-outline-that-won't-go-away" yet.

humdingerb commented 1 year ago

this "simple" issue is a challenge

It's always the on-a-quick glance simple issues that turn out frustratingly annoying. Well, not always. Most of the time you know it'll be a bugger before starting it...:)

dsizzle commented 1 year ago

well, I think I solved the brush outline not going away issue, but Spray tool is just... hating me.

humdingerb commented 1 year ago

Very good. If you need a change of coding scenery, we can merge as is and you can decide to get back to it at a later time. It's not a showstopper or annoying...

dsizzle commented 1 year ago

It’s mildly frustrating because it seems to be some kind of race condition between when the tool stops drawing and the brush outline draws - but it’s not clear why the brush wins the race in every situation except spray… I would expect it to be more unpredictable??

With that said, if everything else works ok I’m inclined to merge it.

humdingerb commented 1 year ago

Alright. Let's merge while we wait on your sudden brain wave. :) I created #545 where you can add further findings.