From c893a3c262d6942afccb182609e06e79e6d982fe Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tomas=20Franze=CC=81n?= Date: Sun, 28 Jul 2024 18:51:26 +0200 Subject: [PATCH] Simplify ApplyColor --- Sources/SwiftSCAD/Development/ApplyColor.swift | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/Sources/SwiftSCAD/Development/ApplyColor.swift b/Sources/SwiftSCAD/Development/ApplyColor.swift index 93aad31..e86e8a5 100644 --- a/Sources/SwiftSCAD/Development/ApplyColor.swift +++ b/Sources/SwiftSCAD/Development/ApplyColor.swift @@ -12,12 +12,12 @@ struct ApplyColor3D: WrappedGeometry3D { var invocation: Invocation? { color.invocation } } -extension Geometry2D { - public func colored(_ color: Color) -> any Geometry2D { +public extension Geometry2D { + func colored(_ color: Color) -> any Geometry2D { ApplyColor2D(color: color, body: self) } - public func colored(_ color: Color, alpha: Double) -> any Geometry2D { + func colored(_ color: Color, alpha: Double) -> any Geometry2D { ApplyColor2D(color: color.withAlphaComponent(alpha), body: self) } @@ -28,17 +28,17 @@ extension Geometry2D { /// - blue: The blue component, in the range 0.0 to 1.0. /// - alpha: The alpha component, in the range 0.0 to 1.0. /// - Returns: A colored geometry - public func colored(red: Double, green: Double, blue: Double, alpha: Double = 1) -> any Geometry2D { + func colored(red: Double, green: Double, blue: Double, alpha: Double = 1) -> any Geometry2D { ApplyColor2D(color: .init(red: red, green: green, blue: blue, alpha: alpha), body: self) } } -extension Geometry3D { - public func colored(_ color: Color) -> any Geometry3D { +public extension Geometry3D { + func colored(_ color: Color) -> any Geometry3D { ApplyColor3D(color: color, body: self) } - public func colored(_ color: Color, alpha: Double) -> any Geometry3D { + func colored(_ color: Color, alpha: Double) -> any Geometry3D { ApplyColor3D(color: color.withAlphaComponent(alpha), body: self) } @@ -49,7 +49,7 @@ extension Geometry3D { /// - blue: The blue component, in the range 0.0 to 1.0. /// - alpha: The alpha component, in the range 0.0 to 1.0. /// - Returns: A colored geometry - public func colored(red: Double, green: Double, blue: Double, alpha: Double = 1) -> any Geometry3D { + func colored(red: Double, green: Double, blue: Double, alpha: Double = 1) -> any Geometry3D { ApplyColor3D(color: .init(red: red, green: green, blue: blue, alpha: alpha), body: self) } }