(view: View, bounds: CGRect)
| 289 | } |
| 290 | |
| 291 | export function generateClipPath(view: View, bounds: CGRect): UIBezierPath { |
| 292 | const background = view.style.backgroundInternal; |
| 293 | const { origin, size } = bounds; |
| 294 | |
| 295 | const position = { |
| 296 | left: origin.x, |
| 297 | top: origin.y, |
| 298 | bottom: size.height, |
| 299 | right: size.width, |
| 300 | }; |
| 301 | |
| 302 | if (position.right === 0 || position.bottom === 0) { |
| 303 | return; |
| 304 | } |
| 305 | |
| 306 | let path: UIBezierPath; |
| 307 | const clipPath = background.clipPath; |
| 308 | |
| 309 | if (clipPath instanceof ClipPathFunction) { |
| 310 | switch (clipPath.shape) { |
| 311 | case 'rect': |
| 312 | path = rectPath(clipPath.rule, position); |
| 313 | break; |
| 314 | case 'inset': |
| 315 | path = insetPath(clipPath.rule, position); |
| 316 | break; |
| 317 | case 'circle': |
| 318 | path = circlePath(clipPath.rule, position); |
| 319 | break; |
| 320 | case 'ellipse': |
| 321 | path = ellipsePath(clipPath.rule, position); |
| 322 | break; |
| 323 | case 'polygon': |
| 324 | path = polygonPath(clipPath.rule, position); |
| 325 | break; |
| 326 | } |
| 327 | } else { |
| 328 | path = null; |
| 329 | } |
| 330 | |
| 331 | return path; |
| 332 | } |
| 333 | |
| 334 | export function getUniformBorderRadius(view: View, bounds: CGRect): number { |
| 335 | const background = view.style.backgroundInternal; |
no test coverage detected