mirror of
https://github.com/darlinghq/darling-cocotron.git
synced 2024-11-23 12:09:51 +00:00
parent
b583fd29ca
commit
2e09764d1f
@ -337,7 +337,7 @@ static inline CGFloat calibratedWhiteFromRGB(CGFloat r, CGFloat g, CGFloat b) {
|
||||
NSLog(@"-[%@ %s] failed",[self class],_cmd);
|
||||
}
|
||||
|
||||
-(CGColorRef)CGColorRef {
|
||||
-(CGColorRef)CGColor {
|
||||
return CGColorRetain(_colorRef);
|
||||
}
|
||||
|
||||
|
@ -10,6 +10,13 @@ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLI
|
||||
|
||||
@implementation NSColorSpace
|
||||
|
||||
+(NSColorSpace *)sRGBColorSpace
|
||||
{
|
||||
CGColorSpaceRef srgb = CGColorSpaceCreateWithName(kCGColorSpaceSRGB);
|
||||
NSColorSpace *colorSpace = [[[self alloc] initWithCGColorSpace:srgb] autorelease];
|
||||
return colorSpace;
|
||||
}
|
||||
|
||||
+(NSColorSpace *)deviceRGBColorSpace {
|
||||
CGColorSpaceRef device=CGColorSpaceCreateDeviceRGB();
|
||||
NSColorSpace *result=[[[self alloc] initWithCGColorSpace:device] autorelease];
|
||||
|
@ -13,6 +13,8 @@ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLI
|
||||
CGColorSpaceRef _cgColorSpace;
|
||||
}
|
||||
|
||||
@property(class, strong, readonly) NSColorSpace *sRGBColorSpace;
|
||||
|
||||
+ (NSColorSpace *)deviceRGBColorSpace;
|
||||
|
||||
- initWithCGColorSpace:(CGColorSpaceRef)cgColorSpace;
|
||||
|
@ -62,3 +62,8 @@ CGColorSpaceModel CGColorSpaceGetModel(CGColorSpaceRef self) {
|
||||
size_t CGColorSpaceGetNumberOfComponents(CGColorSpaceRef self) {
|
||||
return O2ColorSpaceGetNumberOfComponents(self);
|
||||
}
|
||||
|
||||
CGColorSpaceRef CGColorSpaceCreateWithName(CFStringRef name)
|
||||
{
|
||||
return (CGColorSpaceRef)O2ColorSpaceCreateWithName(name);
|
||||
}
|
||||
|
@ -473,3 +473,28 @@ void CGContextCopyBits(CGContextRef context,CGRect rect,CGPoint point,int gState
|
||||
CFDataRef CGContextCaptureBitmap(CGContextRef context,CGRect rect) {
|
||||
return (CFDataRef)O2ContextCaptureBitmap(context,rect);
|
||||
}
|
||||
|
||||
void CGContextSetAllowsFontSmoothing(CGContextRef context, bool allowsFontSmoothing)
|
||||
{
|
||||
O2ContextSetAllowsFontSmoothing((O2ContextRef)context, allowsFontSmoothing);
|
||||
}
|
||||
|
||||
void CGContextSetAllowsFontSubpixelQuantization(CGContextRef context, bool allowsFontSubpixelQuantization)
|
||||
{
|
||||
O2ContextSetAllowsFontSubpixelQuantization((O2ContextRef)context, allowsFontSubpixelQuantization);
|
||||
}
|
||||
|
||||
void CGContextSetShouldSubpixelQuantizeFonts(CGContextRef context, bool shouldSubpixelQuantizeFonts)
|
||||
{
|
||||
O2ContextSetShouldSubpixelQuantizeFonts((O2ContextRef)context, shouldSubpixelQuantizeFonts);
|
||||
}
|
||||
|
||||
void CGContextSetAllowsFontSubpixelPositioning(CGContextRef context, bool allowsFontSubpixelPositioning)
|
||||
{
|
||||
O2ContextSetAllowsFontSubpixelPositioning((O2ContextRef)context, allowsFontSubpixelPositioning);
|
||||
}
|
||||
|
||||
void CGContextSetShouldSubpixelPositionFonts(CGContextRef context, bool shouldSubpixelPositionFonts)
|
||||
{
|
||||
O2ContextSetShouldSubpixelPositionFonts((O2ContextRef)context, shouldSubpixelPositionFonts);
|
||||
}
|
||||
|
@ -13,27 +13,27 @@ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLI
|
||||
@class O2ColorSpace;
|
||||
typedef O2ColorSpace *CGColorSpaceRef;
|
||||
|
||||
extern const CFStringRef kCGColorSpaceGenericGray;
|
||||
extern const CFStringRef kCGColorSpaceGenericRGB;
|
||||
extern const CFStringRef kCGColorSpaceGenericCMYK;
|
||||
extern const CFStringRef kCGColorSpaceDisplayP3;
|
||||
extern const CFStringRef kCGColorSpaceGenericRGBLinear;
|
||||
extern const CFStringRef kCGColorSpaceAdobeRGB1998;
|
||||
extern const CFStringRef kCGColorSpaceSRGB;
|
||||
extern const CFStringRef kCGColorSpaceGenericGrayGamma2_2;
|
||||
extern const CFStringRef kCGColorSpaceGenericXYZ;
|
||||
extern const CFStringRef kCGColorSpaceGenericLab;
|
||||
extern const CFStringRef kCGColorSpaceACESCGLinear;
|
||||
extern const CFStringRef kCGColorSpaceITUR_709;
|
||||
extern const CFStringRef kCGColorSpaceITUR_2020;
|
||||
extern const CFStringRef kCGColorSpaceROMMRGB;
|
||||
extern const CFStringRef kCGColorSpaceDCIP3;
|
||||
extern const CFStringRef kCGColorSpaceExtendedSRGB;
|
||||
extern const CFStringRef kCGColorSpaceLinearSRGB;
|
||||
extern const CFStringRef kCGColorSpaceExtendedLinearSRGB;
|
||||
extern const CFStringRef kCGColorSpaceExtendedGray;
|
||||
extern const CFStringRef kCGColorSpaceLinearGray;
|
||||
extern const CFStringRef kCGColorSpaceExtendedLinearGray;
|
||||
COREGRAPHICS_EXPORT const CFStringRef kCGColorSpaceGenericGray;
|
||||
COREGRAPHICS_EXPORT const CFStringRef kCGColorSpaceGenericRGB;
|
||||
COREGRAPHICS_EXPORT const CFStringRef kCGColorSpaceGenericCMYK;
|
||||
COREGRAPHICS_EXPORT const CFStringRef kCGColorSpaceDisplayP3;
|
||||
COREGRAPHICS_EXPORT const CFStringRef kCGColorSpaceGenericRGBLinear;
|
||||
COREGRAPHICS_EXPORT const CFStringRef kCGColorSpaceAdobeRGB1998;
|
||||
COREGRAPHICS_EXPORT const CFStringRef kCGColorSpaceSRGB;
|
||||
COREGRAPHICS_EXPORT const CFStringRef kCGColorSpaceGenericGrayGamma2_2;
|
||||
COREGRAPHICS_EXPORT const CFStringRef kCGColorSpaceGenericXYZ;
|
||||
COREGRAPHICS_EXPORT const CFStringRef kCGColorSpaceGenericLab;
|
||||
COREGRAPHICS_EXPORT const CFStringRef kCGColorSpaceACESCGLinear;
|
||||
COREGRAPHICS_EXPORT const CFStringRef kCGColorSpaceITUR_709;
|
||||
COREGRAPHICS_EXPORT const CFStringRef kCGColorSpaceITUR_2020;
|
||||
COREGRAPHICS_EXPORT const CFStringRef kCGColorSpaceROMMRGB;
|
||||
COREGRAPHICS_EXPORT const CFStringRef kCGColorSpaceDCIP3;
|
||||
COREGRAPHICS_EXPORT const CFStringRef kCGColorSpaceExtendedSRGB;
|
||||
COREGRAPHICS_EXPORT const CFStringRef kCGColorSpaceLinearSRGB;
|
||||
COREGRAPHICS_EXPORT const CFStringRef kCGColorSpaceExtendedLinearSRGB;
|
||||
COREGRAPHICS_EXPORT const CFStringRef kCGColorSpaceExtendedGray;
|
||||
COREGRAPHICS_EXPORT const CFStringRef kCGColorSpaceLinearGray;
|
||||
COREGRAPHICS_EXPORT const CFStringRef kCGColorSpaceExtendedLinearGray;
|
||||
|
||||
typedef enum {
|
||||
kCGRenderingIntentDefault,
|
||||
@ -64,3 +64,5 @@ COREGRAPHICS_EXPORT CGColorSpaceRef CGColorSpaceCreatePattern(CGColorSpaceRef ba
|
||||
|
||||
COREGRAPHICS_EXPORT CGColorSpaceModel CGColorSpaceGetModel(CGColorSpaceRef self);
|
||||
COREGRAPHICS_EXPORT size_t CGColorSpaceGetNumberOfComponents(CGColorSpaceRef self);
|
||||
|
||||
COREGRAPHICS_EXPORT CGColorSpaceRef CGColorSpaceCreateWithName(CFStringRef name);
|
||||
|
@ -260,3 +260,8 @@ COREGRAPHICS_EXPORT CFDataRef CGContextCaptureBitmap(CGContextRef context, CGRec
|
||||
COREGRAPHICS_EXPORT void CGContextCopyBits(CGContextRef context, CGRect rect, CGPoint point, int gState);
|
||||
COREGRAPHICS_EXPORT bool CGContextSupportsGlobalAlpha(CGContextRef context);
|
||||
COREGRAPHICS_EXPORT bool CGContextIsBitmapContext(CGContextRef context);
|
||||
COREGRAPHICS_EXPORT void CGContextSetAllowsFontSmoothing(CGContextRef context, bool allowsFontSmoothing);
|
||||
COREGRAPHICS_EXPORT void CGContextSetAllowsFontSubpixelQuantization(CGContextRef context, bool allowsFontSubpixelQuantization);
|
||||
COREGRAPHICS_EXPORT void CGContextSetShouldSubpixelQuantizeFonts(CGContextRef context, bool shouldSubpixelQuantizeFonts);
|
||||
COREGRAPHICS_EXPORT void CGContextSetAllowsFontSubpixelPositioning(CGContextRef context, bool allowsFontSubpixelPositioning);
|
||||
COREGRAPHICS_EXPORT void CGContextSetShouldSubpixelPositionFonts(CGContextRef context, bool shouldSubpixelPositionFonts);
|
||||
|
@ -10,6 +10,28 @@ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLI
|
||||
#import <Foundation/NSString.h>
|
||||
#import <CoreFoundation/CFBase.h>
|
||||
|
||||
const CFStringRef kO2ColorSpaceDisplayP3 = CFSTR("kCGColorSpaceDisplayP3");
|
||||
const CFStringRef kO2ColorSpaceGenericGray = CFSTR("kCGColorSpaceGenericGray");
|
||||
const CFStringRef kO2ColorSpaceGenericRGB = CFSTR("kCGColorSpaceGenericRGB");
|
||||
const CFStringRef kO2ColorSpaceGenericCMYK = CFSTR("kCGColorSpaceGenericCMYK");
|
||||
const CFStringRef kO2ColorSpaceGenericRGBLinear = CFSTR("kCGColorSpaceGenericRGBLinear");
|
||||
const CFStringRef kO2ColorSpaceAdobeRGB1998 = CFSTR("kCGColorSpaceAdobeRGB1998");
|
||||
const CFStringRef kO2ColorSpaceSRGB = CFSTR("kCGColorSpaceSRGB");
|
||||
const CFStringRef kO2ColorSpaceGenericGrayGamma2_2 = CFSTR("kCGColorSpaceGenericGrayGamma2_2");
|
||||
const CFStringRef kO2ColorSpaceGenericXYZ = CFSTR("kCGColorSpaceGenericXYZ");
|
||||
const CFStringRef kO2ColorSpaceGenericLab = CFSTR("kCGColorSpaceGenericLab");
|
||||
const CFStringRef kO2ColorSpaceACESCGLinear = CFSTR("kCGColorSpaceACESCGLinear");
|
||||
const CFStringRef kO2ColorSpaceITUR_709 = CFSTR("kCGColorSpaceITUR_709");
|
||||
const CFStringRef kO2ColorSpaceITUR_2020 = CFSTR("kCGColorSpaceITUR_2020");
|
||||
const CFStringRef kO2ColorSpaceROMMRGB = CFSTR("kCGColorSpaceROMMRGB");
|
||||
const CFStringRef kO2ColorSpaceDCIP3 = CFSTR("kCGColorSpaceDCIP3");
|
||||
const CFStringRef kO2ColorSpaceExtendedSRGB = CFSTR("kCGColorSpaceExtendedSRGB");
|
||||
const CFStringRef kO2ColorSpaceLinearSRGB = CFSTR("kCGColorSpaceLinearSRGB");
|
||||
const CFStringRef kO2ColorSpaceExtendedLinearSRGB = CFSTR("kCGColorSpaceExtendedLinearSRGB");
|
||||
const CFStringRef kO2ColorSpaceExtendedGray = CFSTR("kCGColorSpaceExtendedGray");
|
||||
const CFStringRef kO2ColorSpaceLinearGray = CFSTR("kCGColorSpaceLinearGray");
|
||||
const CFStringRef kO2ColorSpaceExtendedLinearGray = CFSTR("kCGColorSpaceExtendedLinearGray");
|
||||
|
||||
@implementation O2ColorSpace
|
||||
|
||||
-initWithDeviceGray {
|
||||
@ -86,6 +108,26 @@ O2ColorSpaceRef O2ColorSpaceCreateDeviceN(const char **names,O2ColorSpaceRef alt
|
||||
return [[O2ColorSpace_DeviceN alloc] initWithComponentNames:names alternateSpace:alternateSpace tintTransform:tintTransform];
|
||||
}
|
||||
|
||||
O2ColorSpaceRef O2ColorSpaceCreateWithName(CFStringRef name)
|
||||
{
|
||||
printf("CALLED: O2ColorSpaceCreateWithName\n");
|
||||
if (CFStringCompare(name, kO2ColorSpaceSRGB, 0) == kCFCompareEqualTo)
|
||||
{
|
||||
O2ColorSpaceRef cs = [[O2ColorSpace alloc] initWithDeviceRGB];
|
||||
cs->_name = kO2ColorSpaceSRGB;
|
||||
return cs;
|
||||
}
|
||||
if (CFStringCompare(name, kO2ColorSpaceDisplayP3, 0) == kCFCompareEqualTo)
|
||||
{
|
||||
O2ColorSpaceRef cs = [[O2ColorSpace alloc] init];
|
||||
cs->_type = kO2ColorSpaceModelRGB;
|
||||
return cs;
|
||||
}
|
||||
printf("unknown color space name\n");
|
||||
CFShow(name);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
BOOL O2ColorSpaceIsPlatformRGB(O2ColorSpaceRef self) {
|
||||
return self->_isPlatformRGB;
|
||||
}
|
||||
|
@ -1365,4 +1365,30 @@ bool O2ContextIsBitmapContext(O2ContextRef self)
|
||||
{
|
||||
return [self isBitmapContext];
|
||||
}
|
||||
|
||||
void O2ContextSetAllowsFontSmoothing(O2ContextRef self, BOOL allowsFontSmoothing)
|
||||
{
|
||||
self->_allowsFontSmoothing = allowsFontSmoothing;
|
||||
}
|
||||
|
||||
void O2ContextSetAllowsFontSubpixelQuantization(O2ContextRef self, BOOL allowsFontSubpixelQuantization)
|
||||
{
|
||||
self->_allowsFontSubpixelQuantization = allowsFontSubpixelQuantization;
|
||||
}
|
||||
|
||||
void O2ContextSetShouldSubpixelQuantizeFonts(O2ContextRef self, BOOL shouldSubpixelQuantizeFonts)
|
||||
{
|
||||
self->_shouldSubpixelQuantizeFonts = shouldSubpixelQuantizeFonts;
|
||||
}
|
||||
|
||||
void O2ContextSetAllowsFontSubpixelPositioning(O2ContextRef self, BOOL allowsFontSubpixelPositioning)
|
||||
{
|
||||
self->_allowsFontSubpixelPositioning = allowsFontSubpixelPositioning;
|
||||
}
|
||||
|
||||
void O2ContextSetShouldSubpixelPositionFonts(O2ContextRef self, BOOL shouldSubpixelPositionFonts)
|
||||
{
|
||||
self->_shouldSubpixelPositionFonts = shouldSubpixelPositionFonts;
|
||||
}
|
||||
|
||||
@end
|
||||
|
@ -35,6 +35,7 @@ typedef enum {
|
||||
@interface O2ColorSpace : NSObject <NSCopying> {
|
||||
O2ColorSpaceModel _type;
|
||||
BOOL _isPlatformRGB;
|
||||
CFStringRef _name;
|
||||
}
|
||||
|
||||
- (O2ColorSpaceModel)type;
|
||||
@ -59,6 +60,8 @@ O2ColorSpaceModel O2ColorSpaceGetModel(O2ColorSpaceRef self);
|
||||
|
||||
- (BOOL)isEqualToColorSpace:(O2ColorSpaceRef)other;
|
||||
|
||||
O2ColorSpaceRef O2ColorSpaceCreateWithName(CFStringRef name);
|
||||
|
||||
@end
|
||||
|
||||
@interface O2ColorSpace_indexed : O2ColorSpace {
|
||||
|
@ -119,6 +119,11 @@ typedef void (*O2ContextShowGlyphsFunction)(O2ContextRef, SEL, const O2Glyph *,
|
||||
O2GState *_currentState;
|
||||
O2MutablePath *_path;
|
||||
BOOL _allowsAntialiasing;
|
||||
BOOL _allowsFontSmoothing;
|
||||
BOOL _allowsFontSubpixelQuantization;
|
||||
BOOL _shouldSubpixelQuantizeFonts;
|
||||
BOOL _allowsFontSubpixelPositioning;
|
||||
BOOL _shouldSubpixelPositionFonts;
|
||||
O2AffineTransform _textMatrix;
|
||||
O2AffineTransform _textLineMatrix;
|
||||
|
||||
@ -281,13 +286,16 @@ void O2ContextSetFont(O2ContextRef self, O2FontRef font);
|
||||
void O2ContextSetFontSize(O2ContextRef self, O2Float size);
|
||||
void O2ContextSelectFont(O2ContextRef self, const char *name, O2Float size, O2TextEncoding encoding);
|
||||
void O2ContextSetShouldSmoothFonts(O2ContextRef self, BOOL yesOrNo);
|
||||
|
||||
void O2ContextSetAllowsFontSmoothing(O2ContextRef self, BOOL allowsFontSmoothing);
|
||||
void O2ContextSetAllowsFontSubpixelQuantization(O2ContextRef self, BOOL allowsFontSubpixelQuantization);
|
||||
void O2ContextSetShouldSubpixelQuantizeFonts(O2ContextRef self, BOOL shouldSubpixelQuantizeFonts);
|
||||
void O2ContextSetLineWidth(O2ContextRef self, O2Float width);
|
||||
void O2ContextSetLineCap(O2ContextRef self, O2LineCap lineCap);
|
||||
void O2ContextSetLineJoin(O2ContextRef self, O2LineJoin lineJoin);
|
||||
void O2ContextSetMiterLimit(O2ContextRef self, O2Float miterLimit);
|
||||
void O2ContextSetLineDash(O2ContextRef self, O2Float phase, const O2Float *lengths, NSUInteger count);
|
||||
|
||||
void O2ContextSetAllowsFontSubpixelPositioning(O2ContextRef self, BOOL allowsFontSubpixelPositioning);
|
||||
void O2ContextSetShouldSubpixelPositionFonts(O2ContextRef self, BOOL shouldSubpixelPositionFonts);
|
||||
void O2ContextSetRenderingIntent(O2ContextRef self, O2ColorRenderingIntent renderingIntent);
|
||||
void O2ContextSetBlendMode(O2ContextRef self, O2BlendMode blendMode);
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user