博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
使用Java2D改善API绘制效果
阅读量:4619 次
发布时间:2019-06-09

本文共 405 字,大约阅读时间需要 1 分钟。

使用API绘图时,图形有毛刺:

使用Java2D改善后:

使用方法:

在MyPanel类中重写paintComponent方法:

protected void paintComponent(Graphics g) {		Graphics2D g2d=(Graphics2D)g;		g2d.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON);		g2d.drawOval(100, 10, 100, 100);		g.drawOval(10, 10, 100, 100);	}

 使用Graphics2D对象代替Graphics对象,设置渲染提示(setRenderingHint)。

转载于:https://www.cnblogs.com/zhhy236400/p/10522079.html

你可能感兴趣的文章
ARC076F Exhausted
查看>>
TC10738 TheContest
查看>>
bzoj4754 [JSOI2016]独特的树叶
查看>>
多校2019 Contest 2 hdu6602 Longest Subarray
查看>>
CF277D Google Code Jam
查看>>
Redis相关面试题
查看>>
LeetCode 1101. The Earliest Moment When Everyone Become Friends
查看>>
LeetCode 1135. Connecting Cities With Minimum Cost
查看>>
LeetCode 1102. Path With Maximum Minimum Value
查看>>
LeetCode 1061. Lexicographically Smallest Equivalent String
查看>>
LeetCode 841. Keys and Rooms
查看>>
LeetCode 1043. Partition Array for Maximum Sum
查看>>
LeetCode 923. 3Sum With Multiplicity
查看>>
LeetCode 750. Number Of Corner Rectangles
查看>>
LeetCode 983. Minimum Cost For Tickets
查看>>
LeetCode 723. Candy Crush
查看>>
LeetCode 881. Boats to Save People
查看>>
LeetCode 334. Increasing Triplet Subsequence
查看>>
LeetCode 877. Stone Game
查看>>
LeetCode 712. Minimum ASCII Delete Sum for Two Strings
查看>>