-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
18 changed files
with
93 additions
and
57 deletions.
There are no files selected for viewing
File renamed without changes.
19 changes: 19 additions & 0 deletions
19
Modules/Capabilities/Redactions/Sources/GeometryExtensions.swift
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
// Created by Geoff Pado on 5/8/24. | ||
// Copyright © 2024 Cocoatype, LLC. All rights reserved. | ||
|
||
import CoreGraphics | ||
|
||
extension CGPoint { | ||
static func flippedPoint(from point: CGPoint, scaledTo size: CGSize) -> CGPoint { | ||
var scaledPoint = point | ||
|
||
#if canImport(UIKit) | ||
scaledPoint.y = (1.0 - scaledPoint.y) | ||
#endif | ||
|
||
scaledPoint.x *= size.width | ||
scaledPoint.y *= size.height | ||
|
||
return scaledPoint | ||
} | ||
} |
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
// Created by Geoff Pado on 5/6/19. | ||
// Copyright © 2019 Cocoatype, LLC. All rights reserved. | ||
|
||
public struct Redaction: Equatable { | ||
public let color: RedactionColor | ||
public let parts: [RedactionPart] | ||
|
||
init(color: RedactionColor, parts: [RedactionPart]) { | ||
self.color = color | ||
self.parts = parts.filter { part in | ||
if case .shape(let shape) = part { | ||
return shape.isNotEmpty | ||
} else { return true } | ||
} | ||
} | ||
|
||
public var paths: [RedactionPath] { | ||
parts.map(\.path) | ||
} | ||
} |
14 changes: 14 additions & 0 deletions
14
Modules/Capabilities/Redactions/Sources/RedactionDefinitions.swift
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
// Created by Geoff Pado on 5/8/24. | ||
// Copyright © 2024 Cocoatype, LLC. All rights reserved. | ||
|
||
#if canImport(AppKit) && !targetEnvironment(macCatalyst) | ||
import AppKit | ||
|
||
public typealias RedactionColor = NSColor | ||
public typealias RedactionPath = NSBezierPath | ||
#elseif canImport(UIKit) | ||
import UIKit | ||
|
||
public typealias RedactionColor = UIColor | ||
public typealias RedactionPath = UIBezierPath | ||
#endif |
14 changes: 14 additions & 0 deletions
14
Modules/Capabilities/Redactions/Sources/RedactionPart.swift
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
// Created by Geoff Pado on 5/8/24. | ||
// Copyright © 2024 Cocoatype, LLC. All rights reserved. | ||
|
||
public enum RedactionPart: Equatable { | ||
case path(RedactionPath) | ||
case shape(Shape) | ||
|
||
var path: RedactionPath { | ||
switch self { | ||
case .path(let path): return path | ||
case .shape(let shape): return RedactionPath(cgPath: shape.path) | ||
} | ||
} | ||
} |
File renamed without changes.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
// file intentionally left blank |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
import ProjectDescription | ||
|
||
public enum Redactions { | ||
public static let target = Target.capabilitiesTarget(name: "Redactions") | ||
|
||
public static let testTarget = Target.capabilitiesTestTarget(name: "Redactions") | ||
} |