mirror of
https://github.com/darlinghq/darling-cocotron.git
synced 2024-11-23 12:09:51 +00:00
00dea648f8
- added opengl32 as a direct dependency - added CGGradient skeleton - reorganized some private CA, FreeBSD CGL fixes
49 lines
1.5 KiB
Objective-C
49 lines
1.5 KiB
Objective-C
#import <CoreGraphics/CGGradient.h>
|
|
#import <CoreGraphics/CGColor.h>
|
|
#import <Foundation/NSString.h>
|
|
|
|
CGGradientRef CGGradientCreateWithColorComponents(CGColorSpaceRef colorSpace,const CGFloat components[],const CGFloat locations[],size_t count) {
|
|
return NULL;
|
|
}
|
|
|
|
CGGradientRef CGGradientCreateWithColors(CGColorSpaceRef colorSpace,CFArrayRef colors,const CGFloat locations[]) {
|
|
CFIndex i,count=CFArrayGetCount(colors);
|
|
size_t numberOfComponents=CGColorSpaceGetNumberOfComponents(colorSpace)+1;
|
|
CGFloat components[count*numberOfComponents];
|
|
|
|
for(i=0;i<count;i++){
|
|
CGColorRef color=(CGColorRef)CFArrayGetValueAtIndex(colors,i);
|
|
size_t checkNumberOfComponents=CGColorGetNumberOfComponents(color);
|
|
size_t j;
|
|
|
|
if(checkNumberOfComponents==numberOfComponents){
|
|
const CGFloat *copy=CGColorGetComponents(color);
|
|
|
|
for(j=0;j<numberOfComponents;j++)
|
|
components[i*numberOfComponents+j]=components[j];
|
|
}
|
|
else {
|
|
NSLog(@"CGGradientCreateWithColors, color spaces don't match, conversion not implemented");
|
|
for(j=0;j<numberOfComponents;j++)
|
|
components[i*numberOfComponents+j]=0;
|
|
}
|
|
|
|
}
|
|
|
|
return CGGradientCreateWithColorComponents(colorSpace,components,locations,count);
|
|
}
|
|
|
|
void CGGradientRelease(CGGradientRef self) {
|
|
if(self==NULL)
|
|
return;
|
|
|
|
CFRelease(self);
|
|
}
|
|
|
|
CGGradientRef CGGradientRetain(CGGradientRef self) {
|
|
if(self==NULL)
|
|
return NULL;
|
|
|
|
return (CGGradientRef)CFRetain(self);
|
|
}
|