NSColorWell: Draw a black-and-white pattern behind transparent color swatches.

git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/gui/trunk@29152 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
Eric Wasylishen 2009-12-21 04:09:35 +00:00
parent c435d58e6a
commit 4433753e94
2 changed files with 22 additions and 0 deletions

View file

@ -1,3 +1,8 @@
2009-12-20 Eric Wasylishen <ewasylishen@gmail.com>
* Source/NSColorWell.m: Draw a black-and-white pattern behind
transparent color swatches.
2009-12-20 Eric Wasylishen <ewasylishen@gmail.com>
* Source/NSColor.m: -[GSRGBColor isEqual:] was ignoring the alpha

View file

@ -31,6 +31,7 @@
#include "config.h"
#include "AppKit/NSActionCell.h"
#include "AppKit/NSApplication.h"
#include "AppKit/NSBezierPath.h"
#include "AppKit/NSColorPanel.h"
#include "AppKit/NSColorWell.h"
#include "AppKit/NSColor.h"
@ -190,6 +191,22 @@ static NSString *GSColorWellDidBecomeExclusiveNotification =
{
return;
}
if ([_the_color alphaComponent] < 1.0)
{
NSBezierPath *triangle = [NSBezierPath bezierPath];
[[NSColor whiteColor] set];
NSRectFill(insideRect);
[triangle moveToPoint: NSMakePoint(insideRect.origin.x,
insideRect.origin.y + insideRect.size.height)];
[triangle lineToPoint: NSMakePoint(insideRect.origin.x + insideRect.size.width,
insideRect.origin.y + insideRect.size.height)];
[triangle lineToPoint: insideRect.origin];
[triangle closePath];
[[NSColor blackColor] set];
[triangle fill];
}
[_the_color drawSwatchInRect: insideRect];
}