.drawLine() issues and buffered image

前端 未结 3 832
时光取名叫无心
时光取名叫无心 2020-12-11 10:11

I have a paint programme and i have all the buttons and sliders done however i am having a problem with the actual painting itself. When I drag the cursor across the scre

3条回答
  •  猫巷女王i
    2020-12-11 10:41

    Thirty pixels is a very wide line, and I can imagine that when drawn without antialiasing, it's going to look very jagged; that's probably what you're seeing. You might want to try something like

    graph.setRenderingHint(
        RenderingHints.KEY_ANTIALIASING,
        RenderingHints.VALUE_ANTIALIAS_ON);
    

    On the other hand, maybe you're already getting antialiasing, and you want to turn it off; then

    graph.setRenderingHint(
        RenderingHints.KEY_ANTIALIASING,
        RenderingHints.VALUE_ANTIALIAS_OFF);
    

    One of these is guaranteed to change the appearance of your image; hopefully it will be more to your liking.

提交回复
热议问题