¡@

Home 

2014/10/15 ¤U¤È 10:04:35

iphone Programming Glossary: bitmapcontext

Iphone convert color image to 2bit image (black-white)

http://stackoverflow.com/questions/4030430/iphone-convert-color-image-to-2bit-image-black-white

bw pixelBuffer index 1 bw pixelBuffer index 2 bw CGColorSpaceRef colorSpace CGColorSpaceCreateDeviceRGB CGContextRef bitmapContext CGBitmapContextCreate pixelBuffer originalImage.size.width originalImage.size.height 8 4 originalImage.size.width colorSpace.. kCGBitmapByteOrderDefault CFRelease colorSpace free pixelBuffer CGImageRef cgImage CGBitmapContextCreateImage bitmapContext CGContextRelease bitmapContext UIImage bwImage UIImage imageWithCGImage cgImage I get the pixel data by writing to an offscreen.. CFRelease colorSpace free pixelBuffer CGImageRef cgImage CGBitmapContextCreateImage bitmapContext CGContextRelease bitmapContext UIImage bwImage UIImage imageWithCGImage cgImage I get the pixel data by writing to an offscreen context the new way of..

Round two corners in UIView

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

context kCGPathFill Create CGImageRef of the main view bitmap content and then release that bitmap context CGImageRef bitmapContext CGBitmapContextCreateImage context CGContextRelease context convert the finished resized image to a UIImage UIImage theImage.. CGContextRelease context convert the finished resized image to a UIImage UIImage theImage UIImage imageWithCGImage bitmapContext image is retained by the property setting above so we can release the original CGImageRelease bitmapContext return the image.. bitmapContext image is retained by the property setting above so we can release the original CGImageRelease bitmapContext return the image return theImage Now you just need few lines of code. I put stuff in my viewController viewDidLoad method..

polaroid filter from UIImage

http://stackoverflow.com/questions/5590216/polaroid-filter-from-uiimage

myImage CGImageRef originalImage myImage CGImage CGColorSpaceRef colorSpace CGColorSpaceCreateDeviceRGB CGContextRef bitmapContext CGBitmapContextCreate NULL CGImageGetWidth originalImage CGImageGetHeight originalImage 8 CGImageGetWidth originalImage.. originalImage 4 colorSpace kCGImageAlphaPremultipliedLast CGColorSpaceRelease colorSpace CGContextDrawImage bitmapContext CGRectMake 0 0 CGBitmapContextGetWidth bitmapContext CGBitmapContextGetHeight bitmapContext originalImage UInt8 data CGBitmapContextGetData.. CGColorSpaceRelease colorSpace CGContextDrawImage bitmapContext CGRectMake 0 0 CGBitmapContextGetWidth bitmapContext CGBitmapContextGetHeight bitmapContext originalImage UInt8 data CGBitmapContextGetData bitmapContext int numComponents..

Byte Array to UIImage Objective-C

http://stackoverflow.com/questions/6660482/byte-array-to-uiimage-objective-c

uiimage bytearray share improve this question CGColorSpaceRef colorSpace CGColorSpaceCreateDeviceRGB CGContextRef bitmapContext CGBitmapContextCreate outputData w h 8 4 w colorSpace kCGImageAlphaPremultipliedLast kCGBitmapByteOrderDefault CFRelease.. kCGBitmapByteOrderDefault CFRelease colorSpace free outputData CGImageRef cgImage CGBitmapContextCreateImage bitmapContext CGContextRelease bitmapContext UIImage newimage UIImage imageWithCGImage cgImage CGImageRelease cgImage share improve..

Make Background of UIView a Gradient Without Sub Classing

http://stackoverflow.com/questions/844710/make-background-of-uiview-a-gradient-without-sub-classing

Allocate color space CGColorSpaceRef colorSpace CGColorSpaceCreateDeviceRGB Allocate bitmap context CGContextRef bitmapContext CGBitmapContextCreate NULL 320 480 8 4 320 colorSpace kCGImageAlphaNoneSkipFirst allocate myGradient CGFloat locationList.. 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 CGBitmapContextCreateImage.. 0.0f 0.0f CGPointMake 320.0f 480.0f 0 Create a CGImage from context CGImageRef cgImage CGBitmapContextCreateImage bitmapContext Create a UIImage from CGImage UIImage uiImage UIImage imageWithCGImage cgImage Release the CGImage CGImageRelease cgImage..