gg icon indicating copy to clipboard operation
gg copied to clipboard

[Question] Float coordinate values for DrawImage? (sub-pixel positioning)

Open HeCorr opened this issue 4 years ago • 1 comments

Hello! I was wondering why there's no current way (that I know of) of drawing images in float coordinates since DrawImage and DrawImageAnchored both take ints for the X and Y.

I think float values would work alright since they apparently get converted to float internally anyway.

I'd create a PR and try something out but I'm usure about how to call the new functions.. DrawImageFloat sounds really bad..

It would make more sense if they just accepted floats (like DrawRectangle) since int to float conversion doesn't mess with the values (5 -> 5.00) so one could just use float64(x), float64(y) but that would definitely break backwards-compatibility, which nobody wants.

Ideas?

HeCorr avatar Sep 02 '21 03:09 HeCorr

I did some testing and it actually seems to not work as expected.

Instead of smoothly moving from 0.00 to 1.00 in 0.10 increments, the drawn image just jumps once it reaches 1.00, staying in the same position as 0.00 with the other values.

Is sub-pixel positioning not possible after all?

HeCorr avatar Sep 03 '21 04:09 HeCorr