Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我什至不知道如何表达这个问题......但基本上我有一个小图像,我想拉伸它以覆盖屏幕。由于放大,图像很模糊,我希望它看起来像块状,所以我可以看到单个像素为正方形。有没有什么简单的方法可以达到这个效果?
将图像绘制为图层的内容,然后通过放大图层将其放大(给它一个缩放变换,或者更好的是,使用该contentsRect属性使图像小区域填充图层)。该层仅由原始位图支持,因此您现在将看到位图的位。IIRC 如果您使用shouldRasterize.
contentsRect
shouldRasterize