Questions tagged [cgbitmapcontextcreate]

Creates a bitmap graphics context (drawing destination) in Apple's Core Graphics framework.

The Core Graphics framework is often referred to as "CG"

See Apple's CGBitmap reference for more specific information, or The Graphics Contexts section of Apple's Quartz 2D Programming Guide for background information.

67 questions
1
vote
0 answers

How to obtain array of pixels from a .png image?

I want to get the color of each pixel of a .png image. Its size is 320*480. But each time I use 'malloc' or 'calloc' to get memory, I get only NULL. Here is the code: CGImageRef imageRef = image.CGImage; NSUInteger width =…
user1899840
  • 543
  • 2
  • 7
  • 19
1
vote
1 answer

Where is memory footprint increase in following function?

I am using following function. Whenever i call it that time it will increase my memory usage.I have checked all leaks. Even, I am release object immediately at they end of function. Here,I am providing my code for reference. Please, provide…
Nitin
  • 7,455
  • 2
  • 32
  • 51
0
votes
2 answers

iOS Does CGBitmapContextCreate copy data?

I have written this piece of code: bitmapData = calloc(1, bitmapByteCount ); context = CGBitmapContextCreate (bitmapData, pixelsWide, pixelsHigh, …
MegaManX
  • 8,766
  • 12
  • 51
  • 83
0
votes
1 answer

GBitmapContextCreate: unsupported parameter combination

Having trouble with CGBitmapContextCreate and getting: Error: Unsupported pixel description - 1 components, 8 bits-per-component, 8 bits-per-pixel with this code: float *bitmap = (float*)malloc(sizeof(float) * width * height); // fill with…
richy
  • 2,716
  • 1
  • 33
  • 42
0
votes
1 answer

Different UIImage RGB data output in Swift and Objective-C apps

I'm working on image processing framework and use this code to read RGB data: if let data = image.cgImage?.dataProvider?.data { let dataPtr: UnsafePointer = CFDataGetBytePtr(data) let width = Int(image.size.width) let height…
0
votes
2 answers

iPhone SDK - CGBitmapContextCreate

I would like to create an image of my own. I already know its width (320*2 = 640) and height (427). So I have some raw data : unsigned char *rawImg = malloc(height * width * 4 *2 ); Then, I will fill it :) Then, I have to do something like that to…
nax_
  • 469
  • 6
  • 16
0
votes
1 answer

CGBitmapContextCreate returns NULL for some pixels of width and height

I have the following code to create a new bitmap graphics context. NSLog(@"newRect Width %f",newRect.size.width); NSLog(@"newRect Height %f",newRect.size.height); NSLog(@"imageRef %@",imageRef); CGContextRef bitmap = CGBitmapContextCreate(NULL, …
0
votes
1 answer

Why does drawPatternInRect: on UIImage works only in Views context

I am creating my own context using CGBitmapContextCreate call. The context is created successfully. I can draw an UIImage in this context using the call CGContextDrawImage successfully. But, when I try to use the call drawPatternInRect: of UIImage,…
spd
  • 2,114
  • 1
  • 29
  • 54
0
votes
1 answer

CGContextDrawImage error, how to allocate the buffer?

I am trying to store image data in buffer in my app so i will be able to use it however I get EXC_BAD_ACCESS error on CGContextDrawImage line. Here is the code i am using: resizedImage.Array() // resizedImage - resized image of 280x140 pixels size …
0
votes
1 answer

Image Generation from TrueType font in Swift/Cocoa

I'm trying to generate an NSImage from a ttf font using Swift in Cocoa (not UIKit) and I'm struggling with the context creation at the moment. My base code came from this project: https://github.com/reeonce/Ionicons.swift but it's designed for…
beeb
  • 1,187
  • 11
  • 32
0
votes
1 answer

png uncompressed by CGContextDrawImage is different from orign png image in xcode

I have a png image which color is white, but alpha channel is different.That is a pixel of the image is made of (255, 255, 255, x),x belongs to [0~255]. I use the following code to read it into menory, find color value changed to the same as alpha…
jayzhen
  • 111
  • 1
  • 1
  • 7
0
votes
1 answer

iOS: not getting correct result with CGBitmapContextCreate in method call

I have been scratching my head over this over hours. I am using the following method to resize 2 images. One after another: CGImageRef imageReference = [image CGImage]; bytes = malloc(width * height * 4); NSUInteger bytesPerPixel = 4; NSUInteger…
Unheilig
  • 16,196
  • 193
  • 68
  • 98
0
votes
0 answers

Alpha Images convert to .mov

I have been able to create the playing .mov, by following the various tutorials on stack. However, my image contains alpha. CGColorSpaceRef rgbColorSpace = CGColorSpaceCreateDeviceRGB(); CGBitmapInfo bitmapInfo = (CGBitmapInfo)…
DogCoffee
  • 19,820
  • 10
  • 87
  • 120
0
votes
1 answer

"CGBitmapContextCreate: unsupported parameter combination" errors when running the official sample code "Current Location" in my Iphone5s

When I run the sample code "Current Location" in my Iphone5s, It always appears the following errors. Nov 26 20:24:00 dev CurAddress[571] : CGBitmapContextCreate: unsupported parameter combination: 5 integer bits/component; 16 bits/pixel;…
0
votes
0 answers

largeimagedownsizing giving destImageRef NULL and crashing ios

I am using Apple sample code to downsize the image. I tested for two images. One image is 204kB and other image is 205kB. It is crashing for 204kB image giving error as Terminating app due to uncaught exception 'CALayerInvalidGeometry', reason:…