¡@

Home 

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

iphone Programming Glossary: cgcontexttranslatectm

Retrieving a pixel alpha value for a UIImage

http://stackoverflow.com/questions/1042830/retrieving-a-pixel-alpha-value-for-a-uiimage

How do I make UILabel display outlined text?

http://stackoverflow.com/questions/1103148/how-do-i-make-uilabel-display-outlined-text

CGRect rect CGContextRef theContext UIGraphicsGetCurrentContext CGRect viewBounds self.bounds CGContextTranslateCTM theContext 0 viewBounds.size.height CGContextScaleCTM theContext 1 1 CGContextSelectFont theContext..

Resizing UIimages pulled from the Camera also ROTATES the UIimage?

http://stackoverflow.com/questions/1260249/resizing-uiimages-pulled-from-the-camera-also-rotates-the-uiimage

if sourceImage.imageOrientation UIImageOrientationLeft CGContextRotateCTM bitmap radians 90 CGContextTranslateCTM bitmap 0 targetHeight else if sourceImage.imageOrientation UIImageOrientationRight CGContextRotateCTM.. else if sourceImage.imageOrientation UIImageOrientationRight CGContextRotateCTM bitmap radians 90 CGContextTranslateCTM bitmap targetWidth 0 else if sourceImage.imageOrientation UIImageOrientationUp NOTHING else if sourceImage.imageOrientation.. UIImageOrientationUp NOTHING else if sourceImage.imageOrientation UIImageOrientationDown CGContextTranslateCTM bitmap targetWidth targetHeight CGContextRotateCTM bitmap radians 180. CGContextDrawImage bitmap CGRectMake..

How to Rotate a UIImage 90 degrees?

http://stackoverflow.com/questions/1315251/how-to-rotate-a-uiimage-90-degrees

if sourceImage.imageOrientation UIImageOrientationRight CGContextRotateCTM bitmap radians 90 CGContextTranslateCTM bitmap 0 targetHeight else if sourceImage.imageOrientation UIImageOrientationLeft CGContextRotateCTM.. else if sourceImage.imageOrientation UIImageOrientationLeft CGContextRotateCTM bitmap radians 90 CGContextTranslateCTM bitmap targetWidth 0 else if sourceImage.imageOrientation UIImageOrientationDown NOTHING else if sourceImage.imageOrientation.. else if sourceImage.imageOrientation UIImageOrientationUp CGContextRotateCTM bitmap radians 90 CGContextTranslateCTM bitmap 0 targetHeight CGContextDrawImage bitmap CGRectMake 0 0 targetWidth targetHeight imageRef CGImageRef..

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

if ovalWidth 0 ovalHeight 0 1 CGContextAddRect context rect return CGContextSaveGState context 2 CGContextTranslateCTM context CGRectGetMinX rect 3 CGRectGetMinY rect CGContextScaleCTM context ovalWidth ovalHeight 4 fw..

UIImagePickerController camera preview is portrait in landscape app

http://stackoverflow.com/questions/538041/uiimagepickercontroller-camera-preview-is-portrait-in-landscape-app

orient UIImageOrientationLeft CGContextScaleCTM context scaleRatio scaleRatio CGContextTranslateCTM context height 0 else CGContextScaleCTM context scaleRatio scaleRatio CGContextTranslateCTM context.. CGContextTranslateCTM context height 0 else CGContextScaleCTM context scaleRatio scaleRatio CGContextTranslateCTM context 0 height CGContextConcatCTM context transform CGContextDrawImage UIGraphicsGetCurrentContext..

Retrieving a pixel alpha value for a UIImage

http://stackoverflow.com/questions/1042830/retrieving-a-pixel-alpha-value-for-a-uiimage

How do I make UILabel display outlined text?

http://stackoverflow.com/questions/1103148/how-do-i-make-uilabel-display-outlined-text

gc x pt.x 2 y str strlen str void drawRect CGRect rect CGContextRef theContext UIGraphicsGetCurrentContext CGRect viewBounds self.bounds CGContextTranslateCTM theContext 0 viewBounds.size.height CGContextScaleCTM theContext 1 1 CGContextSelectFont theContext Helvetica viewBounds.size.height kCGEncodingMacRoman CGContextSetRGBFillColor..

Resizing UIimages pulled from the Camera also ROTATES the UIimage?

http://stackoverflow.com/questions/1260249/resizing-uiimages-pulled-from-the-camera-also-rotates-the-uiimage

imageRef CGImageGetBytesPerRow imageRef colorSpaceInfo bitmapInfo if sourceImage.imageOrientation UIImageOrientationLeft CGContextRotateCTM bitmap radians 90 CGContextTranslateCTM bitmap 0 targetHeight else if sourceImage.imageOrientation UIImageOrientationRight CGContextRotateCTM bitmap radians 90 CGContextTranslateCTM bitmap targetWidth.. radians 90 CGContextTranslateCTM bitmap 0 targetHeight else if sourceImage.imageOrientation UIImageOrientationRight CGContextRotateCTM bitmap radians 90 CGContextTranslateCTM bitmap targetWidth 0 else if sourceImage.imageOrientation UIImageOrientationUp NOTHING else if sourceImage.imageOrientation UIImageOrientationDown CGContextTranslateCTM.. bitmap targetWidth 0 else if sourceImage.imageOrientation UIImageOrientationUp NOTHING else if sourceImage.imageOrientation UIImageOrientationDown CGContextTranslateCTM bitmap targetWidth targetHeight CGContextRotateCTM bitmap radians 180. CGContextDrawImage bitmap CGRectMake 0 0 targetWidth targetHeight imageRef CGImageRef ref..

