NSDrawNinePartImage 间隙
我正在使用 NSDrawNinePartImage
绘制自定义按钮/文本字段。我在代码中将图像分割成九个部分,并使用 NSDrawNinePartImage
将其绘制到一个矩形中。
不幸的是,我在绘图模式中发现了一些空白。我认为这与我的切片代码有关,但我将它们保存为切片时的图像,它们看起来都不错(我什至将它们放在一起,看起来也不错)。在某些情况下,尽管有些使用相同的图像,但我使用它工作得很好。
我非常有信心这取决于实际的绘图。
您是否知道任何 NSGraphicsContext
或其他会影响它的设置或可能导致此问题的其他原因?
有间隙
无间隙
I am working on drawing custom buttons/textfields with NSDrawNinePartImage
. I slice up an image into nine parts in code and draw it into a rect with NSDrawNinePartImage
.
Unfortunately I am getting some gaps in the drawing pattern. I thought it had something to do with my slicing code, but I saved them out as images from where I slice them, and they all look good (I even put them together and they looked good). Some of the cases where I use it to work just fine though despite some using the same images.
I am pretty confident that it comes down to the actual drawing.
Do you know of any NSGraphicsContext
or other settings that would affect it or something else that may be causing this?
With gaps
Without gaps
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
我通过禁用抗锯齿选项修复了类似的问题
I fixed a similar issue by disable the anti-alias option
您的左上和右下图像是否可能太宽一个像素?
Is it possible that your upper left and lower right images are a pixel too wide?
在图像中使用均匀尺寸。我这样做了,它为我解决了这个问题。
Use even sizes in images. I did this, and it solved this problem for me.