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
2
votes
5 answers

iPhone - CGBitmapContextCreateImage Leak, Anyone else with this problem?

Has anyone else come across this problem? I am resizing images pretty often with an NSTimer. After using Instruments it does not show any memory leaks but my objectalloc just continues to climb. It points directly to…
bbullis21
  • 741
  • 3
  • 9
  • 21
2
votes
1 answer

CGBitmapContextCreate unsupported parameter combination error

I'm reading an image file and re-displaying it without making any change as shown in the code below, but I get the this error: : CGBitmapContextCreate: unsupported parameter combination: 8 integer bits/component; 16 bits/pixel; 1-component color…
user1643881
  • 61
  • 1
  • 4
1
vote
0 answers

How to get Quality image using CGBitmapContextCreateImage

How?... I am tring to get High Quality image using CGBitmapContextCreateImage() and tried to do it with the following code. - (CGImageRef) imageForPageIndex:(NSUInteger)pageIndex { NSUInteger width = pageSize.width; NSUInteger height =…
jinbruce627
  • 133
  • 8
1
vote
2 answers

setNeedsDisplay for UIImage doesn't work

I am trying to draw a line on an UIImage with the help of a dataBuffer when a button gets touched, but the drawRect: .. methode doesn´t get called. (so, the line i want to draw does't appear) I really don't know where the problem could be, so I…
Kito
  • 1,375
  • 4
  • 17
  • 37
1
vote
1 answer

UIImage/CGImage changing my pixel color

I have an image that is totally white in its RGB components, with varying alpha -- so, for example, 0xFFFFFF09 in RGBA format. But when I load this image with either UIImage or CGImage APIs, and then draw it in a CGBitmapContext, it comes out…
RedMarbleGames
  • 121
  • 2
  • 6
1
vote
0 answers

CGBitmapContextCreate returns nil on anything but an iPhone 4 photo

I'm pretty sure this is a stupid coding error due to the fact i'm a bit of a newbie in iOS and especially on Quartz. I have the following code - Which works on photos i've taken with my iPhone's camera, but it returns nil (in ctx) when im creating a…
Shai Mishali
  • 9,224
  • 4
  • 56
  • 83
1
vote
1 answer

Get pixel RGB wrong by CGBitmapContextCreate

I came into a strange problem. I'm using CGBitmapContextCreate to get the raw pixel data from an image, and then modify the pixel color at specified location. However, I found out when I get the RGBA of a pixel that alpha equals to 1, everything…
Yic
  • 13
  • 3
1
vote
1 answer

iOS sdk, render image from unsigned char array, CGBitmapContextCreate returns NULL

I have an unsigned char* data with the following values, as seen while debugging in xcode,…
EnGassa
  • 2,927
  • 1
  • 14
  • 16
1
vote
1 answer

Drawing in Objective-c (iOS)

I develop an iOS app with user-drawing as one of its parts. I want to draw over a bitmap's context. This can be implemented in two ways: 1) When drawing option is selected I create bitmap context. The context is closed only when the tool is…
kpower
  • 3,871
  • 4
  • 42
  • 62
1
vote
1 answer

Swift version get wrong pixels data but the Object-c version get the right pixels data from the same image using method "CGBitmapContextCreate"

I can't believe my eyes, they are basically the same code, just convert the Object-c code to swift code, but the Object-c code always gets the right answer, but the swift code sometimes gets the right answer, sometimes gets wrong. The Swift…
Changwei
  • 672
  • 1
  • 5
  • 16
1
vote
0 answers

Exporting extremely large images in iOS

I am working on an app that uses a CATiledLayer backed View in a UIScrollView to let the user work on an arbitrarily large canvas. The canvas basically contains a large chart of blocks that the user can color, select, move, etc. I override draw(_…
N.W
  • 672
  • 2
  • 8
  • 19
1
vote
2 answers

CGContextDrawLayerInRect from CGBitmapContextCreate failing iPhone 7 Plus

I've got an Objective C project which at one point takes a photo from either your photo library or from the camera, and then chops them up into little squares (tiles), and eventually creates new UIImage objects from the chopped up squares. The code…
drewster
  • 5,460
  • 5
  • 40
  • 50
1
vote
2 answers

Convert PDF to CGImage turns image to negative

I have the following piece of code to convert a PDF page to a CGImage: func testPrint(pp:UnsafePointer) { // debug to see bits var p = UnsafePointer(pp) var res = "" for _ in 0..<200 { res += "\(p.memory) " p =…
qwerty_so
  • 35,448
  • 8
  • 62
  • 86
1
vote
0 answers

Generating Wrong Image with CGBitmapContext

I have this code private static UIImage Copy(UIImage self) { var inImage = self.CGImage; var width = inImage.Width; var height = inImage.Height; var bits = inImage.BitsPerComponent; var bitsPerRow =…
1
vote
1 answer

Create CGImage From CGBitmapContext and Add to UIImageView

I am trying to create a snapshot of a UICollectionViewCell by creating a CGBitMapContext. I am not entirely clear on how to do this or how to use the associated classes, but after a bit of research, I have written the following method which is…