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

[CoreGraphics] Implement Xcode 16.0 beta 1-6 changes. #21033

Merged
merged 4 commits into from
Aug 26, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
35 changes: 35 additions & 0 deletions src/CoreGraphics/CGColorSpace.cs
Original file line number Diff line number Diff line change
Expand Up @@ -1005,6 +1005,41 @@ public bool UsesExtendedRange {
#endif
public bool IsPQBased => CGColorSpaceIsPQBased (Handle) != 0;

#if NET
[SupportedOSPlatform ("macos15.0")]
[SupportedOSPlatform ("ios18.0")]
[SupportedOSPlatform ("tvos18.0")]
[SupportedOSPlatform ("maccatalyst18.0")]
#else
[Mac (15, 0)]
[iOS (18, 0)]
[TV (18, 0)]
[MacCatalyst (18, 0)]
[Watch (11, 0)]
#endif
[DllImport (Constants.CoreGraphicsLibrary)]
extern static /* CGColorSpaceRef */ IntPtr CGColorSpaceCopyBaseColorSpace (/* CGColorSpaceRef */ IntPtr space);

/// <summary>Get the base color space, or a new color space without any image-specific metadata.</summary>
/// <returns>If the current color space is a pattern or an indexed color space, get the base color space. If the current color space contains image-specific metadata associated with the gain map, get a new color space without the metadata. Otherwise returns a null value.</returns>
#if NET
[SupportedOSPlatform ("macos15.0")]
[SupportedOSPlatform ("ios18.0")]
[SupportedOSPlatform ("tvos18.0")]
[SupportedOSPlatform ("maccatalyst18.0")]
#else
[Mac (15, 0)]
[iOS (18, 0)]
[TV (18, 0)]
[MacCatalyst (18, 0)]
[Watch (11, 0)]
#endif
public CGColorSpace? CopyBaseColorSpace ()
{
var h = CGColorSpaceCopyBaseColorSpace (Handle);
return FromHandle (h, true);
}


#endif // !COREBUILD
}
Expand Down
103 changes: 103 additions & 0 deletions src/CoreGraphics/CGContext.cs
Original file line number Diff line number Diff line change
Expand Up @@ -1433,6 +1433,109 @@ public CGBitmapContext AsBitmapContext ()
public void DrawConicGradient (CGGradient? gradient, CGPoint point, nfloat angle) =>
CGContextDrawConicGradient (Handle, gradient.GetHandle (), point, angle);

#if NET
[SupportedOSPlatform ("ios18.0")]
[SupportedOSPlatform ("maccatalyst18.0")]
[SupportedOSPlatform ("macos15.0")]
[SupportedOSPlatform ("tvos18.0")]
#else
[Watch (11, 0), TV (18, 0), Mac (15, 0), iOS (18, 0), MacCatalyst (18, 0)]
#endif
[DllImport (Constants.CoreGraphicsLibrary)]
static extern byte CGContextSetEDRTargetHeadroom (/* CGContextRef __nonnull */ IntPtr context, /* float */ float headroom);

#if NET
[SupportedOSPlatform ("ios18.0")]
[SupportedOSPlatform ("maccatalyst18.0")]
[SupportedOSPlatform ("macos15.0")]
[SupportedOSPlatform ("tvos18.0")]
#else
[Watch (11, 0), TV (18, 0), Mac (15, 0), iOS (18, 0), MacCatalyst (18, 0)]
#endif
[DllImport (Constants.CoreGraphicsLibrary)]
static extern float CGContextGetEDRTargetHeadroom (/* CGContextRef __nonnull */ IntPtr context);

/// <summary>Get the EDR headroom that's used when rendering HDR content.</summary>
/// <returns>The EDR headroom.</returns>
#if NET
[SupportedOSPlatform ("ios18.0")]
[SupportedOSPlatform ("maccatalyst18.0")]
[SupportedOSPlatform ("macos15.0")]
[SupportedOSPlatform ("tvos18.0")]
#else
[Watch (11, 0), TV (18, 0), Mac (15, 0), iOS (18, 0), MacCatalyst (18, 0)]
#endif
public float GetEdrTargetHeadroom ()
{
return CGContextGetEDRTargetHeadroom (Handle);
}

/// <summary>Get the EDR headroom that's used when rendering HDR content.</summary>
/// <param name="value">The value to set. Must be greater than 1.0f.</param>
/// <returns>Returns true if successful, false otherwise.</returns>
#if NET
[SupportedOSPlatform ("ios18.0")]
[SupportedOSPlatform ("maccatalyst18.0")]
[SupportedOSPlatform ("macos15.0")]
[SupportedOSPlatform ("tvos18.0")]
#else
[Watch (11, 0), TV (18, 0), Mac (15, 0), iOS (18, 0), MacCatalyst (18, 0)]
#endif
public bool SetEdrTargetHeadroom (float value)
{
return CGContextSetEDRTargetHeadroom (Handle, value) != 0;
}

#if NET
[SupportedOSPlatform ("ios18.0")]
[SupportedOSPlatform ("maccatalyst18.0")]
[SupportedOSPlatform ("macos15.0")]
[SupportedOSPlatform ("tvos18.0")]
#else
[Watch (11, 0), TV (18, 0), Mac (15, 0), iOS (18, 0), MacCatalyst (18, 0)]
#endif
[DllImport (Constants.CoreGraphicsLibrary)]
static extern /* bool */ byte CGContextDrawImageApplyingToneMapping (/* CGContextRef __nonnull */ IntPtr context, CGRect r, /* CGImageRef */ IntPtr image, CGToneMapping method, /* CFDictionaryRef __nullable */ IntPtr options);

/// <summary>Draw the specified image onto the CGContext, applying the tone mapping and any tone mapping options.</summary>
/// <param name="rect">The rectangle where the image is rendered.</param>
/// <param name="image">The image to render.</param>
/// <param name="method">The tone mapping method to use.</param>
/// <param name="options">The tone mapping options to use.</param>
/// <returns>Returns true if successful, otherwise false.</returns>
#if NET
[SupportedOSPlatform ("ios18.0")]
[SupportedOSPlatform ("maccatalyst18.0")]
[SupportedOSPlatform ("macos15.0")]
[SupportedOSPlatform ("tvos18.0")]
#else
[Watch (11, 0), TV (18, 0), Mac (15, 0), iOS (18, 0), MacCatalyst (18, 0)]
#endif
public bool DrawImageApplyingToneMapping (CGRect rect, CGImage image, CGToneMapping method, NSDictionary? options)
{
var rv = CGContextDrawImageApplyingToneMapping (Handle, rect, image.Handle, method, options.GetHandle ());
return rv != 0;
}

/// <summary>Draw the specified image onto the CGContext, applying the tone mapping and any tone mapping options.</summary>
/// <param name="rect">The rectangle where the image is rendered.</param>
/// <param name="image">The image to render.</param>
/// <param name="method">The tone mapping method to use.</param>
/// <param name="options">The tone mapping options to use.</param>
/// <returns>Returns true if successful, otherwise false.</returns>
#if NET
[SupportedOSPlatform ("ios18.0")]
[SupportedOSPlatform ("maccatalyst18.0")]
[SupportedOSPlatform ("macos15.0")]
[SupportedOSPlatform ("tvos18.0")]
#else
[Watch (11, 0), TV (18, 0), Mac (15, 0), iOS (18, 0), MacCatalyst (18, 0)]
#endif
public bool DrawImageApplyingToneMapping (CGRect rect, CGImage image, CGToneMapping method, CGToneMappingOptions? options)
{
var rv = CGContextDrawImageApplyingToneMapping (Handle, rect, image.Handle, method, options?.Dictionary?.GetHandle () ?? IntPtr.Zero);
return rv != 0;
}
#endif // !COREBUILD
}
}
72 changes: 72 additions & 0 deletions src/CoreGraphics/CGContextPDF.cs
Original file line number Diff line number Diff line change
Expand Up @@ -378,6 +378,78 @@ public void EndTag ()
CGPDFContextEndTag (Handle);
}

#if NET
[SupportedOSPlatform ("ios18.0")]
[SupportedOSPlatform ("maccatalyst18.0")]
[SupportedOSPlatform ("macos15.0")]
[SupportedOSPlatform ("tvos18.0")]
#else
[Watch (11, 0), TV (18, 0), Mac (15, 0), iOS (18, 0), MacCatalyst (18, 0)]
#endif
[DllImport (Constants.CoreGraphicsLibrary)]
static extern void CGPDFContextSetParentTree (/* CGContextRef cg_nullable */ IntPtr context, /* CGPDFDictionaryRef */ IntPtr parentTreeDictionary);

#if NET
[SupportedOSPlatform ("ios18.0")]
[SupportedOSPlatform ("maccatalyst18.0")]
[SupportedOSPlatform ("macos15.0")]
[SupportedOSPlatform ("tvos18.0")]
#else
[Watch (11, 0), TV (18, 0), Mac (15, 0), iOS (18, 0), MacCatalyst (18, 0)]
#endif
public void SetParentTree (CGPDFDictionary parentTreeDictionary)
{
CGPDFContextSetParentTree (GetCheckedHandle (), parentTreeDictionary.GetNonNullHandle (nameof (parentTreeDictionary)));
}

#if NET
[SupportedOSPlatform ("ios18.0")]
[SupportedOSPlatform ("maccatalyst18.0")]
[SupportedOSPlatform ("macos15.0")]
[SupportedOSPlatform ("tvos18.0")]
#else
[Watch (11, 0), TV (18, 0), Mac (15, 0), iOS (18, 0), MacCatalyst (18, 0)]
#endif
[DllImport (Constants.CoreGraphicsLibrary)]
static extern void CGPDFContextSetIDTree (/* CGContextRef cg_nullable */ IntPtr context, /* CGPDFDictionaryRef */ IntPtr IDTreeDictionary);

