Request: option to restore Java 5 rasterizer “uniform jaggies” for curves

Francisco Flores chico_xiba at yahoo.com
Mon Sep 29 02:35:20 UTC 2025


 
Hello,

I work with Java2D for CAD/CAM style applications where antialiasing is not desirable. Since Java 6 the rasterizer for Bézier curves changed:
   
   -    
Java 5: non-antialiased Bézier curves produced very regular, uniform “ladder” steps (each pixel step had the same length).

   -    
Java 6 and later: the rasterizer switched, and now the visible steps are irregular — some longer, some shorter.


For my use case, the old behavior was much cleaner and easier to interpret visually. Rendering hints such as KEY_STROKE_CONTROL and KEY_FRACTIONALMETRICS do not restore this, since the difference lies in the rasterizer implementation itself.

Minimal test case: 
import java.awt.*;import java.awt.geom.*;import javax.swing.*;
public class CurveTest extends JPanel {    @Override    protected void paintComponent(Graphics g) {        super.paintComponent(g);        Graphics2D g2 = (Graphics2D) g;
        g2.setRenderingHint(RenderingHints.KEY_ANTIALIASING,                            RenderingHints.VALUE_ANTIALIAS_OFF);
        g2.setStroke(new BasicStroke(1f));
        // Flatter cubic curve across the panel        CubicCurve2D curve = new CubicCurve2D.Double(                50, 400,   // start                200, 350,  // control1                600, 450,  // control2                750, 400   // end        );        g2.draw(curve);    }
    public static void main(String[] args) {        JFrame f = new JFrame("Curve Test");        f.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);        f.setSize(800, 800);        f.add(new CurveTest());        f.setVisible(true);    }}
Expected (Java 5): uniform, even “ladder” steps when antialiasing is off.
Actual (Java 6+): irregular steps of varying length, harder to read.

Request:
Would it be possible to expose an option (for example, a rendering hint or system property) to select the old Java 5 rasterizer mode, or otherwise reproduce its uniform step behavior for non-antialiased curve rendering?

This would help applications that rely on crisp pixel stair-steps as a visual aid, rather than smooth antialiasing.

Thank you for considering,
Francisco

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://mail.openjdk.org/pipermail/client-libs-dev/attachments/20250929/0a6f3436/attachment.htm>


More information about the client-libs-dev mailing list