Interface CoreGraphics

All Superinterfaces:
Library

public interface CoreGraphics extends Library
Bindings for the macOS CoreGraphics framework, specifically the Quartz Window Services and Quartz Display Services APIs.

CoreGraphics provides low-level 2D rendering and, on macOS, services for working with display hardware, low-level user input events, and the windowing system.

See Also:
  • Field Details

    • INSTANCE

      static final CoreGraphics INSTANCE
    • kCGWindowListOptionAll

      static final int kCGWindowListOptionAll
      List all windows, including off-screen windows.
      See Also:
    • kCGWindowListOptionOnScreenOnly

      static final int kCGWindowListOptionOnScreenOnly
      List only on-screen windows.
      See Also:
    • kCGWindowListOptionOnScreenAboveWindow

      static final int kCGWindowListOptionOnScreenAboveWindow
      List on-screen windows above the specified window.
      See Also:
    • kCGWindowListOptionOnScreenBelowWindow

      static final int kCGWindowListOptionOnScreenBelowWindow
      List on-screen windows below the specified window.
      See Also:
    • kCGWindowListOptionIncludingWindow

      static final int kCGWindowListOptionIncludingWindow
      Include the specified window.
      See Also:
    • kCGWindowListExcludeDesktopElements

      static final int kCGWindowListExcludeDesktopElements
      Exclude desktop elements (wallpaper, icons).
      See Also:
    • kCGNullWindowID

      static final int kCGNullWindowID
      A null window ID, used as the relativeToWindow parameter.
      See Also:
    • kCGWindowImageDefault

      static final int kCGWindowImageDefault
      Default window image options.
      See Also:
    • kCGWindowImageBoundsIgnoreFraming

      static final int kCGWindowImageBoundsIgnoreFraming
      Include window frame decorations in the image.
      See Also:
    • kCGWindowImageShouldBeOpaque

      static final int kCGWindowImageShouldBeOpaque
      Only include the specified window (not windows below it).
      See Also:
    • kCGWindowImageOnlyShadows

      static final int kCGWindowImageOnlyShadows
      Only capture the shadow of the window.
      See Also:
    • kCGWindowImageBestResolution

      static final int kCGWindowImageBestResolution
      Use best resolution regardless of display. @since macOS 10.9
      See Also:
    • kCGWindowImageNominalResolution

      static final int kCGWindowImageNominalResolution
      Use nominal resolution. @since macOS 10.9
      See Also:
    • kCGWindowNumber

      static final String kCGWindowNumber
      Key for the window ID (CGWindowID, a CFNumber).
      See Also:
    • kCGWindowStoreType

      static final String kCGWindowStoreType
      Key for the window's Core Graphics backing store type (CFNumber).
      See Also:
    • kCGWindowLayer

      static final String kCGWindowLayer
      Key for the window layer (CFNumber). Windows with layer 0 are normal windows.
      See Also:
    • kCGWindowBounds

      static final String kCGWindowBounds
      Key for the window bounds (CFDictionary with X, Y, Width, Height). Use CGRectMakeWithDictionaryRepresentation(CoreFoundation.CFDictionaryRef, CoreGraphics.CGRect) to parse.
      See Also:
    • kCGWindowSharingState

      static final String kCGWindowSharingState
      Key for the sharing state (CFNumber).
      See Also:
    • kCGWindowAlpha

      static final String kCGWindowAlpha
      Key for the window alpha/opacity (CFNumber, 0.0-1.0).
      See Also:
    • kCGWindowOwnerPID

      static final String kCGWindowOwnerPID
      Key for the owning process ID (CFNumber, a pid_t).
      See Also:
    • kCGWindowMemoryUsage

      static final String kCGWindowMemoryUsage
      Key for the memory usage of the window in bytes (CFNumber).
      See Also:
    • kCGWindowName

      static final String kCGWindowName
      Key for the window name/title (CFString). May be absent if the window has no title or the caller lacks permissions.
      See Also:
    • kCGWindowOwnerName

      static final String kCGWindowOwnerName
      Key for the name of the process that owns the window (CFString).
      See Also:
    • kCGWindowIsOnscreen

      static final String kCGWindowIsOnscreen
      Key for whether the window is on screen (CFBoolean).
      See Also:
    • kCGWindowBackingLocationVideoMemory

      static final String kCGWindowBackingLocationVideoMemory
      Key for the backing location type (CFNumber).
      See Also:
    • kCGWindowSharingNone

      static final int kCGWindowSharingNone
      Window contents cannot be read.
      See Also:
    • kCGWindowSharingReadOnly

      static final int kCGWindowSharingReadOnly
      Window contents can be read only by the owning process.
      See Also:
    • kCGWindowSharingReadWrite

      static final int kCGWindowSharingReadWrite
      Window contents can be read by any process.
      See Also:
    • kCGBackingStoreRetained

      static final int kCGBackingStoreRetained
      Retained backing store (deprecated).
      See Also:
    • kCGBackingStoreNonretained

      static final int kCGBackingStoreNonretained
      Non-retained backing store (deprecated).
      See Also:
    • kCGBackingStoreBuffered

      static final int kCGBackingStoreBuffered
      Buffered backing store.
      See Also:
  • Method Details

    • CGWindowListCopyWindowInfo

      CoreFoundation.CFArrayRef CGWindowListCopyWindowInfo(int option, int relativeToWindow)
      Returns information about the windows in the current user session.

      Each element in the returned array is a CFDictionary containing window properties keyed by the kCGWindow* constants.

      Parameters:
      option - a combination of kCGWindowListOption* constants specifying which windows to include
      relativeToWindow - the window ID to use as a reference point for above/below options, or kCGNullWindowID for all windows
      Returns:
      a CFArray of CFDictionary objects describing each window, or null on failure. The caller is responsible for releasing the array.
      See Also:
    • CGRectMakeWithDictionaryRepresentation

      byte CGRectMakeWithDictionaryRepresentation(CoreFoundation.CFDictionaryRef dict, CoreGraphics.CGRect rect)
      Creates a CoreGraphics.CGRect from a dictionary representation (as returned in the kCGWindowBounds key of window info dictionaries).
      Parameters:
      dict - the dictionary containing X, Y, Width, and Height keys
      rect - a CoreGraphics.CGRect structure to populate
      Returns:
      non-zero if the conversion was successful
      See Also:
    • CGMainDisplayID

      int CGMainDisplayID()
      Returns the display ID of the main display.

      The main display is the display with its screen location at (0,0) in the global display coordinate space. In a system without display mirroring, the display with the menu bar is typically the main display.

      Returns:
      the main display ID
      See Also:
    • CGDisplayBounds

      CoreGraphics.CGRect.ByValue CGDisplayBounds(int display)
      Returns the bounds of a display in the global display coordinate space.
      Parameters:
      display - the display ID
      Returns:
      a CoreGraphics.CGRect describing the display bounds
      See Also:
    • CGDisplayPixelsWide

      LibCAPI.size_t CGDisplayPixelsWide(int display)
      Returns the width in pixels of a display.
      Parameters:
      display - the display ID
      Returns:
      the width in pixels
      See Also:
    • CGDisplayPixelsHigh

      LibCAPI.size_t CGDisplayPixelsHigh(int display)
      Returns the height in pixels of a display.
      Parameters:
      display - the display ID
      Returns:
      the height in pixels
      See Also:
    • CGGetActiveDisplayList

      int CGGetActiveDisplayList(int maxDisplays, int[] activeDisplays, IntByReference displayCount)
      Provides a list of displays that are active (or drawable).
      Parameters:
      maxDisplays - maximum number of displays to return
      activeDisplays - an array to fill with display IDs
      displayCount - receives the actual number of displays
      Returns:
      0 (kCGErrorSuccess) on success
      See Also:
    • CGGetOnlineDisplayList

      int CGGetOnlineDisplayList(int maxDisplays, int[] onlineDisplays, IntByReference displayCount)
      Provides a list of online displays (active or mirrored).
      Parameters:
      maxDisplays - maximum number of displays to return
      onlineDisplays - an array to fill with display IDs
      displayCount - receives the actual number of displays
      Returns:
      0 (kCGErrorSuccess) on success
      See Also:
    • CGDisplayRotation

      double CGDisplayRotation(int display)
      Returns the rotation angle of a display in degrees.
      Parameters:
      display - the display ID
      Returns:
      the rotation angle (0, 90, 180, or 270)
      See Also:
    • CGDisplayIsActive

      int CGDisplayIsActive(int display)
      Returns whether a display is active.
      Parameters:
      display - the display ID
      Returns:
      non-zero if the display is active
    • CGDisplayIsMain

      int CGDisplayIsMain(int display)
      Returns whether a display is the main display.
      Parameters:
      display - the display ID
      Returns:
      non-zero if the display is the main display
    • CGDisplayIsBuiltin

      int CGDisplayIsBuiltin(int display)
      Returns whether a display is built-in (e.g., a laptop screen).
      Parameters:
      display - the display ID
      Returns:
      non-zero if the display is built-in
    • CGDisplayVendorNumber

      int CGDisplayVendorNumber(int display)
      Returns the vendor number for a display.
      Parameters:
      display - the display ID
      Returns:
      the vendor number
    • CGDisplayModelNumber

      int CGDisplayModelNumber(int display)
      Returns the model number for a display.
      Parameters:
      display - the display ID
      Returns:
      the model number
    • CGDisplaySerialNumber

      int CGDisplaySerialNumber(int display)
      Returns the serial number for a display.
      Parameters:
      display - the display ID
      Returns:
      the serial number