iphone Programming Glossary: cgcontextstrokepath
underline text in UIlabel http://stackoverflow.com/questions/2711297/underline-text-in-uilabel 1 CGContextAddLineToPoint ctx self.bounds.size.width self.bounds.size.height 1 CGContextStrokePath ctx super drawRect rect UPD As of iOS 6 Apple added NSAttributedString support for UILabel so now it's..
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 rect.size.width rect.size.height CGContextAddLineToPoint c rect.size.width rect.size.height 10.0f CGContextStrokePath c CGContextClipToRect c CGRectMake 0.0f 0.0f rect.size.width rect.size.height 10.0f else if position.. 10.0f CGContextBeginPath c CGContextMoveToPoint c 0.0f 10.0f CGContextAddLineToPoint c 0.0f 0.0f CGContextStrokePath c CGContextBeginPath c CGContextMoveToPoint c rect.size.width 0.0f CGContextAddLineToPoint c rect.size.width.. c CGContextMoveToPoint c rect.size.width 0.0f CGContextAddLineToPoint c rect.size.width 10.0f CGContextStrokePath c CGContextClipToRect c CGRectMake 0.0f 10.0f rect.size.width rect.size.height else if position CustomCellBackgroundViewPositionMiddle..
iPhone smooth sketch drawing algorithm http://stackoverflow.com/questions/5076622/iphone-smooth-sketch-drawing-algorithm objectAtIndex i CGPoint point value getValue point CGContextAddLineToPoint context point.x point.y CGContextStrokePath context UIGraphicsPushContext context And now I want to improve the drawing tobe more like Sketch Book..
How do I draw a line on the iPhone? http://stackoverflow.com/questions/856354/how-do-i-draw-a-line-on-the-iphone c red CGContextBeginPath c CGContextMoveToPoint c 5.0f 5.0f CGContextAddLineToPoint c 50.0f 50.0f CGContextStrokePath c Save everything and click Build and Run you should now see a short red line on the iPhone. For more..
underline text in UIlabel http://stackoverflow.com/questions/2711297/underline-text-in-uilabel ctx 1.0f CGContextMoveToPoint ctx 0 self.bounds.size.height 1 CGContextAddLineToPoint ctx self.bounds.size.width self.bounds.size.height 1 CGContextStrokePath ctx super drawRect rect UPD As of iOS 6 Apple added NSAttributedString support for UILabel so now it's much easier and works for multiple lines NSDictionary underlineAttribute..
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 c 0.0f rect.size.height CGContextAddLineToPoint c rect.size.width rect.size.height CGContextAddLineToPoint c rect.size.width rect.size.height 10.0f CGContextStrokePath c CGContextClipToRect c CGRectMake 0.0f 0.0f rect.size.width rect.size.height 10.0f else if position CustomCellBackgroundViewPositionBottom CGContextFillRect c.. CGContextFillRect c CGRectMake 0.0f 0.0f rect.size.width 10.0f CGContextBeginPath c CGContextMoveToPoint c 0.0f 10.0f CGContextAddLineToPoint c 0.0f 0.0f CGContextStrokePath c CGContextBeginPath c CGContextMoveToPoint c rect.size.width 0.0f CGContextAddLineToPoint c rect.size.width 10.0f CGContextStrokePath c CGContextClipToRect c CGRectMake.. c 0.0f 0.0f CGContextStrokePath c CGContextBeginPath c CGContextMoveToPoint c rect.size.width 0.0f CGContextAddLineToPoint c rect.size.width 10.0f CGContextStrokePath c CGContextClipToRect c CGRectMake 0.0f 10.0f rect.size.width rect.size.height else if position CustomCellBackgroundViewPositionMiddle CGContextFillRect c rect..
iPhone smooth sketch drawing algorithm http://stackoverflow.com/questions/5076622/iphone-smooth-sketch-drawing-algorithm for int i 1 i points count i NSValue value points objectAtIndex i CGPoint point value getValue point CGContextAddLineToPoint context point.x point.y CGContextStrokePath context UIGraphicsPushContext context And now I want to improve the drawing tobe more like Sketch Book App I think there is something to do with signal processing..
How do I draw a line on the iPhone? http://stackoverflow.com/questions/856354/how-do-i-draw-a-line-on-the-iphone CGFloat red 4 1.0f 0.0f 0.0f 1.0f CGContextSetStrokeColor c red CGContextBeginPath c CGContextMoveToPoint c 5.0f 5.0f CGContextAddLineToPoint c 50.0f 50.0f CGContextStrokePath c Save everything and click Build and Run you should now see a short red line on the iPhone. For more information about Core Graphics look up the Apple Documentation...
How to create a UIImage from the current graphics context? http://stackoverflow.com/questions/1112947/how-to-create-a-uiimage-from-the-current-graphics-context CFIndex i 0 i CFArrayGetCount _pathArray i CGPathRef path CFArrayGetValueAtIndex _pathArray i CGContextAddPath c path CGContextStrokePath c CGContextRestoreGState c ... where _pathArray is of type CFArrayRef and is populated every time touchesEnded is invoked...
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 context 1.0 1.0 1.0 1.0 CGContextMoveToPoint context x y CGContextAddLineToPoint context x2 y2 CGContextStrokePath context And I know how to do a gradient rectangle i.g. CGColorSpaceRef myColorspace CGColorSpaceCreateDeviceRGB size_t num_locations.. tries I'm now sure that gradients doesn't affect strokes so I think it's 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.. which fortunately is what I need. I replaced CGContextMoveToPoint context x y CGContextAddLineToPoint context x2 y2 CGContextStrokePath context with CGContextSaveGState context CGContextAddRect context CGRectMake x y width height CGContextClip context CGContextDrawLinearGradient..
How to Unerase the erased UIImage http://stackoverflow.com/questions/14053563/how-to-unerase-the-erased-uiimage context CGContextMoveToPoint context lastPoint.x lastPoint.y CGContextAddLineToPoint context lastPoint.x lastPoint.y CGContextStrokePath context imgForeground.image UIGraphicsGetImageFromCurrentImageContext UIGraphicsEndImageContext My Question is How to Unerase.. CGContextMoveToPoint context lastTouch.x lastTouch.y CGContextAddLineToPoint context currentTouch.x currentTouch.y CGContextStrokePath context self.editedImageView.image UIGraphicsGetImageFromCurrentImageContext UIGraphicsEndImageContext lastTouch touch locationInView..
underline text in UIlabel http://stackoverflow.com/questions/2711297/underline-text-in-uilabel ctx 0 self.bounds.size.height 1 CGContextAddLineToPoint ctx self.bounds.size.width self.bounds.size.height 1 CGContextStrokePath ctx super drawRect rect UPD As of iOS 6 Apple added NSAttributedString support for UILabel so now it's much easier and works..
want to add manual erasing option in ipad painting application by quartz http://stackoverflow.com/questions/3863931/want-to-add-manual-erasing-option-in-ipad-painting-application-by-quartz lastPoint.x lastPoint.y CGContextAddLineToPoint UIGraphicsGetCurrentContext currentPoint.x currentPoint.y CGContextStrokePath UIGraphicsGetCurrentContext imgview.image UIGraphicsGetImageFromCurrentImageContext lastPoint currentPoint then you see..
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 c rect.size.width rect.size.height CGContextAddLineToPoint c rect.size.width rect.size.height 10.0f CGContextStrokePath c CGContextClipToRect c CGRectMake 0.0f 0.0f rect.size.width rect.size.height 10.0f else if position CustomCellBackgroundViewPositionBottom.. 0.0f rect.size.width 10.0f CGContextBeginPath c CGContextMoveToPoint c 0.0f 10.0f CGContextAddLineToPoint c 0.0f 0.0f CGContextStrokePath c CGContextBeginPath c CGContextMoveToPoint c rect.size.width 0.0f CGContextAddLineToPoint c rect.size.width 10.0f CGContextStrokePath.. c CGContextBeginPath c CGContextMoveToPoint c rect.size.width 0.0f CGContextAddLineToPoint c rect.size.width 10.0f CGContextStrokePath c CGContextClipToRect c CGRectMake 0.0f 10.0f rect.size.width rect.size.height else if position CustomCellBackgroundViewPositionMiddle..
Drawing waveform with AVAssetReader http://stackoverflow.com/questions/5032775/drawing-waveform-with-avassetreader pixels CGContextAddLineToPoint context intSample centerLeft pixels CGContextSetStrokeColorWithColor context leftcolor CGContextStrokePath context if channelCount 2 SInt16 right samples float pixels float right pixels sampleAdjustmentFactor CGContextMoveToPoint.. CGContextAddLineToPoint context intSample centerRight pixels CGContextSetStrokeColorWithColor context rightcolor CGContextStrokePath context Create new image UIImage newImage UIGraphicsGetImageFromCurrentImageContext Tidy up UIGraphicsEndImageContext return.. pixels CGContextAddLineToPoint context intSample centerLeft pixels CGContextSetStrokeColorWithColor context leftcolor CGContextStrokePath context if channelCount 2 Float32 right samples float pixels right noiseFloor sampleAdjustmentFactor CGContextMoveToPoint..
iPhone smooth sketch drawing algorithm http://stackoverflow.com/questions/5076622/iphone-smooth-sketch-drawing-algorithm value points objectAtIndex i CGPoint point value getValue point CGContextAddLineToPoint context point.x point.y CGContextStrokePath context UIGraphicsPushContext context And now I want to improve the drawing tobe more like Sketch Book App I think there..
UITextView ruled line background but wrong line height http://stackoverflow.com/questions/5375350/uitextview-ruled-line-background-but-wrong-line-height self.font.leading x 0.5f baselineOffset Close our Path and Stroke draw it CGContextClosePath context CGContextStrokePath context @end MyViewController.h #import UIKit UIKit.h #import NoteView.h @interface MyViewController UIViewController UITextViewDelegate..
How do I draw a line on the iPhone? http://stackoverflow.com/questions/856354/how-do-i-draw-a-line-on-the-iphone c red CGContextBeginPath c CGContextMoveToPoint c 5.0f 5.0f CGContextAddLineToPoint c 50.0f 50.0f CGContextStrokePath c Save everything and click Build and Run you should now see a short red line on the iPhone. For more information about..
|