mirror of
https://github.com/gnustep/libs-gui.git
synced 2025-05-30 17:01:16 +00:00
* Source/NSColor.m:
* Source/NSColorWell.m: Move code to draw the black and white triangles background for transparent colors to -[NSColor drawSwatchInRect:]. git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/gui/trunk@37194 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
parent
e6357523a4
commit
a2975a65f0
3 changed files with 25 additions and 16 deletions
|
@ -40,6 +40,7 @@
|
|||
#import <Foundation/NSDebug.h>
|
||||
#import <Foundation/NSScanner.h>
|
||||
|
||||
#import "AppKit/NSBezierPath.h"
|
||||
#import "AppKit/NSColor.h"
|
||||
#import "AppKit/NSColorList.h"
|
||||
#import "AppKit/NSColorSpace.h"
|
||||
|
@ -1364,6 +1365,23 @@ systemColorWithName(NSString *name)
|
|||
//
|
||||
- (void) drawSwatchInRect: (NSRect)rect
|
||||
{
|
||||
if ([self alphaComponent] < 1.0)
|
||||
{
|
||||
NSBezierPath *triangle = [NSBezierPath bezierPath];
|
||||
|
||||
[[NSColor whiteColor] set];
|
||||
NSRectFill(rect);
|
||||
|
||||
[triangle moveToPoint: NSMakePoint(rect.origin.x,
|
||||
rect.origin.y + rect.size.height)];
|
||||
[triangle lineToPoint: NSMakePoint(rect.origin.x + rect.size.width,
|
||||
rect.origin.y + rect.size.height)];
|
||||
[triangle lineToPoint: rect.origin];
|
||||
[triangle closePath];
|
||||
[[NSColor blackColor] set];
|
||||
[triangle fill];
|
||||
}
|
||||
|
||||
[self set];
|
||||
NSRectFill(rect);
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue