#ifndef CoreGraphicsSPI_h
#define CoreGraphicsSPI_h
#include <CoreFoundation/CoreFoundation.h>
#include <CoreGraphics/CoreGraphics.h>
#if USE(IOSURFACE)
#include "IOSurfaceSPI.h"
#endif
#if PLATFORM(MAC)
#include <ColorSync/ColorSync.h>
#endif
#if USE(APPLE_INTERNAL_SDK)
#if PLATFORM(MAC)
#include <ColorSync/ColorSyncPriv.h>
#endif
#include <CoreGraphics/CGFontCache.h>
#include <CoreGraphics/CoreGraphicsPrivate.h>
#else
struct CGFontHMetrics {
int ascent;
int descent;
int lineGap;
int maxAdvanceWidth;
int minLeftSideBearing;
int minRightSideBearing;
};
struct CGFontDescriptor {
CGRect bbox;
CGFloat ascent;
CGFloat descent;
CGFloat capHeight;
CGFloat italicAngle;
CGFloat stemV;
CGFloat stemH;
CGFloat avgWidth;
CGFloat maxWidth;
CGFloat missingWidth;
CGFloat leading;
CGFloat xHeight;
};
typedef const struct CGColorTransform* CGColorTransformRef;
typedef enum {
kCGContextTypeUnknown,
kCGContextTypePDF,
kCGContextTypePostScript,
kCGContextTypeWindow,
kCGContextTypeBitmap,
kCGContextTypeGL,
kCGContextTypeDisplayList,
kCGContextTypeKSeparation,
kCGContextTypeIOSurface,
kCGContextTypeCount
} CGContextType;
typedef enum {
kCGCompositeCopy = 1,
kCGCompositeSover = 2,
} CGCompositeOperation;
enum {
kCGFontRenderingStyleAntialiasing = 1 << 0,
kCGFontRenderingStyleSmoothing = 1 << 1,
kCGFontRenderingStyleSubpixelPositioning = 1 << 2,
kCGFontRenderingStyleSubpixelQuantization = 1 << 3,
kCGFontRenderingStylePlatformNative = 1 << 9,
kCGFontRenderingStyleMask = 0x20F,
};
typedef uint32_t CGFontRenderingStyle;
enum {
kCGFontAntialiasingStyleUnfiltered = 0 << 7,
kCGFontAntialiasingStyleFilterLight = 1 << 7,
#if PLATFORM(MAC) && __MAC_OS_X_VERSION_MIN_REQUIRED >= 101100
kCGFontAntialiasingStyleUnfilteredCustomDilation = (8 << 7),
#endif
};
typedef uint32_t CGFontAntialiasingStyle;
enum {
kCGImageCachingTransient = 1,
kCGImageCachingTemporary = 3,
};
typedef uint32_t CGImageCachingFlags;
#if PLATFORM(COCOA)
typedef struct CGSRegionEnumeratorObject* CGSRegionEnumeratorObj;
typedef struct CGSRegionObject* CGSRegionObj;
typedef struct CGSRegionObject* CGRegionRef;
#endif
#ifdef CGFLOAT_IS_DOUBLE
#define CGRound(value) round((value))
#define CGFloor(value) floor((value))
#define CGCeiling(value) ceil((value))
#define CGFAbs(value) fabs((value))
#else
#define CGRound(value) roundf((value))
#define CGFloor(value) floorf((value))
#define CGCeiling(value) ceilf((value))
#define CGFAbs(value) fabsf((value))
#endif
static inline CGFloat CGFloatMin(CGFloat a, CGFloat b) { return isnan(a) ? b : ((isnan(b) || a < b) ? a : b); }
typedef struct CGFontCache CGFontCache;
#if PLATFORM(MAC)
typedef uint32_t CGSConnectionID;
typedef uint32_t CGSWindowID;
typedef uint32_t CGSWindowCount;
typedef CGSWindowID *CGSWindowIDList;
enum {
kCGSWindowCaptureNominalResolution = 0x0200,
kCGSCaptureIgnoreGlobalClipShape = 0x0800,
};
typedef uint32_t CGSWindowCaptureOptions;
#endif
#endif // USE(APPLE_INTERNAL_SDK)
WTF_EXTERN_C_BEGIN
CGColorRef CGColorTransformConvertColor(CGColorTransformRef, CGColorRef, CGColorRenderingIntent);
CGColorTransformRef CGColorTransformCreate(CGColorSpaceRef, CFDictionaryRef attributes);
CGAffineTransform CGContextGetBaseCTM(CGContextRef);
CGCompositeOperation CGContextGetCompositeOperation(CGContextRef);
CGColorRef CGContextGetFillColorAsColor(CGContextRef);
CGFloat CGContextGetLineWidth(CGContextRef);
bool CGContextGetShouldSmoothFonts(CGContextRef);
bool CGContextGetShouldAntialias(CGContextRef);
void CGContextSetBaseCTM(CGContextRef, CGAffineTransform);
void CGContextSetCTM(CGContextRef, CGAffineTransform);
void CGContextSetCompositeOperation(CGContextRef, CGCompositeOperation);
void CGContextSetShouldAntialiasFonts(CGContextRef, bool shouldAntialiasFonts);
void CGContextResetClip(CGContextRef);
CGContextType CGContextGetType(CGContextRef);
#if PLATFORM(MAC) && __MAC_OS_X_VERSION_MIN_REQUIRED >= 101100
void CGContextSetFontDilation(CGContextRef, CGSize);
void CGContextSetFontRenderingStyle(CGContextRef, CGFontRenderingStyle);
#endif
CFStringRef CGFontCopyFamilyName(CGFontRef);
bool CGFontGetDescriptor(CGFontRef, CGFontDescriptor*);
bool CGFontGetGlyphAdvancesForStyle(CGFontRef, const CGAffineTransform* , CGFontRenderingStyle, const CGGlyph[], size_t count, CGSize advances[]);
void CGFontGetGlyphsForUnichars(CGFontRef, const UniChar[], CGGlyph[], size_t count);
const CGFontHMetrics* CGFontGetHMetrics(CGFontRef);
const char* CGFontGetPostScriptName(CGFontRef);
bool CGFontIsFixedPitch(CGFontRef);
void CGFontSetShouldUseMulticache(bool);
void CGImageSetCachingFlags(CGImageRef, CGImageCachingFlags);
CGImageCachingFlags CGImageGetCachingFlags(CGImageRef);
CGDataProviderRef CGPDFDocumentGetDataProvider(CGPDFDocumentRef);
CGFontAntialiasingStyle CGContextGetFontAntialiasingStyle(CGContextRef);
void CGContextSetFontAntialiasingStyle(CGContextRef, CGFontAntialiasingStyle);
#if USE(IOSURFACE)
CGContextRef CGIOSurfaceContextCreate(IOSurfaceRef, size_t, size_t, size_t, size_t, CGColorSpaceRef, CGBitmapInfo);
CGImageRef CGIOSurfaceContextCreateImage(CGContextRef);
CGImageRef CGIOSurfaceContextCreateImageReference(CGContextRef);
CGColorSpaceRef CGIOSurfaceContextGetColorSpace(CGContextRef);
#endif
#if PLATFORM(COCOA)
CGSRegionEnumeratorObj CGSRegionEnumerator(CGRegionRef);
CGRect* CGSNextRect(const CGSRegionEnumeratorObj);
CGError CGSReleaseRegionEnumerator(const CGSRegionEnumeratorObj);
CGColorSpaceRef CGContextCopyDeviceColorSpace(CGContextRef);
#endif
#if PLATFORM(WIN)
CGFontCache* CGFontCacheGetLocalCache();
void CGFontCacheSetShouldAutoExpire(CGFontCache*, bool);
void CGFontCacheSetMaxSize(CGFontCache*, size_t);
#endif
#if PLATFORM(MAC)
CGSConnectionID CGSMainConnectionID(void);
CFArrayRef CGSHWCaptureWindowList(CGSConnectionID cid, CGSWindowIDList windowList, CGSWindowCount windowCount, CGSWindowCaptureOptions options);
CGError CGSSetConnectionProperty(CGSConnectionID, CGSConnectionID ownerCid, CFStringRef key, CFTypeRef value);
CGError CGSCopyConnectionProperty(CGSConnectionID, CGSConnectionID ownerCid, CFStringRef key, CFTypeRef *value);
CGError CGSGetScreenRectForWindow(CGSConnectionID, CGSWindowID, CGRect *);
bool ColorSyncProfileIsWideGamut(ColorSyncProfileRef);
#endif
WTF_EXTERN_C_END
#endif // CoreGraphicsSPI_h