#if NET
[SupportedOSPlatform ("ios18.0")]
[SupportedOSPlatform ("maccatalyst18.0")]
[SupportedOSPlatform ("macos15.0")]
[SupportedOSPlatform ("tvos18.0")]
#else
[Watch (11, 0), TV (18, 0), Mac (15, 0), iOS (18, 0), MacCatalyst (18, 0)]
#endif
public void SetIdTree (CGPDFDictionary idTreeDictionary)
{
CGPDFContextSetIDTree (GetCheckedHandle (), idTreeDictionary.GetNonNullHandle (nameof (idTreeDictionary)));
}

#if NET
[SupportedOSPlatform ("ios18.0")]
[SupportedOSPlatform ("maccatalyst18.0")]
[SupportedOSPlatform ("macos15.0")]
[SupportedOSPlatform ("tvos18.0")]
#else
[Watch (11, 0), TV (18, 0), Mac (15, 0), iOS (18, 0), MacCatalyst (18, 0)]
#endif
[DllImport (Constants.CoreGraphicsLibrary)]
static extern void CGPDFContextSetPageTagStructureTree (/* CGContextRef cg_nullable */ IntPtr context, /* CFDictionaryRef */ IntPtr pageTagStructureTreeDictionary);

#if NET
[SupportedOSPlatform ("ios18.0")]
[SupportedOSPlatform ("maccatalyst18.0")]
[SupportedOSPlatform ("macos15.0")]
[SupportedOSPlatform ("tvos18.0")]
#else
[Watch (11, 0), TV (18, 0), Mac (15, 0), iOS (18, 0), MacCatalyst (18, 0)]
#endif
public void SetPageTagStructureTree (NSDictionary pageTagStructureTreeDictionary)
{
CGPDFContextSetPageTagStructureTree (GetCheckedHandle (), pageTagStructureTreeDictionary.GetNonNullHandle (nameof (pageTagStructureTreeDictionary)));
}

protected override void Dispose (bool disposing)
{
if (disposing)
Expand Down
2 changes: 2 additions & 0 deletions src/CoreGraphics/CGEnums.cs
Original file line number Diff line number Diff line change
Expand Up @@ -168,6 +168,8 @@ public enum CGPdfTagType /* int32_t */ {
Figure = 700,
Formula,
Form,
[NoWatch, TV (18, 0), Mac (15, 0), iOS (18, 0), MacCatalyst (18, 0)]
Object = 800,
}

// untyped enum -> CGPDFObject.h
Expand Down
26 changes: 23 additions & 3 deletions src/CoreGraphics/CGEventTypes.cs
Original file line number Diff line number Diff line change
Expand Up @@ -358,15 +358,15 @@ public enum CGEventField : int {
EventWindowUnderMousePointerThatCanHandleThisEvent = 92,

// no documentation for this value in the header file.
/// <summary>A value that represnets the scroll wheel's scroll phase.</summary>
/// <summary>A value that represents the scroll wheel's scroll phase.</summary>
ScrollWheelEventScrollPhase = 99,

// no documentation for this value in the header file.
/// <summary>A value that represnets the scroll wheel's scroll count.</summary>
/// <summary>A value that represents the scroll wheel's scroll count.</summary>
ScrollWheelEventScrollCount = 100,

// no documentation for this value in the header file.
/// <summary>A value that represnets the scroll wheel's scroll momentum.</summary>
/// <summary>A value that represents the scroll wheel's scroll momentum.</summary>
ScrollWheelEventMomentumPhase = 123,

// the header file doesn't say whether this is an integer or a double
Expand All @@ -376,6 +376,26 @@ public enum CGEventField : int {
// the header file doesn't say whether this is an integer or a double
/// <summary>The unaccelerated pointer movement for the Y axis.</summary>
EventUnacceleratedPointerMovementY = 171,

// no documentation for this value in the header file.
/// <summary>A value that represents the scroll wheel's scroll momentum.</summary>
ScrollWheelEventMomentumOptionPhase = 173,

// no documentation for this value in the header file.
/// <summary>A value that represents the accelerated delta value for axis 1.</summary>
ScrollWheelEventAcceleratedDeltaAxis1 = 176,

// no documentation for this value in the header file.
/// <summary>A value that represents the accelerated delta value for axis 2.</summary>
ScrollWheelEventAcceleratedDeltaAxis2 = 175,

// no documentation for this value in the header file.
/// <summary>A value that represents the raw delta value for axis 1.</summary>
ScrollWheelEventRawDeltaAxis1 = 178,

// no documentation for this value in the header file.
/// <summary>A value that represents the raw delta value for axis 2.</summary>
ScrollWheelEventRawDeltaAxis2 = 177
}

// CGEventTypes.h:typedef uint32_t CGEventType;
Expand Down
Loading
Loading