Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add isFlippedCropRect option #66

Closed
wants to merge 2 commits into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
8 changes: 7 additions & 1 deletion Sources/Aperture/Aperture.swift
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,8 @@ public final class Aperture: NSObject {
highlightClicks: Bool,
screenId: CGDirectDisplayID = .main,
audioDevice: AVCaptureDevice? = .default(for: .audio),
videoCodec: String? = nil
videoCodec: String? = nil,
isFlippedCropRect: Bool? = false
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This parameter needs to be documented in a doc comment. It should say what it does and what it's useful for.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

And it's should not be an optional.

) throws {
self.destination = destination
session = AVCaptureSession()
Expand All @@ -51,6 +52,11 @@ public final class Aperture: NSObject {

if let cropRect = cropRect {
input.cropRect = cropRect

if isFlippedCropRect {
var screenHeight = CGDisplayScreenSize(screenId).height
IAmJSD marked this conversation as resolved.
Show resolved Hide resolved
input.cropRect.y = screenHeight - (input.cropRect.y + input.cropRect.height)
}
}

input.capturesCursor = showCursor
Expand Down