¡@

Home 

2014/10/15 ¤U¤È 10:05:01

iphone Programming Glossary: cgcontextfillrect

How would I tint an image programatically on the iPhone?

http://stackoverflow.com/questions/1117211/how-would-i-tint-an-image-programatically-on-the-iphone

context CGColorGetComponents UIColor colorWithRed 0.5 green 0.5 blue 0 alpha 1 .CGColor don't make color too saturated CGContextFillRect context rect draw base UIImage imageNamed @ someImage.png drawInRect rect blendMode kCGBlendModeOverlay alpha 1.0 draw image.. context kCGBlendModeMultiply CGContextSetFillColor context CGColorGetComponents self.overlayColor.CGColor CGContextFillRect context self.bounds CGContextRestoreGState context Ordinarily to optimize the drawing you would restrict the actual drawing..

iPhone - How do you color an image?

http://stackoverflow.com/questions/1223340/iphone-how-do-you-color-an-image

ctx 0 area.size.height CGContextSaveGState ctx CGContextClipToMask ctx area baseImage.CGImage theColor set CGContextFillRect ctx area CGContextRestoreGState ctx CGContextSetBlendMode ctx kCGBlendModeNormal CGContextDrawImage ctx area baseImage.CGImage.. CGContextSetBlendMode context kCGBlendModeSourceIn CGContextSetFillColorWithColor context color.CGColor CGContextFillRect context rect UIImage image UIGraphicsGetImageFromCurrentImageContext UIGraphicsEndImageContext return image share improve..

UIImage rounded corners

http://stackoverflow.com/questions/262156/uiimage-rounded-corners

NULL return NULL CGContextSetFillColorWithColor mainViewContentContext UIColor whiteColor CGColor CGContextFillRect mainViewContentContext CGRectMake 0 0 targetSize.width targetSize.height CGContextDrawImage mainViewContentContext CGRectMake..

How to tint a transparent PNG image in iPhone?

http://stackoverflow.com/questions/3514066/how-to-tint-a-transparent-png-image-in-iphone

to tint a transparent PNG image in iPhone I know it's possible to tint a rectangular image by drawing a CGContextFillRect over it and setting the blend mode. However I can't figure out how to do a tint on a transparent image such as an icon... to preserve color of transparent pixels CGContextSetBlendMode context kCGBlendModeNormal UIColor blackColor setFill CGContextFillRect context rect draw original image CGContextSetBlendMode context kCGBlendModeNormal CGContextDrawImage context rect myIconImage.CGImage.. the luminosity of the original image is preserved CGContextSetBlendMode context kCGBlendModeColor tintColor setFill CGContextFillRect context rect mask by alpha values of original image CGContextSetBlendMode context kCGBlendModeDestinationIn CGContextDrawImage..

iPhone - Draw transparent rectangle on UIView to reveal view beneath

http://stackoverflow.com/questions/3800278/iphone-draw-transparent-rectangle-on-uiview-to-reveal-view-beneath

CGContextRef context UIGraphicsGetCurrentContext CGContextSetFillColorWithColor context UIColor blueColor .CGColor CGContextFillRect context rect if CGRectIntersects holeRect rect CGContextSetFillColorWithColor context UIColor clearColor .CGColor CGContextFillEllipseInRect..

How to customize the background/border colors of a grouped table view cell?

http://stackoverflow.com/questions/400965/how-to-customize-the-background-border-colors-of-a-grouped-table-view-cell

CGColor CGContextSetStrokeColorWithColor c borderColor CGColor if position CustomCellBackgroundViewPositionTop CGContextFillRect c CGRectMake 0.0f rect.size.height 10.0f rect.size.width 10.0f CGContextBeginPath c CGContextMoveToPoint c 0.0f rect.size.height.. c CGRectMake 0.0f 0.0f rect.size.width rect.size.height 10.0f else if position CustomCellBackgroundViewPositionBottom CGContextFillRect c CGRectMake 0.0f 0.0f rect.size.width 10.0f CGContextBeginPath c CGContextMoveToPoint c 0.0f 10.0f CGContextAddLineToPoint.. c CGRectMake 0.0f 10.0f rect.size.width rect.size.height else if position CustomCellBackgroundViewPositionMiddle CGContextFillRect c rect CGContextBeginPath c CGContextMoveToPoint c 0.0f 0.0f CGContextAddLineToPoint c 0.0f rect.size.height CGContextAddLineToPoint..

Get RGB value from UIColor presets

http://stackoverflow.com/questions/4700168/get-rgb-value-from-uicolor-presets

1 1 8 4 rgbColorSpace kCGImageAlphaNoneSkipLast CGContextSetFillColorWithColor context color CGColor CGContextFillRect context CGRectMake 0 0 1 1 CGContextRelease context CGColorSpaceRelease rgbColorSpace for int component 0 component 3 component..

Drawing waveform with AVAssetReader

http://stackoverflow.com/questions/5032775/drawing-waveform-with-avassetreader

0 rect.origin.y 0 CGColorRef leftcolor UIColor whiteColor CGColor CGColorRef rightcolor UIColor redColor CGColor CGContextFillRect context rect CGContextSetLineWidth context 1.0 float halfGraphHeight imageHeight 2 float channelCount float centerLeft halfGraphHeight.. 0 rect.origin.y 0 CGColorRef leftcolor UIColor whiteColor CGColor CGColorRef rightcolor UIColor redColor CGColor CGContextFillRect context rect CGContextSetLineWidth context 1.0 float halfGraphHeight imageHeight 2 float channelCount float centerLeft halfGraphHeight..

Recreate recipient bubble behaviour in Mail.app / Three20

http://stackoverflow.com/questions/5247072/recreate-recipient-bubble-behaviour-in-mail-app-three20

CGRectMake badgeBounds.origin.x badgeBounds.size.width capDiameter badgeBounds.origin.y capDiameter capDiameter CGContextFillRect context CGRectMake badgeBounds.origin.x capRadius badgeBounds.origin.y badgeBounds.size.width capDiameter capDiameter..

How to write text on image in objective-c iPhone?

http://stackoverflow.com/questions/6992830/how-to-write-text-on-image-in-objective-c-iphone

of solid color behind the text add the following before the line UIColor whiteColor set UIColor brownColor set CGContextFillRect UIGraphicsGetCurrentContext CGRectMake 0 image.size.height text sizeWithFont font .height image.size.width image.size.height..