HiDPIUtils.scale can return a rectangle with zero dimensions
See original GitHub issueThere’s a bit of a setup to this, more specifically, to have a certain combination of rotation and translation (maybe just rotation) installed on the graphics context. I use that in Radiance to rotate the visuals of tabs in LEFT and RIGHT placement.
If you have these inputs to the scale method:
transform = AffineTransform[[-0.0, 2.5, 820.0], [-2.5, 0.0, 557.5]]
x = 0
y = 0
width = 54
height = 19
The rectangle returned is java.awt.geom.Rectangle2D$Double[x=820.25,y=557.25,w=0.0,h=0.0]
Notice it has zero width and height
Issue Analytics
- State:
- Created a year ago
- Comments:11 (2 by maintainers)
Top Results From Across the Web
Rectangle (Java Platform SE 7 ) - Oracle Help Center
Methods which test if an empty Rectangle contains or intersects a point or rectangle will always return false if either dimension is zero....
Read more >How do I scale one rectangle to the maximum size possible ...
I need to find the maximum scale to which the source can be scaled while fitting within the destination rectangle and maintaining its...
Read more >Class java.awt.Rectangle - Washington
Constructor Summary. Rectangle() Constructs a new rectangle whose top-left corner is at (0, 0) in the coordinate space, and whose width and height...
Read more >geometry - Is it possible to find the dimensions of a rectangle ...
The width of the rectangle will just be 2 times the inner radius and then you can use Pythagoras to get the length...
Read more >java.awt Class Rectangle
A Rectangle whose width or height is negative is considered empty. If the Rectangle is empty, then the isEmpty method returns true ....
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
This is now fixed in main branch. Rotation is now handled correctly.
There is also a small app that I used to test whether
g.fillRect(...)
andHiDPIUtils.paintAtScale1x( (...) -> g.fillRect(...) )
produce the same result.Red rectangle is filled without
HiDPIUtils
and green rectangle is filled usingHiDPIUtils
.@DevCharly Yes! Fair enough for the non-90-degree scalings.