¡@

Home 

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

iphone Programming Glossary: cgcontextaddrect

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

impossible to draw gradient lines with CGContextStrokePath . For horizontal and vertical lines the solution is to use CGContextAddRect instead which fortunately is what I need. I replaced CGContextMoveToPoint context x y CGContextAddLineToPoint context x2.. context x y CGContextAddLineToPoint context x2 y2 CGContextStrokePath context with CGContextSaveGState context CGContextAddRect context CGRectMake x y width height CGContextClip context CGContextDrawLinearGradient context gradient startPoint endPoint..

How to erase some portion of a UIImageView's image on iOS?

http://stackoverflow.com/questions/1487601/how-to-erase-some-portion-of-a-uiimageviews-image-on-ios

s img.size UIGraphicsBeginImageContext s CGContextRef g UIGraphicsGetCurrentContext CGContextAddPath g erasePath CGContextAddRect g CGRectMake 0 0 s.width s.height CGContextEOClip g img drawAtPoint CGPointZero imageView.image UIGraphicsGetImageFromCurrentImageContext..

How to erase part of an image as the user touches it

http://stackoverflow.com/questions/2978382/how-to-erase-part-of-an-image-as-the-user-touches-it

CGContextMoveToPoint g from.x from.y CGContextAddLineToPoint g to.x to.y CGContextClosePath g CGContextAddRect g CGRectMake 0 0 s.width s.height CGContextEOClip g image drawAtPoint CGPointZero bkgdImageView.image UIGraphicsGetImageFromCurrentImageContext..

How to display an image on a MKOverlayView?

http://stackoverflow.com/questions/3891850/how-to-display-an-image-on-a-mkoverlayview

preferences NSUserDefaults standardUserDefaults CGContextSetAlpha context preferences floatForKey @ RadarTransparency CGContextAddRect context clipRect CGContextClip context CGContextDrawImage context theRect imageReference image release When I download the..

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

CGContextRef context CGRect rect float ovalWidth float ovalHeight float fw fh if ovalWidth 0 ovalHeight 0 1 CGContextAddRect context rect return CGContextSaveGState context 2 CGContextTranslateCTM context CGRectGetMinX rect 3 CGRectGetMinY rect..

How erase part of UIImage

http://stackoverflow.com/questions/4526336/how-erase-part-of-uiimage

s img.size UIGraphicsBeginImageContext s CGContextRef g UIGraphicsGetCurrentContext CGContextAddPath g erasePath CGContextAddRect g CGRectMake 0 0 s.width s.height CGContextEOClip g img drawAtPoint CGPointZero imageView.image UIGraphicsGetImageFromCurrentImageContext.. a bitmap image context with given size is needed and then you get a reference to it. CGContextAddPath g erasePath CGContextAddRect g CGRectMake 0 0 s.width s.height CGContextEOClip g Here you provide a path to the context and then clip the context. That's..

Round two corners in UIView

http://stackoverflow.com/questions/4847163/round-two-corners-in-uiview

midy CGRectGetMidY rect maxy CGRectGetMaxY rect CGContextBeginPath context CGContextSetGrayFillColor context 1.0 0.0 CGContextAddRect context rect CGContextClosePath context CGContextDrawPath context kCGPathFill CGContextSetGrayFillColor context 1.0 1.0..

UIImage with transparent rounded corners

http://stackoverflow.com/questions/4885713/uiimage-with-transparent-rounded-corners

it reduces to a right angle so instead of a rounded rectangle we have an ordinary one. if ovalWidth 0 ovalHeight 0 CGContextAddRect context rect return Save the context's state so that the translate and scale can be undone with a call to CGContextRestoreGState...

How do I create an image overlay and add to MKMapView?

http://stackoverflow.com/questions/5283741/how-do-i-create-an-image-overlay-and-add-to-mkmapview

self.overlay boundingMapRect CGRect theRect self rectForMapRect theMapRect CGRect clipRect self rectForMapRect mapRect CGContextAddRect ctx clipRect CGContextClip ctx CGContextDrawImage ctx theRect imageReference image release @end Add the overlay to the MKMapView..

iPhone Glossy Icons Using Core Graphics

http://stackoverflow.com/questions/5541457/iphone-glossy-icons-using-core-graphics

CGContextRef context CGRect rect float ovalWidth float ovalHeight float fw fh if ovalWidth 0 ovalHeight 0 CGContextAddRect context rect return CGContextSaveGState context CGContextTranslateCTM context CGRectGetMinX rect CGRectGetMinY rect CGContextScaleCTM..

How to draw graphics in iphone gesture?

http://stackoverflow.com/questions/6173685/how-to-draw-graphics-in-iphone-gesture

The following code in this block is useless due to context nil CGContextRef context UIGraphicsGetCurrentContext CGContextAddRect context CGRectMake 30.0 30.0 60.0 60.0 CGContextStrokePath context else if gR state UIGestureRecognizerStateChanged CGPoint..

How to draw signature with lines on iPhone screen?

http://stackoverflow.com/questions/679983/how-to-draw-signature-with-lines-on-iphone-screen

mySize CGContextRef ctx UIGraphicsGetCurrentContext CGContextBeginPath ctx CGContextSetRGBFillColor ctx 1 0 0 1 CGContextAddRect ctx CGRectMake 0 0 5 5 CGContextFillPath ctx UIImage redRect UIGraphicsGetImageFromCurrentImageContext UIGraphicsEndImageContext..

Beginner iphone question: drawing a rectangle. What am I doing wrong?

http://stackoverflow.com/questions/970137/beginner-iphone-question-drawing-a-rectangle-what-am-i-doing-wrong

1.0 0.0 0.0 1.0 context UIGraphicsGetCurrentContext CGContextSetFillColorWithColor context currentColor.CGColor CGContextAddRect context myRect CGContextFillRect context myRect return self Thanks Sean. iphone quartz graphics draw share improve this..

How to mask a square image into an image with round corners in the iPhone SDK?

http://stackoverflow.com/questions/996292/how-to-mask-a-square-image-into-an-image-with-round-corners-in-the-iphone-sdk

CGContextRef context CGRect rect float ovalWidth float ovalHeight float fw fh if ovalWidth 0 ovalHeight 0 CGContextAddRect context rect return CGContextSaveGState context CGContextTranslateCTM context CGRectGetMinX rect CGRectGetMinY rect CGContextScaleCTM..