* Source/cairo/CairoGState.m: Added code in -drawGradient:

fromPoint:toPoint:options: to handle gradients for colorspaces
	other than NSCalibratedRGBColorSpace, NSDeviceRGBColorSpace,
	NSCalibratedWhiteColorSpace, NSDeviceWhiteColorSpace,
	NSCalibratedBlackColorSpace, NSDeviceBlackColorSpace.  The
	previous implementation assumed RGB based colorspaces only.



git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/back/trunk@36582 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
gcasa 2013-04-25 03:16:06 +00:00
parent 4e59c1c2ce
commit 803afa868a
2 changed files with 39 additions and 7 deletions

View file

@ -1,3 +1,12 @@
2013-04-24 23:10-EDT Gregory John Casamento <greg.casamento@gmail.com>
* Source/cairo/CairoGState.m: Added code in -drawGradient:
fromPoint:toPoint:options: to handle gradients for colorspaces
other than NSCalibratedRGBColorSpace, NSDeviceRGBColorSpace,
NSCalibratedWhiteColorSpace, NSDeviceWhiteColorSpace,
NSCalibratedBlackColorSpace, NSDeviceBlackColorSpace. The
previous implementation assumed RGB based colorspaces only.
2012-03-01 Richard Frith-Macdonald <rfm@gnu.org>
* Version ... bump subminor number in preparation for next release.

View file

@ -1608,16 +1608,39 @@ doesn't support to use the receiver cairo target as the source. */
double green;
double blue;
double alpha;
NSString *colorSpaceName;
[gradient getColor: &color
location: &location
atIndex: i];
red = [color redComponent];
green = [color greenComponent];
blue = [color blueComponent];
alpha = [color alphaComponent];
cairo_pattern_add_color_stop_rgba(cpattern, location,
red, green, blue, alpha);
colorSpaceName = [color colorSpaceName];
if([NSCalibratedRGBColorSpace isEqualToString: colorSpaceName] ||
[NSDeviceRGBColorSpace isEqualToString: colorSpaceName])
{
red = [color redComponent];
green = [color greenComponent];
blue = [color blueComponent];
alpha = [color alphaComponent];
cairo_pattern_add_color_stop_rgba(cpattern, location,
red, green, blue, alpha);
}
else if([NSCalibratedWhiteColorSpace isEqualToString: colorSpaceName] ||
[NSDeviceWhiteColorSpace isEqualToString: colorSpaceName] ||
[NSCalibratedBlackColorSpace isEqualToString: colorSpaceName] ||
[NSDeviceBlackColorSpace isEqualToString: colorSpaceName])
{
red = [color whiteComponent];
green = [color whiteComponent];
blue = [color whiteComponent];
alpha = [color alphaComponent];
cairo_pattern_add_color_stop_rgba(cpattern, location,
red, green, blue, alpha);
}
else
{
NSLog(@"Cannot draw gradient for %@",colorSpaceName);
}
}
cairo_save(_ct);