iphone Programming Glossary: cgcolorspaceref
Retrieving a pixel alpha value for a UIImage http://stackoverflow.com/questions/1042830/retrieving-a-pixel-alpha-value-for-a-uiimage uiImage.CGImage NSUInteger width CGImageGetWidth image NSUInteger height CGImageGetHeight image CGColorSpaceRef colorSpace CGColorSpaceCreateDeviceRGB rawData malloc height width 4 bytesPerPixel 4 bytesPerRow bytesPerPixel..
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 CGImageRef imageRef sourceImage CGImage CGBitmapInfo bitmapInfo CGImageGetBitmapInfo imageRef CGColorSpaceRef colorSpaceInfo CGImageGetColorSpace imageRef if bitmapInfo kCGImageAlphaNone bitmapInfo kCGImageAlphaNoneSkipLast..
Convert image to grayscale http://stackoverflow.com/questions/1298867/convert-image-to-grayscale image NSUInteger height CGImageGetHeight image NSUInteger bytesPerRow bytesPerPixel width CGColorSpaceRef colorSpace CGColorSpaceCreateDeviceRGB unsigned char rawData malloc height width 4 CGContextRef context.. int m_height i.size.height uint32_t rgbImage uint32_t malloc m_width m_height sizeof uint32_t CGColorSpaceRef colorSpace CGColorSpaceCreateDeviceRGB CGContextRef context CGBitmapContextCreate rgbImage m_width m_height..
How to Rotate a UIImage 90 degrees? http://stackoverflow.com/questions/1315251/how-to-rotate-a-uiimage-90-degrees CGImageRef imageRef sourceImage CGImage CGBitmapInfo bitmapInfo CGImageGetBitmapInfo imageRef CGColorSpaceRef colorSpaceInfo CGImageGetColorSpace imageRef if bitmapInfo kCGImageAlphaNone bitmapInfo kCGImageAlphaNoneSkipLast..
How to get the RGB values for a pixel on an image on the iphone http://stackoverflow.com/questions/144250/how-to-get-the-rgb-values-for-a-pixel-on-an-image-on-the-iphone instance variables size_t bytesPerRow size_t byteCount size_t pixelCount CGContextRef context CGColorSpaceRef colorSpace UInt8 pixelByteData A pointer to an array of RGBA bytes in memory RPVW_RGBAPixel pixelData..
Rounded UIView using CALayers - only some corners - How? http://stackoverflow.com/questions/2264083/rounded-uiview-using-calayers-only-some-corners-how setImage UIImage img UIImage imageNamed @ my_image.png int w img.size.width int h img.size.height CGColorSpaceRef colorSpace CGColorSpaceCreateDeviceRGB CGContextRef context CGBitmapContextCreate NULL w h 8 4 w colorSpace..
How do I export UIImage array as a movie? http://stackoverflow.com/questions/3741323/how-do-i-export-uiimage-array-as-a-movie pxbuffer 0 void pxdata CVPixelBufferGetBaseAddress pxbuffer NSParameterAssert pxdata NULL CGColorSpaceRef rgbColorSpace CGColorSpaceCreateDeviceRGB CGContextRef context CGBitmapContextCreate pxdata frameSize.width..
Round two corners in UIView http://stackoverflow.com/questions/4847163/round-two-corners-in-uiview rect CGFloat radius_tl CGFloat radius_tr CGFloat radius_bl CGFloat radius_br CGContextRef context CGColorSpaceRef colorSpace colorSpace CGColorSpaceCreateDeviceRGB create a bitmap graphics context the size of the image..
Retrieving a pixel alpha value for a UIImage http://stackoverflow.com/questions/1042830/retrieving-a-pixel-alpha-value-for-a-uiimage byte array from this. Alpha is premultiplied. CGImageRef image uiImage.CGImage NSUInteger width CGImageGetWidth image NSUInteger height CGImageGetHeight image CGColorSpaceRef colorSpace CGColorSpaceCreateDeviceRGB rawData malloc height width 4 bytesPerPixel 4 bytesPerRow bytesPerPixel width NSUInteger bitsPerComponent 8 CGContextRef..
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 targetSize.width CGFloat targetHeight targetSize.height CGImageRef imageRef sourceImage CGImage CGBitmapInfo bitmapInfo CGImageGetBitmapInfo imageRef CGColorSpaceRef colorSpaceInfo CGImageGetColorSpace imageRef if bitmapInfo kCGImageAlphaNone bitmapInfo kCGImageAlphaNoneSkipLast CGContextRef bitmap if sourceImage.imageOrientation..
Convert image to grayscale http://stackoverflow.com/questions/1298867/convert-image-to-grayscale CGImageRef image pImage CGImage NSUInteger width CGImageGetWidth image NSUInteger height CGImageGetHeight image NSUInteger bytesPerRow bytesPerPixel width CGColorSpaceRef colorSpace CGColorSpaceCreateDeviceRGB unsigned char rawData malloc height width 4 CGContextRef context CGBitmapContextCreate rawData width height bitsPerComponent.. kGreen 2 int kBlue 4 int colors kGreen int m_width i.size.width int m_height i.size.height uint32_t rgbImage uint32_t malloc m_width m_height sizeof uint32_t CGColorSpaceRef colorSpace CGColorSpaceCreateDeviceRGB CGContextRef context CGBitmapContextCreate rgbImage m_width m_height 8 m_width 4 colorSpace kCGBitmapByteOrder32Little kCGImageAlphaNoneSkipLast..
How to Rotate a UIImage 90 degrees? http://stackoverflow.com/questions/1315251/how-to-rotate-a-uiimage-90-degrees targetSize.height CGFloat targetHeight targetSize.width CGImageRef imageRef sourceImage CGImage CGBitmapInfo bitmapInfo CGImageGetBitmapInfo imageRef CGColorSpaceRef colorSpaceInfo CGImageGetColorSpace imageRef if bitmapInfo kCGImageAlphaNone bitmapInfo kCGImageAlphaNoneSkipLast CGContextRef bitmap if sourceImage.imageOrientation..
How to get the RGB values for a pixel on an image on the iphone http://stackoverflow.com/questions/144250/how-to-get-the-rgb-values-for-a-pixel-on-an-image-on-the-iphone RGBA 4 #define RGBA_8_BIT 8 In my UIImage subclass I declared instance variables size_t bytesPerRow size_t byteCount size_t pixelCount CGContextRef context CGColorSpaceRef colorSpace UInt8 pixelByteData A pointer to an array of RGBA bytes in memory RPVW_RGBAPixel pixelData The pixel struct with alpha in this version typedef struct..
Rounded UIView using CALayers - only some corners - How? http://stackoverflow.com/questions/2264083/rounded-uiview-using-calayers-only-some-corners-how context CGContextRestoreGState context UIImage setImage UIImage img UIImage imageNamed @ my_image.png int w img.size.width int h img.size.height CGColorSpaceRef colorSpace CGColorSpaceCreateDeviceRGB CGContextRef context CGBitmapContextCreate NULL w h 8 4 w colorSpace kCGImageAlphaPremultipliedFirst CGContextBeginPath context..
How do I export UIImage array as a movie? http://stackoverflow.com/questions/3741323/how-do-i-export-uiimage-array-as-a-movie status kCVReturnSuccess pxbuffer NULL CVPixelBufferLockBaseAddress pxbuffer 0 void pxdata CVPixelBufferGetBaseAddress pxbuffer NSParameterAssert pxdata NULL CGColorSpaceRef rgbColorSpace CGColorSpaceCreateDeviceRGB CGContextRef context CGBitmapContextCreate pxdata frameSize.width frameSize.height 8 4 frameSize.width rgbColorSpace kCGImageAlphaNoneSkipFirst..
Round two corners in UIView http://stackoverflow.com/questions/4847163/round-two-corners-in-uiview . static inline UIImage MTDContextCreateRoundedMask CGRect rect CGFloat radius_tl CGFloat radius_tr CGFloat radius_bl CGFloat radius_br CGContextRef context CGColorSpaceRef colorSpace colorSpace CGColorSpaceCreateDeviceRGB create a bitmap graphics context the size of the image context CGBitmapContextCreate NULL rect.size.width rect.size.height..
Drawing rotated text with NSString drawInRect http://stackoverflow.com/questions/10289898/drawing-rotated-text-with-nsstring-drawinrect of the height. void drawRect CGRect rect CGContextRef context UIGraphicsGetCurrentContext CGContextSaveGState context CGColorSpaceRef colorSpace CGColorSpaceCreateDeviceRGB Create the gradient CGColorRef startColor UIColor colorWithRed 1.0 green 1.0 blue..
Retrieving a pixel alpha value for a UIImage http://stackoverflow.com/questions/1042830/retrieving-a-pixel-alpha-value-for-a-uiimage CGImageRef image uiImage.CGImage NSUInteger width CGImageGetWidth image NSUInteger height CGImageGetHeight image CGColorSpaceRef colorSpace CGColorSpaceCreateDeviceRGB rawData malloc height width 4 bytesPerPixel 4 bytesPerRow bytesPerPixel width NSUInteger..
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 targetSize.height CGImageRef imageRef sourceImage CGImage CGBitmapInfo bitmapInfo CGImageGetBitmapInfo imageRef CGColorSpaceRef colorSpaceInfo CGImageGetColorSpace imageRef if bitmapInfo kCGImageAlphaNone bitmapInfo kCGImageAlphaNoneSkipLast CGContextRef..
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 context self.text UTF8String strlen self.text UTF8String CGContextClip context CGGradientRef gradient CGColorSpaceRef rgbColorspace size_t num_locations 2 CGFloat locations 2 0.0 1.0 CGFloat components 8 1.0 1.0 1.0 1.0 Start color 1.0 1.0..
Convert image to grayscale http://stackoverflow.com/questions/1298867/convert-image-to-grayscale width CGImageGetWidth image NSUInteger height CGImageGetHeight image NSUInteger bytesPerRow bytesPerPixel width CGColorSpaceRef colorSpace CGColorSpaceCreateDeviceRGB unsigned char rawData malloc height width 4 CGContextRef context CGBitmapContextCreate.. int m_width i.size.width int m_height i.size.height uint32_t rgbImage uint32_t malloc m_width m_height sizeof uint32_t CGColorSpaceRef colorSpace CGColorSpaceCreateDeviceRGB CGContextRef context CGBitmapContextCreate rgbImage m_width m_height 8 m_width 4..
How to Rotate a UIImage 90 degrees? http://stackoverflow.com/questions/1315251/how-to-rotate-a-uiimage-90-degrees targetSize.width CGImageRef imageRef sourceImage CGImage CGBitmapInfo bitmapInfo CGImageGetBitmapInfo imageRef CGColorSpaceRef colorSpaceInfo CGImageGetColorSpace imageRef if bitmapInfo kCGImageAlphaNone bitmapInfo kCGImageAlphaNoneSkipLast CGContextRef..
How to get the RGB values for a pixel on an image on the iphone http://stackoverflow.com/questions/144250/how-to-get-the-rgb-values-for-a-pixel-on-an-image-on-the-iphone subclass I declared instance variables size_t bytesPerRow size_t byteCount size_t pixelCount CGContextRef context CGColorSpaceRef colorSpace UInt8 pixelByteData A pointer to an array of RGBA bytes in memory RPVW_RGBAPixel pixelData The pixel struct with..
How do I create/render a UIImage from a 3D transformed UIImageView? http://stackoverflow.com/questions/1949003/how-do-i-create-render-a-uiimage-from-a-3d-transformed-uiimageview imageRef source CGImage NSUInteger width CGImageGetWidth imageRef NSUInteger height CGImageGetHeight imageRef CGColorSpaceRef colorSpace CGColorSpaceCreateDeviceRGB unsigned char inputData malloc height width 4 unsigned char outputData malloc height..
Rounded UIView using CALayers - only some corners - How? http://stackoverflow.com/questions/2264083/rounded-uiview-using-calayers-only-some-corners-how context UIImage setImage UIImage img UIImage imageNamed @ my_image.png int w img.size.width int h img.size.height CGColorSpaceRef colorSpace CGColorSpaceCreateDeviceRGB CGContextRef context CGBitmapContextCreate NULL w h 8 4 w colorSpace kCGImageAlphaPremultipliedFirst..
UIImage rounded corners http://stackoverflow.com/questions/262156/uiimage-rounded-corners else if widthFactor heightFactor thumbnailPoint.x targetSize.width scaledWidth 0.5 CGContextRef mainViewContentContext CGColorSpaceRef colorSpace colorSpace CGColorSpaceCreateDeviceRGB create a bitmap graphics context the size of the image mainViewContentContext..
How do I export UIImage array as a movie? http://stackoverflow.com/questions/3741323/how-do-i-export-uiimage-array-as-a-movie CVPixelBufferLockBaseAddress pxbuffer 0 void pxdata CVPixelBufferGetBaseAddress pxbuffer NSParameterAssert pxdata NULL CGColorSpaceRef rgbColorSpace CGColorSpaceCreateDeviceRGB CGContextRef context CGBitmapContextCreate pxdata frameSize.width frameSize.height..
Curve text on existing circle http://stackoverflow.com/questions/3841642/curve-text-on-existing-circle count float totalRotation 90 char fontName char self.menuItemsFont.fontName cStringUsingEncoding NSASCIIStringEncoding CGColorSpaceRef colorSpace CGColorSpaceCreateDeviceRGB CGContextRef context CGBitmapContextCreate NULL imageSize.size.width imageSize.size.height.. float CGColorGetComponents ringColor.CGColor CGFloat textColorComponents float CGColorGetComponents textColor.CGColor CGColorSpaceRef colorSpace CGColorSpaceCreateDeviceRGB CGContextRef context CGBitmapContextCreate NULL frame.size.width frame.size.height..
Get RGB value from UIColor presets http://stackoverflow.com/questions/4700168/get-rgb-value-from-uicolor-presets which don't have reasonable RGB values. void getRGBComponents CGFloat 3 components forColor UIColor color CGColorSpaceRef rgbColorSpace CGColorSpaceCreateDeviceRGB unsigned char resultingPixel 4 CGContextRef context CGBitmapContextCreate resultingPixel..
Round two corners in UIView http://stackoverflow.com/questions/4847163/round-two-corners-in-uiview CGRect rect CGFloat radius_tl CGFloat radius_tr CGFloat radius_bl CGFloat radius_br CGContextRef context CGColorSpaceRef colorSpace colorSpace CGColorSpaceCreateDeviceRGB create a bitmap graphics context the size of the image context CGBitmapContextCreate..
Recreate recipient bubble behaviour in Mail.app / Three20 http://stackoverflow.com/questions/5247072/recreate-recipient-bubble-behaviour-in-mail-app-three20 capDiameter capDiameter if self.textColor nil const CGFloat colors CGColorGetComponents self.textColor.CGColor CGColorSpaceRef space CGColorGetColorSpace self.textColor.CGColor CGColorSpaceModel model CGColorSpaceGetModel space if model kCGColorSpaceModelMonochrome..
How to make one color transparent on a UIImage? http://stackoverflow.com/questions/633722/how-to-make-one-color-transparent-on-a-uiimage mWidth CGImageGetWidth ref int mHeight CGImageGetHeight ref int count mWidth mHeight 4 void bufferdata malloc count CGColorSpaceRef colorSpaceRef CGColorSpaceCreateDeviceRGB CGBitmapInfo bitmapInfo kCGBitmapByteOrderDefault CGColorRenderingIntent renderingIntent..
iPhone Watermark on recorded Video. http://stackoverflow.com/questions/7205820/iphone-watermark-on-recorded-video imageBuffer size_t width CVPixelBufferGetWidth imageBuffer size_t height CVPixelBufferGetHeight imageBuffer CGColorSpaceRef colorSpace CGColorSpaceCreateDeviceRGB CGContextRef newContext CGBitmapContextCreate baseAddress width height 8 bytesPerRow..
Make Background of UIView a Gradient Without Sub Classing http://stackoverflow.com/questions/844710/make-background-of-uiview-a-gradient-without-sub-classing colorWithPatternImage to produce a patterned background. Example bring your own CGGradient Allocate color space CGColorSpaceRef colorSpace CGColorSpaceCreateDeviceRGB Allocate bitmap context CGContextRef bitmapContext CGBitmapContextCreate NULL 320..
|