core graphics - How do I draw this exact gradient on the iPhone? -
The gradient in question is from the quartz 2D programming guide, "A radial gradient that varies between a point and a circle ".
I am trying to create a CGGradient object (not a CGShading object, which can be a problem):
CGColorSpaceRef rgb = CGColorSpaceCreateDeviceRGB (); CGFloat color [] = {0, 0, 0, 0.9, 0, 0, 0, 0}; CGGradientRef shield = CGGradientCreateWithColorComponents (RGB, color, faucet, size (color) / (size (color [0]) * sizeof (CGFloat)); CGContextClipToRect (reference, rect); CGContextDrawRadialGradient (Reference, Slope, Initial Center, Start Radio, Closing Center, Interval, Gradient Drawingopts); CGGradientRelease (Slope); CGColorSpaceRelease (RGB);
Of course, this is not perfect - the center point and radius are correct, but the actual gradient does not look the same. I used to provide only the source code for every instance of the apple! >:
Update: These color values add shading to the top Content (to pull out of a circle from a point):
CGFLOT color [] = {0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f , 0.75f};
The values of these colors are very close (pull out of a circle from a point):
CGflat color [] = {0.0 F , 1.0f, 1.0f, 1.0f, 0.0f, 0.0f, 0.0f, 0.75f};
Comments
Post a Comment