我正在制作两个正方形,如下图所示。一红一蓝方块
黄色圆圈不是图像的一部分,但它显示了一些我期望不存在的像素。我没有计算机图形方面的经验,但从我在文档中读到的内容来看,这些像素不应该存在。我是否有不切实际的期望,或者我做错了什么以获得这些“溢出”像素,如上图中黄色圆圈所示?
这是生成框的代码。
#lang racket/gui
(define dc (new svg-dc%
[width 64]
[height 64]
[output "boxes.svg"]
[exists 'replace]))
(send dc start-doc "boxes.svg")
(send dc start-page)
(define old-brush (send dc get-brush))
(define old-pen (send dc get-pen))
(send dc set-brush
(new brush% [style 'solid]
[color "White"]))
(send dc set-pen
(new pen% [width 0]
[color "Black"]
[cap 'butt]
[join 'miter]))
(send dc set-pen old-pen)
(send dc set-brush old-brush)
(send dc set-pen
(new pen% [width 0]
[color "Black"]
[cap 'butt]
[join 'miter]))
(send dc set-brush
(new brush% [style 'solid]
[color "Red"]))
(define path (new dc-path%))
(send path move-to 0 0)
(send path line-to 10 0)
(send path line-to 10 10)
(send path line-to 0 10)
(send path close)
(send dc draw-path path 0 0)
(send dc set-pen old-pen)
(send dc set-brush old-brush)
(send dc set-pen
(new pen% [width 0]
[color "Black"]
[cap 'butt]
[join 'miter]))
(send dc set-brush
(new brush% [style 'solid]
[color "Blue"]))
(define path2 (new dc-path%))
(send path2 move-to 0 0)
(send path2 line-to 10 0)
(send path2 line-to 10 10)
(send path2 line-to 0 10)
(send path2 close)
(send dc draw-path path2 10 0)
(send dc set-pen old-pen)
(send dc set-brush old-brush)
(send dc end-page)
(send dc end-doc)