mirror of
https://github.com/gnustep/libs-gui.git
synced 2025-05-31 20:50:48 +00:00
Add gradient methods on graphics context.
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/gui/trunk@28872 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
parent
7d7e198088
commit
47823bc12b
5 changed files with 59 additions and 6 deletions
|
@ -1,3 +1,11 @@
|
||||||
|
2009-10-23 Fred Kiefer <FredKiefer@gmx.de>
|
||||||
|
|
||||||
|
* Headers/AppKit/NSGraphicsContext.h,
|
||||||
|
* Source/NSGraphicsContext.m: Define empty gradient methods.
|
||||||
|
* Source/NSGradient.m: Use these methods.
|
||||||
|
* Source/NSColor.m (-colorUsingColorSpace): Don't use isEqual: on
|
||||||
|
color space.
|
||||||
|
|
||||||
2009-10-23 Fred Kiefer <FredKiefer@gmx.de>
|
2009-10-23 Fred Kiefer <FredKiefer@gmx.de>
|
||||||
|
|
||||||
* Source/NSGradient.m: Add context savig/restore and first attempt
|
* Source/NSGradient.m: Add context savig/restore and first attempt
|
||||||
|
|
|
@ -48,6 +48,7 @@
|
||||||
@class NSFont;
|
@class NSFont;
|
||||||
@class NSSet;
|
@class NSSet;
|
||||||
@class NSBitmapImageRep;
|
@class NSBitmapImageRep;
|
||||||
|
@class NSGradient;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Backing Store Types
|
* Backing Store Types
|
||||||
|
@ -505,6 +506,21 @@ transform between current user space and image space for this image.</desc>
|
||||||
|
|
||||||
@end
|
@end
|
||||||
|
|
||||||
|
@interface NSGraphicsContext (NSGradient)
|
||||||
|
- (void) drawGradient: (NSGradient*)gradient
|
||||||
|
fromCenter: (NSPoint)startCenter
|
||||||
|
radius: (CGFloat)startRadius
|
||||||
|
toCenter: (NSPoint)endCenter
|
||||||
|
radius: (CGFloat)endRadius
|
||||||
|
options: (NSUInteger)options;
|
||||||
|
|
||||||
|
- (void) drawGradient: (NSGradient*)gradient
|
||||||
|
fromPoint: (NSPoint)startPoint
|
||||||
|
toPoint: (NSPoint)endPoint
|
||||||
|
options: (NSUInteger)options;
|
||||||
|
|
||||||
|
@end
|
||||||
|
|
||||||
/* NSGraphicContext constants */
|
/* NSGraphicContext constants */
|
||||||
APPKIT_EXPORT NSString *NSGraphicsContextDestinationAttributeName;
|
APPKIT_EXPORT NSString *NSGraphicsContextDestinationAttributeName;
|
||||||
APPKIT_EXPORT NSString *NSGraphicsContextPDFFormat;
|
APPKIT_EXPORT NSString *NSGraphicsContextPDFFormat;
|
||||||
|
|
|
@ -1218,7 +1218,7 @@ systemColorWithName(NSString *name)
|
||||||
// FIXME
|
// FIXME
|
||||||
NSString *colorSpaceName;
|
NSString *colorSpaceName;
|
||||||
|
|
||||||
if ([space isEqualTo: [self colorSpace]])
|
if (space == [self colorSpace])
|
||||||
{
|
{
|
||||||
return self;
|
return self;
|
||||||
}
|
}
|
||||||
|
|
|
@ -55,14 +55,22 @@
|
||||||
radius: (CGFloat)endRadius
|
radius: (CGFloat)endRadius
|
||||||
options: (NSGradientDrawingOptions)options
|
options: (NSGradientDrawingOptions)options
|
||||||
{
|
{
|
||||||
// FIXME: New backend call
|
[[NSGraphicsContext currentContext] drawGradient: self
|
||||||
|
fromCenter: startCenter
|
||||||
|
radius: startRadius
|
||||||
|
toCenter: endCenter
|
||||||
|
radius: endRadius
|
||||||
|
options: options];
|
||||||
}
|
}
|
||||||
|
|
||||||
- (void) drawFromPoint: (NSPoint)startPoint
|
- (void) drawFromPoint: (NSPoint)startPoint
|
||||||
toPoint: (NSPoint)endPoint
|
toPoint: (NSPoint)endPoint
|
||||||
options: (NSGradientDrawingOptions)options
|
options: (NSGradientDrawingOptions)options
|
||||||
{
|
{
|
||||||
// FIXME: New backend call
|
[[NSGraphicsContext currentContext] drawGradient: self
|
||||||
|
fromPoint: startPoint
|
||||||
|
toPoint: endPoint
|
||||||
|
options: options];
|
||||||
}
|
}
|
||||||
|
|
||||||
- (void) drawInBezierPath: (NSBezierPath *)path angle: (CGFloat)angle
|
- (void) drawInBezierPath: (NSBezierPath *)path angle: (CGFloat)angle
|
||||||
|
@ -197,7 +205,7 @@ relativeCenterPosition: (NSPoint)relativeCenterPoint
|
||||||
{
|
{
|
||||||
return [self initWithColors: colorArray
|
return [self initWithColors: colorArray
|
||||||
atLocations: NULL
|
atLocations: NULL
|
||||||
colorSpace: null];
|
colorSpace: nil];
|
||||||
}
|
}
|
||||||
|
|
||||||
- (id) initWithColors: (NSArray *)colorArray
|
- (id) initWithColors: (NSArray *)colorArray
|
||||||
|
@ -208,7 +216,7 @@ relativeCenterPosition: (NSPoint)relativeCenterPoint
|
||||||
{
|
{
|
||||||
_numberOfColorStops = [colorArray count];
|
_numberOfColorStops = [colorArray count];
|
||||||
NSAssert(_numberOfColorStops >= 2, @"NSGradient needs at least 2 locations");
|
NSAssert(_numberOfColorStops >= 2, @"NSGradient needs at least 2 locations");
|
||||||
if (colorSpace == null)
|
if (colorSpace == nil)
|
||||||
{
|
{
|
||||||
colorSpace = [[colorArray objectAtIndex: 0] colorSpace];
|
colorSpace = [[colorArray objectAtIndex: 0] colorSpace];
|
||||||
}
|
}
|
||||||
|
@ -261,7 +269,7 @@ relativeCenterPosition: (NSPoint)relativeCenterPoint
|
||||||
|
|
||||||
self = [self initWithColors: colorArray
|
self = [self initWithColors: colorArray
|
||||||
atLocations: locations
|
atLocations: locations
|
||||||
colorSpace: null];
|
colorSpace: nil];
|
||||||
|
|
||||||
RELEASE(colorArray);
|
RELEASE(colorArray);
|
||||||
objc_free(locations);
|
objc_free(locations);
|
||||||
|
|
|
@ -1780,3 +1780,24 @@ NSGraphicsContext *GSCurrentContext(void)
|
||||||
}
|
}
|
||||||
|
|
||||||
@end
|
@end
|
||||||
|
|
||||||
|
@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
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue