本文介紹了如何在 Java 中繪制一個看起來像樣的圓圈的處理方法,對大家解決問題具有一定的參考價值,需要的朋友們下面隨著小編來一起學習吧!
問題描述
我嘗試過使用具有相同高度和寬度的 drawOval 方法,但隨著直徑的增加,圓的外觀變得更糟.無論大小,我該怎么做才能擁有一個像樣的圓圈.我將如何在 java 或其他方法中實現抗鋸齒.
I have tried using the method drawOval with equal height and width but as the diameter increases the circle becomes worse looking. What can I do to have a decent looking circle no matter the size. How would I implement anti-aliasing in java or some other method.
推薦答案
事實證明,Java2D(我假設是你正在使用的)在這方面已經相當出色了!這里有一個不錯的教程:http://www.javaworld.com/javaworld/jw-08-1998/jw-08-media.html
As it turns out, Java2D (which I'm assuming is what you're using) is already pretty good at this! There's a decent tutorial here: http://www.javaworld.com/javaworld/jw-08-1998/jw-08-media.html
重要的一行是:
graphics.setRenderingHint(RenderingHints.KEY_ANTIALIASING,
RenderingHints.VALUE_ANTIALIAS_ON);
這篇關于如何在 Java 中繪制一個看起來像樣的圓圈的文章就介紹到這了,希望我們推薦的答案對大家有所幫助,也希望大家多多支持html5模板網!
【網站聲明】本站部分內容來源于互聯網,旨在幫助大家更快的解決問題,如果有圖片或者內容侵犯了您的權益,請聯系我們刪除處理,感謝您的支持!