iphone Programming Glossary: cgcontextdrawlineargradient
Drawing rotated text with NSString drawInRect http://stackoverflow.com/questions/10289898/drawing-rotated-text-with-nsstring-drawinrect for me https discussions.apple.com thread 1779814 start 0 tstart 0 My code looks like CGContextSaveGState context CGContextDrawLinearGradient context gradient CGPointMake 0 centY halfWidth CGPointMake 0 centY halfWidth 0 Add text CGContextSetFillColorWithColor.. nil CGFloat locations 0.0 1.0 CGGradientRef gradient CGGradientCreateWithColors colorSpace CFArrayRef colors locations CGContextDrawLinearGradient context gradient CGPointMake rect.origin.x rect.size.width 2 rect.origin.y CGPointMake rect.origin.x rect.size.width 2 rect.origin.y..
How do I add a gradient to the text of a UILabel, but not the background? http://stackoverflow.com/questions/1266179/how-do-i-add-a-gradient-to-the-text-of-a-uilabel-but-not-the-background CGRectGetMidX currentBounds 0.0f CGPoint midCenter CGPointMake CGRectGetMidX currentBounds CGRectGetMidY currentBounds CGContextDrawLinearGradient context gradient topCenter midCenter 0 CGGradientRelease gradient CGColorSpaceRelease rgbColorspace CGContextRestoreGState..
How to draw a gradient line (fading in/out) with Core Graphics/iPhone? http://stackoverflow.com/questions/1303855/how-to-draw-a-gradient-line-fading-in-out-with-core-graphics-iphone num_locations CGPoint myStartPoint myEndPoint myStartPoint.x 0.0 myStartPoint.y 0.0 myEndPoint.x 0.0 myEndPoint.y 10.0 CGContextDrawLinearGradient context myGradient myStartPoint myEndPoint 0 But how could I draw a line with a gradient i.g. fading in from black to white.. context with CGContextSaveGState context CGContextAddRect context CGRectMake x y width height CGContextClip context CGContextDrawLinearGradient context gradient startPoint endPoint 0 CGContextRestoreGState context and everything works fine. Thanks to Brad Larson for..
UINavigationBar gradient details http://stackoverflow.com/questions/1852319/uinavigationbar-gradient-details CGGradientRef topGradient CGGradientCreateWithColorComponents myColorspace topComponents locations 2 CGContextDrawLinearGradient context topGradient CGPointMake 0 0 CGPointMake 0 self.frame.size.height 2 0 CGGradientRelease topGradient CGFloat botComponents.. CGGradientRef botGradient CGGradientCreateWithColorComponents myColorspace botComponents locations 2 CGContextDrawLinearGradient context botGradient CGPointMake 0 self.frame.size.height 2 CGPointMake 0 self.frame.size.height 0 CGGradientRelease botGradient..
Applying background gradient to a Grouple table cell http://stackoverflow.com/questions/1979165/applying-background-gradient-to-a-grouple-table-cell CGPoint startPoint endPoint startPoint.x 0.0 startPoint.y self.frame.size.height endPoint.x 0.0 endPoint.y 0.0 CGContextDrawLinearGradient c myGradient startPoint endPoint 0 const CGFloat topSepColor 0.8f 0.8f 0.8f 1.0f Cell Seperator Colour Top CGGradientRelease..
Smoothing a rounded stroke in Core Graphics http://stackoverflow.com/questions/2181279/smoothing-a-rounded-stroke-in-core-graphics CGColorSpaceCreateDeviceRGB myGradient CGGradientCreateWithColorComponents myColorspace mycomponents locations 2 CGContextDrawLinearGradient c myGradient CGPointMake minx miny CGPointMake minx maxy 0 CGContextRestoreGState c CGContextAddPath c path CGContextStrokePath..
UIView border with fade or blur effect http://stackoverflow.com/questions/2306043/uiview-border-with-fade-or-blur-effect colorWithRed 0.5 green 0.5 blue 0.5 alpha 0.0 .CGColor CGContextFillRect context CGRectMake 0 0 320 gradientHPos CGContextDrawLinearGradient context gradient CGPointMake 160 gradientHPos CGPointMake 160 gradientHPos gradientH 0 CGGradientRelease gradient CGImageRef..
CGGradient in an CGPath http://stackoverflow.com/questions/2563303/cggradient-in-an-cgpath
How to fill a path with gradient in drawRect:? http://stackoverflow.com/questions/2985359/how-to-fill-a-path-with-gradient-in-drawrect graphics quartz graphics drawrect share improve this question I would clip to the path you want to fill and use CGContextDrawLinearGradient. Here is a simple implementation of drawRect as an example void drawRect CGRect rect Create a gradient from white to red.. CGPointMake CGRectGetMidX rect CGRectGetMinY rect CGPoint endPoint CGPointMake CGRectGetMidX rect CGRectGetMaxY rect CGContextDrawLinearGradient context gradient startPoint endPoint 0 CGGradientRelease gradient gradient NULL CGContextRestoreGState context CGContextAddEllipseInRect..
How to get UILabel (UITextView) auto adjusted font size? http://stackoverflow.com/questions/3669844/how-to-get-uilabel-uitextview-auto-adjusted-font-size CGPoint midCenter CGPointMake CGRectGetMidX currentBounds CGRectGetMidY currentBounds fontCapHeightHalf CGContextDrawLinearGradient myContext glossGradient topCenter midCenter 0 CGGradientRelease glossGradient CGColorSpaceRelease rgbColorspace CGContextRestoreGState..
Change background color of UIButton when Highlighted http://stackoverflow.com/questions/4022763/change-background-color-of-uibutton-when-highlighted gradient CGGradientCreateWithColorComponents rgb colors NULL sizeof colors sizeof colors 0 4 CGColorSpaceRelease rgb CGContextDrawLinearGradient ctx gradient CGPointMake 0 0 CGPointMake 0 self.bounds.size.height 0 CGGradientRelease gradient else Do custom drawing..
Gradient effect for Line Graph in iPhone http://stackoverflow.com/questions/4835515/gradient-effect-for-line-graph-in-iphone bottom CGPoint gradStartPoint CGPointMake 50.0 graphView.bounds.size.height CGPoint gradEndPoint CGPointMake 50.0 0.0 CGContextDrawLinearGradient UIGraphicsGetCurrentContext gradient gradStartPoint gradEndPoint 0 CFRelease gradient Cleanup CGColorSpaceRelease colorSpace..
iPhone Glossy Icons Using Core Graphics http://stackoverflow.com/questions/5541457/iphone-glossy-icons-using-core-graphics CGColorSpaceCreateDeviceRGB glossGradient CGGradientCreateWithColorComponents rgbColorspace components locations 2 CGContextDrawLinearGradient context glossGradient topCenter midCenter 0 UIGraphicsPopContext newImage UIGraphicsGetImageFromCurrentImageContext CGGradientRelease..
How to implement alpha gradient on a image? http://stackoverflow.com/questions/5908731/how-to-implement-alpha-gradient-on-a-image it. You could generate an appropriate mask simply enough by drawing to a greyscale or alpha only CGBitmapContext with CGContextDrawLinearGradient . If it's being displayed as the content of a CALayer you could apply an appropriate masking layer to the parent layer's.. . Or draw the gradient first and draw the image over it using kCGBlendModeSourceIn . In both cases CGContextDrawLinearGradient is again your friend. Then of course get the image out of the CGContext using CGBitmapContextCreateImage or CGImageCreate..
Make Background of UIView a Gradient Without Sub Classing http://stackoverflow.com/questions/844710/make-background-of-uiview-a-gradient-without-sub-classing CGGradientRef myGradient CGGradientCreateWithColorComponents colorSpace colorList locationList 2 Draw Gradient Here CGContextDrawLinearGradient bitmapContext myGradient CGPointMake 0.0f 0.0f CGPointMake 320.0f 480.0f 0 Create a CGImage from context CGImageRef cgImage..
|