mirror of
https://github.com/gnustep/libs-gui.git
synced 2025-04-22 16:10:48 +00:00
NSGraphicsContext: create -CGContext methods
Create methods which allow a graphics context to be created with a CGContext as an equivalent to a graphics port. The context set through this property will be used in gnustep-back.
This commit is contained in:
parent
dc9ff85436
commit
257017c65f
2 changed files with 20 additions and 1 deletions
|
@ -50,6 +50,8 @@
|
|||
@class NSBitmapImageRep;
|
||||
@class NSGradient;
|
||||
|
||||
typedef struct CGContext *CGContextRef;
|
||||
|
||||
/*
|
||||
* Backing Store Types
|
||||
*/
|
||||
|
@ -202,6 +204,12 @@ typedef enum _GSColorSpace
|
|||
flipped: (BOOL)flag;
|
||||
#endif
|
||||
|
||||
#if OS_API_VERSION(MAC_OS_X_VERSION_10_10, GS_API_LATEST)
|
||||
- (CGContextRef) CGContext;
|
||||
+ (NSGraphicsContext *) graphicsContextWithCGContext: (CGContextRef)ctx
|
||||
flipped: (BOOL)flipped;
|
||||
#endif
|
||||
|
||||
- (NSDictionary *) attributes;
|
||||
- (void *) graphicsPort;
|
||||
|
||||
|
@ -530,7 +538,6 @@ transform between current user space and image space for this image.</desc>
|
|||
fromPoint: (NSPoint)startPoint
|
||||
toPoint: (NSPoint)endPoint
|
||||
options: (NSUInteger)options;
|
||||
|
||||
@end
|
||||
|
||||
/* NSGraphicContext constants */
|
||||
|
|
|
@ -232,6 +232,13 @@ NSGraphicsContext *GSCurrentContext(void)
|
|||
return new;
|
||||
}
|
||||
|
||||
+ (NSGraphicsContext *)graphicsContextWithCGContext: (CGContextRef)context
|
||||
flipped: (BOOL)flipped
|
||||
{
|
||||
return [NSGraphicsContext graphicsContextWithGraphicsPort: (void *)context
|
||||
flipped: flipped];
|
||||
}
|
||||
|
||||
+ (void) restoreGraphicsState
|
||||
{
|
||||
NSGraphicsContext *ctxt;
|
||||
|
@ -355,6 +362,11 @@ NSGraphicsContext *GSCurrentContext(void)
|
|||
return _graphicsPort;
|
||||
}
|
||||
|
||||
- (CGContextRef)CGContext
|
||||
{
|
||||
return (CGContextRef)[self graphicsPort];
|
||||
}
|
||||
|
||||
- (BOOL) isDrawingToScreen
|
||||
{
|
||||
return NO;
|
||||
|
|
Loading…
Reference in a new issue