简体   繁体   English

AWT 绘画工具不是像素完美的

[英]AWT paint tools not pixel perfect

When using the AWT package to draw stuff I've found that sometimes when I'm using functions such as fillRect or copyArea, it will sometimes add a pixel to the side or bottom, and is getting quite annoying and noticable when painting very small shapes.当使用 AWT package 绘制东西时,我发现有时当我使用诸如 fillRect 或 copyArea 之类的函数时,它有时会在侧面或底部添加一个像素,并且在绘制非常小的形状时变得非常烦人和引人注目.

How do I fix this?我该如何解决?

Update: Here's a picture of what happens when I do g.fillRect(1, 1, 3, 3);更新:这是我执行g.fillRect(1, 1, 3, 3);时发生的情况的图片。 , which should produce a 3 by 3 rectangle: picture ,它应该产生一个 3 x 3 的矩形:图片

It is hard to see but there is a row of pixels added to the right side.很难看到,但右侧添加了一排像素。

Please read the documentation for fillRect() , and note that the coordinates are treated differently from drawRect() .请阅读fillRect()的文档,并注意坐标的处理方式与drawRect()不同。 fillRect() fills in a rectangle that's 1 pixels wider and taller than drawRect() . fillRect()填充一个比drawRect()宽和高 1 个像素的矩形。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM