java - Why GraphicsContext uses methods with double params? -


i'm moving swing javafx. wondered why graphicscontext uses methods double params. example fillrect(double x, double y, double w, double h) unlike swing has methods drawrect(int x, int y, int width, int height).

should calculations in double?

drawrect in inherited graphics uses int specify co-ords & size.

the graphics2d object on other hand, capable of dealing graphics values lie 'between whole pixels'. compensate typically render dithered pixel (part way between drawing , bg color) @ parts of rendering has deal fractions of pixel.

should calculations in double?

yes! double values equal integer rendered might expect graphics method - sharp, clean lines. if boundary of shape ever falls between whole pixels, color dithered.


Comments

Popular posts from this blog

angularjs - ADAL JS Angular- WebAPI add a new role claim to the token -

php - CakePHP HttpSockets send array of paramms -

node.js - Using Node without global install -