diff --git a/Sources/OpenSwiftUICore/Graphic/GraphicsContext.swift b/Sources/OpenSwiftUICore/Graphic/GraphicsContext.swift index cf36c0f13..a10e1a9a1 100644 --- a/Sources/OpenSwiftUICore/Graphic/GraphicsContext.swift +++ b/Sources/OpenSwiftUICore/Graphic/GraphicsContext.swift @@ -40,6 +40,11 @@ public enum CGBlendMode: Int32, @unchecked Sendable { } #endif +package enum PathDrawingStyle { + case fill(FillStyle) + case stroke(StrokeStyle) +} + /// An immediate mode drawing destination, and its current state. /// /// Use a context to execute 2D drawing primitives. For example, you can draw diff --git a/Sources/OpenSwiftUICore/Render/CoreAnimation/CAFrameRateRangeUtil.swift b/Sources/OpenSwiftUICore/Render/Util/CAFrameRateRangeUtil.swift similarity index 100% rename from Sources/OpenSwiftUICore/Render/CoreAnimation/CAFrameRateRangeUtil.swift rename to Sources/OpenSwiftUICore/Render/Util/CAFrameRateRangeUtil.swift diff --git a/Sources/OpenSwiftUICore/Render/Util/CGBlendModeUtil.swift b/Sources/OpenSwiftUICore/Render/Util/CGBlendModeUtil.swift new file mode 100644 index 000000000..bc5167c68 --- /dev/null +++ b/Sources/OpenSwiftUICore/Render/Util/CGBlendModeUtil.swift @@ -0,0 +1,39 @@ +// +// CGBlendModeUtil.swift +// OpenSwiftUICore +// +// Audited for 6.5.4 +// Status: Complete + +#if canImport(CoreGraphics) +package import CoreGraphics + +extension BlendMode { + package init(_ blendMode: CGBlendMode) { + self = switch blendMode { + case .normal: .normal + case .multiply: .multiply + case .screen: .screen + case .overlay: .overlay + case .darken: .darken + case .lighten: .lighten + case .colorDodge: .colorDodge + case .colorBurn: .colorBurn + case .softLight: .softLight + case .hardLight: .hardLight + case .difference: .difference + case .exclusion: .exclusion + case .hue: .hue + case .saturation: .saturation + case .color: .color + case .luminosity: .luminosity + case .sourceAtop: .sourceAtop + case .destinationOver: .destinationOver + case .destinationOut: .destinationOut + case .plusDarker: .plusDarker + case .plusLighter: .plusLighter + default: .normal + } + } +} +#endif diff --git a/Sources/OpenSwiftUICore/Shape/FillStyle.swift b/Sources/OpenSwiftUICore/Shape/FillStyle.swift index a8e2d932b..35ccc7b27 100644 --- a/Sources/OpenSwiftUICore/Shape/FillStyle.swift +++ b/Sources/OpenSwiftUICore/Shape/FillStyle.swift @@ -2,10 +2,11 @@ // FillStyle.swift // OpenSwiftUICore // -// Audited for 6.0.87 +// Audited for 6.5.4 // Status: Complete /// A style for rasterizing vector shapes. +@available(OpenSwiftUI_v1_0, *) @frozen public struct FillStyle: Equatable { diff --git a/Sources/OpenSwiftUICore/Shape/PathDrawingStyle.swift b/Sources/OpenSwiftUICore/Shape/PathDrawingStyle.swift deleted file mode 100644 index 9594bf26d..000000000 --- a/Sources/OpenSwiftUICore/Shape/PathDrawingStyle.swift +++ /dev/null @@ -1,11 +0,0 @@ -// -// PathDrawingStyle.swift -// OpenSwiftUICore -// -// Audited for 6.0.87 -// Status: Complete - -package enum PathDrawingStyle { - case fill(FillStyle) - case stroke(StrokeStyle) -} diff --git a/Sources/OpenSwiftUICore/Shape/ShapeStyle/BlendMode.swift b/Sources/OpenSwiftUICore/Shape/ShapeStyle/BlendMode.swift index 2874bb20c..a30ebd685 100644 --- a/Sources/OpenSwiftUICore/Shape/ShapeStyle/BlendMode.swift +++ b/Sources/OpenSwiftUICore/Shape/ShapeStyle/BlendMode.swift @@ -8,6 +8,7 @@ // MARK: - BlendMode /// Modes for compositing a view with overlapping content. +@available(OpenSwiftUI_v1_0, *) public enum BlendMode: Sendable { case normal case multiply @@ -32,39 +33,6 @@ public enum BlendMode: Sendable { case plusLighter } -#if canImport(CoreGraphics) -package import CoreGraphics - -extension BlendMode { - package init(_ blendMode: CGBlendMode) { - self = switch blendMode { - case .normal: .normal - case .multiply: .multiply - case .screen: .screen - case .overlay: .overlay - case .darken: .darken - case .lighten: .lighten - case .colorDodge: .colorDodge - case .colorBurn: .colorBurn - case .softLight: .softLight - case .hardLight: .hardLight - case .difference: .difference - case .exclusion: .exclusion - case .hue: .hue - case .saturation: .saturation - case .color: .color - case .luminosity: .luminosity - case .sourceAtop: .sourceAtop - case .destinationOver: .destinationOver - case .destinationOut: .destinationOut - case .plusDarker: .plusDarker - case .plusLighter: .plusLighter - default: .normal - } - } -} -#endif - extension ShapeStyle { /// Returns a new style based on `self` that applies the specified /// blend mode when drawing. diff --git a/Sources/OpenSwiftUICore/Shape/ShapeStyle/ShapeStyleRenderedShape.swift b/Sources/OpenSwiftUICore/Shape/ShapeStyle/ShapeStyleRendering.swift similarity index 94% rename from Sources/OpenSwiftUICore/Shape/ShapeStyle/ShapeStyleRenderedShape.swift rename to Sources/OpenSwiftUICore/Shape/ShapeStyle/ShapeStyleRendering.swift index 9027315a6..b0be82412 100644 --- a/Sources/OpenSwiftUICore/Shape/ShapeStyle/ShapeStyleRenderedShape.swift +++ b/Sources/OpenSwiftUICore/Shape/ShapeStyle/ShapeStyleRendering.swift @@ -1,10 +1,10 @@ // -// ShapeStyle_RenderedShape.swift +// ShapeStyleRendering.swift // OpenSwiftUICore // // Audited for 6.0.87 // Status: WIP -// ID: 3890C65F12EA82A4BC5FBD33046B67FA (?) +// ID: 3890C65F12EA82A4BC5FBD33046B67FA (SwiftUICore) extension ShapeStyle { package typealias RenderedShape = _ShapeStyle_RenderedShape diff --git a/Sources/OpenSwiftUICore/Shape/StrokeStyle.swift b/Sources/OpenSwiftUICore/Shape/StrokeStyle.swift index f1bcc1166..86da0b12c 100644 --- a/Sources/OpenSwiftUICore/Shape/StrokeStyle.swift +++ b/Sources/OpenSwiftUICore/Shape/StrokeStyle.swift @@ -2,13 +2,14 @@ // StrokeStyle.swift // OpenSwiftUICore // -// Audited for 6.0.87 +// Audited for 6.5.4 // Status: Complete public import Foundation public import OpenCoreGraphicsShims /// The characteristics of a stroke that traces a path. +@available(OpenSwiftUI_v1_0, *) @frozen public struct StrokeStyle: Equatable { /// The width of the stroked path. @@ -51,6 +52,7 @@ public struct StrokeStyle: Equatable { } } +@available(OpenSwiftUI_v1_0, *) extension StrokeStyle: Animatable { public var animatableData: AnimatablePair> { get { diff --git a/Tests/OpenSwiftUICoreTests/Render/CoreAnimation/CAFrameRateRangeUtilTests.swift b/Tests/OpenSwiftUICoreTests/Render/Util/CAFrameRateRangeUtilTests.swift similarity index 100% rename from Tests/OpenSwiftUICoreTests/Render/CoreAnimation/CAFrameRateRangeUtilTests.swift rename to Tests/OpenSwiftUICoreTests/Render/Util/CAFrameRateRangeUtilTests.swift