Interface CoreGraphics
- All Superinterfaces:
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:
-
Nested Class Summary
Nested ClassesModifier and TypeInterfaceDescriptionstatic classA point in the Core Graphics coordinate system.static classA rectangle in the Core Graphics coordinate system.static classA size in the Core Graphics coordinate system.Nested classes/interfaces inherited from interface Library
Library.Handler -
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final CoreGraphicsstatic final intBuffered backing store.static final intNon-retained backing store (deprecated).static final intRetained backing store (deprecated).static final intA null window ID, used as the relativeToWindow parameter.static final StringKey for the window alpha/opacity (CFNumber, 0.0-1.0).static final StringKey for the backing location type (CFNumber).static final StringKey for the window bounds (CFDictionarywith X, Y, Width, Height).static final intUse best resolution regardless of display.static final intInclude window frame decorations in the image.static final intDefault window image options.static final intUse nominal resolution.static final intOnly capture the shadow of the window.static final intOnly include the specified window (not windows below it).static final StringKey for whether the window is on screen (CFBoolean).static final StringKey for the window layer (CFNumber).static final intExclude desktop elements (wallpaper, icons).static final intList all windows, including off-screen windows.static final intInclude the specified window.static final intList on-screen windows above the specified window.static final intList on-screen windows below the specified window.static final intList only on-screen windows.static final StringKey for the memory usage of the window in bytes (CFNumber).static final StringKey for the window name/title (CFString).static final StringKey for the window ID (CGWindowID, aCFNumber).static final StringKey for the name of the process that owns the window (CFString).static final StringKey for the owning process ID (CFNumber, apid_t).static final intWindow contents cannot be read.static final intWindow contents can be read only by the owning process.static final intWindow contents can be read by any process.static final StringKey for the sharing state (CFNumber).static final StringKey for the window's Core Graphics backing store type (CFNumber). -
Method Summary
Modifier and TypeMethodDescriptionCGDisplayBounds(int display) Returns the bounds of a display in the global display coordinate space.intCGDisplayIsActive(int display) Returns whether a display is active.intCGDisplayIsBuiltin(int display) Returns whether a display is built-in (e.g., a laptop screen).intCGDisplayIsMain(int display) Returns whether a display is the main display.intCGDisplayModelNumber(int display) Returns the model number for a display.CGDisplayPixelsHigh(int display) Returns the height in pixels of a display.CGDisplayPixelsWide(int display) Returns the width in pixels of a display.doubleCGDisplayRotation(int display) Returns the rotation angle of a display in degrees.intCGDisplaySerialNumber(int display) Returns the serial number for a display.intCGDisplayVendorNumber(int display) Returns the vendor number for a display.intCGGetActiveDisplayList(int maxDisplays, int[] activeDisplays, IntByReference displayCount) Provides a list of displays that are active (or drawable).intCGGetOnlineDisplayList(int maxDisplays, int[] onlineDisplays, IntByReference displayCount) Provides a list of online displays (active or mirrored).intReturns the display ID of the main display.byteCGRectMakeWithDictionaryRepresentation(CoreFoundation.CFDictionaryRef dict, CoreGraphics.CGRect rect) Creates aCoreGraphics.CGRectfrom a dictionary representation (as returned in thekCGWindowBoundskey of window info dictionaries).CGWindowListCopyWindowInfo(int option, int relativeToWindow) Returns information about the windows in the current user session.
-
Field Details
-
INSTANCE
-
kCGWindowListOptionAll
static final int kCGWindowListOptionAllList all windows, including off-screen windows.- See Also:
-
kCGWindowListOptionOnScreenOnly
static final int kCGWindowListOptionOnScreenOnlyList only on-screen windows.- See Also:
-
kCGWindowListOptionOnScreenAboveWindow
static final int kCGWindowListOptionOnScreenAboveWindowList on-screen windows above the specified window.- See Also:
-
kCGWindowListOptionOnScreenBelowWindow
static final int kCGWindowListOptionOnScreenBelowWindowList on-screen windows below the specified window.- See Also:
-
kCGWindowListOptionIncludingWindow
static final int kCGWindowListOptionIncludingWindowInclude the specified window.- See Also:
-
kCGWindowListExcludeDesktopElements
static final int kCGWindowListExcludeDesktopElementsExclude desktop elements (wallpaper, icons).- See Also:
-
kCGNullWindowID
static final int kCGNullWindowIDA null window ID, used as the relativeToWindow parameter.- See Also:
-
kCGWindowImageDefault
static final int kCGWindowImageDefaultDefault window image options.- See Also:
-
kCGWindowImageBoundsIgnoreFraming
static final int kCGWindowImageBoundsIgnoreFramingInclude window frame decorations in the image.- See Also:
-
kCGWindowImageShouldBeOpaque
static final int kCGWindowImageShouldBeOpaqueOnly include the specified window (not windows below it).- See Also:
-
kCGWindowImageOnlyShadows
static final int kCGWindowImageOnlyShadowsOnly capture the shadow of the window.- See Also:
-
kCGWindowImageBestResolution
static final int kCGWindowImageBestResolutionUse best resolution regardless of display. @since macOS 10.9- See Also:
-
kCGWindowImageNominalResolution
static final int kCGWindowImageNominalResolutionUse nominal resolution. @since macOS 10.9- See Also:
-
kCGWindowNumber
-
kCGWindowStoreType
Key for the window's Core Graphics backing store type (CFNumber).- See Also:
-
kCGWindowLayer
Key for the window layer (CFNumber). Windows with layer 0 are normal windows.- See Also:
-
kCGWindowBounds
Key for the window bounds (CFDictionarywith X, Y, Width, Height). UseCGRectMakeWithDictionaryRepresentation(CoreFoundation.CFDictionaryRef, CoreGraphics.CGRect)to parse.- See Also:
-
kCGWindowSharingState
-
kCGWindowAlpha
-
kCGWindowOwnerPID
-
kCGWindowMemoryUsage
Key for the memory usage of the window in bytes (CFNumber).- See Also:
-
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
Key for the name of the process that owns the window (CFString).- See Also:
-
kCGWindowIsOnscreen
Key for whether the window is on screen (CFBoolean).- See Also:
-
kCGWindowBackingLocationVideoMemory
Key for the backing location type (CFNumber).- See Also:
-
kCGWindowSharingNone
static final int kCGWindowSharingNoneWindow contents cannot be read.- See Also:
-
kCGWindowSharingReadOnly
static final int kCGWindowSharingReadOnlyWindow contents can be read only by the owning process.- See Also:
-
kCGWindowSharingReadWrite
static final int kCGWindowSharingReadWriteWindow contents can be read by any process.- See Also:
-
kCGBackingStoreRetained
static final int kCGBackingStoreRetainedRetained backing store (deprecated).- See Also:
-
kCGBackingStoreNonretained
static final int kCGBackingStoreNonretainedNon-retained backing store (deprecated).- See Also:
-
kCGBackingStoreBuffered
static final int kCGBackingStoreBufferedBuffered backing store.- See Also:
-
-
Method Details
-
CGWindowListCopyWindowInfo
Returns information about the windows in the current user session.Each element in the returned array is a
CFDictionarycontaining window properties keyed by thekCGWindow*constants.- Parameters:
option- a combination ofkCGWindowListOption*constants specifying which windows to includerelativeToWindow- the window ID to use as a reference point for above/below options, orkCGNullWindowIDfor all windows- Returns:
- a
CFArrayofCFDictionaryobjects describing each window, ornullon failure. The caller is responsible for releasing the array. - See Also:
-
CGRectMakeWithDictionaryRepresentation
byte CGRectMakeWithDictionaryRepresentation(CoreFoundation.CFDictionaryRef dict, CoreGraphics.CGRect rect) Creates aCoreGraphics.CGRectfrom a dictionary representation (as returned in thekCGWindowBoundskey of window info dictionaries).- Parameters:
dict- the dictionary containing X, Y, Width, and Height keysrect- aCoreGraphics.CGRectstructure 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
Returns the bounds of a display in the global display coordinate space.- Parameters:
display- the display ID- Returns:
- a
CoreGraphics.CGRectdescribing the display bounds - See Also:
-
CGDisplayPixelsWide
Returns the width in pixels of a display.- Parameters:
display- the display ID- Returns:
- the width in pixels
- See Also:
-
CGDisplayPixelsHigh
Returns the height in pixels of a display.- Parameters:
display- the display ID- Returns:
- the height in pixels
- See Also:
-
CGGetActiveDisplayList
Provides a list of displays that are active (or drawable).- Parameters:
maxDisplays- maximum number of displays to returnactiveDisplays- an array to fill with display IDsdisplayCount- receives the actual number of displays- Returns:
- 0 (
kCGErrorSuccess) on success - See Also:
-
CGGetOnlineDisplayList
Provides a list of online displays (active or mirrored).- Parameters:
maxDisplays- maximum number of displays to returnonlineDisplays- an array to fill with display IDsdisplayCount- 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
-