PlanetKitScreenCaptureWindow

public class PlanetKitScreenCaptureWindow : NSObject

A window used for screen capture in the PlanetKit framework.

  • The ID of the window.

    Declaration

    Swift

    @objc
    public private(set) var windowID: CGWindowID { get }
  • Sets a custom filter if you want to select and capture part or all of a window for the target application.

    Remark

    If you do not set the filter, the default filter is used for capturing depending on the Bundle ID internally. If you want to easily capture an app that consists of multiple windows, consider using hasMultipleWindows.

    Declaration

    Swift

    @objc
    public weak var windowFilter: PlanetKitScreenCaptureWindowFilterControllable?
  • The image representation of the window.

    Declaration

    Swift

    @objc
    public var image: CGImage? { get }
  • The backing type of the window.

    Declaration

    Swift

    @objc
    public var backingType: CGWindowBackingType { get }
  • The level of the window.

    Declaration

    Swift

    @objc
    public var level: CGWindowLevel { get }
  • The bounds of the window.

    Declaration

    Swift

    @objc
    public var bounds: CGRect { get }
  • The sharing type of the window.

    Declaration

    Swift

    @objc
    public var sharingType: CGWindowSharingType { get }
  • The alpha value of the window.

    Declaration

    Swift

    @objc
    public var alpha: CGFloat { get }
  • pid

    The process ID of the window’s owner.

    Declaration

    Swift

    @objc
    public var pid: Int32 { get }
  • The memory usage of the window.

    Declaration

    Swift

    @objc
    public var memoryUsage: Int64 { get }
  • The name of the window’s owner.

    Declaration

    Swift

    @objc
    public var ownerName: String { get }
  • The name of the window.

    Declaration

    Swift

    @objc
    public var windowName: String { get }
  • Indicates whether the window is on screen.

    Remark

    This value remembers whether the PlanetKitScreenCaptureWindow was on screen at the time it was created. To check if it is currently visible on the screen, use isVisibleOnScreen.

    Declaration

    Swift

    @objc
    public var isOnScreen: Bool { get }
  • Indicates whether the window’s backing is located in video memory.

    Declaration

    Swift

    @objc
    public var isBackingLocationVideoMemory: Bool { get }
  • The rectangle of the captured window image.

    Remark

    If the last window image is captured successfully from PlanetKitScreenCaptureWindow.capture(), the captured window rectangle will be set at capturedBounds. The default value is .zero. This value is based on the screen coordinates system.

    Declaration

    Swift

    @objc
    public internal(set) var capturedBounds: CGRect { get }
  • The bundle identifier of the window’s owner.

    Declaration

    Swift

    @objc
    public var bundleId: String? { get }
  • The bundle object associated with the window’s bundle ID.

    Declaration

    Swift

    @objc
    public var bundle: Bundle? { get }
  • Indicates whether the target application window has multiple windows and the whole windows or a specific window need to be captured.

    Remark

    The default value is false.

    Declaration

    Swift

    @objc
    public var hasMultipleWindows: Bool
  • Checks if the window with the specified window ID is currently visible on the screen.

    Declaration

    Swift

    @objc
    public var isVisibleOnScreen: Bool
  • Initializes a PlanetKitScreenCaptureWindow instance with the given window ID.

    Declaration

    Swift

    @objc
    public convenience init?(windowID: CGWindowID, inDesktop: Bool = false)

    Parameters

    windowID

    The ID of the window.

    inDesktop

    Indicates whether the window is in the desktop.

  • A textual representation of the PlanetKitScreenCaptureWindow instance.

    Declaration

    Swift

    public override var description: String { get }
  • Returns an array of PlanetKitScreenCaptureWindow instances based on the given window ID and option.

    Declaration

    Swift

    @objc
    public static func list(windowID: CGWindowID, option: CGWindowListOption) -> [PlanetKitScreenCaptureWindow]

    Parameters

    windowID

    The ID of the window.

    option

    The option for window list.

    Return Value

    An array of PlanetKitScreenCaptureWindow instances.

  • Returns a PlanetKitScreenCaptureWindow instance based on the given window ID.

    Declaration

    Swift

    @objc
    public static func get(windowID: CGWindowID) -> PlanetKitScreenCaptureWindow?

    Parameters

    windowID

    The ID of the window.

    Return Value

    A PlanetKitScreenCaptureWindow instance.

  • Returns an array of PlanetKitScreenCaptureWindow instances based on the given process ID.

    Declaration

    Swift

    @objc
    public static func get(pid: Int32) -> [PlanetKitScreenCaptureWindow]

    Parameters

    pid

    The process ID.

    Return Value

    An array of PlanetKitScreenCaptureWindow instances.

Capturable