Skip to content
Merged
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
5 changes: 5 additions & 0 deletions Sources/OpenSwiftUICore/Graphic/GraphicsContext.swift
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
39 changes: 39 additions & 0 deletions Sources/OpenSwiftUICore/Render/Util/CGBlendModeUtil.swift
Original file line number Diff line number Diff line change
@@ -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
3 changes: 2 additions & 1 deletion Sources/OpenSwiftUICore/Shape/FillStyle.swift
Original file line number Diff line number Diff line change
Expand Up @@ -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 {

Expand Down
11 changes: 0 additions & 11 deletions Sources/OpenSwiftUICore/Shape/PathDrawingStyle.swift

This file was deleted.

34 changes: 1 addition & 33 deletions Sources/OpenSwiftUICore/Shape/ShapeStyle/BlendMode.swift
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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.
Expand Down
Original file line number Diff line number Diff line change
@@ -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
Expand Down
4 changes: 3 additions & 1 deletion Sources/OpenSwiftUICore/Shape/StrokeStyle.swift
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down Expand Up @@ -51,6 +52,7 @@ public struct StrokeStyle: Equatable {
}
}

@available(OpenSwiftUI_v1_0, *)
extension StrokeStyle: Animatable {
public var animatableData: AnimatablePair<CGFloat, AnimatablePair<CGFloat, CGFloat>> {
get {
Expand Down
Loading