Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/honghaoz/calayer-issues
The issue: https://twitter.com/ChouTiUI/status/1576765138316963841
https://github.com/honghaoz/calayer-issues
Last synced: 27 days ago
JSON representation
The issue: https://twitter.com/ChouTiUI/status/1576765138316963841
- Host: GitHub
- URL: https://github.com/honghaoz/calayer-issues
- Owner: honghaoz
- Created: 2022-10-11T21:09:36.000Z (about 2 years ago)
- Default Branch: master
- Last Pushed: 2022-10-11T21:28:30.000Z (about 2 years ago)
- Last Synced: 2023-07-31T15:46:51.753Z (over 1 year ago)
- Language: Swift
- Size: 253 KB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
For the following code:
```swift
// borderLayer1 renders the border in 3 points wide
// ⚠️ but the outer 2.5 points are solid red, and inner 0.5 points are rendered in semi transparent red
let borderLayer1 = CALayer()
borderLayer1.cornerCurve = .continuous
borderLayer1.borderColor = NSColor.red.cgColor
borderLayer1.borderWidth = 3borderLayer1.frame = CGRect(x: 100, y: 100, width: 50, height: 50)
view.layer?.addSublayer(borderLayer1)
// borderLayer2 renders the border perfectly
let borderLayer2 = CALayer()
borderLayer2.cornerCurve = .circular
borderLayer2.borderColor = NSColor.red.cgColor
borderLayer2.borderWidth = 3borderLayer2.frame = CGRect(x: 200, y: 100, width: 50, height: 50)
view.layer?.addSublayer(borderLayer2)
```There's a border render issue on macOS (tested on macOS Monterey, 12.5.1).
with `CALayer.cornerCurve = .continuous`, on macOS, the layer's border's inner 1 pixel is rendered incorrectly, see the following screenshots:
| border 1 | border 2 |
| :-: | :-: |
| ![](mac-border1.png) | ![](mac-border2.png) |on iOS (iOS 15/16), both layers' borders are rendered perfectly.