Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions Package.resolved

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 4 additions & 4 deletions Sources/OpenSwiftUICore/Graphic/Color/Paint.swift
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
// OpenSwiftUICore
//
// Audited for 6.5.4
// Status: Complete (Blocked by ImagePaint and Shader)
// Status: Complete (Blocked by ImagePaint)
// ID: 1A0B37DF690543DA63A8C3A51910F39C (SwiftUICore)

package import Foundation
Expand Down Expand Up @@ -190,7 +190,7 @@ package protocol ResolvedPaintVisitor {
mutating func visitPaint<P>(_ paint: P) where P: ResolvedPaint
}

// MARK: - CodableResolvedPaint [WIP: ImagePaint, Shader]
// MARK: - CodableResolvedPaint [WIP: ImagePaint]

package struct CodableResolvedPaint: ProtobufMessage {
package struct Tag: Equatable, ProtobufTag {
Expand Down Expand Up @@ -247,8 +247,8 @@ package struct CodableResolvedPaint: ProtobufMessage {
let rect: CGRect = try decoder.messageField(field)
base = base?.anchorRect(rect)
case Tag.shader.rawValue:
// TODO: Decode Shader.ResolvedShader.
_openSwiftUIUnimplementedFailure()
let shader: Shader.ResolvedShader = try decoder.messageField(field)
base = _AnyResolvedPaint(shader)
case Tag.meshGradient.rawValue:
let paint: MeshGradient._Paint = try decoder.messageField(field)
base = _AnyResolvedPaint(paint)
Expand Down
13 changes: 13 additions & 0 deletions Sources/OpenSwiftUICore/Graphic/GraphicsContext.swift
Original file line number Diff line number Diff line change
Expand Up @@ -526,6 +526,12 @@ public struct GraphicsContext {
self.storage = storage
}

@available(OpenSwiftUI_v5_0, *)
@available(watchOS, unavailable) // @_spi_available(watchOS, introduced: 10.0)
public static func shader(_ shader: Shader, bounds: CGRect = .zero) -> Shading {
Shading(storage: .shader(shader, bounds))
}

// TODO

/// Creates a shading that fills with a mesh gradient.
Expand Down Expand Up @@ -815,3 +821,10 @@ extension GraphicsContext {
_openSwiftUIUnimplementedFailure()
}
}

extension Color.Resolved {
func rbColor(in space: ORBColor.ColorSpace) -> ORBColor {
let color = ORBColor(red: linearRed, green: linearGreen, blue: linearBlue, alpha: opacity)
return space == .linearSRGB ? color : color.fromLinear()
}
}
Loading
Loading