2007-02-13 03:41:55 +00:00
|
|
|
/* Copyright (c) 2007 Christopher J. W. Lloyd
|
|
|
|
|
|
|
|
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
|
|
|
|
|
|
|
|
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
|
|
|
|
|
|
|
|
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
|
|
|
|
|
2009-11-18 04:48:58 +00:00
|
|
|
#import "O2Context.h"
|
|
|
|
#import "O2BitmapContext.h"
|
|
|
|
#import "O2GraphicsState.h"
|
2009-08-06 20:02:33 +00:00
|
|
|
#import "O2Color.h"
|
2009-09-04 16:36:13 +00:00
|
|
|
#import "O2ColorSpace.h"
|
2009-08-03 20:52:42 +00:00
|
|
|
#import "O2MutablePath.h"
|
2009-11-18 04:48:58 +00:00
|
|
|
#import "O2Layer.h"
|
|
|
|
#import "O2PDFPage.h"
|
|
|
|
#import "O2ClipPhase.h"
|
|
|
|
#import "O2Exceptions.h"
|
2008-04-17 16:59:58 +00:00
|
|
|
#import <Foundation/NSBundle.h>
|
|
|
|
#import <Foundation/NSArray.h>
|
2007-02-13 03:41:55 +00:00
|
|
|
|
2009-10-06 16:02:46 +00:00
|
|
|
@implementation O2Context
|
2007-02-13 03:41:55 +00:00
|
|
|
|
2008-02-29 17:56:38 +00:00
|
|
|
static NSMutableArray *possibleContextClasses=nil;
|
|
|
|
|
|
|
|
+(void)initialize {
|
|
|
|
if(possibleContextClasses==nil){
|
|
|
|
possibleContextClasses=[NSMutableArray new];
|
|
|
|
|
2009-11-18 04:48:58 +00:00
|
|
|
[possibleContextClasses addObject:@"O2Context_gdi"];
|
2009-11-02 16:23:34 +00:00
|
|
|
[possibleContextClasses addObject:@"O2Context_builtin"];
|
2009-11-18 04:48:58 +00:00
|
|
|
[possibleContextClasses addObject:@"O2Context_builtin_gdi"];
|
2008-02-29 17:56:38 +00:00
|
|
|
|
|
|
|
NSArray *allPaths=[[NSBundle bundleForClass:self] pathsForResourcesOfType:@"cgContext" inDirectory:nil];
|
|
|
|
int i,count=[allPaths count];
|
|
|
|
|
|
|
|
for(i=0;i<count;i++){
|
|
|
|
NSString *path=[allPaths objectAtIndex:i];
|
|
|
|
NSBundle *check=[NSBundle bundleWithPath:path];
|
|
|
|
Class cls=[check principalClass];
|
|
|
|
|
|
|
|
if(cls!=Nil)
|
|
|
|
[possibleContextClasses addObject:NSStringFromClass([check principalClass])];
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2008-01-02 03:31:21 +00:00
|
|
|
+(NSArray *)allContextClasses {
|
|
|
|
NSMutableArray *result=[NSMutableArray array];
|
2008-02-29 17:56:38 +00:00
|
|
|
int i,count=[possibleContextClasses count];
|
2008-01-02 03:31:21 +00:00
|
|
|
|
2008-02-29 17:56:38 +00:00
|
|
|
for(i=0;i<count;i++){
|
|
|
|
Class check=NSClassFromString([possibleContextClasses objectAtIndex:i]);
|
2008-01-02 03:31:21 +00:00
|
|
|
|
2008-08-12 16:16:19 +00:00
|
|
|
if(check!=Nil)
|
2008-01-02 03:31:21 +00:00
|
|
|
[result addObject:check];
|
|
|
|
}
|
|
|
|
|
|
|
|
return result;
|
|
|
|
}
|
|
|
|
|
2009-11-02 16:23:34 +00:00
|
|
|
+(O2Context *)createContextWithSize:(O2Size)size window:(CGWindow *)window {
|
2008-01-02 03:31:21 +00:00
|
|
|
NSArray *array=[self allContextClasses];
|
|
|
|
int count=[array count];
|
|
|
|
|
|
|
|
while(--count>=0){
|
|
|
|
Class check=[array objectAtIndex:count];
|
|
|
|
|
2008-02-29 17:56:38 +00:00
|
|
|
if([check canInitWithWindow:window]){
|
2009-10-06 16:02:46 +00:00
|
|
|
O2Context *result=[[check alloc] initWithSize:size window:window];
|
2008-02-29 17:56:38 +00:00
|
|
|
|
|
|
|
if(result!=nil)
|
|
|
|
return result;
|
|
|
|
}
|
2008-01-02 03:31:21 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
return nil;
|
|
|
|
}
|
|
|
|
|
2009-11-02 16:23:34 +00:00
|
|
|
+(O2Context *)createBackingContextWithSize:(O2Size)size context:(O2Context *)context deviceDictionary:(NSDictionary *)deviceDictionary {
|
2008-01-02 03:31:21 +00:00
|
|
|
NSArray *array=[self allContextClasses];
|
|
|
|
int count=[array count];
|
|
|
|
|
|
|
|
while(--count>=0){
|
|
|
|
Class check=[array objectAtIndex:count];
|
|
|
|
|
2008-08-12 16:16:19 +00:00
|
|
|
if([check canInitBackingWithContext:context deviceDictionary:deviceDictionary]){
|
2009-10-06 16:02:46 +00:00
|
|
|
O2Context *result=[[check alloc] initWithSize:size context:context];
|
2008-02-29 17:56:38 +00:00
|
|
|
|
|
|
|
if(result!=nil)
|
|
|
|
return result;
|
|
|
|
}
|
2008-01-02 03:31:21 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
return nil;
|
|
|
|
}
|
|
|
|
|
2009-11-02 16:23:34 +00:00
|
|
|
-initWithBytes:(void *)bytes width:(size_t)width height:(size_t)height bitsPerComponent:(size_t)bitsPerComponent bytesPerRow:(size_t)bytesPerRow colorSpace:(O2ColorSpaceRef)colorSpace bitmapInfo:(O2BitmapInfo)bitmapInfo releaseCallback:(O2BitmapContextReleaseDataCallback)releaseCallback releaseInfo:(void *)releaseInfo {
|
|
|
|
return nil;
|
|
|
|
}
|
|
|
|
|
|
|
|
+(O2Context *)createWithBytes:(void *)bytes width:(size_t)width height:(size_t)height bitsPerComponent:(size_t)bitsPerComponent bytesPerRow:(size_t)bytesPerRow colorSpace:(O2ColorSpaceRef)colorSpace bitmapInfo:(O2BitmapInfo)bitmapInfo releaseCallback:(O2BitmapContextReleaseDataCallback)releaseCallback releaseInfo:(void *)releaseInfo {
|
- Issue #84 fix in NSDocumentController, NSDocumentController was referring to a NSMenu's itemArray while the array was changing due to KVC & -[NSMenu _setItemArray:]
- Added NSIntegerMapKeyCallBacks
- Added variety of CGBitmapContext, CGImage, CGDataProvider, CGGeometry, CGPath, CGPattern, CGColor C interfaces to the .h's in ApplicationServices and underlying implementation in AppKit.
- Consolidated KGPath/VGPath more. Consolidated KGImage/KGSurface(VGImage) more into read-only and read-write images.
- Moved some KG classes from SWRender to AppKit
- SWRender overhaul to use the whole KG interface (context,color,path,etc.) directly using the C CoreGraphics interface and a common test template for both CG and KG using the C interface.
2008-04-23 17:52:06 +00:00
|
|
|
NSArray *array=[self allContextClasses];
|
|
|
|
int count=[array count];
|
|
|
|
|
|
|
|
while(--count>=0){
|
|
|
|
Class check=[array objectAtIndex:count];
|
|
|
|
|
|
|
|
if([check canInitBitmap]){
|
2009-11-02 16:23:34 +00:00
|
|
|
O2Context *result=[[check alloc] initWithBytes:bytes width:width height:height bitsPerComponent:bitsPerComponent bytesPerRow:bytesPerRow colorSpace:colorSpace bitmapInfo:bitmapInfo releaseCallback:releaseCallback releaseInfo:releaseInfo];
|
- Issue #84 fix in NSDocumentController, NSDocumentController was referring to a NSMenu's itemArray while the array was changing due to KVC & -[NSMenu _setItemArray:]
- Added NSIntegerMapKeyCallBacks
- Added variety of CGBitmapContext, CGImage, CGDataProvider, CGGeometry, CGPath, CGPattern, CGColor C interfaces to the .h's in ApplicationServices and underlying implementation in AppKit.
- Consolidated KGPath/VGPath more. Consolidated KGImage/KGSurface(VGImage) more into read-only and read-write images.
- Moved some KG classes from SWRender to AppKit
- SWRender overhaul to use the whole KG interface (context,color,path,etc.) directly using the C CoreGraphics interface and a common test template for both CG and KG using the C interface.
2008-04-23 17:52:06 +00:00
|
|
|
|
|
|
|
if(result!=nil)
|
|
|
|
return result;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
return nil;
|
|
|
|
}
|
|
|
|
|
2008-01-02 03:31:21 +00:00
|
|
|
+(BOOL)canInitWithWindow:(CGWindow *)window {
|
2008-02-29 17:56:38 +00:00
|
|
|
return NO;
|
2008-01-02 03:31:21 +00:00
|
|
|
}
|
|
|
|
|
2009-10-06 16:02:46 +00:00
|
|
|
+(BOOL)canInitBackingWithContext:(O2Context *)context deviceDictionary:(NSDictionary *)deviceDictionary {
|
- Issue #84 fix in NSDocumentController, NSDocumentController was referring to a NSMenu's itemArray while the array was changing due to KVC & -[NSMenu _setItemArray:]
- Added NSIntegerMapKeyCallBacks
- Added variety of CGBitmapContext, CGImage, CGDataProvider, CGGeometry, CGPath, CGPattern, CGColor C interfaces to the .h's in ApplicationServices and underlying implementation in AppKit.
- Consolidated KGPath/VGPath more. Consolidated KGImage/KGSurface(VGImage) more into read-only and read-write images.
- Moved some KG classes from SWRender to AppKit
- SWRender overhaul to use the whole KG interface (context,color,path,etc.) directly using the C CoreGraphics interface and a common test template for both CG and KG using the C interface.
2008-04-23 17:52:06 +00:00
|
|
|
return NO;
|
|
|
|
}
|
|
|
|
|
|
|
|
+(BOOL)canInitBitmap {
|
2008-02-29 17:56:38 +00:00
|
|
|
return NO;
|
2008-01-02 03:31:21 +00:00
|
|
|
}
|
|
|
|
|
2009-11-02 16:23:34 +00:00
|
|
|
-initWithSize:(O2Size)size window:(CGWindow *)window {
|
2009-11-18 04:48:58 +00:00
|
|
|
O2InvalidAbstractInvocation();
|
2008-01-02 03:31:21 +00:00
|
|
|
return nil;
|
|
|
|
}
|
|
|
|
|
2009-11-02 16:23:34 +00:00
|
|
|
-initWithSize:(O2Size)size context:(O2Context *)context {
|
2009-11-18 04:48:58 +00:00
|
|
|
O2InvalidAbstractInvocation();
|
2008-01-02 03:31:21 +00:00
|
|
|
return nil;
|
|
|
|
}
|
|
|
|
|
2009-10-06 16:02:46 +00:00
|
|
|
-initWithGraphicsState:(O2GState *)state {
|
2008-02-29 17:56:38 +00:00
|
|
|
_userToDeviceTransform=[state userSpaceToDeviceSpaceTransform];
|
2007-03-11 19:28:02 +00:00
|
|
|
_layerStack=[NSMutableArray new];
|
|
|
|
_stateStack=[NSMutableArray new];
|
|
|
|
[_stateStack addObject:state];
|
2009-08-03 20:52:42 +00:00
|
|
|
_path=[[O2MutablePath alloc] init];
|
2007-03-11 19:28:02 +00:00
|
|
|
_allowsAntialiasing=YES;
|
|
|
|
return self;
|
|
|
|
}
|
|
|
|
|
2007-10-15 18:08:57 +00:00
|
|
|
-init {
|
2009-10-06 16:02:46 +00:00
|
|
|
return [self initWithGraphicsState:[[[O2GState alloc] init] autorelease]];
|
2007-10-15 18:08:57 +00:00
|
|
|
}
|
|
|
|
|
2007-03-11 19:28:02 +00:00
|
|
|
-(void)dealloc {
|
|
|
|
[_layerStack release];
|
|
|
|
[_stateStack release];
|
|
|
|
[_path release];
|
|
|
|
[super dealloc];
|
|
|
|
}
|
|
|
|
|
2009-10-06 16:02:46 +00:00
|
|
|
static inline O2GState *currentState(O2Context *self){
|
2007-03-11 19:28:02 +00:00
|
|
|
return [self->_stateStack lastObject];
|
|
|
|
}
|
|
|
|
|
2009-11-02 16:23:34 +00:00
|
|
|
-(O2Surface *)surface {
|
2008-06-27 17:35:48 +00:00
|
|
|
return nil;
|
|
|
|
}
|
|
|
|
|
2009-11-02 16:23:34 +00:00
|
|
|
-(O2Surface *)createSurfaceWithWidth:(size_t)width height:(size_t)height {
|
2008-06-27 17:35:48 +00:00
|
|
|
return nil;
|
|
|
|
}
|
|
|
|
|
2007-03-11 19:28:02 +00:00
|
|
|
-(void)beginTransparencyLayerWithInfo:(NSDictionary *)unused {
|
|
|
|
}
|
|
|
|
|
|
|
|
-(void)endTransparencyLayer {
|
|
|
|
}
|
|
|
|
|
2009-11-02 16:23:34 +00:00
|
|
|
-(O2Color *)strokeColor {
|
|
|
|
return [currentState(self) strokeColor];
|
|
|
|
}
|
|
|
|
|
|
|
|
-(O2Color *)fillColor {
|
|
|
|
return [currentState(self) fillColor];
|
|
|
|
}
|
|
|
|
|
|
|
|
-(void)setStrokeAlpha:(O2Float)alpha {
|
|
|
|
O2Color *color=O2ColorCreateCopyWithAlpha([self strokeColor],alpha);
|
|
|
|
O2ContextSetStrokeColorWithColor(self,color);
|
|
|
|
O2ColorRelease(color);
|
|
|
|
}
|
|
|
|
|
|
|
|
-(void)setGrayStrokeColor:(O2Float)gray {
|
|
|
|
O2Float alpha=O2ColorGetAlpha([self strokeColor]);
|
|
|
|
|
|
|
|
O2ContextSetGrayStrokeColor(self,gray,alpha);
|
|
|
|
}
|
|
|
|
|
|
|
|
-(void)setRGBStrokeColor:(O2Float)r:(O2Float)g:(O2Float)b {
|
|
|
|
O2Float alpha=O2ColorGetAlpha([self strokeColor]);
|
|
|
|
O2ContextSetRGBStrokeColor(self,r,g,b,alpha);
|
2007-03-11 19:28:02 +00:00
|
|
|
}
|
|
|
|
|
2009-11-02 16:23:34 +00:00
|
|
|
-(void)setCMYKStrokeColor:(O2Float)c:(O2Float)m:(O2Float)y:(O2Float)k {
|
|
|
|
O2Float alpha=O2ColorGetAlpha([self strokeColor]);
|
|
|
|
O2ContextSetCMYKStrokeColor(self,c,m,y,k,alpha);
|
2007-03-11 19:28:02 +00:00
|
|
|
}
|
|
|
|
|
2009-11-02 16:23:34 +00:00
|
|
|
-(void)setFillAlpha:(O2Float)alpha {
|
|
|
|
O2Color *color=O2ColorCreateCopyWithAlpha([self fillColor],alpha);
|
|
|
|
O2ContextSetFillColorWithColor(self,color);
|
|
|
|
O2ColorRelease(color);
|
2007-03-11 19:28:02 +00:00
|
|
|
}
|
|
|
|
|
2009-11-02 16:23:34 +00:00
|
|
|
-(void)setGrayFillColor:(O2Float)gray {
|
|
|
|
O2Float alpha=O2ColorGetAlpha([self fillColor]);
|
|
|
|
O2ContextSetGrayFillColor(self,gray,alpha);
|
|
|
|
}
|
|
|
|
|
|
|
|
-(void)setRGBFillColor:(O2Float)r:(O2Float)g:(O2Float)b {
|
|
|
|
O2Float alpha=O2ColorGetAlpha([self fillColor]);
|
|
|
|
O2ContextSetRGBFillColor(self,r,g,b,alpha);
|
|
|
|
}
|
|
|
|
|
|
|
|
-(void)setCMYKFillColor:(O2Float)c:(O2Float)m:(O2Float)y:(O2Float)k {
|
|
|
|
O2Float alpha=O2ColorGetAlpha([self fillColor]);
|
|
|
|
O2ContextSetCMYKFillColor(self,c,m,y,k,alpha);
|
|
|
|
}
|
|
|
|
|
|
|
|
-(void)drawPath:(O2PathDrawingMode)pathMode {
|
2009-11-18 04:48:58 +00:00
|
|
|
O2InvalidAbstractInvocation();
|
2009-11-02 16:23:34 +00:00
|
|
|
// reset path in subclass
|
|
|
|
}
|
|
|
|
|
|
|
|
-(void)showGlyphs:(const O2Glyph *)glyphs count:(unsigned)count {
|
2009-11-18 04:48:58 +00:00
|
|
|
O2InvalidAbstractInvocation();
|
2009-11-02 16:23:34 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
-(void)showText:(const char *)text length:(unsigned)length {
|
2009-11-18 04:48:58 +00:00
|
|
|
O2InvalidAbstractInvocation();
|
2009-11-02 16:23:34 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
-(void)drawShading:(O2Shading *)shading {
|
2009-11-18 04:48:58 +00:00
|
|
|
O2InvalidAbstractInvocation();
|
2009-11-02 16:23:34 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
-(void)drawImage:(O2Image *)image inRect:(O2Rect)rect {
|
2009-11-18 04:48:58 +00:00
|
|
|
O2InvalidAbstractInvocation();
|
2009-11-02 16:23:34 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
-(void)drawLayer:(O2LayerRef)layer inRect:(O2Rect)rect {
|
2009-11-18 04:48:58 +00:00
|
|
|
O2InvalidAbstractInvocation();
|
2009-11-02 16:23:34 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
-(void)flush {
|
|
|
|
// do nothing
|
|
|
|
}
|
|
|
|
|
|
|
|
-(void)synchronize {
|
|
|
|
// do nothing
|
|
|
|
}
|
|
|
|
|
|
|
|
-(void)beginPage:(const O2Rect *)mediaBox {
|
|
|
|
// do nothing
|
|
|
|
}
|
|
|
|
|
|
|
|
-(void)endPage {
|
|
|
|
// do nothing
|
|
|
|
}
|
|
|
|
|
|
|
|
-(void)close {
|
|
|
|
// do nothing
|
|
|
|
}
|
|
|
|
|
|
|
|
-(O2Size)size {
|
|
|
|
return O2SizeMake(0,0);
|
|
|
|
}
|
|
|
|
|
|
|
|
-(O2ContextRef)createCompatibleContextWithSize:(O2Size)size unused:(NSDictionary *)unused {
|
|
|
|
return [[isa alloc] initWithSize:size context:self];
|
|
|
|
}
|
|
|
|
|
|
|
|
-(BOOL)getImageableRect:(O2Rect *)rect {
|
|
|
|
return NO;
|
|
|
|
}
|
|
|
|
|
|
|
|
// temporary
|
|
|
|
|
|
|
|
-(void)drawBackingContext:(O2Context *)other size:(O2Size)size {
|
2009-11-18 04:48:58 +00:00
|
|
|
O2InvalidAbstractInvocation();
|
2009-11-02 16:23:34 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
-(void)setAntialiasingQuality:(int)value {
|
|
|
|
[currentState(self) setAntialiasingQuality:value];
|
|
|
|
}
|
|
|
|
|
|
|
|
-(void)setWordSpacing:(O2Float)spacing {
|
|
|
|
[currentState(self) setWordSpacing:spacing];
|
|
|
|
}
|
|
|
|
|
|
|
|
-(void)setTextLeading:(O2Float)leading {
|
|
|
|
[currentState(self) setTextLeading:leading];
|
|
|
|
}
|
|
|
|
|
|
|
|
-(void)copyBitsInRect:(O2Rect)rect toPoint:(O2Point)point gState:(int)gState {
|
2009-11-18 04:48:58 +00:00
|
|
|
O2InvalidAbstractInvocation();
|
2009-11-02 16:23:34 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
-(NSData *)captureBitmapInRect:(O2Rect)rect {
|
2009-11-18 04:48:58 +00:00
|
|
|
O2InvalidAbstractInvocation();
|
2009-11-02 16:23:34 +00:00
|
|
|
return nil;
|
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
Notes: OSX generates a clip mask at fill time using the current aliasing setting. Once the fill is complete the clip mask persists with the next clip/fill. This means you can turn off AA, create a clip path, fill, turn on AA, create another clip path, fill, and edges from the first path will be aliased, and ones from the second will not. PDF does not dictate aliasing behavior, so while this is not really expected behavior, it is not a bug.
|
|
|
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
-(void)deviceClipReset {
|
|
|
|
// do nothing
|
|
|
|
}
|
|
|
|
|
|
|
|
-(void)deviceClipToNonZeroPath:(O2Path *)path {
|
|
|
|
// do nothing
|
|
|
|
}
|
|
|
|
|
|
|
|
-(void)deviceClipToEvenOddPath:(O2Path *)path {
|
|
|
|
// do nothing
|
|
|
|
}
|
|
|
|
|
|
|
|
-(void)deviceClipToMask:(O2Image *)mask inRect:(O2Rect)rect {
|
|
|
|
// do nothing
|
|
|
|
}
|
|
|
|
|
|
|
|
O2ContextRef O2ContextRetain(O2ContextRef self) {
|
|
|
|
return [self retain];
|
|
|
|
}
|
|
|
|
|
|
|
|
void O2ContextRelease(O2ContextRef self) {
|
|
|
|
[self release];
|
|
|
|
}
|
|
|
|
|
|
|
|
// context state
|
|
|
|
void O2ContextSetAllowsAntialiasing(O2ContextRef self,BOOL yesOrNo) {
|
|
|
|
self->_allowsAntialiasing=yesOrNo;
|
|
|
|
}
|
|
|
|
|
|
|
|
// layers
|
|
|
|
void O2ContextBeginTransparencyLayer(O2ContextRef self,NSDictionary *unused) {
|
|
|
|
[self beginTransparencyLayerWithInfo:unused];
|
|
|
|
}
|
|
|
|
|
|
|
|
void O2ContextEndTransparencyLayer(O2ContextRef self) {
|
|
|
|
[self endTransparencyLayer];
|
|
|
|
}
|
|
|
|
|
|
|
|
// path
|
|
|
|
BOOL O2ContextIsPathEmpty(O2ContextRef self) {
|
|
|
|
return (self->_path==nil)?YES:O2PathIsEmpty(self->_path);
|
|
|
|
}
|
|
|
|
|
|
|
|
O2Point O2ContextGetPathCurrentPoint(O2ContextRef self) {
|
|
|
|
return (self->_path==nil)?O2PointZero:O2PathGetCurrentPoint(self->_path);
|
|
|
|
}
|
|
|
|
|
|
|
|
O2Rect O2ContextGetPathBoundingBox(O2ContextRef self) {
|
|
|
|
return (self->_path==nil)?O2RectZero:O2PathGetBoundingBox(self->_path);
|
|
|
|
}
|
|
|
|
|
|
|
|
BOOL O2ContextPathContainsPoint(O2ContextRef self,O2Point point,O2PathDrawingMode pathMode) {
|
|
|
|
O2AffineTransform ctm=[currentState(self) userSpaceToDeviceSpaceTransform];
|
2007-03-11 19:28:02 +00:00
|
|
|
|
|
|
|
// FIX evenOdd
|
2009-11-02 16:23:34 +00:00
|
|
|
return O2PathContainsPoint(self->_path,&ctm,point,NO);
|
2007-03-11 19:28:02 +00:00
|
|
|
}
|
|
|
|
|
2009-11-02 16:23:34 +00:00
|
|
|
void O2ContextBeginPath(O2ContextRef self) {
|
|
|
|
O2PathReset(self->_path);
|
2007-03-11 19:28:02 +00:00
|
|
|
}
|
|
|
|
|
2009-11-02 16:23:34 +00:00
|
|
|
void O2ContextClosePath(O2ContextRef self) {
|
|
|
|
O2PathCloseSubpath(self->_path);
|
2007-03-11 19:28:02 +00:00
|
|
|
}
|
|
|
|
|
2008-07-08 15:59:34 +00:00
|
|
|
/* Path building is affected by the CTM, we transform them here into base coordinates (first quadrant, no transformation)
|
|
|
|
|
|
|
|
A backend can then convert them to where it needs them, base, current, or device space.
|
|
|
|
*/
|
|
|
|
|
2009-11-02 16:23:34 +00:00
|
|
|
void O2ContextMoveToPoint(O2ContextRef self,O2Float x,O2Float y) {
|
|
|
|
O2AffineTransform ctm=[currentState(self) userSpaceTransform];
|
2008-06-30 16:18:49 +00:00
|
|
|
|
2009-11-02 16:23:34 +00:00
|
|
|
O2PathMoveToPoint(self->_path,&ctm,x,y);
|
2007-03-11 19:28:02 +00:00
|
|
|
}
|
|
|
|
|
2009-11-02 16:23:34 +00:00
|
|
|
void O2ContextAddLineToPoint(O2ContextRef self,O2Float x,O2Float y) {
|
|
|
|
O2AffineTransform ctm=[currentState(self) userSpaceTransform];
|
2008-06-30 16:18:49 +00:00
|
|
|
|
2009-11-02 16:23:34 +00:00
|
|
|
O2PathAddLineToPoint(self->_path,&ctm,x,y);
|
2007-03-11 19:28:02 +00:00
|
|
|
}
|
|
|
|
|
2009-11-02 16:23:34 +00:00
|
|
|
void O2ContextAddCurveToPoint(O2ContextRef self,O2Float cx1,O2Float cy1,O2Float cx2,O2Float cy2,O2Float x,O2Float y) {
|
|
|
|
O2AffineTransform ctm=[currentState(self) userSpaceTransform];
|
2008-06-30 16:18:49 +00:00
|
|
|
|
2009-11-02 16:23:34 +00:00
|
|
|
O2PathAddCurveToPoint(self->_path,&ctm,cx1,cy1,cx2,cy2,x,y);
|
2007-03-11 19:28:02 +00:00
|
|
|
}
|
|
|
|
|
2009-11-02 16:23:34 +00:00
|
|
|
void O2ContextAddQuadCurveToPoint(O2ContextRef self,O2Float cx1,O2Float cy1,O2Float x,O2Float y) {
|
|
|
|
O2AffineTransform ctm=[currentState(self) userSpaceTransform];
|
2008-06-30 16:18:49 +00:00
|
|
|
|
2009-11-02 16:23:34 +00:00
|
|
|
O2PathAddQuadCurveToPoint(self->_path,&ctm,cx1,cy1,x,y);
|
2007-03-11 19:28:02 +00:00
|
|
|
}
|
|
|
|
|
2009-11-02 16:23:34 +00:00
|
|
|
void O2ContextAddLines(O2ContextRef self,const O2Point *points,unsigned count) {
|
|
|
|
O2AffineTransform ctm=[currentState(self) userSpaceTransform];
|
2008-06-30 16:18:49 +00:00
|
|
|
|
2009-11-02 16:23:34 +00:00
|
|
|
O2PathAddLines(self->_path,&ctm,points,count);
|
2007-03-11 19:28:02 +00:00
|
|
|
}
|
|
|
|
|
2009-11-02 16:23:34 +00:00
|
|
|
void O2ContextAddRect(O2ContextRef self,O2Rect rect) {
|
|
|
|
O2AffineTransform ctm=[currentState(self) userSpaceTransform];
|
2009-08-03 20:52:42 +00:00
|
|
|
|
2009-11-02 16:23:34 +00:00
|
|
|
O2PathAddRect(self->_path,&ctm,rect);
|
2007-03-11 19:28:02 +00:00
|
|
|
}
|
|
|
|
|
2009-11-02 16:23:34 +00:00
|
|
|
void O2ContextAddRects(O2ContextRef self,const O2Rect *rects,unsigned count) {
|
|
|
|
O2AffineTransform ctm=[currentState(self) userSpaceTransform];
|
2008-06-30 16:18:49 +00:00
|
|
|
|
2009-11-02 16:23:34 +00:00
|
|
|
O2PathAddRects(self->_path,&ctm,rects,count);
|
2007-03-11 19:28:02 +00:00
|
|
|
}
|
|
|
|
|
2009-11-02 16:23:34 +00:00
|
|
|
void O2ContextAddArc(O2ContextRef self,O2Float x,O2Float y,O2Float radius,O2Float startRadian,O2Float endRadian,BOOL clockwise) {
|
|
|
|
O2AffineTransform ctm=[currentState(self) userSpaceTransform];
|
2008-06-30 16:18:49 +00:00
|
|
|
|
2009-11-02 16:23:34 +00:00
|
|
|
O2PathAddArc(self->_path,&ctm,x,y,radius,startRadian,endRadian,clockwise);
|
2007-03-11 19:28:02 +00:00
|
|
|
}
|
|
|
|
|
2009-11-02 16:23:34 +00:00
|
|
|
void O2ContextAddArcToPoint(O2ContextRef self,O2Float x1,O2Float y1,O2Float x2,O2Float y2,O2Float radius) {
|
|
|
|
O2AffineTransform ctm=[currentState(self) userSpaceTransform];
|
2008-06-30 16:18:49 +00:00
|
|
|
|
2009-11-02 16:23:34 +00:00
|
|
|
O2PathAddArcToPoint(self->_path,&ctm,x1,y1,x2,y2,radius);
|
2007-03-11 19:28:02 +00:00
|
|
|
}
|
|
|
|
|
2009-11-02 16:23:34 +00:00
|
|
|
void O2ContextAddEllipseInRect(O2ContextRef self,O2Rect rect) {
|
|
|
|
O2AffineTransform ctm=[currentState(self) userSpaceTransform];
|
2008-06-30 16:18:49 +00:00
|
|
|
|
2009-11-02 16:23:34 +00:00
|
|
|
O2PathAddEllipseInRect(self->_path,&ctm,rect);
|
2007-03-11 19:28:02 +00:00
|
|
|
}
|
|
|
|
|
2009-11-02 16:23:34 +00:00
|
|
|
void O2ContextAddPath(O2ContextRef self,O2PathRef path) {
|
|
|
|
O2AffineTransform ctm=[currentState(self) userSpaceTransform];
|
2008-06-30 16:18:49 +00:00
|
|
|
|
2009-11-02 16:23:34 +00:00
|
|
|
O2PathAddPath(self->_path,&ctm,path);
|
2007-03-11 19:28:02 +00:00
|
|
|
}
|
|
|
|
|
2009-11-02 16:23:34 +00:00
|
|
|
void O2ContextReplacePathWithStrokedPath(O2ContextRef self) {
|
2009-11-18 04:48:58 +00:00
|
|
|
O2UnimplementedFunction();
|
2007-03-11 19:28:02 +00:00
|
|
|
}
|
|
|
|
|
2009-11-02 16:23:34 +00:00
|
|
|
// gstate
|
2008-02-29 17:56:38 +00:00
|
|
|
|
2009-11-02 16:23:34 +00:00
|
|
|
void O2ContextSaveGState(O2ContextRef self) {
|
2009-10-06 16:02:46 +00:00
|
|
|
O2GState *current=currentState(self),*next;
|
2007-03-11 19:28:02 +00:00
|
|
|
|
|
|
|
next=[current copy];
|
2009-11-02 16:23:34 +00:00
|
|
|
[self->_stateStack addObject:next];
|
2007-03-11 19:28:02 +00:00
|
|
|
[next release];
|
|
|
|
}
|
|
|
|
|
2009-11-02 16:23:34 +00:00
|
|
|
void O2ContextRestoreGState(O2ContextRef self) {
|
|
|
|
[self->_stateStack removeLastObject];
|
2008-02-29 17:56:38 +00:00
|
|
|
|
2009-11-02 16:23:34 +00:00
|
|
|
O2GState *gState=currentState(self);
|
|
|
|
|
|
|
|
// FIXME, this could be conditional by comparing to previous font
|
|
|
|
gState->_fontIsDirty=YES;
|
|
|
|
|
|
|
|
NSArray *phases=[currentState(self) clipPhases];
|
2008-02-29 17:56:38 +00:00
|
|
|
int i,count=[phases count];
|
|
|
|
|
|
|
|
[self deviceClipReset];
|
|
|
|
|
|
|
|
for(i=0;i<count;i++){
|
2009-10-06 16:02:46 +00:00
|
|
|
O2ClipPhase *phase=[phases objectAtIndex:i];
|
2008-02-29 17:56:38 +00:00
|
|
|
|
|
|
|
switch([phase phaseType]){
|
|
|
|
|
2009-10-06 16:02:46 +00:00
|
|
|
case O2ClipPhaseNonZeroPath:{
|
2009-08-03 20:52:42 +00:00
|
|
|
O2Path *path=[phase object];
|
2008-02-29 17:56:38 +00:00
|
|
|
[self deviceClipToNonZeroPath:path];
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
|
2009-10-06 16:02:46 +00:00
|
|
|
case O2ClipPhaseEOPath:{
|
2009-08-03 20:52:42 +00:00
|
|
|
O2Path *path=[phase object];
|
2008-02-29 17:56:38 +00:00
|
|
|
[self deviceClipToEvenOddPath:path];
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
|
2009-10-06 16:02:46 +00:00
|
|
|
case O2ClipPhaseMask:
|
2008-02-29 17:56:38 +00:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
2007-03-11 19:28:02 +00:00
|
|
|
}
|
|
|
|
|
2009-11-02 16:23:34 +00:00
|
|
|
O2AffineTransform O2ContextGetUserSpaceToDeviceSpaceTransform(O2ContextRef self) {
|
2007-11-08 15:58:54 +00:00
|
|
|
return [currentState(self) userSpaceToDeviceSpaceTransform];
|
2007-03-11 19:28:02 +00:00
|
|
|
}
|
|
|
|
|
2009-11-02 16:23:34 +00:00
|
|
|
O2AffineTransform O2ContextGetCTM(O2ContextRef self){
|
2008-02-29 17:56:38 +00:00
|
|
|
return [currentState(self) userSpaceTransform];
|
2007-03-11 19:28:02 +00:00
|
|
|
}
|
|
|
|
|
2009-11-02 16:23:34 +00:00
|
|
|
O2Rect O2ContextGetClipBoundingBox(O2ContextRef self) {
|
2007-11-08 15:58:54 +00:00
|
|
|
return [currentState(self) clipBoundingBox];
|
2007-03-11 19:28:02 +00:00
|
|
|
}
|
|
|
|
|
2009-11-02 16:23:34 +00:00
|
|
|
O2AffineTransform O2ContextGetTextMatrix(O2ContextRef self) {
|
2007-03-11 19:28:02 +00:00
|
|
|
return [currentState(self) textMatrix];
|
|
|
|
}
|
|
|
|
|
2009-11-02 16:23:34 +00:00
|
|
|
O2InterpolationQuality O2ContextGetInterpolationQuality(O2ContextRef self) {
|
2007-03-11 19:28:02 +00:00
|
|
|
return [currentState(self) interpolationQuality];
|
|
|
|
}
|
|
|
|
|
2009-11-02 16:23:34 +00:00
|
|
|
O2Point O2ContextGetTextPosition(O2ContextRef self){
|
2007-03-11 19:28:02 +00:00
|
|
|
return [currentState(self) textPosition];
|
|
|
|
}
|
|
|
|
|
2009-11-02 16:23:34 +00:00
|
|
|
O2Point O2ContextConvertPointToDeviceSpace(O2ContextRef self,O2Point point) {
|
2007-03-11 19:28:02 +00:00
|
|
|
return [currentState(self) convertPointToDeviceSpace:point];
|
|
|
|
}
|
|
|
|
|
2009-11-02 16:23:34 +00:00
|
|
|
O2Point O2ContextConvertPointToUserSpace(O2ContextRef self,O2Point point) {
|
2007-03-11 19:28:02 +00:00
|
|
|
return [currentState(self) convertPointToUserSpace:point];
|
|
|
|
}
|
|
|
|
|
2009-11-02 16:23:34 +00:00
|
|
|
O2Size O2ContextConvertSizeToDeviceSpace(O2ContextRef self,O2Size size) {
|
2007-03-11 19:28:02 +00:00
|
|
|
return [currentState(self) convertSizeToDeviceSpace:size];
|
|
|
|
}
|
|
|
|
|
2009-11-02 16:23:34 +00:00
|
|
|
O2Size O2ContextConvertSizeToUserSpace(O2ContextRef self,O2Size size) {
|
2007-03-11 19:28:02 +00:00
|
|
|
return [currentState(self) convertSizeToUserSpace:size];
|
|
|
|
}
|
|
|
|
|
2009-11-02 16:23:34 +00:00
|
|
|
O2Rect O2ContextConvertRectToDeviceSpace(O2ContextRef self,O2Rect rect) {
|
2007-03-11 19:28:02 +00:00
|
|
|
return [currentState(self) convertRectToDeviceSpace:rect];
|
|
|
|
}
|
|
|
|
|
2009-11-02 16:23:34 +00:00
|
|
|
O2Rect O2ContextConvertRectToUserSpace(O2ContextRef self,O2Rect rect) {
|
2007-03-11 19:28:02 +00:00
|
|
|
return [currentState(self) convertRectToUserSpace:rect];
|
|
|
|
}
|
|
|
|
|
2009-11-02 16:23:34 +00:00
|
|
|
void O2ContextConcatCTM(O2ContextRef self,O2AffineTransform matrix) {
|
|
|
|
[currentState(self) concatCTM:matrix];
|
2007-11-08 15:58:54 +00:00
|
|
|
}
|
|
|
|
|
2009-11-02 16:23:34 +00:00
|
|
|
void O2ContextTranslateCTM(O2ContextRef self,O2Float translatex,O2Float translatey) {
|
|
|
|
O2ContextConcatCTM(self,O2AffineTransformMakeTranslation(translatex,translatey));
|
2007-03-11 19:28:02 +00:00
|
|
|
}
|
|
|
|
|
2009-11-02 16:23:34 +00:00
|
|
|
void O2ContextScaleCTM(O2ContextRef self,O2Float scalex,O2Float scaley) {
|
|
|
|
O2ContextConcatCTM(self,O2AffineTransformMakeScale(scalex,scaley));
|
2007-03-11 19:28:02 +00:00
|
|
|
}
|
|
|
|
|
2009-11-02 16:23:34 +00:00
|
|
|
void O2ContextRotateCTM(O2ContextRef self,O2Float radians) {
|
|
|
|
O2ContextConcatCTM(self,O2AffineTransformMakeRotation(radians));
|
2007-03-11 19:28:02 +00:00
|
|
|
}
|
|
|
|
|
2009-11-02 16:23:34 +00:00
|
|
|
void O2ContextClip(O2ContextRef self) {
|
|
|
|
if(O2PathIsEmpty(self->_path))
|
2007-07-11 23:27:46 +00:00
|
|
|
return;
|
2008-02-29 17:56:38 +00:00
|
|
|
|
2009-11-02 16:23:34 +00:00
|
|
|
[currentState(self) addClipToPath:self->_path];
|
|
|
|
[self deviceClipToNonZeroPath:self->_path];
|
|
|
|
O2PathReset(self->_path);
|
2007-03-11 19:28:02 +00:00
|
|
|
}
|
|
|
|
|
2009-11-02 16:23:34 +00:00
|
|
|
void O2ContextEOClip(O2ContextRef self) {
|
|
|
|
if(O2PathIsEmpty(self->_path))
|
2007-07-11 23:27:46 +00:00
|
|
|
return;
|
|
|
|
|
2009-11-02 16:23:34 +00:00
|
|
|
[currentState(self) addEvenOddClipToPath:self->_path];
|
|
|
|
[self deviceClipToEvenOddPath:self->_path];
|
|
|
|
O2PathReset(self->_path);
|
2007-03-11 19:28:02 +00:00
|
|
|
}
|
|
|
|
|
2009-11-02 16:23:34 +00:00
|
|
|
void O2ContextClipToMask(O2ContextRef self,O2Rect rect,O2ImageRef image) {
|
2008-02-29 17:56:38 +00:00
|
|
|
[currentState(self) addClipToMask:image inRect:rect];
|
|
|
|
[self deviceClipToMask:image inRect:rect];
|
2007-03-11 19:28:02 +00:00
|
|
|
}
|
|
|
|
|
2009-11-02 16:23:34 +00:00
|
|
|
void O2ContextClipToRect(O2ContextRef self,O2Rect rect) {
|
|
|
|
O2AffineTransform ctm=[currentState(self) userSpaceTransform];
|
2008-06-30 16:18:49 +00:00
|
|
|
|
2009-11-02 16:23:34 +00:00
|
|
|
O2PathReset(self->_path);
|
|
|
|
O2PathAddRect(self->_path,&ctm,rect);
|
|
|
|
O2ContextClip(self);
|
2007-03-11 19:28:02 +00:00
|
|
|
}
|
|
|
|
|
2009-11-02 16:23:34 +00:00
|
|
|
void O2ContextClipToRects(O2ContextRef self,const O2Rect *rects,unsigned count) {
|
|
|
|
O2AffineTransform ctm=[currentState(self) userSpaceTransform];
|
2007-06-23 04:08:45 +00:00
|
|
|
|
2009-11-02 16:23:34 +00:00
|
|
|
O2PathReset(self->_path);
|
|
|
|
O2PathAddRects(self->_path,&ctm,rects,count);
|
|
|
|
O2ContextClip(self);
|
2007-06-23 04:08:45 +00:00
|
|
|
}
|
|
|
|
|
2009-11-02 16:23:34 +00:00
|
|
|
void O2ContextSetStrokeColorSpace(O2ContextRef self,O2ColorSpaceRef colorSpace) {
|
|
|
|
int i,length=O2ColorSpaceGetNumberOfComponents(colorSpace);
|
|
|
|
O2Float components[length+1];
|
2009-09-04 16:36:13 +00:00
|
|
|
|
|
|
|
for(i=0;i<length;i++)
|
|
|
|
components[i]=0;
|
|
|
|
components[i]=1;
|
|
|
|
|
|
|
|
O2Color *color=O2ColorCreate(colorSpace,components);
|
2007-10-15 18:08:57 +00:00
|
|
|
|
2009-11-02 16:23:34 +00:00
|
|
|
O2ContextSetStrokeColorWithColor(self,color);
|
2007-10-15 18:08:57 +00:00
|
|
|
|
2009-11-02 16:23:34 +00:00
|
|
|
O2ColorRelease(color);
|
2007-03-11 19:28:02 +00:00
|
|
|
}
|
|
|
|
|
2009-11-02 16:23:34 +00:00
|
|
|
void O2ContextSetFillColorSpace(O2ContextRef self,O2ColorSpaceRef colorSpace) {
|
|
|
|
int i,length=O2ColorSpaceGetNumberOfComponents(colorSpace);
|
|
|
|
O2Float components[length+1];
|
2009-09-04 16:36:13 +00:00
|
|
|
|
|
|
|
for(i=0;i<length;i++)
|
|
|
|
components[i]=0;
|
|
|
|
components[i]=1;
|
|
|
|
|
|
|
|
O2Color *color=O2ColorCreate(colorSpace,components);
|
2007-10-15 18:08:57 +00:00
|
|
|
|
2009-11-02 16:23:34 +00:00
|
|
|
O2ContextSetFillColorWithColor(self,color);
|
2007-10-15 18:08:57 +00:00
|
|
|
|
2009-11-02 16:23:34 +00:00
|
|
|
O2ColorRelease(color);
|
2007-03-11 19:28:02 +00:00
|
|
|
}
|
|
|
|
|
2009-11-02 16:23:34 +00:00
|
|
|
void O2ContextSetStrokeColor(O2ContextRef self,const O2Float *components) {
|
2009-09-04 16:36:13 +00:00
|
|
|
O2ColorSpaceRef colorSpace=O2ColorGetColorSpace([self strokeColor]);
|
|
|
|
O2Color *color=O2ColorCreate(colorSpace,components);
|
2007-10-15 18:08:57 +00:00
|
|
|
|
2009-11-02 16:23:34 +00:00
|
|
|
O2ContextSetStrokeColorWithColor(self,color);
|
2007-10-15 18:08:57 +00:00
|
|
|
|
2009-11-02 16:23:34 +00:00
|
|
|
O2ColorRelease(color);
|
2007-03-11 19:28:02 +00:00
|
|
|
}
|
|
|
|
|
2009-11-02 16:23:34 +00:00
|
|
|
void O2ContextSetStrokeColorWithColor(O2ContextRef self,O2ColorRef color) {
|
2007-03-11 19:28:02 +00:00
|
|
|
[currentState(self) setStrokeColor:color];
|
|
|
|
}
|
|
|
|
|
2009-11-02 16:23:34 +00:00
|
|
|
void O2ContextSetGrayStrokeColor(O2ContextRef self,O2Float gray,O2Float alpha) {
|
|
|
|
O2ColorSpaceRef colorSpace=O2ColorSpaceCreateDeviceGray();
|
|
|
|
O2Float components[2]={gray,alpha};
|
2009-09-04 16:36:13 +00:00
|
|
|
O2Color *color=O2ColorCreate(colorSpace,components);
|
2007-10-15 18:08:57 +00:00
|
|
|
|
2009-11-02 16:23:34 +00:00
|
|
|
O2ContextSetStrokeColorWithColor(self,color);
|
2007-10-15 18:08:57 +00:00
|
|
|
|
2009-11-02 16:23:34 +00:00
|
|
|
O2ColorRelease(color);
|
|
|
|
O2ColorSpaceRelease(colorSpace);
|
2007-03-11 19:28:02 +00:00
|
|
|
}
|
|
|
|
|
2009-11-02 16:23:34 +00:00
|
|
|
void O2ContextSetRGBStrokeColor(O2ContextRef self,O2Float r,O2Float g,O2Float b,O2Float alpha) {
|
|
|
|
O2ColorSpaceRef colorSpace=O2ColorSpaceCreateDeviceRGB();
|
|
|
|
O2Float components[4]={r,g,b,alpha};
|
2009-09-04 16:36:13 +00:00
|
|
|
O2Color *color=O2ColorCreate(colorSpace,components);
|
2007-10-15 18:08:57 +00:00
|
|
|
|
2009-11-02 16:23:34 +00:00
|
|
|
O2ContextSetStrokeColorWithColor(self,color);
|
2007-10-15 18:08:57 +00:00
|
|
|
|
2009-11-02 16:23:34 +00:00
|
|
|
O2ColorRelease(color);
|
|
|
|
O2ColorSpaceRelease(colorSpace);
|
2007-03-11 19:28:02 +00:00
|
|
|
}
|
|
|
|
|
2009-11-02 16:23:34 +00:00
|
|
|
void O2ContextSetCMYKStrokeColor(O2ContextRef self,O2Float c,O2Float m,O2Float y,O2Float k,O2Float alpha) {
|
|
|
|
O2ColorSpaceRef colorSpace=O2ColorSpaceCreateDeviceCMYK();
|
|
|
|
O2Float components[5]={c,m,y,k,alpha};
|
2009-09-04 16:36:13 +00:00
|
|
|
O2Color *color=O2ColorCreate(colorSpace,components);
|
2007-10-15 18:08:57 +00:00
|
|
|
|
2009-11-02 16:23:34 +00:00
|
|
|
O2ContextSetStrokeColorWithColor(self,color);
|
2007-10-15 18:08:57 +00:00
|
|
|
|
2009-11-02 16:23:34 +00:00
|
|
|
O2ColorRelease(color);
|
|
|
|
O2ColorSpaceRelease(colorSpace);
|
|
|
|
}
|
|
|
|
|
|
|
|
void O2ContextSetCalibratedRGBStrokeColor(O2ContextRef self,O2Float red,O2Float green,O2Float blue,O2Float alpha) {
|
2007-03-11 19:28:02 +00:00
|
|
|
}
|
|
|
|
|
2009-11-02 16:23:34 +00:00
|
|
|
void O2ContextSetCalibratedGrayStrokeColor(O2ContextRef self,O2Float gray,O2Float alpha) {
|
|
|
|
}
|
|
|
|
|
|
|
|
void O2ContextSetFillColor(O2ContextRef self,const O2Float *components) {
|
2009-09-04 16:36:13 +00:00
|
|
|
O2ColorSpaceRef colorSpace=O2ColorGetColorSpace([self fillColor]);
|
|
|
|
O2Color *color=O2ColorCreate(colorSpace,components);
|
2007-10-15 18:08:57 +00:00
|
|
|
|
2009-11-02 16:23:34 +00:00
|
|
|
O2ContextSetFillColorWithColor(self,color);
|
2007-10-15 18:08:57 +00:00
|
|
|
|
2009-11-02 16:23:34 +00:00
|
|
|
O2ColorRelease(color);
|
2007-03-11 19:28:02 +00:00
|
|
|
}
|
|
|
|
|
2009-11-02 16:23:34 +00:00
|
|
|
void O2ContextSetFillColorWithColor(O2ContextRef self,O2ColorRef color) {
|
2007-03-11 19:28:02 +00:00
|
|
|
[currentState(self) setFillColor:color];
|
|
|
|
}
|
|
|
|
|
2009-11-02 16:23:34 +00:00
|
|
|
void O2ContextSetGrayFillColor(O2ContextRef self,O2Float gray,O2Float alpha) {
|
|
|
|
O2ColorSpaceRef colorSpace=O2ColorSpaceCreateDeviceGray();
|
|
|
|
O2Float components[2]={gray,alpha};
|
2009-09-04 16:36:13 +00:00
|
|
|
O2Color *color=O2ColorCreate(colorSpace,components);
|
2007-10-15 18:08:57 +00:00
|
|
|
|
2009-11-02 16:23:34 +00:00
|
|
|
O2ContextSetFillColorWithColor(self,color);
|
2007-10-15 18:08:57 +00:00
|
|
|
|
2009-11-02 16:23:34 +00:00
|
|
|
O2ColorRelease(color);
|
|
|
|
O2ColorSpaceRelease(colorSpace);
|
2007-03-11 19:28:02 +00:00
|
|
|
}
|
|
|
|
|
2009-11-02 16:23:34 +00:00
|
|
|
void O2ContextSetRGBFillColor(O2ContextRef self,O2Float r,O2Float g,O2Float b,O2Float alpha) {
|
|
|
|
O2ColorSpaceRef colorSpace=O2ColorSpaceCreateDeviceRGB();
|
|
|
|
O2Float components[4]={r,g,b,alpha};
|
2009-09-04 16:36:13 +00:00
|
|
|
O2Color *color=O2ColorCreate(colorSpace,components);
|
2007-10-15 18:08:57 +00:00
|
|
|
|
2009-11-02 16:23:34 +00:00
|
|
|
O2ContextSetFillColorWithColor(self,color);
|
2007-10-15 18:08:57 +00:00
|
|
|
|
2009-11-02 16:23:34 +00:00
|
|
|
O2ColorRelease(color);
|
|
|
|
O2ColorSpaceRelease(colorSpace);
|
2007-03-11 19:28:02 +00:00
|
|
|
}
|
|
|
|
|
2009-11-02 16:23:34 +00:00
|
|
|
void O2ContextSetCMYKFillColor(O2ContextRef self,O2Float c,O2Float m,O2Float y,O2Float k,O2Float alpha) {
|
|
|
|
O2ColorSpaceRef colorSpace=O2ColorSpaceCreateDeviceCMYK();
|
|
|
|
O2Float components[5]={c,m,y,k,alpha};
|
2009-09-04 16:36:13 +00:00
|
|
|
O2Color *color=O2ColorCreate(colorSpace,components);
|
2007-10-15 18:08:57 +00:00
|
|
|
|
2009-11-02 16:23:34 +00:00
|
|
|
O2ContextSetFillColorWithColor(self,color);
|
2007-10-15 18:08:57 +00:00
|
|
|
|
2009-11-02 16:23:34 +00:00
|
|
|
O2ColorRelease(color);
|
|
|
|
O2ColorSpaceRelease(colorSpace);
|
2007-03-11 19:28:02 +00:00
|
|
|
}
|
|
|
|
|
2009-11-02 16:23:34 +00:00
|
|
|
void O2ContextSetCalibratedGrayFillColor(O2ContextRef self,O2Float gray,O2Float alpha) {
|
2007-03-11 19:28:02 +00:00
|
|
|
}
|
|
|
|
|
2009-11-02 16:23:34 +00:00
|
|
|
void O2ContextSetCalibratedRGBFillColor(O2ContextRef self,O2Float red,O2Float green,O2Float blue,O2Float alpha) {
|
2007-03-11 19:28:02 +00:00
|
|
|
}
|
|
|
|
|
2009-11-02 16:23:34 +00:00
|
|
|
void O2ContextSetAlpha(O2ContextRef self,O2Float alpha) {
|
|
|
|
[self setStrokeAlpha:alpha];
|
|
|
|
[self setFillAlpha:alpha];
|
2007-03-11 19:28:02 +00:00
|
|
|
}
|
|
|
|
|
2009-11-02 16:23:34 +00:00
|
|
|
void O2ContextSetPatternPhase(O2ContextRef self,O2Size phase) {
|
2007-03-11 19:28:02 +00:00
|
|
|
[currentState(self) setPatternPhase:phase];
|
|
|
|
}
|
|
|
|
|
2009-11-02 16:23:34 +00:00
|
|
|
void O2ContextSetStrokePattern(O2ContextRef self,O2PatternRef pattern,const O2Float *components) {
|
2007-03-11 19:28:02 +00:00
|
|
|
[currentState(self) setStrokePattern:pattern components:components];
|
|
|
|
}
|
|
|
|
|
2009-11-02 16:23:34 +00:00
|
|
|
void O2ContextSetFillPattern(O2ContextRef self,O2PatternRef pattern,const O2Float *components) {
|
2007-03-11 19:28:02 +00:00
|
|
|
[currentState(self) setFillPattern:pattern components:components];
|
|
|
|
}
|
|
|
|
|
2009-11-02 16:23:34 +00:00
|
|
|
void O2ContextSetTextMatrix(O2ContextRef self,O2AffineTransform matrix) {
|
|
|
|
[currentState(self) setTextMatrix:matrix];
|
2007-03-11 19:28:02 +00:00
|
|
|
}
|
|
|
|
|
2009-11-02 16:23:34 +00:00
|
|
|
void O2ContextSetTextPosition(O2ContextRef self,O2Float x,O2Float y) {
|
2007-03-11 19:28:02 +00:00
|
|
|
[currentState(self) setTextPosition:x:y];
|
|
|
|
}
|
|
|
|
|
2009-11-02 16:23:34 +00:00
|
|
|
void O2ContextSetCharacterSpacing(O2ContextRef self,O2Float spacing) {
|
2007-03-11 19:28:02 +00:00
|
|
|
[currentState(self) setCharacterSpacing:spacing];
|
|
|
|
}
|
|
|
|
|
2009-11-02 16:23:34 +00:00
|
|
|
void O2ContextSetTextDrawingMode(O2ContextRef self,O2TextDrawingMode textMode) {
|
2007-03-11 19:28:02 +00:00
|
|
|
[currentState(self) setTextDrawingMode:textMode];
|
|
|
|
}
|
|
|
|
|
2009-11-02 16:23:34 +00:00
|
|
|
void O2ContextSetFont(O2ContextRef self,O2FontRef font) {
|
2008-12-03 21:17:06 +00:00
|
|
|
[currentState(self) setFont:font];
|
2007-03-11 19:28:02 +00:00
|
|
|
}
|
|
|
|
|
2009-11-02 16:23:34 +00:00
|
|
|
void O2ContextSetFontSize(O2ContextRef self,O2Float size) {
|
2008-12-03 21:17:06 +00:00
|
|
|
[currentState(self) setFontSize:size];
|
2007-03-11 19:28:02 +00:00
|
|
|
}
|
|
|
|
|
2009-11-02 16:23:34 +00:00
|
|
|
void O2ContextSelectFont(O2ContextRef self,const char *name,O2Float size,O2TextEncoding encoding) {
|
2008-12-03 21:17:06 +00:00
|
|
|
[currentState(self) selectFontWithName:name size:size encoding:encoding];
|
2007-03-11 19:28:02 +00:00
|
|
|
}
|
|
|
|
|
2009-11-02 16:23:34 +00:00
|
|
|
void O2ContextSetShouldSmoothFonts(O2ContextRef self,BOOL yesOrNo) {
|
2007-03-11 19:28:02 +00:00
|
|
|
[currentState(self) setShouldSmoothFonts:yesOrNo];
|
|
|
|
}
|
|
|
|
|
2009-11-02 16:23:34 +00:00
|
|
|
void O2ContextSetLineWidth(O2ContextRef self,O2Float width) {
|
2007-03-11 19:28:02 +00:00
|
|
|
[currentState(self) setLineWidth:width];
|
|
|
|
}
|
|
|
|
|
2009-11-02 16:23:34 +00:00
|
|
|
void O2ContextSetLineCap(O2ContextRef self,O2LineCap lineCap) {
|
2007-03-11 19:28:02 +00:00
|
|
|
[currentState(self) setLineCap:lineCap];
|
|
|
|
}
|
|
|
|
|
2009-11-02 16:23:34 +00:00
|
|
|
void O2ContextSetLineJoin(O2ContextRef self,O2LineJoin lineJoin) {
|
2007-03-11 19:28:02 +00:00
|
|
|
[currentState(self) setLineJoin:lineJoin];
|
|
|
|
}
|
|
|
|
|
2009-11-02 16:23:34 +00:00
|
|
|
void O2ContextSetMiterLimit(O2ContextRef self,O2Float miterLimit) {
|
|
|
|
[currentState(self) setMiterLimit:miterLimit];
|
2007-03-11 19:28:02 +00:00
|
|
|
}
|
|
|
|
|
2009-11-02 16:23:34 +00:00
|
|
|
void O2ContextSetLineDash(O2ContextRef self,O2Float phase,const O2Float *lengths,unsigned count) {
|
2007-03-11 19:28:02 +00:00
|
|
|
[currentState(self) setLineDashPhase:phase lengths:lengths count:count];
|
|
|
|
}
|
|
|
|
|
2009-11-02 16:23:34 +00:00
|
|
|
void O2ContextSetRenderingIntent(O2ContextRef self,O2ColorRenderingIntent renderingIntent) {
|
|
|
|
[currentState(self) setRenderingIntent:renderingIntent];
|
2007-03-11 19:28:02 +00:00
|
|
|
}
|
|
|
|
|
2009-11-02 16:23:34 +00:00
|
|
|
void O2ContextSetBlendMode(O2ContextRef self,O2BlendMode blendMode) {
|
|
|
|
[currentState(self) setBlendMode:blendMode];
|
2007-03-11 19:28:02 +00:00
|
|
|
}
|
|
|
|
|
2009-11-02 16:23:34 +00:00
|
|
|
void O2ContextSetFlatness(O2ContextRef self,O2Float flatness) {
|
2007-03-11 19:28:02 +00:00
|
|
|
[currentState(self) setFlatness:flatness];
|
|
|
|
}
|
|
|
|
|
2009-11-02 16:23:34 +00:00
|
|
|
void O2ContextSetInterpolationQuality(O2ContextRef self,O2InterpolationQuality quality) {
|
2007-03-11 19:28:02 +00:00
|
|
|
[currentState(self) setInterpolationQuality:quality];
|
|
|
|
}
|
|
|
|
|
2009-11-02 16:23:34 +00:00
|
|
|
void O2ContextSetShadowWithColor(O2ContextRef self,O2Size offset,O2Float blur,O2ColorRef color) {
|
2007-03-11 19:28:02 +00:00
|
|
|
[currentState(self) setShadowOffset:offset blur:blur color:color];
|
|
|
|
}
|
|
|
|
|
2009-11-02 16:23:34 +00:00
|
|
|
void O2ContextSetShadow(O2ContextRef self,O2Size offset,O2Float blur) {
|
2007-03-11 19:28:02 +00:00
|
|
|
[currentState(self) setShadowOffset:offset blur:blur];
|
|
|
|
}
|
|
|
|
|
2009-11-02 16:23:34 +00:00
|
|
|
void O2ContextSetShouldAntialias(O2ContextRef self,BOOL yesOrNo) {
|
|
|
|
[currentState(self) setShouldAntialias:yesOrNo];
|
2007-03-11 19:28:02 +00:00
|
|
|
}
|
|
|
|
|
2009-11-02 16:23:34 +00:00
|
|
|
// drawing
|
|
|
|
void O2ContextStrokeLineSegments(O2ContextRef self,const O2Point *points,unsigned count) {
|
2007-10-15 18:08:57 +00:00
|
|
|
int i;
|
|
|
|
|
2009-11-02 16:23:34 +00:00
|
|
|
O2ContextBeginPath(self);
|
2007-10-15 18:08:57 +00:00
|
|
|
for(i=0;i<count;i+=2){
|
2009-11-02 16:23:34 +00:00
|
|
|
O2ContextMoveToPoint(self,points[i].x,points[i].y);
|
|
|
|
O2ContextAddLineToPoint(self,points[i+1].x,points[i+1].y);
|
2007-10-15 18:08:57 +00:00
|
|
|
}
|
2009-11-02 16:23:34 +00:00
|
|
|
O2ContextStrokePath(self);
|
2007-03-11 19:28:02 +00:00
|
|
|
}
|
|
|
|
|
2009-11-02 16:23:34 +00:00
|
|
|
void O2ContextStrokeRect(O2ContextRef self,O2Rect rect) {
|
|
|
|
O2ContextBeginPath(self);
|
|
|
|
O2ContextAddRect(self,rect);
|
|
|
|
O2ContextStrokePath(self);
|
2007-03-11 19:28:02 +00:00
|
|
|
}
|
|
|
|
|
2009-11-02 16:23:34 +00:00
|
|
|
void O2ContextStrokeRectWithWidth(O2ContextRef self,O2Rect rect,O2Float width) {
|
|
|
|
O2ContextSaveGState(self);
|
|
|
|
O2ContextSetLineWidth(self,width);
|
|
|
|
O2ContextBeginPath(self);
|
|
|
|
O2ContextAddRect(self,rect);
|
|
|
|
O2ContextStrokePath(self);
|
|
|
|
O2ContextRestoreGState(self);
|
2007-03-11 19:28:02 +00:00
|
|
|
}
|
|
|
|
|
2009-11-02 16:23:34 +00:00
|
|
|
void O2ContextStrokeEllipseInRect(O2ContextRef self,O2Rect rect) {
|
|
|
|
O2ContextBeginPath(self);
|
|
|
|
O2ContextAddEllipseInRect(self,rect);
|
|
|
|
O2ContextStrokePath(self);
|
2007-03-11 19:28:02 +00:00
|
|
|
}
|
|
|
|
|
2009-11-02 16:23:34 +00:00
|
|
|
void O2ContextFillRect(O2ContextRef self,O2Rect rect) {
|
|
|
|
O2ContextFillRects(self,&rect,1);
|
2007-03-11 19:28:02 +00:00
|
|
|
}
|
|
|
|
|
2009-11-02 16:23:34 +00:00
|
|
|
void O2ContextFillRects(O2ContextRef self,const O2Rect *rects,unsigned count) {
|
|
|
|
O2ContextBeginPath(self);
|
|
|
|
O2ContextAddRects(self,rects,count);
|
|
|
|
O2ContextFillPath(self);
|
2007-03-11 19:28:02 +00:00
|
|
|
}
|
|
|
|
|
2009-11-02 16:23:34 +00:00
|
|
|
void O2ContextFillEllipseInRect(O2ContextRef self,O2Rect rect) {
|
|
|
|
O2ContextBeginPath(self);
|
|
|
|
O2ContextAddEllipseInRect(self,rect);
|
|
|
|
O2ContextFillPath(self);
|
2007-03-11 19:28:02 +00:00
|
|
|
}
|
|
|
|
|
2009-11-02 16:23:34 +00:00
|
|
|
void O2ContextDrawPath(O2ContextRef self,O2PathDrawingMode pathMode) {
|
|
|
|
[self drawPath:pathMode];
|
2007-03-11 19:28:02 +00:00
|
|
|
}
|
|
|
|
|
2009-11-02 16:23:34 +00:00
|
|
|
void O2ContextStrokePath(O2ContextRef self) {
|
|
|
|
O2ContextDrawPath(self,kO2PathStroke);
|
2007-03-11 19:28:02 +00:00
|
|
|
}
|
|
|
|
|
2009-11-02 16:23:34 +00:00
|
|
|
void O2ContextFillPath(O2ContextRef self) {
|
|
|
|
O2ContextDrawPath(self,kO2PathFill);
|
2007-03-11 19:28:02 +00:00
|
|
|
}
|
|
|
|
|
2009-11-02 16:23:34 +00:00
|
|
|
void O2ContextEOFillPath(O2ContextRef self) {
|
|
|
|
O2ContextDrawPath(self,kO2PathEOFill);
|
2007-03-11 19:28:02 +00:00
|
|
|
}
|
|
|
|
|
2009-11-02 16:23:34 +00:00
|
|
|
void O2ContextClearRect(O2ContextRef self,O2Rect rect) {
|
|
|
|
// doc.s are not clear. tests say O2ContextClearRect resets the path and does not affect gstate color
|
|
|
|
O2ContextSaveGState(self);
|
|
|
|
O2ContextSetBlendMode(self,kO2BlendModeCopy); // does it set the blend mode?
|
|
|
|
O2ContextSetGrayFillColor(self,0,0);
|
|
|
|
O2ContextFillRect(self,rect);
|
|
|
|
O2ContextRestoreGState(self);
|
2007-03-11 19:28:02 +00:00
|
|
|
}
|
|
|
|
|
2009-11-02 16:23:34 +00:00
|
|
|
void O2ContextShowGlyphs(O2ContextRef self,const O2Glyph *glyphs,unsigned count) {
|
|
|
|
[self showGlyphs:glyphs count:count];
|
2007-03-11 19:28:02 +00:00
|
|
|
}
|
|
|
|
|
2009-11-02 16:23:34 +00:00
|
|
|
void O2ContextShowGlyphsAtPoint(O2ContextRef self,O2Float x,O2Float y,const O2Glyph *glyphs,unsigned count) {
|
|
|
|
O2ContextSetTextPosition(self,x,y);
|
|
|
|
O2ContextShowGlyphs(self,glyphs,count);
|
2007-03-11 19:28:02 +00:00
|
|
|
}
|
|
|
|
|
2009-11-02 16:23:34 +00:00
|
|
|
void O2ContextShowGlyphsWithAdvances(O2ContextRef self,const O2Glyph *glyphs,const O2Size *advances,unsigned count) {
|
|
|
|
O2AffineTransform textMatrix=[currentState(self) textMatrix];
|
|
|
|
O2Float x=textMatrix.tx;
|
|
|
|
O2Float y=textMatrix.ty;
|
2007-10-15 18:08:57 +00:00
|
|
|
int i;
|
|
|
|
|
|
|
|
for(i=0;i<count;i++){
|
|
|
|
[self showGlyphs:glyphs+i count:1];
|
|
|
|
|
|
|
|
x+=advances[i].width;
|
|
|
|
y+=advances[i].height;
|
2009-11-02 16:23:34 +00:00
|
|
|
O2ContextSetTextPosition(self,x,y);
|
2007-10-15 18:08:57 +00:00
|
|
|
}
|
2007-03-11 19:28:02 +00:00
|
|
|
}
|
|
|
|
|
2009-11-02 16:23:34 +00:00
|
|
|
void O2ContextShowText(O2ContextRef self,const char *text,unsigned count) {
|
|
|
|
[self showText:text length:count];
|
2007-03-11 19:28:02 +00:00
|
|
|
}
|
|
|
|
|
2009-11-02 16:23:34 +00:00
|
|
|
void O2ContextShowTextAtPoint(O2ContextRef self,O2Float x,O2Float y,const char *text,unsigned count) {
|
|
|
|
O2ContextSetTextPosition(self,x,y);
|
|
|
|
O2ContextShowText(self,text,count);
|
2007-03-11 19:28:02 +00:00
|
|
|
}
|
|
|
|
|
2009-11-02 16:23:34 +00:00
|
|
|
void O2ContextDrawShading(O2ContextRef self,O2ShadingRef shading) {
|
|
|
|
[self drawShading:shading];
|
2007-03-11 19:28:02 +00:00
|
|
|
}
|
|
|
|
|
2009-11-02 16:23:34 +00:00
|
|
|
void O2ContextDrawImage(O2ContextRef self,O2Rect rect,O2ImageRef image) {
|
|
|
|
[self drawImage:image inRect:rect];
|
2007-03-11 19:28:02 +00:00
|
|
|
}
|
|
|
|
|
2009-11-02 16:23:34 +00:00
|
|
|
void O2ContextDrawLayerAtPoint(O2ContextRef self,O2Point point,O2LayerRef layer) {
|
|
|
|
O2Size size=O2LayerGetSize(layer);
|
|
|
|
O2Rect rect={point,size};
|
2007-03-11 19:28:02 +00:00
|
|
|
|
2009-11-02 16:23:34 +00:00
|
|
|
O2ContextDrawLayerInRect(self,rect,layer);
|
2007-03-11 19:28:02 +00:00
|
|
|
}
|
|
|
|
|
2009-11-02 16:23:34 +00:00
|
|
|
void O2ContextDrawLayerInRect(O2ContextRef self,O2Rect rect,O2LayerRef layer) {
|
|
|
|
[self drawLayer:layer inRect:rect];
|
2007-03-11 19:28:02 +00:00
|
|
|
}
|
|
|
|
|
2009-11-02 16:23:34 +00:00
|
|
|
void O2ContextDrawPDFPage(O2ContextRef self,O2PDFPageRef page) {
|
2007-03-11 19:28:02 +00:00
|
|
|
[page drawInContext:self];
|
|
|
|
}
|
2007-10-15 18:08:57 +00:00
|
|
|
|
2009-11-02 16:23:34 +00:00
|
|
|
void O2ContextFlush(O2ContextRef self) {
|
|
|
|
[self flush];
|
2007-10-15 18:08:57 +00:00
|
|
|
}
|
|
|
|
|
2009-11-02 16:23:34 +00:00
|
|
|
void O2ContextSynchronize(O2ContextRef self) {
|
|
|
|
[self synchronize];
|
2007-03-11 19:28:02 +00:00
|
|
|
}
|
|
|
|
|
2009-11-02 16:23:34 +00:00
|
|
|
// pagination
|
- Issue #84 fix in NSDocumentController, NSDocumentController was referring to a NSMenu's itemArray while the array was changing due to KVC & -[NSMenu _setItemArray:]
- Added NSIntegerMapKeyCallBacks
- Added variety of CGBitmapContext, CGImage, CGDataProvider, CGGeometry, CGPath, CGPattern, CGColor C interfaces to the .h's in ApplicationServices and underlying implementation in AppKit.
- Consolidated KGPath/VGPath more. Consolidated KGImage/KGSurface(VGImage) more into read-only and read-write images.
- Moved some KG classes from SWRender to AppKit
- SWRender overhaul to use the whole KG interface (context,color,path,etc.) directly using the C CoreGraphics interface and a common test template for both CG and KG using the C interface.
2008-04-23 17:52:06 +00:00
|
|
|
|
2009-11-02 16:23:34 +00:00
|
|
|
void O2ContextBeginPage(O2ContextRef self,const O2Rect *mediaBox) {
|
|
|
|
[self beginPage:mediaBox];
|
- Issue #84 fix in NSDocumentController, NSDocumentController was referring to a NSMenu's itemArray while the array was changing due to KVC & -[NSMenu _setItemArray:]
- Added NSIntegerMapKeyCallBacks
- Added variety of CGBitmapContext, CGImage, CGDataProvider, CGGeometry, CGPath, CGPattern, CGColor C interfaces to the .h's in ApplicationServices and underlying implementation in AppKit.
- Consolidated KGPath/VGPath more. Consolidated KGImage/KGSurface(VGImage) more into read-only and read-write images.
- Moved some KG classes from SWRender to AppKit
- SWRender overhaul to use the whole KG interface (context,color,path,etc.) directly using the C CoreGraphics interface and a common test template for both CG and KG using the C interface.
2008-04-23 17:52:06 +00:00
|
|
|
}
|
|
|
|
|
2009-11-02 16:23:34 +00:00
|
|
|
void O2ContextEndPage(O2ContextRef self) {
|
|
|
|
[self endPage];
|
- Issue #84 fix in NSDocumentController, NSDocumentController was referring to a NSMenu's itemArray while the array was changing due to KVC & -[NSMenu _setItemArray:]
- Added NSIntegerMapKeyCallBacks
- Added variety of CGBitmapContext, CGImage, CGDataProvider, CGGeometry, CGPath, CGPattern, CGColor C interfaces to the .h's in ApplicationServices and underlying implementation in AppKit.
- Consolidated KGPath/VGPath more. Consolidated KGImage/KGSurface(VGImage) more into read-only and read-write images.
- Moved some KG classes from SWRender to AppKit
- SWRender overhaul to use the whole KG interface (context,color,path,etc.) directly using the C CoreGraphics interface and a common test template for both CG and KG using the C interface.
2008-04-23 17:52:06 +00:00
|
|
|
}
|
|
|
|
|
2009-11-02 16:23:34 +00:00
|
|
|
// **PRIVATE** These are private in Apple's implementation as well as ours.
|
- Issue #84 fix in NSDocumentController, NSDocumentController was referring to a NSMenu's itemArray while the array was changing due to KVC & -[NSMenu _setItemArray:]
- Added NSIntegerMapKeyCallBacks
- Added variety of CGBitmapContext, CGImage, CGDataProvider, CGGeometry, CGPath, CGPattern, CGColor C interfaces to the .h's in ApplicationServices and underlying implementation in AppKit.
- Consolidated KGPath/VGPath more. Consolidated KGImage/KGSurface(VGImage) more into read-only and read-write images.
- Moved some KG classes from SWRender to AppKit
- SWRender overhaul to use the whole KG interface (context,color,path,etc.) directly using the C CoreGraphics interface and a common test template for both CG and KG using the C interface.
2008-04-23 17:52:06 +00:00
|
|
|
|
2009-11-02 16:23:34 +00:00
|
|
|
void O2ContextSetCTM(O2ContextRef self,O2AffineTransform matrix) {
|
|
|
|
O2AffineTransform deviceTransform=self->_userToDeviceTransform;
|
|
|
|
|
|
|
|
deviceTransform=O2AffineTransformConcat(matrix,deviceTransform);
|
|
|
|
|
|
|
|
[currentState(self) setDeviceSpaceCTM:deviceTransform];
|
2007-03-11 19:28:02 +00:00
|
|
|
|
2009-11-02 16:23:34 +00:00
|
|
|
[currentState(self) setUserSpaceCTM:matrix];
|
2008-01-02 03:31:21 +00:00
|
|
|
}
|
|
|
|
|
2009-11-02 16:23:34 +00:00
|
|
|
void O2ContextResetClip(O2ContextRef self) {
|
|
|
|
[currentState(self) removeAllClipPhases];
|
2008-02-29 17:56:38 +00:00
|
|
|
[self deviceClipReset];
|
2007-06-26 03:07:44 +00:00
|
|
|
}
|
|
|
|
|
2009-11-02 16:23:34 +00:00
|
|
|
// Temporary hacks
|
2008-06-23 18:58:30 +00:00
|
|
|
|
2009-11-02 16:23:34 +00:00
|
|
|
NSData *O2ContextCaptureBitmap(O2ContextRef self,O2Rect rect) {
|
|
|
|
return [self captureBitmapInRect:rect];
|
2007-03-11 19:28:02 +00:00
|
|
|
}
|
|
|
|
|
2009-11-02 16:23:34 +00:00
|
|
|
void O2ContextCopyBits(O2ContextRef self,O2Rect rect,O2Point point,int gState) {
|
|
|
|
[self copyBitsInRect:rect toPoint:point gState:gState];
|
2007-03-11 19:28:02 +00:00
|
|
|
}
|
|
|
|
|
2008-02-29 17:56:38 +00:00
|
|
|
|
2007-02-13 03:41:55 +00:00
|
|
|
@end
|