Merge commit '7621e2f8dec938cf48181c8b10afc9b01f444e68' into beta

This commit is contained in:
Ilya Laktyushin
2025-12-06 02:17:48 +04:00
commit 8344b97e03
28070 changed files with 7995182 additions and 0 deletions
@@ -0,0 +1,62 @@
//
// RenderNode.swift
// lottie-swift
//
// Created by Brandon Withrow on 1/17/19.
//
import CoreGraphics
import Foundation
import QuartzCore
// MARK: - RenderNode
/// A protocol that defines a node that holds render instructions
protocol RenderNode {
var renderer: Renderable & NodeOutput { get }
}
// MARK: - Renderable
/// A protocol that defines anything with render instructions
protocol Renderable {
/// The last frame in which this node was updated.
var hasUpdate: Bool { get }
func hasRenderUpdates(_ forFrame: CGFloat) -> Bool
/// Determines if the renderer requires a custom context for drawing.
/// If yes the shape layer will perform a custom drawing pass.
/// If no the shape layer will be a standard CAShapeLayer
var shouldRenderInContext: Bool { get }
/// Passes in the CAShapeLayer to update
func updateShapeLayer(layer: CAShapeLayer)
/// Asks the renderer what the renderable bounds is for the given box.
func renderBoundsFor(_ boundingBox: CGRect) -> CGRect
/// Opportunity for renderers to inject sublayers
func setupSublayers(layer: CAShapeLayer)
/// Renders the shape in a custom context
func render(_ inContext: CGContext)
}
extension RenderNode where Self: AnimatorNode {
var outputNode: NodeOutput {
renderer
}
}
extension Renderable {
func renderBoundsFor(_ boundingBox: CGRect) -> CGRect {
/// Optional
boundingBox
}
}