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
Post a Comment