mirror of
https://github.com/gnustep/libs-gui.git
synced 2025-06-02 12:30:59 +00:00
[GSPatternColor colorSpaceName] uses NSPatternColorSpace.
Corrected [blendedColorWithFraction:ofColor:], where self and aColor where exchanged and alpha handling was missing. git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/gui/trunk@16541 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
parent
9310a019ef
commit
32f6a28f96
1 changed files with 19 additions and 9 deletions
|
@ -941,22 +941,33 @@ systemColorWithName(NSString *name)
|
||||||
{
|
{
|
||||||
NSColor *myColor = [self colorUsingColorSpaceName: NSCalibratedRGBColorSpace];
|
NSColor *myColor = [self colorUsingColorSpaceName: NSCalibratedRGBColorSpace];
|
||||||
NSColor *other = [aColor colorUsingColorSpaceName: NSCalibratedRGBColorSpace];
|
NSColor *other = [aColor colorUsingColorSpaceName: NSCalibratedRGBColorSpace];
|
||||||
float mr, mg, mb, or, og, ob, red, green, blue;
|
float mr, mg, mb, ma, or, og, ob, oa, red, green, blue, alpha;
|
||||||
|
|
||||||
|
if (fraction <= 0.0)
|
||||||
|
{
|
||||||
|
return self;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (fraction >= 1.0)
|
||||||
|
{
|
||||||
|
return aColor;
|
||||||
|
}
|
||||||
|
|
||||||
if (myColor == nil || other == nil)
|
if (myColor == nil || other == nil)
|
||||||
{
|
{
|
||||||
return nil;
|
return nil;
|
||||||
}
|
}
|
||||||
|
|
||||||
[myColor getRed: &mr green: &mg blue: &mb alpha: 0];
|
[myColor getRed: &mr green: &mg blue: &mb alpha: &ma];
|
||||||
[other getRed: &or green: &og blue: &ob alpha: 0];
|
[other getRed: &or green: &og blue: &ob alpha: &oa];
|
||||||
red = fraction * mr + (1 - fraction) * or;
|
red = fraction * or + (1 - fraction) * mr;
|
||||||
green = fraction * mg + (1 - fraction) * og;
|
green = fraction * og + (1 - fraction) * mg;
|
||||||
blue = fraction * mb + (1 - fraction) * ob;
|
blue = fraction * ob + (1 - fraction) * mb;
|
||||||
|
alpha = fraction * oa + (1 - fraction) * ma;
|
||||||
return [NSColorClass colorWithCalibratedRed: red
|
return [NSColorClass colorWithCalibratedRed: red
|
||||||
green: green
|
green: green
|
||||||
blue: blue
|
blue: blue
|
||||||
alpha: 1.0];
|
alpha: alpha];
|
||||||
}
|
}
|
||||||
|
|
||||||
- (NSColor*) colorWithAlphaComponent: (float)alpha
|
- (NSColor*) colorWithAlphaComponent: (float)alpha
|
||||||
|
@ -2437,8 +2448,7 @@ systemColorWithName(NSString *name)
|
||||||
|
|
||||||
- (NSString *)colorSpaceName
|
- (NSString *)colorSpaceName
|
||||||
{
|
{
|
||||||
// return NSPatternImageColorSpace;
|
return NSPatternColorSpace;
|
||||||
return nil;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
- (NSImage*) patternImage
|
- (NSImage*) patternImage
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue