On Wed, 30 Oct 2024 14:52:17 GMT, Alexey Ivanov <aiva...@openjdk.org> wrote:

>> @aivanov-jdk 
>> While creating the Canvas 
>> drawImage(realImage, 10, 10, this)
>> 10 offset is used.
>> 
>> Hence the start point coordinates also moved by 10 pixels
>> for capturing.
>
> Okay, I see that you offset the image on the canvas too.
> 
> If you insist on using an offset, please declare a constant `OFFSET = 10` and 
> use it everywhere instead of the ‘magic’ numbers: when painting to canvas, 
> and when capturing the image.
> 
> You used a constant for a delay that was used once but you don't create a 
> constant to offset the image off edges that you use in two different places. 
> If one place is updated, the other has to be updated as well. Using a 
> constant does it all automatically.

> @aivanov-jdk While creating the Canvas drawImage(realImage, 10, 10, this) 10 
> offset is used.
> 
> Hence the start point coordinates also moved by 10 pixels for capturing.

This is why _you should create a constant_ for this offset and use when drawing 
the image on the canvas and when capturing the screen.

-------------

PR Review Comment: https://git.openjdk.org/jdk/pull/21524#discussion_r1822931687

Reply via email to