2001-12-17 16:51:51 +00:00
|
|
|
|
/** <title>NSGraphicsContext</title>
|
|
|
|
|
|
|
|
|
|
<abstract>GNUstep drawing context class.</abstract>
|
1999-02-25 15:41:17 +00:00
|
|
|
|
|
|
|
|
|
Copyright (C) 1998 Free Software Foundation, Inc.
|
|
|
|
|
|
2001-12-17 16:51:51 +00:00
|
|
|
|
Written by: Adam Fedor <fedor@gnu.org>
|
1999-02-25 15:41:17 +00:00
|
|
|
|
Date: Nov 1998
|
2001-12-17 16:51:51 +00:00
|
|
|
|
Updated by: Richard Frith-Macdonald <richard@brainstorm.co.uk>
|
1999-03-05 15:47:22 +00:00
|
|
|
|
Date: Feb 1999
|
1999-02-25 15:41:17 +00:00
|
|
|
|
|
|
|
|
|
This file is part of the GNUStep GUI Library.
|
|
|
|
|
|
|
|
|
|
This library is free software; you can redistribute it and/or
|
2007-10-29 21:16:17 +00:00
|
|
|
|
modify it under the terms of the GNU Lesser General Public
|
1999-02-25 15:41:17 +00:00
|
|
|
|
License as published by the Free Software Foundation; either
|
2008-06-10 04:01:49 +00:00
|
|
|
|
version 2 of the License, or (at your option) any later version.
|
2007-10-29 21:16:17 +00:00
|
|
|
|
|
1999-02-25 15:41:17 +00:00
|
|
|
|
This library is distributed in the hope that it will be useful,
|
|
|
|
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
2007-10-29 21:16:17 +00:00
|
|
|
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
|
|
|
Lesser General Public License for more details.
|
|
|
|
|
|
|
|
|
|
You should have received a copy of the GNU Lesser General Public
|
|
|
|
|
License along with this library; see the file COPYING.LIB.
|
|
|
|
|
If not, see <http://www.gnu.org/licenses/> or write to the
|
|
|
|
|
Free Software Foundation, 51 Franklin Street, Fifth Floor,
|
|
|
|
|
Boston, MA 02110-1301, USA.
|
1999-02-25 15:41:17 +00:00
|
|
|
|
*/
|
|
|
|
|
|
2017-12-27 12:15:31 +00:00
|
|
|
|
#if !defined(_NONFRAGILE_ABI)
|
2010-03-27 00:01:03 +00:00
|
|
|
|
#define EXPOSE_NSThread_IVARS
|
2017-12-27 12:15:31 +00:00
|
|
|
|
#endif
|
2010-03-27 00:01:03 +00:00
|
|
|
|
|
2010-03-24 09:18:14 +00:00
|
|
|
|
#import <Foundation/NSGeometry.h>
|
|
|
|
|
#import <Foundation/NSString.h>
|
|
|
|
|
#import <Foundation/NSArray.h>
|
|
|
|
|
#import <Foundation/NSBundle.h>
|
|
|
|
|
#import <Foundation/NSValue.h>
|
|
|
|
|
#import <Foundation/NSDictionary.h>
|
|
|
|
|
#import <Foundation/NSException.h>
|
|
|
|
|
#import <Foundation/NSData.h>
|
|
|
|
|
#import <Foundation/NSLock.h>
|
|
|
|
|
#import <Foundation/NSRunLoop.h>
|
|
|
|
|
#import <Foundation/NSSet.h>
|
|
|
|
|
#import <Foundation/NSThread.h>
|
|
|
|
|
#import <Foundation/NSZone.h>
|
|
|
|
|
#import "AppKit/AppKitExceptions.h"
|
|
|
|
|
#import "AppKit/NSGraphicsContext.h"
|
|
|
|
|
#import "AppKit/NSAffineTransform.h"
|
|
|
|
|
#import "AppKit/NSBezierPath.h"
|
|
|
|
|
#import "AppKit/NSPrintInfo.h"
|
|
|
|
|
#import "AppKit/NSPrintOperation.h"
|
|
|
|
|
#import "AppKit/NSWindow.h"
|
|
|
|
|
#import "AppKit/NSView.h"
|
|
|
|
|
#import "AppKit/DPSOperators.h"
|
|
|
|
|
#import "GNUstepGUI/GSVersion.h"
|
|
|
|
|
#import "GNUstepGUI/GSDisplayServer.h"
|
1999-02-25 15:41:17 +00:00
|
|
|
|
|
|
|
|
|
/* The memory zone where all global objects are allocated from (Contexts
|
|
|
|
|
are also allocated from this zone) */
|
2002-03-28 03:53:18 +00:00
|
|
|
|
static NSZone *_globalGSZone = NULL;
|
1999-02-25 15:41:17 +00:00
|
|
|
|
|
|
|
|
|
/* The current concrete class */
|
|
|
|
|
static Class defaultNSGraphicsContextClass = NULL;
|
|
|
|
|
|
|
|
|
|
/* Class variable for holding pointers to method functions */
|
|
|
|
|
static NSMutableDictionary *classMethodTable;
|
|
|
|
|
|
1999-03-05 15:47:22 +00:00
|
|
|
|
/* Lock for use when creating contexts */
|
|
|
|
|
static NSRecursiveLock *contextLock = nil;
|
|
|
|
|
|
1999-05-10 08:30:14 +00:00
|
|
|
|
#ifndef GNUSTEP_BASE_LIBRARY
|
|
|
|
|
static NSString *NSGraphicsContextThreadKey = @"NSGraphicsContextThreadKey";
|
|
|
|
|
#endif
|
2002-04-01 17:34:08 +00:00
|
|
|
|
static NSString *NSGraphicsContextStackKey = @"NSGraphicsContextStackKey";
|
1999-05-10 08:30:14 +00:00
|
|
|
|
|
2002-08-16 14:11:16 +00:00
|
|
|
|
/* Colorspace constants */
|
|
|
|
|
NSString *GSColorSpaceName = @"GSColorSpaceName";
|
|
|
|
|
NSString *GSColorSpaceWhitePoint = @"GSColorSpaceWhitePoint";
|
|
|
|
|
NSString *GSColorSpaceBlackPoint = @"GSColorSpaceBlackPoint";
|
|
|
|
|
NSString *GSColorSpaceGamma = @"GSColorSpaceGamma";
|
|
|
|
|
NSString *GSColorSpaceMatrix = @"GSColorSpaceMatrix";
|
|
|
|
|
NSString *GSColorSpaceRange = @"GSColorSpaceRange";
|
|
|
|
|
NSString *GSColorSpaceComponents = @"GSColorSpaceComponents";
|
|
|
|
|
NSString *GSColorSpaceProfile = @"GSColorSpaceProfile";
|
|
|
|
|
NSString *GSAlternateColorSpace = @"GSAlternateColorSpace";
|
|
|
|
|
NSString *GSBaseColorSpace = @"GSBaseColorSpace";
|
|
|
|
|
NSString *GSColorSpaceColorTable = @"GSColorSpaceColorTable";
|
|
|
|
|
|
1999-05-10 08:30:14 +00:00
|
|
|
|
/*
|
|
|
|
|
* Function for rapid access to current graphics context.
|
|
|
|
|
*/
|
2003-01-26 17:49:35 +00:00
|
|
|
|
NSGraphicsContext *GSCurrentContext(void)
|
1999-05-10 08:30:14 +00:00
|
|
|
|
{
|
|
|
|
|
#ifdef GNUSTEP_BASE_LIBRARY
|
|
|
|
|
/*
|
|
|
|
|
* gstep-base has a faster mechanism to get the current thread.
|
|
|
|
|
*/
|
|
|
|
|
NSThread *th = GSCurrentThread();
|
|
|
|
|
|
2017-12-27 12:15:31 +00:00
|
|
|
|
# if defined(_NONFRAGILE_ABI)
|
|
|
|
|
return (NSGraphicsContext*)object_getIvar(th,
|
|
|
|
|
class_getInstanceVariable(object_getClass(th), "_gcontext"));
|
|
|
|
|
# else
|
2010-03-27 00:01:03 +00:00
|
|
|
|
return (NSGraphicsContext*) th->_gcontext;
|
2017-12-27 12:15:31 +00:00
|
|
|
|
# endif
|
1999-05-10 08:30:14 +00:00
|
|
|
|
#else
|
1999-06-04 04:26:07 +00:00
|
|
|
|
NSMutableDictionary *dict = [[NSThread currentThread] threadDictionary];
|
1999-05-10 08:30:14 +00:00
|
|
|
|
|
|
|
|
|
return (NSGraphicsContext*) [dict objectForKey: NSGraphicsContextThreadKey];
|
|
|
|
|
#endif
|
|
|
|
|
}
|
|
|
|
|
|
1999-03-05 15:47:22 +00:00
|
|
|
|
|
1999-02-25 15:41:17 +00:00
|
|
|
|
@interface NSGraphicsContext (Private)
|
|
|
|
|
+ (gsMethodTable *) _initializeMethodTable;
|
|
|
|
|
@end
|
|
|
|
|
|
2002-03-28 03:53:18 +00:00
|
|
|
|
/**
|
|
|
|
|
<unit>
|
|
|
|
|
<heading>NSGraphicsContext</heading>
|
|
|
|
|
|
|
|
|
|
<p>This is an abstract class which provides a framework for a device
|
|
|
|
|
independant drawing.
|
|
|
|
|
</p>
|
|
|
|
|
|
|
|
|
|
<p>In addition, this class provides methods to perform the actual
|
|
|
|
|
drawing. As a convenience, you can also access these through various
|
|
|
|
|
function interfaces. One is a Display Postscript interface using PS
|
2002-04-03 16:59:43 +00:00
|
|
|
|
and DPS operations. Another is a Quartz interface (not yet written).
|
2002-03-28 03:53:18 +00:00
|
|
|
|
</p>
|
|
|
|
|
|
|
|
|
|
</unit> */
|
1999-02-25 15:41:17 +00:00
|
|
|
|
@implementation NSGraphicsContext
|
|
|
|
|
|
|
|
|
|
+ (void) initialize
|
|
|
|
|
{
|
1999-03-05 15:47:22 +00:00
|
|
|
|
if (contextLock == nil)
|
1999-02-25 15:41:17 +00:00
|
|
|
|
{
|
1999-03-05 15:47:22 +00:00
|
|
|
|
[gnustep_global_lock lock];
|
|
|
|
|
if (contextLock == nil)
|
|
|
|
|
{
|
|
|
|
|
contextLock = [NSRecursiveLock new];
|
|
|
|
|
defaultNSGraphicsContextClass = [NSGraphicsContext class];
|
|
|
|
|
_globalGSZone = NSDefaultMallocZone();
|
|
|
|
|
classMethodTable =
|
|
|
|
|
[[NSMutableDictionary allocWithZone: _globalGSZone] init];
|
|
|
|
|
}
|
|
|
|
|
[gnustep_global_lock unlock];
|
1999-02-25 15:41:17 +00:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2002-03-28 03:53:18 +00:00
|
|
|
|
+ (void) initializeBackend
|
|
|
|
|
{
|
|
|
|
|
[self subclassResponsibility: _cmd];
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/** Set the concrete subclass that will provide the device dependant
|
|
|
|
|
implementation.
|
|
|
|
|
*/
|
1999-02-25 15:41:17 +00:00
|
|
|
|
+ (void) setDefaultContextClass: (Class)defaultContextClass
|
|
|
|
|
{
|
|
|
|
|
defaultNSGraphicsContextClass = defaultContextClass;
|
|
|
|
|
}
|
|
|
|
|
|
2002-03-28 03:53:18 +00:00
|
|
|
|
/** Set the current context that will handle drawing. */
|
1999-05-10 08:30:14 +00:00
|
|
|
|
+ (void) setCurrentContext: (NSGraphicsContext *)context
|
|
|
|
|
{
|
|
|
|
|
#ifdef GNUSTEP_BASE_LIBRARY
|
1999-04-19 14:34:50 +00:00
|
|
|
|
/*
|
|
|
|
|
* gstep-base has a faster mechanism to get the current thread.
|
|
|
|
|
*/
|
1999-05-10 08:30:14 +00:00
|
|
|
|
NSThread *th = GSCurrentThread();
|
1999-04-19 14:34:50 +00:00
|
|
|
|
|
2017-12-27 12:15:31 +00:00
|
|
|
|
# if defined(_NONFRAGILE_ABI)
|
|
|
|
|
object_setIvar(th,
|
|
|
|
|
class_getInstanceVariable(object_getClass(th), "_gcontext"), context);
|
|
|
|
|
# else
|
2010-03-27 00:01:03 +00:00
|
|
|
|
ASSIGN(th->_gcontext, context);
|
2017-12-27 12:15:31 +00:00
|
|
|
|
# endif
|
1999-05-10 08:30:14 +00:00
|
|
|
|
#else
|
1999-06-04 04:26:07 +00:00
|
|
|
|
NSMutableDictionary *dict = [[NSThread currentThread] threadDictionary];
|
1999-03-05 15:47:22 +00:00
|
|
|
|
|
1999-05-10 08:30:14 +00:00
|
|
|
|
[dict setObject: context forKey: NSGraphicsContextThreadKey];
|
|
|
|
|
#endif
|
1999-02-25 15:41:17 +00:00
|
|
|
|
}
|
|
|
|
|
|
2002-03-28 03:53:18 +00:00
|
|
|
|
/** Returns the current context. Also see the convienience function
|
|
|
|
|
GSCurrentContext() */
|
1999-02-25 15:41:17 +00:00
|
|
|
|
+ (NSGraphicsContext *) currentContext
|
|
|
|
|
{
|
1999-05-10 08:30:14 +00:00
|
|
|
|
return GSCurrentContext();
|
1999-02-25 15:41:17 +00:00
|
|
|
|
}
|
|
|
|
|
|
2002-03-28 03:53:18 +00:00
|
|
|
|
/** Returns YES if the current context is a display context */
|
2001-08-04 14:43:31 +00:00
|
|
|
|
+ (BOOL) currentContextDrawingToScreen
|
|
|
|
|
{
|
|
|
|
|
return [GSCurrentContext() isDrawingToScreen];
|
|
|
|
|
}
|
|
|
|
|
|
2002-03-28 03:53:18 +00:00
|
|
|
|
/**
|
|
|
|
|
<p>Create a graphics context with attributes, which contains key/value
|
|
|
|
|
pairs which describe the specifics of how the context is to
|
|
|
|
|
be initialized.
|
|
|
|
|
</p>
|
|
|
|
|
*/
|
2002-01-26 04:14:38 +00:00
|
|
|
|
+ (NSGraphicsContext *) graphicsContextWithAttributes: (NSDictionary *)attributes
|
2001-08-04 14:43:31 +00:00
|
|
|
|
{
|
2001-11-08 18:26:39 +00:00
|
|
|
|
NSGraphicsContext *ctxt;
|
2008-05-18 23:12:24 +00:00
|
|
|
|
|
|
|
|
|
ctxt = [[self alloc] initWithContextInfo: attributes];
|
2002-02-27 09:40:22 +00:00
|
|
|
|
|
|
|
|
|
return AUTORELEASE(ctxt);
|
2001-08-04 14:43:31 +00:00
|
|
|
|
}
|
|
|
|
|
|
2002-03-28 03:53:18 +00:00
|
|
|
|
/**
|
|
|
|
|
Create graphics context with attributes speficied by aWindow's
|
|
|
|
|
device description. */
|
2001-08-04 14:43:31 +00:00
|
|
|
|
+ (NSGraphicsContext *) graphicsContextWithWindow: (NSWindow *)aWindow
|
|
|
|
|
{
|
2008-01-19 13:11:16 +00:00
|
|
|
|
return [self graphicsContextWithAttributes:
|
|
|
|
|
[NSDictionary dictionaryWithObject: aWindow
|
|
|
|
|
forKey: NSGraphicsContextDestinationAttributeName]];
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
+ (NSGraphicsContext *) graphicsContextWithBitmapImageRep: (NSBitmapImageRep *)bitmap
|
|
|
|
|
{
|
|
|
|
|
return [self graphicsContextWithAttributes:
|
|
|
|
|
[NSDictionary dictionaryWithObject: bitmap
|
|
|
|
|
forKey: NSGraphicsContextDestinationAttributeName]];
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
+ (NSGraphicsContext *) graphicsContextWithGraphicsPort: (void *)port
|
|
|
|
|
flipped: (BOOL)flag
|
|
|
|
|
{
|
2018-09-14 20:18:16 +00:00
|
|
|
|
NSGraphicsContext *ctxt;
|
2008-01-19 13:11:16 +00:00
|
|
|
|
|
2018-09-14 20:18:16 +00:00
|
|
|
|
ctxt = [[self alloc] initWithGraphicsPort: port
|
|
|
|
|
flipped: flag];
|
|
|
|
|
|
|
|
|
|
return AUTORELEASE(ctxt);
|
2001-08-04 14:43:31 +00:00
|
|
|
|
}
|
|
|
|
|
|
2017-07-25 01:53:34 +00:00
|
|
|
|
+ (NSGraphicsContext *)graphicsContextWithCGContext: (CGContextRef)context
|
|
|
|
|
flipped: (BOOL)flipped
|
|
|
|
|
{
|
|
|
|
|
return [NSGraphicsContext graphicsContextWithGraphicsPort: (void *)context
|
|
|
|
|
flipped: flipped];
|
|
|
|
|
}
|
|
|
|
|
|
2001-08-04 14:43:31 +00:00
|
|
|
|
+ (void) restoreGraphicsState
|
|
|
|
|
{
|
2002-04-01 17:34:08 +00:00
|
|
|
|
NSGraphicsContext *ctxt;
|
|
|
|
|
NSMutableDictionary *dict = [[NSThread currentThread] threadDictionary];
|
|
|
|
|
NSMutableArray *stack = [dict objectForKey: NSGraphicsContextStackKey];
|
2009-03-25 08:40:38 +00:00
|
|
|
|
|
|
|
|
|
if (stack == nil)
|
2002-04-01 17:34:08 +00:00
|
|
|
|
{
|
|
|
|
|
[NSException raise: NSGenericException
|
|
|
|
|
format: @"restoreGraphicsState without previous save"];
|
|
|
|
|
}
|
2009-03-25 08:40:38 +00:00
|
|
|
|
// might be nil, i.e. no current context
|
2002-04-01 17:34:08 +00:00
|
|
|
|
ctxt = [stack lastObject];
|
|
|
|
|
[NSGraphicsContext setCurrentContext: ctxt];
|
2009-03-25 08:40:38 +00:00
|
|
|
|
if (ctxt)
|
|
|
|
|
{
|
|
|
|
|
[stack removeLastObject];
|
|
|
|
|
[ctxt restoreGraphicsState];
|
|
|
|
|
}
|
2001-08-04 14:43:31 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
+ (void) saveGraphicsState
|
|
|
|
|
{
|
2002-04-01 17:34:08 +00:00
|
|
|
|
NSGraphicsContext *ctxt;
|
|
|
|
|
NSMutableDictionary *dict = [[NSThread currentThread] threadDictionary];
|
|
|
|
|
NSMutableArray *stack = [dict objectForKey: NSGraphicsContextStackKey];
|
|
|
|
|
if (stack == nil)
|
|
|
|
|
{
|
|
|
|
|
stack = [[NSMutableArray allocWithZone: _globalGSZone] init];
|
|
|
|
|
[dict setObject: stack forKey: NSGraphicsContextStackKey];
|
2011-03-07 21:18:19 +00:00
|
|
|
|
RELEASE(stack);
|
2002-04-01 17:34:08 +00:00
|
|
|
|
}
|
2009-03-25 08:40:38 +00:00
|
|
|
|
// might be nil, i.e. no current context
|
2002-04-01 17:34:08 +00:00
|
|
|
|
ctxt = GSCurrentContext();
|
2009-03-25 08:40:38 +00:00
|
|
|
|
if (ctxt)
|
|
|
|
|
{
|
|
|
|
|
[ctxt saveGraphicsState];
|
|
|
|
|
[stack addObject: ctxt];
|
|
|
|
|
}
|
2001-08-04 14:43:31 +00:00
|
|
|
|
}
|
|
|
|
|
|
2013-02-05 19:18:49 +00:00
|
|
|
|
+ (void) setGraphicsState: (NSInteger)graphicsState
|
2001-08-04 14:43:31 +00:00
|
|
|
|
{
|
2002-04-01 17:34:08 +00:00
|
|
|
|
/* FIXME: Need to keep a table of which context goes with a graphicState,
|
|
|
|
|
or perhaps we could rely on the backend? */
|
|
|
|
|
[self notImplemented: _cmd];
|
2001-08-04 14:43:31 +00:00
|
|
|
|
}
|
|
|
|
|
|
2008-05-18 23:12:24 +00:00
|
|
|
|
+ (id) alloc
|
|
|
|
|
{
|
|
|
|
|
return [self allocWithZone: _globalGSZone];
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
+ (id) allocWithZone: (NSZone*)z
|
|
|
|
|
{
|
|
|
|
|
if (self == [NSGraphicsContext class])
|
|
|
|
|
{
|
|
|
|
|
NSAssert(defaultNSGraphicsContextClass,
|
|
|
|
|
@"Internal Error: No default NSGraphicsContext set\n");
|
|
|
|
|
return [defaultNSGraphicsContextClass allocWithZone: z];
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
return [super allocWithZone: z];
|
|
|
|
|
}
|
|
|
|
|
|
1999-02-25 15:41:17 +00:00
|
|
|
|
- (void) dealloc
|
|
|
|
|
{
|
2003-07-21 09:59:52 +00:00
|
|
|
|
DESTROY(usedFonts);
|
1999-03-05 15:47:22 +00:00
|
|
|
|
DESTROY(focus_stack);
|
1999-02-25 15:41:17 +00:00
|
|
|
|
DESTROY(context_data);
|
|
|
|
|
DESTROY(context_info);
|
2023-12-28 11:47:25 +00:00
|
|
|
|
DESTROY(_shadow);
|
1999-02-25 15:41:17 +00:00
|
|
|
|
[super dealloc];
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
- (id) init
|
|
|
|
|
{
|
2003-07-21 09:59:52 +00:00
|
|
|
|
return [self initWithContextInfo: nil];
|
1999-02-25 15:41:17 +00:00
|
|
|
|
}
|
|
|
|
|
|
2003-07-21 09:59:52 +00:00
|
|
|
|
/** <init />
|
|
|
|
|
*/
|
1999-02-25 15:41:17 +00:00
|
|
|
|
- (id) initWithContextInfo: (NSDictionary *)info
|
|
|
|
|
{
|
2003-07-21 09:59:52 +00:00
|
|
|
|
self = [super init];
|
|
|
|
|
if (self != nil)
|
1999-02-25 15:41:17 +00:00
|
|
|
|
{
|
2003-07-21 09:59:52 +00:00
|
|
|
|
ASSIGN(context_info, info);
|
|
|
|
|
focus_stack = [[NSMutableArray allocWithZone: [self zone]]
|
|
|
|
|
initWithCapacity: 1];
|
|
|
|
|
usedFonts = nil;
|
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
|
* The classMethodTable dictionary and the list of all contexts must both
|
|
|
|
|
* be protected from other threads.
|
|
|
|
|
*/
|
|
|
|
|
[contextLock lock];
|
|
|
|
|
methods = [[classMethodTable objectForKey: [self class]] pointerValue];
|
|
|
|
|
if (methods == 0)
|
2008-01-19 13:11:16 +00:00
|
|
|
|
{
|
|
|
|
|
methods = [[self class] _initializeMethodTable];
|
|
|
|
|
[classMethodTable setObject: [NSValue valueWithPointer: methods]
|
|
|
|
|
forKey: [self class]];
|
|
|
|
|
}
|
2003-07-21 09:59:52 +00:00
|
|
|
|
[contextLock unlock];
|
1999-02-25 15:41:17 +00:00
|
|
|
|
}
|
|
|
|
|
return self;
|
|
|
|
|
}
|
|
|
|
|
|
2018-09-14 20:18:16 +00:00
|
|
|
|
|
|
|
|
|
- (id) initWithGraphicsPort: (void *)port
|
2023-11-20 21:43:49 +00:00
|
|
|
|
flipped: (BOOL)flag
|
2018-09-14 20:18:16 +00:00
|
|
|
|
{
|
|
|
|
|
self = [self init];
|
|
|
|
|
if (self != nil)
|
|
|
|
|
{
|
|
|
|
|
_graphicsPort = port;
|
|
|
|
|
_isFlipped = flag;
|
|
|
|
|
}
|
|
|
|
|
return self;
|
|
|
|
|
}
|
|
|
|
|
|
2001-08-04 14:43:31 +00:00
|
|
|
|
- (NSDictionary *) attributes
|
|
|
|
|
{
|
|
|
|
|
return context_info;
|
|
|
|
|
}
|
|
|
|
|
|
2023-08-01 20:39:46 +00:00
|
|
|
|
- (const gsMethodTable *) methods
|
|
|
|
|
{
|
|
|
|
|
return methods;
|
|
|
|
|
}
|
|
|
|
|
|
2006-09-12 09:49:54 +00:00
|
|
|
|
- (void) flushGraphics
|
2001-08-04 14:43:31 +00:00
|
|
|
|
{
|
2002-04-01 17:34:08 +00:00
|
|
|
|
[self subclassResponsibility: _cmd];
|
2001-08-04 14:43:31 +00:00
|
|
|
|
}
|
|
|
|
|
|
2006-09-12 09:49:54 +00:00
|
|
|
|
- (void *) graphicsPort
|
2001-08-04 14:43:31 +00:00
|
|
|
|
{
|
2008-01-19 13:11:16 +00:00
|
|
|
|
return _graphicsPort;
|
2001-08-04 14:43:31 +00:00
|
|
|
|
}
|
|
|
|
|
|
2017-07-25 01:53:34 +00:00
|
|
|
|
- (CGContextRef)CGContext
|
|
|
|
|
{
|
|
|
|
|
return (CGContextRef)[self graphicsPort];
|
|
|
|
|
}
|
|
|
|
|
|
1999-02-25 15:41:17 +00:00
|
|
|
|
- (BOOL) isDrawingToScreen
|
|
|
|
|
{
|
|
|
|
|
return NO;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
- (void) restoreGraphicsState
|
|
|
|
|
{
|
2002-04-01 17:34:08 +00:00
|
|
|
|
[self DPSgrestore];
|
1999-02-25 15:41:17 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
- (void) saveGraphicsState
|
|
|
|
|
{
|
2002-04-01 17:34:08 +00:00
|
|
|
|
[self DPSgsave];
|
1999-02-25 15:41:17 +00:00
|
|
|
|
}
|
|
|
|
|
|
2002-03-28 03:53:18 +00:00
|
|
|
|
- (void *) focusStack
|
2000-08-03 08:48:22 +00:00
|
|
|
|
{
|
2002-03-28 03:53:18 +00:00
|
|
|
|
return focus_stack;
|
2000-08-03 08:48:22 +00:00
|
|
|
|
}
|
|
|
|
|
|
2002-03-28 03:53:18 +00:00
|
|
|
|
- (void) setFocusStack: (void *)stack
|
1999-03-05 15:47:22 +00:00
|
|
|
|
{
|
2010-04-10 20:33:30 +00:00
|
|
|
|
ASSIGN(focus_stack, (id)stack);
|
1999-03-05 15:47:22 +00:00
|
|
|
|
}
|
|
|
|
|
|
2002-03-28 03:53:18 +00:00
|
|
|
|
- (void) setImageInterpolation: (NSImageInterpolation)interpolation
|
1999-03-05 15:47:22 +00:00
|
|
|
|
{
|
2002-03-28 03:53:18 +00:00
|
|
|
|
_interp = interpolation;
|
1999-03-05 15:47:22 +00:00
|
|
|
|
}
|
|
|
|
|
|
2002-03-28 03:53:18 +00:00
|
|
|
|
- (NSImageInterpolation) imageInterpolation
|
1999-03-05 15:47:22 +00:00
|
|
|
|
{
|
2002-03-28 03:53:18 +00:00
|
|
|
|
return _interp;
|
1999-03-05 15:47:22 +00:00
|
|
|
|
}
|
|
|
|
|
|
2002-03-28 03:53:18 +00:00
|
|
|
|
- (void) setShouldAntialias: (BOOL)antialias
|
1999-06-15 09:23:39 +00:00
|
|
|
|
{
|
2002-03-28 03:53:18 +00:00
|
|
|
|
_antialias = antialias;
|
1999-06-15 09:23:39 +00:00
|
|
|
|
}
|
|
|
|
|
|
2002-03-28 03:53:18 +00:00
|
|
|
|
- (BOOL) shouldAntialias
|
1999-06-15 09:23:39 +00:00
|
|
|
|
{
|
2002-03-28 03:53:18 +00:00
|
|
|
|
return _antialias;
|
1999-06-15 09:23:39 +00:00
|
|
|
|
}
|
|
|
|
|
|
2008-01-19 13:11:16 +00:00
|
|
|
|
- (NSPoint) patternPhase
|
|
|
|
|
{
|
|
|
|
|
return _patternPhase;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
- (void) setPatternPhase: (NSPoint)phase
|
|
|
|
|
{
|
|
|
|
|
_patternPhase = phase;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
- (BOOL) isFlipped
|
|
|
|
|
{
|
|
|
|
|
NSView *focusView = [self focusView];
|
|
|
|
|
|
|
|
|
|
if (focusView)
|
|
|
|
|
return [focusView isFlipped];
|
|
|
|
|
else
|
|
|
|
|
return _isFlipped;
|
|
|
|
|
}
|
|
|
|
|
- (NSCompositingOperation) compositingOperation
|
|
|
|
|
{
|
|
|
|
|
return _compositingOperation;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
- (void) setCompositingOperation: (NSCompositingOperation)operation
|
|
|
|
|
{
|
|
|
|
|
_compositingOperation = operation;
|
|
|
|
|
}
|
|
|
|
|
|
2002-03-28 03:53:18 +00:00
|
|
|
|
- (NSView*) focusView
|
1999-06-15 09:23:39 +00:00
|
|
|
|
{
|
2002-03-28 03:53:18 +00:00
|
|
|
|
return [focus_stack lastObject];
|
1999-07-06 05:37:15 +00:00
|
|
|
|
}
|
|
|
|
|
|
2002-03-28 03:53:18 +00:00
|
|
|
|
- (void) lockFocusView: (NSView*)aView inRect: (NSRect)rect
|
1999-07-29 20:58:04 +00:00
|
|
|
|
{
|
2002-03-28 03:53:18 +00:00
|
|
|
|
[focus_stack addObject: aView];
|
1999-07-29 20:58:04 +00:00
|
|
|
|
}
|
|
|
|
|
|
2002-03-28 03:53:18 +00:00
|
|
|
|
- (void) unlockFocusView: (NSView*)aView needsFlush: (BOOL)flush
|
2002-01-21 15:45:53 +00:00
|
|
|
|
{
|
2002-03-28 03:53:18 +00:00
|
|
|
|
[focus_stack removeLastObject];
|
2002-01-21 15:45:53 +00:00
|
|
|
|
}
|
|
|
|
|
|
2001-11-20 05:00:20 +00:00
|
|
|
|
- (void) useFont: (NSString*)name
|
|
|
|
|
{
|
|
|
|
|
if ([self isDrawingToScreen] == YES)
|
|
|
|
|
return;
|
|
|
|
|
|
|
|
|
|
if (usedFonts == nil)
|
2003-07-21 09:59:52 +00:00
|
|
|
|
usedFonts = [[NSMutableSet alloc] initWithCapacity: 2];
|
2001-11-20 05:00:20 +00:00
|
|
|
|
|
|
|
|
|
[usedFonts addObject: name];
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
- (void) resetUsedFonts
|
|
|
|
|
{
|
2003-07-21 09:59:52 +00:00
|
|
|
|
[usedFonts removeAllObjects];
|
2001-11-20 05:00:20 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
- (NSSet *) usedFonts
|
|
|
|
|
{
|
|
|
|
|
return usedFonts;
|
|
|
|
|
}
|
|
|
|
|
|
2002-03-28 03:53:18 +00:00
|
|
|
|
/* Private backend methods */
|
2002-04-15 02:52:35 +00:00
|
|
|
|
/** Private backend method. Typically this is called by the window
|
|
|
|
|
server to tell the graphics context that it should flush output
|
|
|
|
|
to a window indicated by the device pointer. The device pointer
|
|
|
|
|
is an opaque type setup by the context so that it knows which
|
|
|
|
|
context and/or buffer should be. */
|
|
|
|
|
+ (void) handleExposeRect: (NSRect)rect forDriver: (void *)driver
|
2002-03-28 03:53:18 +00:00
|
|
|
|
{
|
|
|
|
|
}
|
|
|
|
|
|
2023-12-28 11:47:25 +00:00
|
|
|
|
/* Private method for handling shadows */
|
|
|
|
|
- (void) setShadow: (NSShadow *)shadow
|
|
|
|
|
{
|
|
|
|
|
ASSIGN(_shadow, shadow);
|
|
|
|
|
}
|
|
|
|
|
|
2023-12-28 16:20:12 +00:00
|
|
|
|
- (NSShadow *) shadow
|
|
|
|
|
{
|
|
|
|
|
return _shadow;
|
|
|
|
|
}
|
|
|
|
|
|
1999-02-25 15:41:17 +00:00
|
|
|
|
@end
|
|
|
|
|
|
|
|
|
|
@implementation NSGraphicsContext (Private)
|
|
|
|
|
|
|
|
|
|
/* Build up method table for fast access to methods. Cast to (void *) to
|
|
|
|
|
avoid compiler warnings */
|
|
|
|
|
+ (gsMethodTable *) _initializeMethodTable
|
|
|
|
|
{
|
|
|
|
|
gsMethodTable methodTable;
|
|
|
|
|
gsMethodTable *mptr;
|
|
|
|
|
|
|
|
|
|
#define GET_IMP(X) ((void*) [self instanceMethodForSelector: (X)])
|
|
|
|
|
|
|
|
|
|
/* ----------------------------------------------------------------------- */
|
|
|
|
|
/* Color operations */
|
|
|
|
|
/* ----------------------------------------------------------------------- */
|
2002-03-28 03:53:18 +00:00
|
|
|
|
methodTable.DPScurrentalpha_ =
|
|
|
|
|
GET_IMP(@selector(DPScurrentalpha:));
|
1999-02-25 15:41:17 +00:00
|
|
|
|
methodTable.DPScurrentcmykcolor____ =
|
|
|
|
|
GET_IMP(@selector(DPScurrentcmykcolor::::));
|
2002-03-28 03:53:18 +00:00
|
|
|
|
methodTable.DPScurrentgray_ =
|
|
|
|
|
GET_IMP(@selector(DPScurrentgray:));
|
|
|
|
|
methodTable.DPScurrenthsbcolor___ =
|
|
|
|
|
GET_IMP(@selector(DPScurrenthsbcolor:::));
|
|
|
|
|
methodTable.DPScurrentrgbcolor___ =
|
|
|
|
|
GET_IMP(@selector(DPScurrentrgbcolor:::));
|
|
|
|
|
methodTable.DPSsetalpha_ =
|
|
|
|
|
GET_IMP(@selector(DPSsetalpha:));
|
1999-02-25 15:41:17 +00:00
|
|
|
|
methodTable.DPSsetcmykcolor____ =
|
|
|
|
|
GET_IMP(@selector(DPSsetcmykcolor::::));
|
2002-03-28 03:53:18 +00:00
|
|
|
|
methodTable.DPSsetgray_ =
|
|
|
|
|
GET_IMP(@selector(DPSsetgray:));
|
|
|
|
|
methodTable.DPSsethsbcolor___ =
|
|
|
|
|
GET_IMP(@selector(DPSsethsbcolor:::));
|
|
|
|
|
methodTable.DPSsetrgbcolor___ =
|
|
|
|
|
GET_IMP(@selector(DPSsetrgbcolor:::));
|
|
|
|
|
|
|
|
|
|
methodTable.GSSetFillColorspace_ =
|
|
|
|
|
GET_IMP(@selector(GSSetFillColorspace:));
|
|
|
|
|
methodTable.GSSetStrokeColorspace_ =
|
|
|
|
|
GET_IMP(@selector(GSSetStrokeColorspace:));
|
|
|
|
|
methodTable.GSSetFillColor_ =
|
|
|
|
|
GET_IMP(@selector(GSSetFillColor:));
|
|
|
|
|
methodTable.GSSetStrokeColor_ =
|
|
|
|
|
GET_IMP(@selector(GSSetStrokeColor:));
|
|
|
|
|
|
1999-02-25 15:41:17 +00:00
|
|
|
|
/* ----------------------------------------------------------------------- */
|
2002-03-28 03:53:18 +00:00
|
|
|
|
/* Text operations */
|
1999-02-25 15:41:17 +00:00
|
|
|
|
/* ----------------------------------------------------------------------- */
|
2002-03-28 03:53:18 +00:00
|
|
|
|
methodTable.DPSashow___ =
|
|
|
|
|
GET_IMP(@selector(DPSashow:::));
|
|
|
|
|
methodTable.DPSawidthshow______ =
|
|
|
|
|
GET_IMP(@selector(DPSawidthshow::::::));
|
|
|
|
|
methodTable.DPScharpath__ =
|
|
|
|
|
GET_IMP(@selector(DPScharpath::));
|
|
|
|
|
methodTable.DPSshow_ =
|
|
|
|
|
GET_IMP(@selector(DPSshow:));
|
|
|
|
|
methodTable.DPSwidthshow____ =
|
|
|
|
|
GET_IMP(@selector(DPSwidthshow::::));
|
|
|
|
|
methodTable.DPSxshow___ =
|
|
|
|
|
GET_IMP(@selector(DPSxshow:::));
|
|
|
|
|
methodTable.DPSxyshow___ =
|
|
|
|
|
GET_IMP(@selector(DPSxyshow:::));
|
|
|
|
|
methodTable.DPSyshow___ =
|
|
|
|
|
GET_IMP(@selector(DPSyshow:::));
|
|
|
|
|
|
|
|
|
|
methodTable.GSSetCharacterSpacing_ =
|
|
|
|
|
GET_IMP(@selector(GSSetCharacterSpacing:));
|
|
|
|
|
methodTable.GSSetFont_ =
|
|
|
|
|
GET_IMP(@selector(GSSetFont:));
|
|
|
|
|
methodTable.GSSetFontSize_ =
|
|
|
|
|
GET_IMP(@selector(GSSetFontSize:));
|
|
|
|
|
methodTable.GSGetTextCTM =
|
|
|
|
|
GET_IMP(@selector(GSGetTextCTM));
|
|
|
|
|
methodTable.GSGetTextPosition =
|
|
|
|
|
GET_IMP(@selector(GSGetTextPosition));
|
|
|
|
|
methodTable.GSSetTextCTM_ =
|
|
|
|
|
GET_IMP(@selector(GSSetTextCTM:));
|
|
|
|
|
methodTable.GSSetTextDrawingMode_ =
|
|
|
|
|
GET_IMP(@selector(GSSetTextDrawingMode:));
|
|
|
|
|
methodTable.GSSetTextPosition_ =
|
|
|
|
|
GET_IMP(@selector(GSSetTextPosition:));
|
|
|
|
|
methodTable.GSShowText__ =
|
|
|
|
|
GET_IMP(@selector(GSShowText::));
|
|
|
|
|
methodTable.GSShowGlyphs__ =
|
|
|
|
|
GET_IMP(@selector(GSShowGlyphs::));
|
2023-10-01 20:56:02 +00:00
|
|
|
|
methodTable.GSShowGlyphsWithAdvances___ =
|
2011-05-26 03:55:55 +00:00
|
|
|
|
GET_IMP(@selector(GSShowGlyphsWithAdvances:::));
|
2002-03-28 03:53:18 +00:00
|
|
|
|
|
1999-02-25 15:41:17 +00:00
|
|
|
|
/* ----------------------------------------------------------------------- */
|
2002-03-28 03:53:18 +00:00
|
|
|
|
/* Gstate Handling */
|
1999-02-25 15:41:17 +00:00
|
|
|
|
/* ----------------------------------------------------------------------- */
|
2002-03-28 03:53:18 +00:00
|
|
|
|
methodTable.DPSgrestore =
|
|
|
|
|
GET_IMP(@selector(DPSgrestore));
|
|
|
|
|
methodTable.DPSgsave =
|
|
|
|
|
GET_IMP(@selector(DPSgsave));
|
|
|
|
|
methodTable.DPSinitgraphics =
|
|
|
|
|
GET_IMP(@selector(DPSinitgraphics));
|
|
|
|
|
methodTable.DPSsetgstate_ =
|
|
|
|
|
GET_IMP(@selector(DPSsetgstate:));
|
|
|
|
|
|
|
|
|
|
methodTable.GSDefineGState =
|
|
|
|
|
GET_IMP(@selector(GSDefineGState));
|
|
|
|
|
methodTable.GSUndefineGState_ =
|
|
|
|
|
GET_IMP(@selector(GSUndefineGState:));
|
|
|
|
|
methodTable.GSReplaceGState_ =
|
|
|
|
|
GET_IMP(@selector(GSReplaceGState:));
|
|
|
|
|
|
1999-02-25 15:41:17 +00:00
|
|
|
|
/* ----------------------------------------------------------------------- */
|
|
|
|
|
/* Gstate operations */
|
|
|
|
|
/* ----------------------------------------------------------------------- */
|
|
|
|
|
methodTable.DPScurrentflat_ =
|
|
|
|
|
GET_IMP(@selector(DPScurrentflat:));
|
|
|
|
|
methodTable.DPScurrentlinecap_ =
|
|
|
|
|
GET_IMP(@selector(DPScurrentlinecap:));
|
|
|
|
|
methodTable.DPScurrentlinejoin_ =
|
|
|
|
|
GET_IMP(@selector(DPScurrentlinejoin:));
|
|
|
|
|
methodTable.DPScurrentlinewidth_ =
|
|
|
|
|
GET_IMP(@selector(DPScurrentlinewidth:));
|
|
|
|
|
methodTable.DPScurrentmiterlimit_ =
|
|
|
|
|
GET_IMP(@selector(DPScurrentmiterlimit:));
|
|
|
|
|
methodTable.DPScurrentpoint__ =
|
|
|
|
|
GET_IMP(@selector(DPScurrentpoint::));
|
|
|
|
|
methodTable.DPScurrentstrokeadjust_ =
|
|
|
|
|
GET_IMP(@selector(DPScurrentstrokeadjust:));
|
|
|
|
|
methodTable.DPSsetdash___ =
|
|
|
|
|
GET_IMP(@selector(DPSsetdash:::));
|
|
|
|
|
methodTable.DPSsetflat_ =
|
|
|
|
|
GET_IMP(@selector(DPSsetflat:));
|
|
|
|
|
methodTable.DPSsethalftonephase__ =
|
|
|
|
|
GET_IMP(@selector(DPSsethalftonephase::));
|
|
|
|
|
methodTable.DPSsetlinecap_ =
|
|
|
|
|
GET_IMP(@selector(DPSsetlinecap:));
|
|
|
|
|
methodTable.DPSsetlinejoin_ =
|
|
|
|
|
GET_IMP(@selector(DPSsetlinejoin:));
|
|
|
|
|
methodTable.DPSsetlinewidth_ =
|
|
|
|
|
GET_IMP(@selector(DPSsetlinewidth:));
|
|
|
|
|
methodTable.DPSsetmiterlimit_ =
|
|
|
|
|
GET_IMP(@selector(DPSsetmiterlimit:));
|
|
|
|
|
methodTable.DPSsetstrokeadjust_ =
|
|
|
|
|
GET_IMP(@selector(DPSsetstrokeadjust:));
|
2002-03-28 03:53:18 +00:00
|
|
|
|
|
1999-05-11 15:43:10 +00:00
|
|
|
|
/* ----------------------------------------------------------------------- */
|
1999-02-25 15:41:17 +00:00
|
|
|
|
/* Matrix operations */
|
|
|
|
|
/* ----------------------------------------------------------------------- */
|
2002-03-28 03:53:18 +00:00
|
|
|
|
methodTable.DPSconcat_ =
|
|
|
|
|
GET_IMP(@selector(DPSconcat:));
|
|
|
|
|
methodTable.DPSinitmatrix =
|
|
|
|
|
GET_IMP(@selector(DPSinitmatrix));
|
|
|
|
|
methodTable.DPSrotate_ =
|
|
|
|
|
GET_IMP(@selector(DPSrotate:));
|
|
|
|
|
methodTable.DPSscale__ =
|
|
|
|
|
GET_IMP(@selector(DPSscale::));
|
|
|
|
|
methodTable.DPStranslate__ =
|
|
|
|
|
GET_IMP(@selector(DPStranslate::));
|
|
|
|
|
|
|
|
|
|
methodTable.GSCurrentCTM =
|
|
|
|
|
GET_IMP(@selector(GSCurrentCTM));
|
|
|
|
|
methodTable.GSSetCTM_ =
|
|
|
|
|
GET_IMP(@selector(GSSetCTM:));
|
|
|
|
|
methodTable.GSConcatCTM_ =
|
|
|
|
|
GET_IMP(@selector(GSConcatCTM:));
|
|
|
|
|
|
1999-02-25 15:41:17 +00:00
|
|
|
|
/* ----------------------------------------------------------------------- */
|
|
|
|
|
/* Paint operations */
|
|
|
|
|
/* ----------------------------------------------------------------------- */
|
|
|
|
|
methodTable.DPSarc_____ =
|
|
|
|
|
GET_IMP(@selector(DPSarc:::::));
|
|
|
|
|
methodTable.DPSarcn_____ =
|
|
|
|
|
GET_IMP(@selector(DPSarcn:::::));
|
|
|
|
|
methodTable.DPSarct_____ =
|
|
|
|
|
GET_IMP(@selector(DPSarct:::::));
|
|
|
|
|
methodTable.DPSclip =
|
|
|
|
|
GET_IMP(@selector(DPSclip));
|
|
|
|
|
methodTable.DPSclosepath =
|
|
|
|
|
GET_IMP(@selector(DPSclosepath));
|
|
|
|
|
methodTable.DPScurveto______ =
|
|
|
|
|
GET_IMP(@selector(DPScurveto::::::));
|
|
|
|
|
methodTable.DPSeoclip =
|
|
|
|
|
GET_IMP(@selector(DPSeoclip));
|
2002-03-28 03:53:18 +00:00
|
|
|
|
methodTable.DPSeofill =
|
|
|
|
|
GET_IMP(@selector(DPSeofill));
|
|
|
|
|
methodTable.DPSfill =
|
|
|
|
|
GET_IMP(@selector(DPSfill));
|
1999-02-25 15:41:17 +00:00
|
|
|
|
methodTable.DPSflattenpath =
|
|
|
|
|
GET_IMP(@selector(DPSflattenpath));
|
|
|
|
|
methodTable.DPSinitclip =
|
|
|
|
|
GET_IMP(@selector(DPSinitclip));
|
|
|
|
|
methodTable.DPSlineto__ =
|
|
|
|
|
GET_IMP(@selector(DPSlineto::));
|
|
|
|
|
methodTable.DPSmoveto__ =
|
|
|
|
|
GET_IMP(@selector(DPSmoveto::));
|
|
|
|
|
methodTable.DPSnewpath =
|
|
|
|
|
GET_IMP(@selector(DPSnewpath));
|
|
|
|
|
methodTable.DPSpathbbox____ =
|
|
|
|
|
GET_IMP(@selector(DPSpathbbox::::));
|
|
|
|
|
methodTable.DPSrcurveto______ =
|
|
|
|
|
GET_IMP(@selector(DPSrcurveto::::::));
|
|
|
|
|
methodTable.DPSrectclip____ =
|
|
|
|
|
GET_IMP(@selector(DPSrectclip::::));
|
2002-03-28 03:53:18 +00:00
|
|
|
|
methodTable.DPSrectfill____ =
|
|
|
|
|
GET_IMP(@selector(DPSrectfill::::));
|
|
|
|
|
methodTable.DPSrectstroke____ =
|
|
|
|
|
GET_IMP(@selector(DPSrectstroke::::));
|
1999-02-25 15:41:17 +00:00
|
|
|
|
methodTable.DPSreversepath =
|
|
|
|
|
GET_IMP(@selector(DPSreversepath));
|
|
|
|
|
methodTable.DPSrlineto__ =
|
|
|
|
|
GET_IMP(@selector(DPSrlineto::));
|
|
|
|
|
methodTable.DPSrmoveto__ =
|
|
|
|
|
GET_IMP(@selector(DPSrmoveto::));
|
2002-03-28 03:53:18 +00:00
|
|
|
|
methodTable.DPSstroke =
|
|
|
|
|
GET_IMP(@selector(DPSstroke));
|
2023-10-01 20:56:02 +00:00
|
|
|
|
methodTable.DPSshfill_ =
|
2003-05-17 22:04:00 +00:00
|
|
|
|
GET_IMP(@selector(DPSshfill:));
|
2002-03-28 03:53:18 +00:00
|
|
|
|
|
|
|
|
|
methodTable.GSSendBezierPath_ =
|
|
|
|
|
GET_IMP(@selector(GSSendBezierPath:));
|
|
|
|
|
methodTable.GSRectClipList__ =
|
|
|
|
|
GET_IMP(@selector(GSRectClipList::));
|
|
|
|
|
methodTable.GSRectFillList__ =
|
|
|
|
|
GET_IMP(@selector(GSRectFillList::));
|
|
|
|
|
|
2001-09-03 04:10:36 +00:00
|
|
|
|
/* ----------------------------------------------------------------------- */
|
1999-02-25 15:41:17 +00:00
|
|
|
|
/* Window system ops */
|
|
|
|
|
/* ----------------------------------------------------------------------- */
|
2002-04-15 02:52:35 +00:00
|
|
|
|
methodTable.GSCurrentDevice___ =
|
|
|
|
|
GET_IMP(@selector(GSCurrentDevice:::));
|
1999-02-25 15:41:17 +00:00
|
|
|
|
methodTable.DPScurrentoffset__ =
|
|
|
|
|
GET_IMP(@selector(DPScurrentoffset::));
|
2002-04-15 02:52:35 +00:00
|
|
|
|
methodTable.GSSetDevice___ =
|
|
|
|
|
GET_IMP(@selector(GSSetDevice:::));
|
1999-02-25 15:41:17 +00:00
|
|
|
|
methodTable.DPSsetoffset__ =
|
|
|
|
|
GET_IMP(@selector(DPSsetoffset::));
|
2002-03-28 03:53:18 +00:00
|
|
|
|
|
1999-05-18 16:49:13 +00:00
|
|
|
|
/*-------------------------------------------------------------------------*/
|
2002-03-28 03:53:18 +00:00
|
|
|
|
/* Graphics Extensions Ops */
|
1999-05-18 16:49:13 +00:00
|
|
|
|
/*-------------------------------------------------------------------------*/
|
2002-03-28 03:53:18 +00:00
|
|
|
|
methodTable.DPScomposite________ =
|
1999-05-18 16:49:13 +00:00
|
|
|
|
GET_IMP(@selector(DPScomposite::::::::));
|
2002-03-28 03:53:18 +00:00
|
|
|
|
methodTable.DPScompositerect_____ =
|
1999-05-18 16:49:13 +00:00
|
|
|
|
GET_IMP(@selector(DPScompositerect:::::));
|
2002-03-28 03:53:18 +00:00
|
|
|
|
methodTable.DPSdissolve________ =
|
1999-05-18 16:49:13 +00:00
|
|
|
|
GET_IMP(@selector(DPSdissolve::::::::));
|
1999-02-25 15:41:17 +00:00
|
|
|
|
|
2002-03-28 03:53:18 +00:00
|
|
|
|
methodTable.GSDrawImage__ =
|
|
|
|
|
GET_IMP(@selector(GSDrawImage::));
|
1999-02-25 15:41:17 +00:00
|
|
|
|
|
2002-03-28 03:53:18 +00:00
|
|
|
|
/* ----------------------------------------------------------------------- */
|
|
|
|
|
/* Postscript Client functions */
|
|
|
|
|
/* ----------------------------------------------------------------------- */
|
|
|
|
|
methodTable.DPSPrintf__ =
|
|
|
|
|
GET_IMP(@selector(DPSPrintf::));
|
|
|
|
|
methodTable.DPSWriteData__ =
|
|
|
|
|
GET_IMP(@selector(DPSWriteData::));
|
1999-02-25 15:41:17 +00:00
|
|
|
|
|
2002-03-28 03:53:18 +00:00
|
|
|
|
/* ----------------------------------------------------------------------- */
|
|
|
|
|
/* NSGraphics Ops */
|
|
|
|
|
/* ----------------------------------------------------------------------- */
|
2003-09-20 02:57:45 +00:00
|
|
|
|
methodTable.GSReadRect_ =
|
|
|
|
|
GET_IMP(@selector(GSReadRect:));
|
1999-02-25 15:41:17 +00:00
|
|
|
|
|
2002-03-28 03:53:18 +00:00
|
|
|
|
methodTable.NSBeep =
|
|
|
|
|
GET_IMP(@selector(NSBeep));
|
1999-02-25 15:41:17 +00:00
|
|
|
|
|
2002-03-28 03:53:18 +00:00
|
|
|
|
/* Context helper wraps */
|
|
|
|
|
methodTable.GSWSetViewIsFlipped_ =
|
|
|
|
|
GET_IMP(@selector(GSWSetViewIsFlipped:));
|
|
|
|
|
methodTable.GSWViewIsFlipped =
|
|
|
|
|
GET_IMP(@selector(GSWViewIsFlipped));
|
1999-02-25 15:41:17 +00:00
|
|
|
|
|
2002-03-28 03:53:18 +00:00
|
|
|
|
/*
|
|
|
|
|
* Render Bitmap Images
|
|
|
|
|
*/
|
|
|
|
|
methodTable.NSDrawBitmap___________ =
|
|
|
|
|
GET_IMP(@selector(NSDrawBitmap:::::::::::));
|
1999-02-25 15:41:17 +00:00
|
|
|
|
|
2002-03-28 03:53:18 +00:00
|
|
|
|
mptr = NSZoneMalloc(_globalGSZone, sizeof(gsMethodTable));
|
|
|
|
|
memcpy(mptr, &methodTable, sizeof(gsMethodTable));
|
|
|
|
|
return mptr;
|
1999-02-25 15:41:17 +00:00
|
|
|
|
}
|
|
|
|
|
|
2002-04-10 22:04:39 +00:00
|
|
|
|
- (id) subclassResponsibility: (SEL)aSel
|
|
|
|
|
{
|
|
|
|
|
[NSException raise: GSWindowServerInternalException
|
|
|
|
|
format: @"subclass %s(%s) should override %s",
|
2010-09-09 23:39:23 +00:00
|
|
|
|
class_getName(object_getClass(self)),
|
2002-04-10 22:04:39 +00:00
|
|
|
|
GSObjCIsInstance(self) ? "instance" : "class",
|
2010-12-27 12:03:56 +00:00
|
|
|
|
sel_getName(aSel)];
|
2002-04-10 22:04:39 +00:00
|
|
|
|
return nil;
|
|
|
|
|
}
|
|
|
|
|
|
2002-03-28 03:53:18 +00:00
|
|
|
|
@end
|
1999-02-25 15:41:17 +00:00
|
|
|
|
|
2002-03-28 03:53:18 +00:00
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
|
* The 'Ops' catagory contains the methods to implement all the
|
|
|
|
|
* PostScript functions. In this abstract class, these will all
|
|
|
|
|
* raise an exception. Concrete instances of the NSGraphicsContext
|
|
|
|
|
* class should override these methods in order to implement the
|
|
|
|
|
* PostScript functions.
|
|
|
|
|
*/
|
|
|
|
|
@implementation NSGraphicsContext (Ops)
|
1999-02-25 15:41:17 +00:00
|
|
|
|
|
2002-03-28 03:53:18 +00:00
|
|
|
|
/* ----------------------------------------------------------------------- */
|
|
|
|
|
/* Color operations */
|
|
|
|
|
/* ----------------------------------------------------------------------- */
|
2002-08-25 02:47:00 +00:00
|
|
|
|
/** Returns the current alpha component (DPS). */
|
2013-02-05 19:18:49 +00:00
|
|
|
|
- (void) DPScurrentalpha: (CGFloat *)a
|
1999-02-25 15:41:17 +00:00
|
|
|
|
{
|
|
|
|
|
[self subclassResponsibility: _cmd];
|
|
|
|
|
}
|
|
|
|
|
|
2002-08-25 02:47:00 +00:00
|
|
|
|
/** Returns the current color according to the CMYK color model (DPS). */
|
2013-02-05 19:18:49 +00:00
|
|
|
|
- (void) DPScurrentcmykcolor: (CGFloat*)c : (CGFloat*)m : (CGFloat*)y : (CGFloat*)k
|
1999-02-25 15:41:17 +00:00
|
|
|
|
{
|
|
|
|
|
[self subclassResponsibility: _cmd];
|
|
|
|
|
}
|
|
|
|
|
|
2002-04-01 17:34:08 +00:00
|
|
|
|
/** Returns the gray-level equivalent in the current color space. The
|
|
|
|
|
value may depend on the current color space and may be 0 if the
|
2002-08-25 02:47:00 +00:00
|
|
|
|
current color space has no notion of a gray value (DPS) */
|
2013-02-05 19:18:49 +00:00
|
|
|
|
- (void) DPScurrentgray: (CGFloat*)gray
|
1999-02-25 15:41:17 +00:00
|
|
|
|
{
|
|
|
|
|
[self subclassResponsibility: _cmd];
|
|
|
|
|
}
|
|
|
|
|
|
2002-08-25 02:47:00 +00:00
|
|
|
|
/** Returns the current color according to the HSB color model (DPS). */
|
2013-02-05 19:18:49 +00:00
|
|
|
|
- (void) DPScurrenthsbcolor: (CGFloat*)h : (CGFloat*)s : (CGFloat*)b
|
1999-02-25 15:41:17 +00:00
|
|
|
|
{
|
|
|
|
|
[self subclassResponsibility: _cmd];
|
|
|
|
|
}
|
|
|
|
|
|
2002-08-25 02:47:00 +00:00
|
|
|
|
/** Returns the current color according to the RGB color model (DPS). */
|
2013-02-05 19:18:49 +00:00
|
|
|
|
- (void) DPScurrentrgbcolor: (CGFloat*)r : (CGFloat*)g : (CGFloat*)b
|
1999-02-25 15:41:17 +00:00
|
|
|
|
{
|
|
|
|
|
[self subclassResponsibility: _cmd];
|
|
|
|
|
}
|
|
|
|
|
|
2002-04-01 17:34:08 +00:00
|
|
|
|
/** Sets the alpha drawing component. For this and other color setting
|
|
|
|
|
commands that have no differentiation between fill and stroke colors,
|
2002-08-25 02:47:00 +00:00
|
|
|
|
both the fill and stroke alpha are set (DPS). */
|
2013-02-05 19:18:49 +00:00
|
|
|
|
- (void) DPSsetalpha: (CGFloat)a
|
1999-02-25 15:41:17 +00:00
|
|
|
|
{
|
|
|
|
|
[self subclassResponsibility: _cmd];
|
|
|
|
|
}
|
|
|
|
|
|
2002-04-01 17:34:08 +00:00
|
|
|
|
/** Sets the current colorspace to Device CMYK and the current color
|
|
|
|
|
based on the indicated values. For this and other color setting
|
|
|
|
|
commands that have no differentiation between fill and stroke colors,
|
2002-08-25 02:47:00 +00:00
|
|
|
|
both the fill and stroke colors are set (DPS). */
|
2013-02-05 19:18:49 +00:00
|
|
|
|
- (void) DPSsetcmykcolor: (CGFloat)c : (CGFloat)m : (CGFloat)y : (CGFloat)k
|
1999-02-25 15:41:17 +00:00
|
|
|
|
{
|
|
|
|
|
[self subclassResponsibility: _cmd];
|
|
|
|
|
}
|
|
|
|
|
|
2002-08-25 02:47:00 +00:00
|
|
|
|
/** Sets the current colorspace to Device Gray and the current gray value
|
|
|
|
|
(DPS). */
|
2013-02-05 19:18:49 +00:00
|
|
|
|
- (void) DPSsetgray: (CGFloat)gray
|
1999-02-25 15:41:17 +00:00
|
|
|
|
{
|
|
|
|
|
[self subclassResponsibility: _cmd];
|
|
|
|
|
}
|
|
|
|
|
|
2002-04-01 17:34:08 +00:00
|
|
|
|
/** Sets the current colorspace to Device RGB and the current color based on
|
2002-08-25 02:47:00 +00:00
|
|
|
|
the indicated values (DPS). */
|
2013-02-05 19:18:49 +00:00
|
|
|
|
- (void) DPSsethsbcolor: (CGFloat)h : (CGFloat)s : (CGFloat)b
|
1999-02-25 15:41:17 +00:00
|
|
|
|
{
|
|
|
|
|
[self subclassResponsibility: _cmd];
|
|
|
|
|
}
|
|
|
|
|
|
2002-04-01 17:34:08 +00:00
|
|
|
|
/** Sets the current colorspace to Device RGB and the current color based on
|
2002-08-25 02:47:00 +00:00
|
|
|
|
the indicated values (DPS). */
|
2013-02-05 19:18:49 +00:00
|
|
|
|
- (void) DPSsetrgbcolor: (CGFloat)r : (CGFloat)g : (CGFloat)b
|
1999-02-25 15:41:17 +00:00
|
|
|
|
{
|
|
|
|
|
[self subclassResponsibility: _cmd];
|
|
|
|
|
}
|
|
|
|
|
|
2005-07-08 23:51:49 +00:00
|
|
|
|
- (void) GSSetPatterColor: (NSImage*)image
|
|
|
|
|
{
|
|
|
|
|
[self subclassResponsibility: _cmd];
|
|
|
|
|
}
|
|
|
|
|
|
2002-04-01 17:34:08 +00:00
|
|
|
|
/**
|
|
|
|
|
<p>Sets the colorspace for fill operations based on values in the supplied
|
|
|
|
|
dictionary dict.</p>
|
|
|
|
|
<p>For device colorspaces (GSDeviceGray, GSDeviceRGB,
|
|
|
|
|
GSDeviceCMYK), only the name of the colorspace needs to be set
|
|
|
|
|
using the GSColorSpaceName key.</p>
|
2002-08-25 02:47:00 +00:00
|
|
|
|
<p>Other colorspaces will be documented later (Quartz). </p>
|
2002-04-01 17:34:08 +00:00
|
|
|
|
*/
|
2002-10-07 17:05:06 +00:00
|
|
|
|
- (void) GSSetFillColorspace: (void *)spaceref
|
1999-02-25 15:41:17 +00:00
|
|
|
|
{
|
|
|
|
|
[self subclassResponsibility: _cmd];
|
|
|
|
|
}
|
|
|
|
|
|
2002-04-01 17:34:08 +00:00
|
|
|
|
/** Sets the colorspace for stroke operations based on the values in
|
|
|
|
|
the supplied dictionary. See -GSSetFillColorspace: for a
|
2002-08-25 02:47:00 +00:00
|
|
|
|
description of the values that need to be supplied (Quartz). */
|
2002-10-07 17:05:06 +00:00
|
|
|
|
- (void) GSSetStrokeColorspace: (void *)spaceref
|
1999-02-25 15:41:17 +00:00
|
|
|
|
{
|
|
|
|
|
[self subclassResponsibility: _cmd];
|
|
|
|
|
}
|
|
|
|
|
|
2002-04-01 17:34:08 +00:00
|
|
|
|
/** Sets the current color for fill operations. The values array
|
|
|
|
|
should have n components, where n corresponds to the number of
|
|
|
|
|
color components required to specify the color in the current
|
2002-08-25 02:47:00 +00:00
|
|
|
|
colorspace (Quartz). */
|
2011-10-26 00:21:57 +00:00
|
|
|
|
- (void) GSSetFillColor: (const CGFloat *)values
|
1999-02-25 15:41:17 +00:00
|
|
|
|
{
|
|
|
|
|
[self subclassResponsibility: _cmd];
|
|
|
|
|
}
|
|
|
|
|
|
2002-05-07 03:37:48 +00:00
|
|
|
|
/** Sets the current color for stroke operations. The values array
|
2002-04-01 17:34:08 +00:00
|
|
|
|
should have n components, where n corresponds to the number of
|
|
|
|
|
color components required to specify the color in the current
|
2002-08-25 02:47:00 +00:00
|
|
|
|
colorspace (Quartz). */
|
2011-10-26 00:21:57 +00:00
|
|
|
|
- (void) GSSetStrokeColor: (const CGFloat *)values
|
1999-02-25 15:41:17 +00:00
|
|
|
|
{
|
|
|
|
|
[self subclassResponsibility: _cmd];
|
|
|
|
|
}
|
|
|
|
|
|
2002-03-28 03:53:18 +00:00
|
|
|
|
/* ----------------------------------------------------------------------- */
|
|
|
|
|
/* Text operations */
|
|
|
|
|
/* ----------------------------------------------------------------------- */
|
2005-03-29 14:07:38 +00:00
|
|
|
|
|
|
|
|
|
/** Displays a string as in DPSshow, except that (x,y) is added to
|
|
|
|
|
the advancement of every glyph. An alternative means of achieving
|
|
|
|
|
the same effect is to use the -GSSetCharacterSpacing: method. Either
|
|
|
|
|
approach should be more efficient that using -DPSshow: with appropriate
|
|
|
|
|
-DPSrmoveto:: operations.
|
2002-05-07 03:37:48 +00:00
|
|
|
|
*/
|
2013-02-05 19:18:49 +00:00
|
|
|
|
- (void) DPSashow: (CGFloat)x : (CGFloat)y : (const char *)s
|
1999-02-25 15:41:17 +00:00
|
|
|
|
{
|
|
|
|
|
[self subclassResponsibility: _cmd];
|
|
|
|
|
}
|
|
|
|
|
|
2005-03-29 14:07:38 +00:00
|
|
|
|
/** Displays a string as in a combination of DPSashow and DPSwidthshow:
|
|
|
|
|
(ax,ay) is added to the advancement of every glyph, while (cx,cy) is
|
|
|
|
|
also added to the advancement for character c's glyph specifically.
|
|
|
|
|
Using this method should be more efficient that using -DPSshow:
|
|
|
|
|
with appropriate -DPSrmoveto:: operations.
|
2002-05-07 03:37:48 +00:00
|
|
|
|
*/
|
2013-02-05 19:18:49 +00:00
|
|
|
|
- (void) DPSawidthshow: (CGFloat)cx : (CGFloat)cy : (int)c
|
|
|
|
|
: (CGFloat)ax : (CGFloat)ay : (const char *)s
|
1999-02-25 15:41:17 +00:00
|
|
|
|
{
|
|
|
|
|
[self subclassResponsibility: _cmd];
|
|
|
|
|
}
|
|
|
|
|
|
2002-05-07 03:37:48 +00:00
|
|
|
|
/** Appends to the current path a path that is equivalent to the
|
|
|
|
|
outlines of the glyphs in the string. This results in a path
|
2002-08-25 02:47:00 +00:00
|
|
|
|
that can be used for stroking, filling or clipping (DPS). */
|
2002-03-28 03:53:18 +00:00
|
|
|
|
- (void) DPScharpath: (const char *)s : (int)b
|
1999-02-25 15:41:17 +00:00
|
|
|
|
{
|
|
|
|
|
[self subclassResponsibility: _cmd];
|
|
|
|
|
}
|
|
|
|
|
|
2008-04-07 13:45:41 +00:00
|
|
|
|
- (void) appendBezierPathWithPackedGlyphs: (const char *)packedGlyphs
|
|
|
|
|
path: (NSBezierPath*)aPath
|
|
|
|
|
{
|
|
|
|
|
[self subclassResponsibility: _cmd];
|
|
|
|
|
}
|
|
|
|
|
|
2002-08-25 02:47:00 +00:00
|
|
|
|
/** Display the string s using the current font (DPS). */
|
2002-03-28 03:53:18 +00:00
|
|
|
|
- (void) DPSshow: (const char *)s
|
1999-02-25 15:41:17 +00:00
|
|
|
|
{
|
|
|
|
|
[self subclassResponsibility: _cmd];
|
|
|
|
|
}
|
|
|
|
|
|
2005-03-29 14:07:38 +00:00
|
|
|
|
/** Displays a string as in DPSshow, except that, for character c only,
|
|
|
|
|
the glpyh x and y advancement is determined by the values (x,y),
|
|
|
|
|
instead of by the glyph itself. This is often used to adjust the
|
|
|
|
|
length of a line of text by changing the width of the space character.
|
|
|
|
|
Using this method should be more efficient than using -DPSshow:
|
|
|
|
|
with appropriate -DPSrmoveto:: operations.
|
2002-05-07 03:37:48 +00:00
|
|
|
|
*/
|
2013-02-05 19:18:49 +00:00
|
|
|
|
- (void) DPSwidthshow: (CGFloat)x : (CGFloat)y : (int)c : (const char *)s
|
1999-02-25 15:41:17 +00:00
|
|
|
|
{
|
|
|
|
|
[self subclassResponsibility: _cmd];
|
|
|
|
|
}
|
|
|
|
|
|
2005-03-29 14:07:38 +00:00
|
|
|
|
/** Displays a string as in DPSshow, except that the glyph x
|
|
|
|
|
advancement is determined by the values in numarray, one for
|
|
|
|
|
each glyph, instead of by the glyphs themselves. size
|
|
|
|
|
should be equal to the length of s in glyphs. Using this method
|
|
|
|
|
should be more efficient than using -DPSshow: with appropriate
|
2003-07-22 17:25:32 +00:00
|
|
|
|
-DPSrmoveto:: operations.
|
2002-05-07 03:37:48 +00:00
|
|
|
|
*/
|
2013-02-05 19:18:49 +00:00
|
|
|
|
- (void) DPSxshow: (const char *)s : (const CGFloat*)numarray : (int)size
|
1999-02-25 15:41:17 +00:00
|
|
|
|
{
|
|
|
|
|
[self subclassResponsibility: _cmd];
|
|
|
|
|
}
|
|
|
|
|
|
2005-03-29 14:07:38 +00:00
|
|
|
|
/** Displays a string as in DPSshow, except that the glyph x and y
|
|
|
|
|
advancement is determined by the values in numarray, one x and one y
|
|
|
|
|
for each glyph, in alternating order, instead of by the glyphs themselves.
|
|
|
|
|
size should be equal to the length of s in glyphs. Using this method
|
|
|
|
|
should be more efficient than using -DPSshow: with appropriate
|
2003-07-22 17:25:32 +00:00
|
|
|
|
-DPSrmoveto:: operations.
|
2002-05-07 03:37:48 +00:00
|
|
|
|
*/
|
2013-02-05 19:18:49 +00:00
|
|
|
|
- (void) DPSxyshow: (const char *)s : (const CGFloat*)numarray : (int)size
|
1999-02-25 15:41:17 +00:00
|
|
|
|
{
|
|
|
|
|
[self subclassResponsibility: _cmd];
|
|
|
|
|
}
|
|
|
|
|
|
2005-03-29 14:07:38 +00:00
|
|
|
|
/** Displays a string as in DPSshow, except that the glyph y
|
|
|
|
|
advancement is determined by the values in numarray, one for
|
|
|
|
|
each glyph, instead of by the glyphs themselves. size
|
|
|
|
|
should be equal to the length of s in glyphs. Using this method
|
|
|
|
|
should be more efficient than using -DPSshow: with appropriate
|
2003-07-22 17:25:32 +00:00
|
|
|
|
-DPSrmoveto:: operations.
|
2002-05-07 03:37:48 +00:00
|
|
|
|
*/
|
2013-02-05 19:18:49 +00:00
|
|
|
|
- (void) DPSyshow: (const char *)s : (const CGFloat*)numarray : (int)size
|
1999-02-25 15:41:17 +00:00
|
|
|
|
{
|
|
|
|
|
[self subclassResponsibility: _cmd];
|
|
|
|
|
}
|
|
|
|
|
|
2002-08-25 02:47:00 +00:00
|
|
|
|
/** Use this method to set the additional spacing between characters
|
|
|
|
|
(glyphs). This spacing is added to the normal spacing for each
|
|
|
|
|
character. Units are in text-space coordinate system. (Quartz).
|
|
|
|
|
*/
|
2013-02-05 19:18:49 +00:00
|
|
|
|
- (void) GSSetCharacterSpacing: (CGFloat)extra
|
1999-02-25 15:41:17 +00:00
|
|
|
|
{
|
|
|
|
|
[self subclassResponsibility: _cmd];
|
|
|
|
|
}
|
|
|
|
|
|
2002-10-07 17:05:06 +00:00
|
|
|
|
/** Set the current font for drawing glyphs. (DPS, Quartz). */
|
|
|
|
|
- (void) GSSetFont: (void *)fontref
|
1999-02-25 15:41:17 +00:00
|
|
|
|
{
|
|
|
|
|
[self subclassResponsibility: _cmd];
|
|
|
|
|
}
|
|
|
|
|
|
2002-08-25 02:47:00 +00:00
|
|
|
|
/** Set the font size of the current NSFont used for drawing glyphs.
|
|
|
|
|
(DPS, Quartz). */
|
2013-02-05 19:18:49 +00:00
|
|
|
|
- (void) GSSetFontSize: (CGFloat)size
|
1999-02-25 15:41:17 +00:00
|
|
|
|
{
|
|
|
|
|
[self subclassResponsibility: _cmd];
|
|
|
|
|
}
|
|
|
|
|
|
2002-08-25 02:47:00 +00:00
|
|
|
|
/**
|
|
|
|
|
<p> Returns the transfer function for transforming text from text space
|
|
|
|
|
to user space. See -GSSetTextCTM: for additiona information. (Quartz).
|
|
|
|
|
</p>
|
|
|
|
|
*/
|
2002-03-28 03:53:18 +00:00
|
|
|
|
- (NSAffineTransform *) GSGetTextCTM
|
1999-02-25 15:41:17 +00:00
|
|
|
|
{
|
|
|
|
|
[self subclassResponsibility: _cmd];
|
2002-03-28 03:53:18 +00:00
|
|
|
|
return nil;
|
1999-02-25 15:41:17 +00:00
|
|
|
|
}
|
|
|
|
|
|
2002-08-25 02:47:00 +00:00
|
|
|
|
/** Returns the location at which text will be drawn. In text-space
|
|
|
|
|
coordinates. (Quartz).
|
|
|
|
|
*/
|
2002-03-28 03:53:18 +00:00
|
|
|
|
- (NSPoint) GSGetTextPosition
|
1999-02-25 15:41:17 +00:00
|
|
|
|
{
|
|
|
|
|
[self subclassResponsibility: _cmd];
|
2002-03-28 03:53:18 +00:00
|
|
|
|
return NSMakePoint(0,0);
|
1999-02-25 15:41:17 +00:00
|
|
|
|
}
|
|
|
|
|
|
2002-08-25 02:47:00 +00:00
|
|
|
|
/**
|
|
|
|
|
<p> Set the transfer function for transforming text from text space
|
|
|
|
|
to user space. This transform is only applied to text objects and
|
|
|
|
|
is in addition to the normal coordinate transform matrix. When
|
|
|
|
|
drawing text, this transform is applied before the normal CTM.
|
|
|
|
|
</p>
|
|
|
|
|
|
|
|
|
|
<p> The text matrix can be changed by either modifying it directly,
|
|
|
|
|
or just by drawing text, in which case the tx and ty offset
|
|
|
|
|
veriables are modified to point to the location of the next
|
|
|
|
|
character that could be rendered (Quartz). </p>
|
|
|
|
|
*/
|
2002-03-28 03:53:18 +00:00
|
|
|
|
- (void) GSSetTextCTM: (NSAffineTransform *)ctm
|
1999-02-25 15:41:17 +00:00
|
|
|
|
{
|
|
|
|
|
[self subclassResponsibility: _cmd];
|
|
|
|
|
}
|
|
|
|
|
|
2002-08-25 02:47:00 +00:00
|
|
|
|
/** Set the current text drawing mode. The mode can be one of several
|
|
|
|
|
values that fill/stroke the text or add it to the current clipping
|
|
|
|
|
path. (Quartz).
|
|
|
|
|
*/
|
2002-03-28 03:53:18 +00:00
|
|
|
|
- (void) GSSetTextDrawingMode: (GSTextDrawingMode)mode
|
1999-02-25 15:41:17 +00:00
|
|
|
|
{
|
|
|
|
|
[self subclassResponsibility: _cmd];
|
|
|
|
|
}
|
|
|
|
|
|
2002-08-25 02:47:00 +00:00
|
|
|
|
/** Set the location at which text will be drawn, in text-space
|
|
|
|
|
coordinates. This routine updates the current text coordinate
|
|
|
|
|
matrix. (Quartz).
|
|
|
|
|
*/
|
2002-03-28 03:53:18 +00:00
|
|
|
|
- (void) GSSetTextPosition: (NSPoint)loc
|
1999-02-25 15:41:17 +00:00
|
|
|
|
{
|
|
|
|
|
[self subclassResponsibility: _cmd];
|
|
|
|
|
}
|
|
|
|
|
|
2002-08-25 02:47:00 +00:00
|
|
|
|
/** Paints text represented by the characters in string in the current
|
|
|
|
|
font. (Quartz).
|
|
|
|
|
*/
|
2002-03-28 03:53:18 +00:00
|
|
|
|
- (void) GSShowText: (const char *)string : (size_t) length
|
2001-09-03 04:10:36 +00:00
|
|
|
|
{
|
|
|
|
|
[self subclassResponsibility: _cmd];
|
|
|
|
|
}
|
|
|
|
|
|
2002-08-25 02:47:00 +00:00
|
|
|
|
/** Paints the glyphs using the current font. (Quartz). */
|
2002-03-28 03:53:18 +00:00
|
|
|
|
- (void) GSShowGlyphs: (const NSGlyph *)glyphs : (size_t) length
|
2001-09-03 04:10:36 +00:00
|
|
|
|
{
|
|
|
|
|
[self subclassResponsibility: _cmd];
|
|
|
|
|
}
|
|
|
|
|
|
2011-05-26 03:55:55 +00:00
|
|
|
|
/** Paints the glyphs with the specified advances using the current font.
|
|
|
|
|
(Quartz). */
|
|
|
|
|
- (void) GSShowGlyphsWithAdvances: (const NSGlyph *)glyphs : (const NSSize *)advances : (size_t) length
|
|
|
|
|
{
|
|
|
|
|
[self subclassResponsibility: _cmd];
|
|
|
|
|
}
|
|
|
|
|
|
1999-02-25 15:41:17 +00:00
|
|
|
|
/* ----------------------------------------------------------------------- */
|
2002-03-28 03:53:18 +00:00
|
|
|
|
/* Gstate Handling */
|
1999-02-25 15:41:17 +00:00
|
|
|
|
/* ----------------------------------------------------------------------- */
|
|
|
|
|
|
2002-04-02 21:54:22 +00:00
|
|
|
|
/** Pops a previously saved gstate from the gstate stack and makes it
|
|
|
|
|
current. Drawing information in the previously saved gstate
|
2002-08-25 02:47:00 +00:00
|
|
|
|
becomes the current information. (DPS, Quartz). */
|
2002-03-28 03:53:18 +00:00
|
|
|
|
- (void) DPSgrestore
|
1999-02-25 15:41:17 +00:00
|
|
|
|
{
|
|
|
|
|
[self subclassResponsibility: _cmd];
|
|
|
|
|
}
|
|
|
|
|
|
2002-04-02 21:54:22 +00:00
|
|
|
|
/** Saves (pushes) a copy of the current gstate information onto the
|
|
|
|
|
gstate stack. This saves drawing information contained in the
|
2002-08-25 02:47:00 +00:00
|
|
|
|
gstate, such as the current path, ctm and colors. (DPS, Quartz). */
|
2002-03-28 03:53:18 +00:00
|
|
|
|
- (void) DPSgsave
|
1999-02-25 15:41:17 +00:00
|
|
|
|
{
|
|
|
|
|
[self subclassResponsibility: _cmd];
|
|
|
|
|
}
|
|
|
|
|
|
2002-03-28 03:53:18 +00:00
|
|
|
|
- (void) DPSinitgraphics
|
1999-02-25 15:41:17 +00:00
|
|
|
|
{
|
|
|
|
|
[self subclassResponsibility: _cmd];
|
|
|
|
|
}
|
|
|
|
|
|
2002-04-02 21:54:22 +00:00
|
|
|
|
/** Makes the gstate indicated by the tag gst the current gstate. Note
|
|
|
|
|
that the gstate is copied, so that changes to either gstate do not
|
2002-08-25 02:47:00 +00:00
|
|
|
|
affect the other. (DPS, Quartz). */
|
2013-02-05 19:18:49 +00:00
|
|
|
|
- (void) DPSsetgstate: (NSInteger)gst
|
1999-02-25 15:41:17 +00:00
|
|
|
|
{
|
|
|
|
|
[self subclassResponsibility: _cmd];
|
|
|
|
|
}
|
|
|
|
|
|
2002-04-02 21:54:22 +00:00
|
|
|
|
/** Creates a copy of the current gstate and associates it with a tag,
|
|
|
|
|
which is given in the return value. This tag can later be used in
|
2002-08-25 02:47:00 +00:00
|
|
|
|
-DPSsetgstate: to set the gstate as being current again. (DPS, Quartz). */
|
2013-02-05 19:18:49 +00:00
|
|
|
|
- (NSInteger) GSDefineGState
|
1999-02-25 15:41:17 +00:00
|
|
|
|
{
|
|
|
|
|
[self subclassResponsibility: _cmd];
|
2002-03-28 03:53:18 +00:00
|
|
|
|
return 0;
|
1999-02-25 15:41:17 +00:00
|
|
|
|
}
|
|
|
|
|
|
2002-04-02 21:54:22 +00:00
|
|
|
|
/** Disassociates the tag gst with it's gstate and destroys the gstate
|
|
|
|
|
object. The tag will no longer be valid and should not be used to
|
2002-08-25 02:47:00 +00:00
|
|
|
|
refer to the gstate again. (DPS, Quartz). */
|
2013-02-05 19:18:49 +00:00
|
|
|
|
- (void) GSUndefineGState: (NSInteger)gst
|
1999-02-25 15:41:17 +00:00
|
|
|
|
{
|
|
|
|
|
[self subclassResponsibility: _cmd];
|
|
|
|
|
}
|
|
|
|
|
|
2002-04-02 21:54:22 +00:00
|
|
|
|
/** Replaces the gstate refered to by the tag gst with the current
|
2002-08-25 02:47:00 +00:00
|
|
|
|
gstate. The former gstate is destroyed. (DPS, Quartz). */
|
2013-02-05 19:18:49 +00:00
|
|
|
|
- (void) GSReplaceGState: (NSInteger)gst
|
1999-02-25 15:41:17 +00:00
|
|
|
|
{
|
|
|
|
|
[self subclassResponsibility: _cmd];
|
|
|
|
|
}
|
|
|
|
|
|
2002-03-28 03:53:18 +00:00
|
|
|
|
/* ----------------------------------------------------------------------- */
|
|
|
|
|
/* Gstate operations */
|
|
|
|
|
/* ----------------------------------------------------------------------- */
|
2002-08-25 02:47:00 +00:00
|
|
|
|
/** Returns the current flattness parameter, which controls how curved
|
|
|
|
|
lines are drawn. (DPS, Quartz). */
|
2013-02-05 19:18:49 +00:00
|
|
|
|
- (void) DPScurrentflat: (CGFloat*)flatness
|
1999-05-18 16:49:13 +00:00
|
|
|
|
{
|
|
|
|
|
[self subclassResponsibility: _cmd];
|
|
|
|
|
}
|
|
|
|
|
|
2002-08-25 02:47:00 +00:00
|
|
|
|
/** Returns the current linecap value. (DPS, Quartz). */
|
2002-03-28 03:53:18 +00:00
|
|
|
|
- (void) DPScurrentlinecap: (int*)linecap
|
1999-05-18 16:49:13 +00:00
|
|
|
|
{
|
|
|
|
|
[self subclassResponsibility: _cmd];
|
|
|
|
|
}
|
|
|
|
|
|
2002-08-25 02:47:00 +00:00
|
|
|
|
/** Returns the current linejoin value. (DPS, Quartz). */
|
2002-03-28 03:53:18 +00:00
|
|
|
|
- (void) DPScurrentlinejoin: (int*)linejoin
|
1999-05-18 16:49:13 +00:00
|
|
|
|
{
|
|
|
|
|
[self subclassResponsibility: _cmd];
|
|
|
|
|
}
|
|
|
|
|
|
2002-08-25 02:47:00 +00:00
|
|
|
|
/** Returns the current line width. (DPS, Quartz). */
|
2013-02-05 19:18:49 +00:00
|
|
|
|
- (void) DPScurrentlinewidth: (CGFloat*)width
|
1999-05-18 16:49:13 +00:00
|
|
|
|
{
|
|
|
|
|
[self subclassResponsibility: _cmd];
|
|
|
|
|
}
|
|
|
|
|
|
2002-08-25 02:47:00 +00:00
|
|
|
|
/** Returns the current linecap value. (DPS, Quartz). */
|
2013-02-05 19:18:49 +00:00
|
|
|
|
- (void) DPScurrentmiterlimit: (CGFloat*)limit
|
1999-05-18 16:49:13 +00:00
|
|
|
|
{
|
|
|
|
|
[self subclassResponsibility: _cmd];
|
|
|
|
|
}
|
|
|
|
|
|
2002-08-25 02:47:00 +00:00
|
|
|
|
/** Returns the current point. (DPS, Quartz). */
|
2013-02-05 19:18:49 +00:00
|
|
|
|
- (void) DPScurrentpoint: (CGFloat*)x : (CGFloat*)y
|
1999-05-18 16:49:13 +00:00
|
|
|
|
{
|
|
|
|
|
[self subclassResponsibility: _cmd];
|
|
|
|
|
}
|
|
|
|
|
|
2002-08-25 02:47:00 +00:00
|
|
|
|
/** Returns the strokeadjust value. (DPS). */
|
2002-03-28 03:53:18 +00:00
|
|
|
|
- (void) DPScurrentstrokeadjust: (int*)b
|
1999-10-21 18:08:50 +00:00
|
|
|
|
{
|
|
|
|
|
[self subclassResponsibility: _cmd];
|
|
|
|
|
}
|
|
|
|
|
|
2002-08-25 02:47:00 +00:00
|
|
|
|
/** Set the pattern for line dashes like the Postscript setdash operator.
|
|
|
|
|
(DPS, Quartz). */
|
2013-02-05 19:18:49 +00:00
|
|
|
|
- (void) DPSsetdash: (const CGFloat*)pat : (NSInteger)size : (CGFloat)offset
|
1999-10-21 18:08:50 +00:00
|
|
|
|
{
|
|
|
|
|
[self subclassResponsibility: _cmd];
|
|
|
|
|
}
|
|
|
|
|
|
2002-08-25 02:47:00 +00:00
|
|
|
|
/** Sets the current flattness parameter, which controls how curved
|
|
|
|
|
lines are drawn. (DPS, Quartz). */
|
2013-02-05 19:18:49 +00:00
|
|
|
|
- (void) DPSsetflat: (CGFloat)flatness
|
1999-10-21 18:08:50 +00:00
|
|
|
|
{
|
|
|
|
|
[self subclassResponsibility: _cmd];
|
|
|
|
|
}
|
|
|
|
|
|
2013-02-05 19:18:49 +00:00
|
|
|
|
- (void) DPSsethalftonephase: (CGFloat)x : (CGFloat)y
|
1999-10-21 18:08:50 +00:00
|
|
|
|
{
|
|
|
|
|
[self subclassResponsibility: _cmd];
|
|
|
|
|
}
|
|
|
|
|
|
2002-08-25 02:47:00 +00:00
|
|
|
|
/** Set the current linecap value. (DPS, Quartz). */
|
2002-03-28 03:53:18 +00:00
|
|
|
|
- (void) DPSsetlinecap: (int)linecap
|
1999-10-21 18:08:50 +00:00
|
|
|
|
{
|
|
|
|
|
[self subclassResponsibility: _cmd];
|
|
|
|
|
}
|
|
|
|
|
|
2002-08-25 02:47:00 +00:00
|
|
|
|
/** Set the current linejoin value. (DPS, Quartz). */
|
2002-03-28 03:53:18 +00:00
|
|
|
|
- (void) DPSsetlinejoin: (int)linejoin
|
1999-10-21 18:08:50 +00:00
|
|
|
|
{
|
|
|
|
|
[self subclassResponsibility: _cmd];
|
|
|
|
|
}
|
|
|
|
|
|
2002-08-25 02:47:00 +00:00
|
|
|
|
/** Set the current line width. (DPS, Quartz). */
|
2013-02-05 19:18:49 +00:00
|
|
|
|
- (void) DPSsetlinewidth: (CGFloat)width
|
1999-10-21 18:08:50 +00:00
|
|
|
|
{
|
|
|
|
|
[self subclassResponsibility: _cmd];
|
|
|
|
|
}
|
|
|
|
|
|
2002-08-25 02:47:00 +00:00
|
|
|
|
/** Set the current meter limit value. (DPS, Quartz). */
|
2013-02-05 19:18:49 +00:00
|
|
|
|
- (void) DPSsetmiterlimit: (CGFloat)limit
|
1999-10-21 18:08:50 +00:00
|
|
|
|
{
|
|
|
|
|
[self subclassResponsibility: _cmd];
|
|
|
|
|
}
|
|
|
|
|
|
2002-03-28 03:53:18 +00:00
|
|
|
|
- (void) DPSsetstrokeadjust: (int)b
|
1999-10-21 18:08:50 +00:00
|
|
|
|
{
|
|
|
|
|
[self subclassResponsibility: _cmd];
|
|
|
|
|
}
|
|
|
|
|
|
2002-03-28 03:53:18 +00:00
|
|
|
|
/* ----------------------------------------------------------------------- */
|
|
|
|
|
/* Matrix operations */
|
|
|
|
|
/* ----------------------------------------------------------------------- */
|
2002-08-25 02:47:00 +00:00
|
|
|
|
/** Concatenates the coordinate transform represented by the matrix m
|
|
|
|
|
with the current coordinate transform. (DPS). */
|
2013-02-05 19:18:49 +00:00
|
|
|
|
- (void) DPSconcat: (const CGFloat*)m
|
1999-10-21 18:08:50 +00:00
|
|
|
|
{
|
|
|
|
|
[self subclassResponsibility: _cmd];
|
|
|
|
|
}
|
|
|
|
|
|
2002-08-25 02:47:00 +00:00
|
|
|
|
/** Sets the coordinate transform matrix to the initial values for
|
|
|
|
|
the particular context */
|
2002-03-28 03:53:18 +00:00
|
|
|
|
- (void) DPSinitmatrix
|
1999-10-21 18:08:50 +00:00
|
|
|
|
{
|
|
|
|
|
[self subclassResponsibility: _cmd];
|
|
|
|
|
}
|
|
|
|
|
|
2002-08-25 02:47:00 +00:00
|
|
|
|
/** Rotate the coordinate system. (DPS). */
|
2013-02-05 19:18:49 +00:00
|
|
|
|
- (void) DPSrotate: (CGFloat)angle
|
1999-10-21 18:08:50 +00:00
|
|
|
|
{
|
|
|
|
|
[self subclassResponsibility: _cmd];
|
|
|
|
|
}
|
|
|
|
|
|
2002-08-25 02:47:00 +00:00
|
|
|
|
/** Scale the coordinate system. (DPS). */
|
2013-02-05 19:18:49 +00:00
|
|
|
|
- (void) DPSscale: (CGFloat)x : (CGFloat)y
|
1999-10-21 18:08:50 +00:00
|
|
|
|
{
|
|
|
|
|
[self subclassResponsibility: _cmd];
|
|
|
|
|
}
|
|
|
|
|
|
2002-08-25 02:47:00 +00:00
|
|
|
|
/** Translate the coordinate system. (DPS). */
|
2013-02-05 19:18:49 +00:00
|
|
|
|
- (void) DPStranslate: (CGFloat)x : (CGFloat)y
|
1999-10-21 18:08:50 +00:00
|
|
|
|
{
|
|
|
|
|
[self subclassResponsibility: _cmd];
|
|
|
|
|
}
|
|
|
|
|
|
2002-08-25 02:47:00 +00:00
|
|
|
|
/** Returns the current coordinate transform matrix. (Quartz). */
|
2002-03-28 03:53:18 +00:00
|
|
|
|
- (NSAffineTransform *) GSCurrentCTM
|
1999-10-21 18:08:50 +00:00
|
|
|
|
{
|
|
|
|
|
[self subclassResponsibility: _cmd];
|
2002-03-28 03:53:18 +00:00
|
|
|
|
return nil;
|
1999-10-21 18:08:50 +00:00
|
|
|
|
}
|
|
|
|
|
|
2002-08-25 02:47:00 +00:00
|
|
|
|
/** Sets the coordinate transform matrix which describes how graphics
|
|
|
|
|
will be transformed into device coordinates. (Quartz). */
|
2002-03-28 03:53:18 +00:00
|
|
|
|
- (void) GSSetCTM: (NSAffineTransform *)ctm
|
1999-10-21 18:08:50 +00:00
|
|
|
|
{
|
|
|
|
|
[self subclassResponsibility: _cmd];
|
|
|
|
|
}
|
|
|
|
|
|
2002-08-25 02:47:00 +00:00
|
|
|
|
/** Concatenates the matrix ctm onto the current coordinate transform
|
|
|
|
|
matrix. (Quartz).
|
|
|
|
|
*/
|
2002-03-28 03:53:18 +00:00
|
|
|
|
- (void) GSConcatCTM: (NSAffineTransform *)ctm
|
1999-10-21 18:08:50 +00:00
|
|
|
|
{
|
|
|
|
|
[self subclassResponsibility: _cmd];
|
|
|
|
|
}
|
|
|
|
|
|
2002-03-28 03:53:18 +00:00
|
|
|
|
/* ----------------------------------------------------------------------- */
|
|
|
|
|
/* Paint operations */
|
|
|
|
|
/* ----------------------------------------------------------------------- */
|
2013-02-05 19:18:49 +00:00
|
|
|
|
- (void) DPSarc: (CGFloat)x : (CGFloat)y : (CGFloat)r : (CGFloat)angle1
|
|
|
|
|
: (CGFloat)angle2
|
1999-10-21 18:08:50 +00:00
|
|
|
|
{
|
|
|
|
|
[self subclassResponsibility: _cmd];
|
|
|
|
|
}
|
|
|
|
|
|
2013-02-05 19:18:49 +00:00
|
|
|
|
- (void) DPSarcn: (CGFloat)x : (CGFloat)y : (CGFloat)r : (CGFloat)angle1
|
|
|
|
|
: (CGFloat)angle2
|
1999-10-21 18:08:50 +00:00
|
|
|
|
{
|
|
|
|
|
[self subclassResponsibility: _cmd];
|
|
|
|
|
}
|
|
|
|
|
|
2013-02-05 19:18:49 +00:00
|
|
|
|
- (void) DPSarct: (CGFloat)x1 : (CGFloat)y1 : (CGFloat)x2 : (CGFloat)y2 : (CGFloat)r
|
1999-10-21 18:08:50 +00:00
|
|
|
|
{
|
|
|
|
|
[self subclassResponsibility: _cmd];
|
|
|
|
|
}
|
|
|
|
|
|
2002-08-25 02:47:00 +00:00
|
|
|
|
/** Clip to the current path. (DPS, Quartz). */
|
2002-03-28 03:53:18 +00:00
|
|
|
|
- (void) DPSclip
|
1999-10-21 18:08:50 +00:00
|
|
|
|
{
|
|
|
|
|
[self subclassResponsibility: _cmd];
|
|
|
|
|
}
|
|
|
|
|
|
2002-03-28 03:53:18 +00:00
|
|
|
|
- (void) DPSclosepath
|
1999-10-21 18:08:50 +00:00
|
|
|
|
{
|
|
|
|
|
[self subclassResponsibility: _cmd];
|
|
|
|
|
}
|
|
|
|
|
|
2013-02-05 19:18:49 +00:00
|
|
|
|
- (void) DPScurveto: (CGFloat)x1 : (CGFloat)y1 : (CGFloat)x2 : (CGFloat)y2
|
|
|
|
|
: (CGFloat)x3 : (CGFloat)y3
|
1999-10-21 18:08:50 +00:00
|
|
|
|
{
|
|
|
|
|
[self subclassResponsibility: _cmd];
|
|
|
|
|
}
|
|
|
|
|
|
2002-03-28 03:53:18 +00:00
|
|
|
|
- (void) DPSeoclip
|
1999-10-21 18:08:50 +00:00
|
|
|
|
{
|
|
|
|
|
[self subclassResponsibility: _cmd];
|
|
|
|
|
}
|
|
|
|
|
|
2002-03-28 03:53:18 +00:00
|
|
|
|
- (void) DPSeofill
|
1999-10-21 18:08:50 +00:00
|
|
|
|
{
|
|
|
|
|
[self subclassResponsibility: _cmd];
|
|
|
|
|
}
|
|
|
|
|
|
2002-08-25 02:47:00 +00:00
|
|
|
|
/** Fill the current path. (DPS, Quartz). */
|
2002-03-28 03:53:18 +00:00
|
|
|
|
- (void) DPSfill
|
1999-10-21 18:08:50 +00:00
|
|
|
|
{
|
|
|
|
|
[self subclassResponsibility: _cmd];
|
|
|
|
|
}
|
|
|
|
|
|
2002-03-28 03:53:18 +00:00
|
|
|
|
- (void) DPSflattenpath
|
1999-10-21 18:08:50 +00:00
|
|
|
|
{
|
|
|
|
|
[self subclassResponsibility: _cmd];
|
|
|
|
|
}
|
|
|
|
|
|
2002-03-28 03:53:18 +00:00
|
|
|
|
- (void) DPSinitclip
|
1999-10-21 18:08:50 +00:00
|
|
|
|
{
|
|
|
|
|
[self subclassResponsibility: _cmd];
|
|
|
|
|
}
|
|
|
|
|
|
2013-02-05 19:18:49 +00:00
|
|
|
|
- (void) DPSlineto: (CGFloat)x : (CGFloat)y
|
1999-10-21 18:08:50 +00:00
|
|
|
|
{
|
|
|
|
|
[self subclassResponsibility: _cmd];
|
|
|
|
|
}
|
|
|
|
|
|
2013-02-05 19:18:49 +00:00
|
|
|
|
- (void) DPSmoveto: (CGFloat)x : (CGFloat)y
|
1999-10-21 18:08:50 +00:00
|
|
|
|
{
|
|
|
|
|
[self subclassResponsibility: _cmd];
|
|
|
|
|
}
|
|
|
|
|
|
2002-03-28 03:53:18 +00:00
|
|
|
|
- (void) DPSnewpath
|
1999-10-21 18:08:50 +00:00
|
|
|
|
{
|
|
|
|
|
[self subclassResponsibility: _cmd];
|
|
|
|
|
}
|
|
|
|
|
|
2013-02-05 19:18:49 +00:00
|
|
|
|
- (void) DPSpathbbox: (CGFloat*)llx : (CGFloat*)lly : (CGFloat*)urx : (CGFloat*)ury
|
1999-10-21 18:08:50 +00:00
|
|
|
|
{
|
|
|
|
|
[self subclassResponsibility: _cmd];
|
|
|
|
|
}
|
|
|
|
|
|
2013-02-05 19:18:49 +00:00
|
|
|
|
- (void) DPSrcurveto: (CGFloat)x1 : (CGFloat)y1 : (CGFloat)x2 : (CGFloat)y2
|
|
|
|
|
: (CGFloat)x3 : (CGFloat)y3
|
1999-10-21 18:08:50 +00:00
|
|
|
|
{
|
|
|
|
|
[self subclassResponsibility: _cmd];
|
|
|
|
|
}
|
|
|
|
|
|
2013-02-05 19:18:49 +00:00
|
|
|
|
- (void) DPSrectclip: (CGFloat)x : (CGFloat)y : (CGFloat)w : (CGFloat)h
|
1999-10-21 18:08:50 +00:00
|
|
|
|
{
|
|
|
|
|
[self subclassResponsibility: _cmd];
|
|
|
|
|
}
|
|
|
|
|
|
2013-02-05 19:18:49 +00:00
|
|
|
|
- (void) DPSrectfill: (CGFloat)x : (CGFloat)y : (CGFloat)w : (CGFloat)h
|
1999-10-21 18:08:50 +00:00
|
|
|
|
{
|
|
|
|
|
[self subclassResponsibility: _cmd];
|
|
|
|
|
}
|
|
|
|
|
|
2013-02-05 19:18:49 +00:00
|
|
|
|
- (void) DPSrectstroke: (CGFloat)x : (CGFloat)y : (CGFloat)w : (CGFloat)h
|
1999-10-21 18:08:50 +00:00
|
|
|
|
{
|
|
|
|
|
[self subclassResponsibility: _cmd];
|
|
|
|
|
}
|
|
|
|
|
|
2002-03-28 03:53:18 +00:00
|
|
|
|
- (void) DPSreversepath
|
1999-10-21 18:08:50 +00:00
|
|
|
|
{
|
|
|
|
|
[self subclassResponsibility: _cmd];
|
|
|
|
|
}
|
|
|
|
|
|
2013-02-05 19:18:49 +00:00
|
|
|
|
- (void) DPSrlineto: (CGFloat)x : (CGFloat)y
|
1999-10-21 18:08:50 +00:00
|
|
|
|
{
|
|
|
|
|
[self subclassResponsibility: _cmd];
|
|
|
|
|
}
|
|
|
|
|
|
2013-02-05 19:18:49 +00:00
|
|
|
|
- (void) DPSrmoveto: (CGFloat)x : (CGFloat)y
|
1999-10-21 18:08:50 +00:00
|
|
|
|
{
|
|
|
|
|
[self subclassResponsibility: _cmd];
|
|
|
|
|
}
|
|
|
|
|
|
2002-03-28 03:53:18 +00:00
|
|
|
|
- (void) DPSstroke
|
1999-10-29 18:43:48 +00:00
|
|
|
|
{
|
|
|
|
|
[self subclassResponsibility: _cmd];
|
|
|
|
|
}
|
|
|
|
|
|
2003-05-17 22:04:00 +00:00
|
|
|
|
- (void) DPSshfill: (NSDictionary *)shaderDictionary
|
|
|
|
|
{
|
|
|
|
|
[self subclassResponsibility: _cmd];
|
|
|
|
|
}
|
|
|
|
|
|
2002-11-21 20:27:44 +00:00
|
|
|
|
/** Set the bezier path as the current path */
|
2002-03-28 03:53:18 +00:00
|
|
|
|
- (void) GSSendBezierPath: (NSBezierPath *)path
|
1999-10-29 18:43:48 +00:00
|
|
|
|
{
|
2013-02-01 14:03:08 +00:00
|
|
|
|
[self subclassResponsibility: _cmd];
|
1999-10-29 18:43:48 +00:00
|
|
|
|
}
|
|
|
|
|
|
2002-08-25 02:47:00 +00:00
|
|
|
|
/** Append the array of rects to the current clip path (DPS, Quartz). */
|
2002-03-28 03:53:18 +00:00
|
|
|
|
- (void) GSRectClipList: (const NSRect *)rects : (int) count
|
1999-10-29 18:43:48 +00:00
|
|
|
|
{
|
|
|
|
|
[self subclassResponsibility: _cmd];
|
|
|
|
|
}
|
|
|
|
|
|
2002-08-25 02:47:00 +00:00
|
|
|
|
/** Draw and fill the array of rects. (DPS, Quartz) */
|
2002-03-28 03:53:18 +00:00
|
|
|
|
- (void) GSRectFillList: (const NSRect *)rects : (int) count
|
1999-10-29 18:43:48 +00:00
|
|
|
|
{
|
|
|
|
|
[self subclassResponsibility: _cmd];
|
|
|
|
|
}
|
|
|
|
|
|
2002-03-28 03:53:18 +00:00
|
|
|
|
/* ----------------------------------------------------------------------- */
|
|
|
|
|
/* Window system ops */
|
|
|
|
|
/* ----------------------------------------------------------------------- */
|
2002-04-15 02:52:35 +00:00
|
|
|
|
/** This is a private method used between the window server and the context.
|
|
|
|
|
It should not be used in any application. Typically used by the
|
|
|
|
|
window server to find out what window the context is drawing graphics
|
|
|
|
|
to. The device pointer is an opaque type that contains information
|
|
|
|
|
about the window. The x and y pointers indicate the offset of the
|
|
|
|
|
origin of the window from the lower left-hand corner */
|
|
|
|
|
- (void) GSCurrentDevice: (void **)device : (int *)x : (int *)y
|
1999-10-29 18:43:48 +00:00
|
|
|
|
{
|
|
|
|
|
[self subclassResponsibility: _cmd];
|
|
|
|
|
}
|
|
|
|
|
|
2002-03-28 03:53:18 +00:00
|
|
|
|
- (void) DPScurrentoffset: (int *)x : (int *)y
|
1999-10-29 18:43:48 +00:00
|
|
|
|
{
|
|
|
|
|
[self subclassResponsibility: _cmd];
|
|
|
|
|
}
|
|
|
|
|
|
2002-04-15 02:52:35 +00:00
|
|
|
|
/** This is a private method used between the window server and the context.
|
|
|
|
|
It should not be used in any application. Typically called by the
|
|
|
|
|
window server to tell the context what window it should draw graphics
|
|
|
|
|
to. The device pointer is an opaque type that contains information
|
|
|
|
|
about the window. The x and y values tell the context that it
|
|
|
|
|
should put the origin of the transform matrix at the indicated
|
|
|
|
|
x and y values from the lower left-hand corner of the window */
|
|
|
|
|
- (void) GSSetDevice: (void *)device : (int)x : (int)y
|
1999-12-04 19:44:09 +00:00
|
|
|
|
{
|
|
|
|
|
[self subclassResponsibility: _cmd];
|
|
|
|
|
}
|
|
|
|
|
|
2002-03-28 03:53:18 +00:00
|
|
|
|
- (void) DPSsetoffset: (short int)x : (short int)y
|
1999-12-06 13:32:01 +00:00
|
|
|
|
{
|
|
|
|
|
[self subclassResponsibility: _cmd];
|
|
|
|
|
}
|
|
|
|
|
|
2002-03-28 03:53:18 +00:00
|
|
|
|
/*-------------------------------------------------------------------------*/
|
|
|
|
|
/* Graphics Extension Ops */
|
|
|
|
|
/*-------------------------------------------------------------------------*/
|
2013-02-05 19:18:49 +00:00
|
|
|
|
- (void) DPScomposite: (CGFloat)x : (CGFloat)y : (CGFloat)w : (CGFloat)h
|
|
|
|
|
: (NSInteger)gstateNum : (CGFloat)dx : (CGFloat)dy : (NSCompositingOperation)op
|
1999-06-09 08:54:08 +00:00
|
|
|
|
{
|
|
|
|
|
[self subclassResponsibility: _cmd];
|
|
|
|
|
}
|
2000-03-06 21:21:59 +00:00
|
|
|
|
|
2013-02-05 19:18:49 +00:00
|
|
|
|
- (void) DPScompositerect: (CGFloat)x : (CGFloat)y : (CGFloat)w : (CGFloat)h : (NSCompositingOperation)op
|
2000-03-06 21:21:59 +00:00
|
|
|
|
{
|
|
|
|
|
[self subclassResponsibility: _cmd];
|
|
|
|
|
}
|
2000-04-20 22:17:42 +00:00
|
|
|
|
|
2013-02-05 19:18:49 +00:00
|
|
|
|
- (void) DPSdissolve: (CGFloat)x : (CGFloat)y : (CGFloat)w : (CGFloat)h
|
|
|
|
|
: (NSInteger)gstateNum : (CGFloat)dx : (CGFloat)dy : (CGFloat)delta
|
2000-04-20 22:17:42 +00:00
|
|
|
|
{
|
|
|
|
|
[self subclassResponsibility: _cmd];
|
|
|
|
|
}
|
|
|
|
|
|
2005-07-08 23:51:49 +00:00
|
|
|
|
/*
|
|
|
|
|
As currently not all backends support mixed composite and dissolve operations,
|
|
|
|
|
this method is here to dispatch to the best suited one implemented
|
|
|
|
|
*/
|
2013-02-05 19:18:49 +00:00
|
|
|
|
- (void) GScomposite: (NSInteger)gstateNum
|
2005-07-08 23:51:49 +00:00
|
|
|
|
toPoint: (NSPoint)aPoint
|
|
|
|
|
fromRect: (NSRect)srcRect
|
|
|
|
|
operation: (NSCompositingOperation)op
|
2013-02-05 19:18:49 +00:00
|
|
|
|
fraction: (CGFloat)delta
|
2005-07-08 23:51:49 +00:00
|
|
|
|
{
|
|
|
|
|
[self subclassResponsibility: _cmd];
|
|
|
|
|
}
|
|
|
|
|
|
2010-06-01 11:04:36 +00:00
|
|
|
|
/** <override-dummy />
|
|
|
|
|
Returns whether the backend supports a GSDraw operator.
|
|
|
|
|
|
|
|
|
|
By default, returns NO.<br />
|
|
|
|
|
When a GSContext backend subclass overrides this method to return YES, the
|
|
|
|
|
backend must also implement -drawGState:fromRect:toPoint:op:fraction: in its
|
|
|
|
|
GSState subclass.
|
|
|
|
|
|
|
|
|
|
When YES is returned, -[NSImage drawXXX] methods that involves rotation,
|
|
|
|
|
scaling etc. will delegate as much as possible the image drawing to the backend,
|
|
|
|
|
rather than trying to emulate the resulting image in Gui by using intermediate
|
|
|
|
|
images to rotate and scale the content, and then composite the result with
|
|
|
|
|
-GScomposite:toPoint:fromRect:operation:fraction:.
|
|
|
|
|
|
|
|
|
|
Backends which doesn't implement -compositeGState:fromRect:toPoint:op:fraction:
|
|
|
|
|
can draw rotated or scaled images, but the semantic won't exactly match the
|
|
|
|
|
NSImage documentation in non-trivial cases. */
|
|
|
|
|
- (BOOL) supportsDrawGState
|
|
|
|
|
{
|
|
|
|
|
return NO;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/** <override-dummy />
|
|
|
|
|
Draws a gstate in a way that fully respects the destination transform,
|
|
|
|
|
unlike the GSComposite operator which ignores the rotation and the scaling
|
|
|
|
|
effect on the content.
|
|
|
|
|
|
|
|
|
|
Note: For the GScomposite operator, the scaling and rotation affects the
|
|
|
|
|
destination point but not the content. */
|
2013-02-05 19:18:49 +00:00
|
|
|
|
- (void) GSdraw: (NSInteger)gstateNum
|
2010-06-01 11:04:36 +00:00
|
|
|
|
toPoint: (NSPoint)aPoint
|
|
|
|
|
fromRect: (NSRect)srcRect
|
|
|
|
|
operation: (NSCompositingOperation)op
|
2013-02-05 19:18:49 +00:00
|
|
|
|
fraction: (CGFloat)delta
|
2010-06-01 11:04:36 +00:00
|
|
|
|
{
|
|
|
|
|
[self subclassResponsibility: _cmd];
|
|
|
|
|
}
|
|
|
|
|
|
2002-05-07 03:37:48 +00:00
|
|
|
|
/** Generic method to draw an image into a rect. The image is defined
|
|
|
|
|
by imageref, an opaque structure. Support for this method hasn't
|
|
|
|
|
been implemented yet, so it should not be used anywhere. */
|
2013-01-30 09:48:54 +00:00
|
|
|
|
- (void) GSDrawImage: (NSRect)rect : (void *)imageref
|
2007-11-22 10:47:33 +00:00
|
|
|
|
{
|
2007-11-22 12:15:50 +00:00
|
|
|
|
[self subclassResponsibility: _cmd];
|
2000-04-20 22:17:42 +00:00
|
|
|
|
}
|
|
|
|
|
|
2001-10-16 02:09:09 +00:00
|
|
|
|
/* ----------------------------------------------------------------------- */
|
|
|
|
|
/* Client functions */
|
|
|
|
|
/* ----------------------------------------------------------------------- */
|
2002-05-07 03:37:48 +00:00
|
|
|
|
/** Write the string (with printf substitutions) to a PostScript context.
|
|
|
|
|
Other output contexts will likely ignore this */
|
2002-10-29 03:46:39 +00:00
|
|
|
|
- (void) DPSPrintf: (const char *)fmt : (va_list)args
|
2001-10-16 02:09:09 +00:00
|
|
|
|
{
|
|
|
|
|
[self subclassResponsibility: _cmd];
|
|
|
|
|
}
|
|
|
|
|
|
2002-05-07 03:37:48 +00:00
|
|
|
|
/** Write the encoded data to a PostScript context.
|
|
|
|
|
Other output contexts will likely ignore this */
|
2002-10-29 03:46:39 +00:00
|
|
|
|
- (void) DPSWriteData: (const char *)buf : (unsigned int)count
|
2001-10-16 02:09:09 +00:00
|
|
|
|
{
|
|
|
|
|
[self subclassResponsibility: _cmd];
|
|
|
|
|
}
|
|
|
|
|
|
2001-04-29 22:30:52 +00:00
|
|
|
|
@end
|
|
|
|
|
|
2001-04-13 20:04:04 +00:00
|
|
|
|
/* ----------------------------------------------------------------------- */
|
|
|
|
|
/* NSGraphics Ops */
|
|
|
|
|
/* ----------------------------------------------------------------------- */
|
2002-03-28 03:53:18 +00:00
|
|
|
|
@implementation NSGraphicsContext (NSGraphics)
|
2004-07-30 13:58:03 +00:00
|
|
|
|
|
2003-09-20 02:57:45 +00:00
|
|
|
|
- (NSDictionary *) GSReadRect: (NSRect) rect
|
2001-04-13 20:04:04 +00:00
|
|
|
|
{
|
|
|
|
|
return nil;
|
|
|
|
|
}
|
|
|
|
|
|
2002-05-07 03:37:48 +00:00
|
|
|
|
/** Generic method to render bitmap images. This method shouldn't be used
|
|
|
|
|
anywhere except in the AppKit itself. It will be replaced by the more
|
2002-08-25 02:47:00 +00:00
|
|
|
|
flexible GSDrawImage method sometime in the future. (Quartz).
|
2001-04-13 20:04:04 +00:00
|
|
|
|
*/
|
2013-02-05 19:18:49 +00:00
|
|
|
|
- (void) NSDrawBitmap: (NSRect) rect : (NSInteger) pixelsWide : (NSInteger) pixelsHigh
|
|
|
|
|
: (NSInteger) bitsPerSample : (NSInteger) samplesPerPixel
|
|
|
|
|
: (NSInteger) bitsPerPixel : (NSInteger) bytesPerRow : (BOOL) isPlanar
|
2001-04-13 20:04:04 +00:00
|
|
|
|
: (BOOL) hasAlpha : (NSString *) colorSpaceName
|
|
|
|
|
: (const unsigned char *const [5]) data
|
|
|
|
|
{
|
|
|
|
|
[self subclassResponsibility: _cmd];
|
|
|
|
|
}
|
|
|
|
|
|
2002-05-07 03:37:48 +00:00
|
|
|
|
/** Play the System Beep */
|
2001-04-13 20:04:04 +00:00
|
|
|
|
- (void) NSBeep
|
|
|
|
|
{
|
2002-06-04 02:19:23 +00:00
|
|
|
|
[GSCurrentServer() beep];
|
2001-04-13 20:04:04 +00:00
|
|
|
|
}
|
|
|
|
|
|
2002-05-07 03:37:48 +00:00
|
|
|
|
/** This method is used by the backend, but has been rendered obsolete.
|
|
|
|
|
Do not use it in any code or in any backend implementation as it
|
|
|
|
|
may disappear at any point. */
|
2001-04-29 22:30:52 +00:00
|
|
|
|
- (void) GSWSetViewIsFlipped: (BOOL) flipped
|
2001-04-13 20:04:04 +00:00
|
|
|
|
{
|
2001-04-29 22:30:52 +00:00
|
|
|
|
}
|
|
|
|
|
|
2002-05-07 03:37:48 +00:00
|
|
|
|
/** Returns YES if the current focused view is flipped. This is an
|
|
|
|
|
obsolete method. Use [[NSView focusView] isFlipped] instead */
|
2001-04-29 22:30:52 +00:00
|
|
|
|
- (BOOL) GSWViewIsFlipped
|
|
|
|
|
{
|
|
|
|
|
return [[self focusView] isFlipped];
|
2001-04-13 20:04:04 +00:00
|
|
|
|
}
|
|
|
|
|
|
1999-02-25 15:41:17 +00:00
|
|
|
|
@end
|
2007-06-18 12:49:04 +00:00
|
|
|
|
|
|
|
|
|
@implementation NSGraphicsContext (Printing)
|
|
|
|
|
|
|
|
|
|
- (void) beginPage: (int)ordinalNum
|
|
|
|
|
label: (NSString*)aString
|
|
|
|
|
bBox: (NSRect)pageRect
|
|
|
|
|
fonts: (NSString*)fontNames
|
|
|
|
|
{
|
|
|
|
|
if (aString == nil)
|
|
|
|
|
aString = [[NSNumber numberWithInt: ordinalNum] description];
|
|
|
|
|
DPSPrintf(self, "%%%%Page: %s %d\n", [aString lossyCString], ordinalNum);
|
|
|
|
|
if (NSIsEmptyRect(pageRect) == NO)
|
|
|
|
|
DPSPrintf(self, "%%%%PageBoundingBox: %d %d %d %d\n",
|
|
|
|
|
(int)NSMinX(pageRect), (int)NSMinY(pageRect),
|
|
|
|
|
(int)NSMaxX(pageRect), (int)NSMaxY(pageRect));
|
|
|
|
|
if (fontNames)
|
|
|
|
|
DPSPrintf(self, "%%%%PageFonts: %s\n", [fontNames lossyCString]);
|
|
|
|
|
DPSPrintf(self, "%%%%BeginPageSetup\n");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
- (void) beginPrologueBBox: (NSRect)boundingBox
|
|
|
|
|
creationDate: (NSString*)dateCreated
|
|
|
|
|
createdBy: (NSString*)anApplication
|
|
|
|
|
fonts: (NSString*)fontNames
|
|
|
|
|
forWhom: (NSString*)user
|
|
|
|
|
pages: (int)numPages
|
|
|
|
|
title: (NSString*)aTitle
|
|
|
|
|
{
|
|
|
|
|
NSPrintOperation *printOp = [NSPrintOperation currentOperation];
|
|
|
|
|
NSPrintingOrientation orient;
|
|
|
|
|
BOOL epsOp;
|
|
|
|
|
|
|
|
|
|
epsOp = [printOp isEPSOperation];
|
|
|
|
|
orient = [[printOp printInfo] orientation];
|
|
|
|
|
|
|
|
|
|
if (epsOp)
|
|
|
|
|
DPSPrintf(self, "%%!PS-Adobe-3.0 EPSF-3.0\n");
|
|
|
|
|
else
|
|
|
|
|
DPSPrintf(self, "%%!PS-Adobe-3.0\n");
|
|
|
|
|
DPSPrintf(self, "%%%%Title: %s\n", [aTitle lossyCString]);
|
|
|
|
|
DPSPrintf(self, "%%%%Creator: %s\n", [anApplication lossyCString]);
|
|
|
|
|
DPSPrintf(self, "%%%%CreationDate: %s\n",
|
|
|
|
|
[[dateCreated description] lossyCString]);
|
|
|
|
|
DPSPrintf(self, "%%%%For: %s\n", [user lossyCString]);
|
|
|
|
|
if (fontNames)
|
|
|
|
|
DPSPrintf(self, "%%%%DocumentFonts: %s\n", [fontNames lossyCString]);
|
|
|
|
|
else
|
|
|
|
|
DPSPrintf(self, "%%%%DocumentFonts: (atend)\n");
|
|
|
|
|
|
|
|
|
|
if (NSIsEmptyRect(boundingBox) == NO)
|
|
|
|
|
DPSPrintf(self, "%%%%BoundingBox: %d %d %d %d\n",
|
|
|
|
|
(int)NSMinX(boundingBox), (int)NSMinY(boundingBox),
|
|
|
|
|
(int)NSMaxX(boundingBox), (int)NSMaxY(boundingBox));
|
|
|
|
|
else
|
|
|
|
|
DPSPrintf(self, "%%%%BoundingBox: (atend)\n");
|
|
|
|
|
|
|
|
|
|
if (epsOp == NO)
|
|
|
|
|
{
|
|
|
|
|
if (numPages)
|
|
|
|
|
DPSPrintf(self, "%%%%Pages: %d\n", numPages);
|
|
|
|
|
else
|
|
|
|
|
DPSPrintf(self, "%%%%Pages: (atend)\n");
|
|
|
|
|
if ([printOp pageOrder] == NSDescendingPageOrder)
|
|
|
|
|
DPSPrintf(self, "%%%%PageOrder: Descend\n");
|
|
|
|
|
else if ([printOp pageOrder] == NSAscendingPageOrder)
|
|
|
|
|
DPSPrintf(self, "%%%%PageOrder: Ascend\n");
|
|
|
|
|
else if ([printOp pageOrder] == NSSpecialPageOrder)
|
|
|
|
|
DPSPrintf(self, "%%%%PageOrder: Special\n");
|
|
|
|
|
|
|
|
|
|
if (orient == NSPortraitOrientation)
|
|
|
|
|
DPSPrintf(self, "%%%%Orientation: Portrait\n");
|
|
|
|
|
else
|
|
|
|
|
DPSPrintf(self, "%%%%Orientation: Landscape\n");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
DPSPrintf(self, "%%%%GNUstepVersion: %d.%d.%d\n",
|
|
|
|
|
GNUSTEP_GUI_MAJOR_VERSION, GNUSTEP_GUI_MINOR_VERSION,
|
|
|
|
|
GNUSTEP_GUI_SUBMINOR_VERSION);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
- (void) beginSetup
|
|
|
|
|
{
|
|
|
|
|
DPSPrintf(self, "%%%%BeginSetup\n");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
- (void) beginTrailer
|
|
|
|
|
{
|
|
|
|
|
DPSPrintf(self, "%%%%Trailer\n");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
- (void) endDocumentPages: (int)pages
|
|
|
|
|
documentFonts: (NSSet*)fontNames
|
|
|
|
|
{
|
|
|
|
|
if (pages != 0)
|
|
|
|
|
{
|
|
|
|
|
DPSPrintf(self, "%%%%Pages: %d\n", pages);
|
|
|
|
|
}
|
|
|
|
|
if (fontNames && [fontNames count])
|
|
|
|
|
{
|
|
|
|
|
NSString *name;
|
|
|
|
|
NSEnumerator *e = [fontNames objectEnumerator];
|
|
|
|
|
|
|
|
|
|
DPSPrintf(self, "%%%%DocumentFonts: %@\n", [e nextObject]);
|
|
|
|
|
while ((name = [e nextObject]))
|
|
|
|
|
{
|
|
|
|
|
DPSPrintf(self, "%%%%+ %@\n", name);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
- (void) endHeaderComments
|
|
|
|
|
{
|
|
|
|
|
DPSPrintf(self, "%%%%EndComments\n\n");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
- (void) endPageSetup
|
|
|
|
|
{
|
|
|
|
|
DPSPrintf(self, "%%%%EndPageSetup\n");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
- (void) endPrologue
|
|
|
|
|
{
|
|
|
|
|
DPSPrintf(self, "%%%%EndProlog\n\n");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
- (void) endSetup
|
|
|
|
|
{
|
|
|
|
|
DPSPrintf(self, "%%%%EndSetup\n\n");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
- (void) endSheet
|
|
|
|
|
{
|
|
|
|
|
NSPrintOperation *printOp = [NSPrintOperation currentOperation];
|
|
|
|
|
|
|
|
|
|
if ([printOp isEPSOperation] == NO)
|
|
|
|
|
{
|
|
|
|
|
[self showPage];
|
|
|
|
|
}
|
|
|
|
|
DPSPrintf(self, "%%%%PageTrailer\n\n");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
- (void) endTrailer
|
|
|
|
|
{
|
|
|
|
|
DPSPrintf(self, "%%%%EOF\n");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
- (void) printerProlog
|
|
|
|
|
{
|
|
|
|
|
NSString *prolog;
|
|
|
|
|
|
|
|
|
|
DPSPrintf(self, "%%%%BeginProlog\n");
|
|
|
|
|
prolog = [NSBundle pathForLibraryResource: @"GSProlog"
|
|
|
|
|
ofType: @"ps"
|
|
|
|
|
inDirectory: @"PostScript"];
|
|
|
|
|
if (prolog == nil)
|
|
|
|
|
{
|
|
|
|
|
NSLog(@"Cannot find printer prolog file");
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
prolog = [NSString stringWithContentsOfFile: prolog];
|
|
|
|
|
DPSPrintf(self, [prolog cString]);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
- (void) showPage
|
|
|
|
|
{
|
|
|
|
|
DPSPrintf(self, "showpage\n");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@end
|
2009-10-23 19:58:22 +00:00
|
|
|
|
|
|
|
|
|
@implementation NSGraphicsContext (NSGradient)
|
|
|
|
|
- (void) drawGradient: (NSGradient*)gradient
|
|
|
|
|
fromCenter: (NSPoint)startCenter
|
|
|
|
|
radius: (CGFloat)startRadius
|
|
|
|
|
toCenter: (NSPoint)endCenter
|
|
|
|
|
radius: (CGFloat)endRadius
|
|
|
|
|
options: (NSUInteger)options
|
|
|
|
|
{
|
|
|
|
|
[self subclassResponsibility: _cmd];
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
- (void) drawGradient: (NSGradient*)gradient
|
|
|
|
|
fromPoint: (NSPoint)startPoint
|
|
|
|
|
toPoint: (NSPoint)endPoint
|
|
|
|
|
options: (NSUInteger)options
|
|
|
|
|
{
|
|
|
|
|
[self subclassResponsibility: _cmd];
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@end
|