iphone Programming Glossary: cgcolorspacecreatedevicergb
Retrieving a pixel alpha value for a UIImage http://stackoverflow.com/questions/1042830/retrieving-a-pixel-alpha-value-for-a-uiimage width CGImageGetWidth image NSUInteger height CGImageGetHeight image CGColorSpaceRef colorSpace CGColorSpaceCreateDeviceRGB rawData malloc height width 4 bytesPerPixel 4 bytesPerRow bytesPerPixel width NSUInteger bitsPerComponent..
Convert image to grayscale http://stackoverflow.com/questions/1298867/convert-image-to-grayscale CGImageGetHeight image NSUInteger bytesPerRow bytesPerPixel width CGColorSpaceRef colorSpace CGColorSpaceCreateDeviceRGB unsigned char rawData malloc height width 4 CGContextRef context CGBitmapContextCreate rawData width.. 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.. val m_imageData i result i 4 1 val result i 4 2 val result i 4 3 val create a UIImage colorSpace CGColorSpaceCreateDeviceRGB context CGBitmapContextCreate result m_width m_height 8 m_width sizeof uint32_t colorSpace kCGBitmapByteOrder32Little..
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 self setPixelCount self.size.width self.size.height Create RGB color space self setColorSpace CGColorSpaceCreateDeviceRGB if colorSpace NSLog @ Error allocating color space. return nil self setPixelData malloc byteCount if..
Rounded UIView using CALayers - only some corners - How? http://stackoverflow.com/questions/2264083/rounded-uiview-using-calayers-only-some-corners-how 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..
How do I export UIImage array as a movie? http://stackoverflow.com/questions/3741323/how-do-i-export-uiimage-array-as-a-movie CVPixelBufferGetBaseAddress pxbuffer NSParameterAssert pxdata NULL CGColorSpaceRef rgbColorSpace CGColorSpaceCreateDeviceRGB CGContextRef context CGBitmapContextCreate pxdata frameSize.width frameSize.height 8 4 frameSize.width..
Round two corners in UIView http://stackoverflow.com/questions/4847163/round-two-corners-in-uiview 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..
Retrieving a pixel alpha value for a UIImage http://stackoverflow.com/questions/1042830/retrieving-a-pixel-alpha-value-for-a-uiimage 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 context CGBitmapContextCreate rawData width..
Convert image to grayscale http://stackoverflow.com/questions/1298867/convert-image-to-grayscale 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 bytesPerRow colorSpace kCGImageAlphaPremultipliedLast.. 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 CGContextSetInterpolationQuality.. to rgb for int i 0 i m_height m_width i result i 4 0 int val m_imageData i result i 4 1 val result i 4 2 val result i 4 3 val create a UIImage colorSpace CGColorSpaceCreateDeviceRGB context CGBitmapContextCreate result m_width m_height 8 m_width sizeof uint32_t colorSpace kCGBitmapByteOrder32Little kCGImageAlphaNoneSkipLast CGImageRef image..
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 self setByteCount bytesPerRow self.size.height self setPixelCount self.size.width self.size.height Create RGB color space self setColorSpace CGColorSpaceCreateDeviceRGB if colorSpace NSLog @ Error allocating color space. return nil self setPixelData malloc byteCount if pixelData NSLog @ Error allocating bitmap memory. Releasing..
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 CGContextBeginPath context CGRect rect CGRectMake 0 0 w h addRoundedRectToPath..
How do I export UIImage array as a movie? http://stackoverflow.com/questions/3741323/how-do-i-export-uiimage-array-as-a-movie 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 NSParameterAssert..
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 NULL rect.size.width rect.size.height 8 0 colorSpace kCGImageAlphaPremultipliedLast..
Drawing rotated text with NSString drawInRect http://stackoverflow.com/questions/10289898/drawing-rotated-text-with-nsstring-drawinrect CGRect rect CGContextRef context UIGraphicsGetCurrentContext CGContextSaveGState context CGColorSpaceRef colorSpace CGColorSpaceCreateDeviceRGB Create the gradient CGColorRef startColor UIColor colorWithRed 1.0 green 1.0 blue 1.0 alpha 1.0 .CGColor CGColorRef endColor..
Retrieving a pixel alpha value for a UIImage http://stackoverflow.com/questions/1042830/retrieving-a-pixel-alpha-value-for-a-uiimage 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..
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 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 1.0 0.1 End color rgbColorspace CGColorSpaceCreateDeviceRGB gradient CGGradientCreateWithColorComponents rgbColorspace components locations num_locations CGRect currentBounds self.bounds..
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 CGBitmapContextCreate rawData width height bitsPerComponent.. 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.. i result i 4 0 int val m_imageData i result i 4 1 val result i 4 2 val result i 4 3 val create a UIImage colorSpace CGColorSpaceCreateDeviceRGB context CGBitmapContextCreate result m_width m_height 8 m_width sizeof uint32_t colorSpace kCGBitmapByteOrder32Little kCGImageAlphaNoneSkipLast..
iPhone development: pointer being freed was not allocated http://stackoverflow.com/questions/1424210/iphone-development-pointer-being-freed-was-not-allocated source CGContextRef context2 CGBitmapContextCreate NULL source.size.width source.size.height 8 4 source.size.width CGColorSpaceCreateDeviceRGB kCGImageAlphaNoneSkipLast CGContextDrawImage context2 CGRectMake 0 0 source.size.width source.size.height original.CGImage..
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 self.size.height self setPixelCount self.size.width self.size.height Create RGB color space self setColorSpace CGColorSpaceCreateDeviceRGB if colorSpace NSLog @ Error allocating color space. return nil self setPixelData malloc byteCount if pixelData NSLog @..
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 NSUInteger width CGImageGetWidth imageRef NSUInteger height CGImageGetHeight imageRef CGColorSpaceRef colorSpace CGColorSpaceCreateDeviceRGB unsigned char inputData malloc height width 4 unsigned char outputData malloc height width 4 NSUInteger bytesPerPixel 4..
Rounded UIView using CALayers - only some corners - How? http://stackoverflow.com/questions/2264083/rounded-uiview-using-calayers-only-some-corners-how 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..
UIImage rounded corners http://stackoverflow.com/questions/262156/uiimage-rounded-corners targetSize.width scaledWidth 0.5 CGContextRef mainViewContentContext CGColorSpaceRef colorSpace colorSpace CGColorSpaceCreateDeviceRGB create a bitmap graphics context the size of the image mainViewContentContext CGBitmapContextCreate NULL targetSize.width..
How do I export UIImage array as a movie? http://stackoverflow.com/questions/3741323/how-do-i-export-uiimage-array-as-a-movie 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..
Curve text on existing circle http://stackoverflow.com/questions/3841642/curve-text-on-existing-circle char fontName char self.menuItemsFont.fontName cStringUsingEncoding NSASCIIStringEncoding CGColorSpaceRef colorSpace CGColorSpaceCreateDeviceRGB CGContextRef context CGBitmapContextCreate NULL imageSize.size.width imageSize.size.height 8 4 imageSize.size.width colorSpace.. ringColor.CGColor CGFloat textColorComponents float CGColorGetComponents textColor.CGColor CGColorSpaceRef colorSpace CGColorSpaceCreateDeviceRGB CGContextRef context CGBitmapContextCreate NULL frame.size.width frame.size.height 8 4 frame.size.width colorSpace kCGImageAlphaPremultipliedFirst..
Get RGB value from UIColor presets http://stackoverflow.com/questions/4700168/get-rgb-value-from-uicolor-presets reasonable RGB values. void getRGBComponents CGFloat 3 components forColor UIColor color CGColorSpaceRef rgbColorSpace CGColorSpaceCreateDeviceRGB unsigned char resultingPixel 4 CGContextRef context CGBitmapContextCreate resultingPixel 1 1 8 4 rgbColorSpace..
Round two corners in UIView http://stackoverflow.com/questions/4847163/round-two-corners-in-uiview 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..
How to make one color transparent on a UIImage? http://stackoverflow.com/questions/633722/how-to-make-one-color-transparent-on-a-uiimage int mHeight CGImageGetHeight ref int count mWidth mHeight 4 void bufferdata malloc count CGColorSpaceRef colorSpaceRef CGColorSpaceCreateDeviceRGB CGBitmapInfo bitmapInfo kCGBitmapByteOrderDefault CGColorRenderingIntent renderingIntent kCGRenderingIntentDefault CGContextRef..
Is programmatically inverting the colors of an image possible? http://stackoverflow.com/questions/6672517/is-programmatically-inverting-the-colors-of-an-image-possible int height size.height Create a suitable RGB alpha bitmap context in BGRA colour space CGColorSpaceRef colourSpace CGColorSpaceCreateDeviceRGB unsigned char memoryPool unsigned char calloc width height 4 1 CGContextRef context CGBitmapContextCreate memoryPool width..
iPhone Watermark on recorded Video. http://stackoverflow.com/questions/7205820/iphone-watermark-on-recorded-video width CVPixelBufferGetWidth imageBuffer size_t height CVPixelBufferGetHeight imageBuffer CGColorSpaceRef colorSpace CGColorSpaceCreateDeviceRGB CGContextRef newContext CGBitmapContextCreate baseAddress width height 8 bytesPerRow colorSpace kCGBitmapByteOrder32Little..
Make Background of UIView a Gradient Without Sub Classing http://stackoverflow.com/questions/844710/make-background-of-uiview-a-gradient-without-sub-classing to produce a patterned background. Example bring your own CGGradient Allocate color space CGColorSpaceRef colorSpace CGColorSpaceCreateDeviceRGB Allocate bitmap context CGContextRef bitmapContext CGBitmapContextCreate NULL 320 480 8 4 320 colorSpace kCGImageAlphaNoneSkipFirst..
|