How to Rotate a UIImage 90 degrees?

http://stackoverflow.com/questions/1315251/how-to-rotate-a-uiimage-90-degrees

CGImageGetBytesPerRow imageRef colorSpaceInfo bitmapInfo if sourceImage.imageOrientation UIImageOrientationRight CGContextRotateCTM bitmap radians 90 CGContextTranslateCTM bitmap 0 targetHeight else if sourceImage.imageOrientation UIImageOrientationLeft CGContextRotateCTM bitmap radians 90 CGContextTranslateCTM bitmap targetWidth.. bitmap radians 90 CGContextTranslateCTM bitmap 0 targetHeight else if sourceImage.imageOrientation UIImageOrientationLeft CGContextRotateCTM bitmap radians 90 CGContextTranslateCTM bitmap targetWidth 0 else if sourceImage.imageOrientation UIImageOrientationDown NOTHING else if sourceImage.imageOrientation UIImageOrientationUp CGContextRotateCTM.. if sourceImage.imageOrientation UIImageOrientationDown NOTHING else if sourceImage.imageOrientation UIImageOrientationUp CGContextRotateCTM bitmap radians 90 CGContextTranslateCTM bitmap 0 targetHeight CGContextDrawImage bitmap CGRectMake 0 0 targetWidth targetHeight imageRef CGImageRef ref CGBitmapContextCreateImage bitmap UIImage newImage..

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

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 CGContextScaleCTM context ovalWidth ovalHeight 4 fw CGRectGetWidth rect ovalWidth 5 fh CGRectGetHeight rect ovalHeight..

UIImagePickerController camera preview is portrait in landscape app

http://stackoverflow.com/questions/538041/uiimagepickercontroller-camera-preview-is-portrait-in-landscape-app

context UIGraphicsGetCurrentContext if orient UIImageOrientationRight orient UIImageOrientationLeft CGContextScaleCTM context scaleRatio scaleRatio CGContextTranslateCTM context height 0 else CGContextScaleCTM context scaleRatio scaleRatio CGContextTranslateCTM context 0 height CGContextConcatCTM context transform CGContextDrawImage.. CGContextScaleCTM context scaleRatio scaleRatio CGContextTranslateCTM context height 0 else CGContextScaleCTM context scaleRatio scaleRatio CGContextTranslateCTM context 0 height CGContextConcatCTM context transform CGContextDrawImage UIGraphicsGetCurrentContext CGRectMake 0 0 width height imgRef UIImage imageCopy UIGraphicsGetImageFromCurrentImageContext..

Retrieving a pixel alpha value for a UIImage

http://stackoverflow.com/questions/1042830/retrieving-a-pixel-alpha-value-for-a-uiimage

How do I make UILabel display outlined text?

http://stackoverflow.com/questions/1103148/how-do-i-make-uilabel-display-outlined-text

strlen str void drawRect CGRect rect CGContextRef theContext UIGraphicsGetCurrentContext CGRect viewBounds self.bounds CGContextTranslateCTM theContext 0 viewBounds.size.height CGContextScaleCTM theContext 1 1 CGContextSelectFont theContext Helvetica viewBounds.size.height..

iPhone - How do you color an image?

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

CGRect area CGRectMake 0 0 baseImage.size.width baseImage.size.height CGContextScaleCTM ctx 1 1 CGContextTranslateCTM ctx 0 area.size.height CGContextSaveGState ctx CGContextClipToMask ctx area baseImage.CGImage theColor set CGContextFillRect..

Resizing UIimages pulled from the Camera also ROTATES the UIimage?

http://stackoverflow.com/questions/1260249/resizing-uiimages-pulled-from-the-camera-also-rotates-the-uiimage

colorSpaceInfo bitmapInfo if sourceImage.imageOrientation UIImageOrientationLeft CGContextRotateCTM bitmap radians 90 CGContextTranslateCTM bitmap 0 targetHeight else if sourceImage.imageOrientation UIImageOrientationRight CGContextRotateCTM bitmap radians 90.. 0 targetHeight else if sourceImage.imageOrientation UIImageOrientationRight CGContextRotateCTM bitmap radians 90 CGContextTranslateCTM bitmap targetWidth 0 else if sourceImage.imageOrientation UIImageOrientationUp NOTHING else if sourceImage.imageOrientation.. sourceImage.imageOrientation UIImageOrientationUp NOTHING else if sourceImage.imageOrientation UIImageOrientationDown CGContextTranslateCTM bitmap targetWidth targetHeight CGContextRotateCTM bitmap radians 180. CGContextDrawImage bitmap CGRectMake 0 0 targetWidth..

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

to have code like the following within it CGContextRef context UIGraphicsGetCurrentContext CGContextSaveGState context CGContextTranslateCTM context 0.0f self.bounds.size.height CGContextScaleCTM context 1.0f 1.0f CGContextSelectFont context Helvetica 20.0f kCGEncodingMacRoman..

How to Rotate a UIImage 90 degrees?

http://stackoverflow.com/questions/1315251/how-to-rotate-a-uiimage-90-degrees

bitmapInfo if sourceImage.imageOrientation UIImageOrientationRight CGContextRotateCTM bitmap radians 90 CGContextTranslateCTM bitmap 0 targetHeight else if sourceImage.imageOrientation UIImageOrientationLeft CGContextRotateCTM bitmap radians 90 CGContextTranslateCTM.. bitmap 0 targetHeight else if sourceImage.imageOrientation UIImageOrientationLeft CGContextRotateCTM bitmap radians 90 CGContextTranslateCTM bitmap targetWidth 0 else if sourceImage.imageOrientation UIImageOrientationDown NOTHING else if sourceImage.imageOrientation.. NOTHING else if sourceImage.imageOrientation UIImageOrientationUp CGContextRotateCTM bitmap radians 90 CGContextTranslateCTM bitmap 0 targetHeight CGContextDrawImage bitmap CGRectMake 0 0 targetWidth targetHeight imageRef CGImageRef ref CGBitmapContextCreateImage..

Blur an image of specific part (rectangular, circular)?

http://stackoverflow.com/questions/14107979/blur-an-image-of-specific-part-rectangular-circular

NO scale CGContextRef context UIGraphicsGetCurrentContext CGContextBeginPath context CGContextSaveGState context CGContextTranslateCTM context CGRectGetMinX rect CGRectGetMinY rect CGContextScaleCTM context radious radious CGFloat rectWidth CGRectGetWidth..

CGImage/UIImage lazily loading on UI thread causes stutter

http://stackoverflow.com/questions/1815476/cgimage-uiimage-lazily-loading-on-ui-thread-causes-stutter

bounds.size CGContextRef context UIGraphicsGetCurrentContext CGContextScaleCTM context scaleRatioX scaleRatioY CGContextTranslateCTM context 0 currentHeight CGContextConcatCTM context transform CGContextDrawImage context CGRectMake 0 0 currentWidth currentHeight..

Annotate PDF within iPhone SDK

http://stackoverflow.com/questions/2313008/annotate-pdf-within-iphone-sdk

paperSize nil CGContextRef currentContext UIGraphicsGetCurrentContext flip context so page is right way up CGContextTranslateCTM currentContext 0 paperSize.size.height CGContextScaleCTM currentContext 1.0 1.0 CGPDFPageRef page CGPDFDocumentGetPage document.. page 1 into graphics context flip context so annotations are right way up CGContextScaleCTM currentContext 1.0 1.0 CGContextTranslateCTM currentContext 0 paperSize.size.height @ Example annotation drawInRect CGRectMake 100.0 100.0 200.0 40.0 withFont UIFont..

Reading PDF files as string through iPhone application

http://stackoverflow.com/questions/2362393/reading-pdf-files-as-string-through-iphone-application

s CFRelease s CFDataRef data CGPDFStreamCopyData stream CGPDFDataFormatRaw CGContextDrawPDFPage myContext page 3 CGContextTranslateCTM myContext 0 20 CGContextScaleCTM myContext 1.0 1.0 CGPDFDocumentRelease document 4 void viewDidLoad super viewDidLoad ..

How to tint a transparent PNG image in iPhone?

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

by the following code UIGraphicsBeginImageContext myIconImage.size CGContextRef context UIGraphicsGetCurrentContext CGContextTranslateCTM context 0 myIconImage.size.height CGContextScaleCTM context 1.0 1.0 CGRect rect CGRectMake 0 0 myIconImage.size.width myIconImage.size.height..

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

float fw fh if ovalWidth 0 ovalHeight 0 1 CGContextAddRect context rect return CGContextSaveGState context 2 CGContextTranslateCTM context CGRectGetMinX rect 3 CGRectGetMinY rect CGContextScaleCTM context ovalWidth ovalHeight 4 fw CGRectGetWidth rect..

UIImagePickerController camera preview is portrait in landscape app

http://stackoverflow.com/questions/538041/uiimagepickercontroller-camera-preview-is-portrait-in-landscape-app

if orient UIImageOrientationRight orient UIImageOrientationLeft CGContextScaleCTM context scaleRatio scaleRatio CGContextTranslateCTM context height 0 else CGContextScaleCTM context scaleRatio scaleRatio CGContextTranslateCTM context 0 height CGContextConcatCTM.. scaleRatio scaleRatio CGContextTranslateCTM context height 0 else CGContextScaleCTM context scaleRatio scaleRatio CGContextTranslateCTM context 0 height CGContextConcatCTM context transform CGContextDrawImage UIGraphicsGetCurrentContext CGRectMake 0 0 width..

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

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