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

iPhone: Changing CGImageAlphaInfo of CGImage

I have a PNG image that has an unsupported bitmap graphics context pixel format. Whenever I attempt to resize the image, CGBitmapContextCreate() chokes on the unsupported format I receive the following error (error formatted for easy…
TechZen
  • 64,370
  • 15
  • 118
  • 145
24
votes
1 answer

CGBitmapContextCreate with kCGImageAlphaNone

I desperately need to create a CGContextRef WITHOUT an alpha channel. Unfortunately, with Core Graphics you CANNOT specify kCGImageAlphaNone with CGBitmapCreateContext. Can someone PLEASE post a working example of how I can create a CGContextRef…
PleaseHelp
  • 315
  • 1
  • 2
  • 15
24
votes
2 answers

CGBitMapContextCreate Method Causes Compiler Warning Xcode 5 not Xcode 4

I just updated Xcode from version 4.6.2 to 5.0, and after doing a method in my project (created in Xcode 4.6.2) is suddenly giving a compiler warning. I have tried re-opening the project in both the old and new versions of Xcode, and I have…
jac300
  • 5,182
  • 14
  • 54
  • 89
18
votes
4 answers

UIView: how to do non-destructive drawing?

My original question: I'm creating a simple drawing application and need to be able to draw over existing, previously drawn content in my drawRect. What is the proper way to draw on top of existing content without entirely replacing it? …
George Armhold
  • 30,824
  • 50
  • 153
  • 232
15
votes
4 answers

How to create a CGBitmapContext which works for Retina display and not wasting space for regular display?

Is it true that if it is in UIKit, including drawRect, the HD aspect of Retina display is automatically handled? So does that mean in drawRect, the current graphics context for a 1024 x 768 view is actually a 2048 x 1536 pixel Bitmap context?…
nonopolarity
  • 146,324
  • 131
  • 460
  • 740
12
votes
2 answers

CGBitmapContextCreate returns NULL

Under what circumstances will a CGBitmapContext fail to allocate? I have a table view, and it has multiple view options. The user can see a small table cell with just previews, one larger preview per line, or two side by side previews per line. …
borrrden
  • 33,256
  • 8
  • 74
  • 109
10
votes
5 answers

iPhone CGContextRef CGBitmapContextCreate unsupported parameter combination

In my application I need to resize and crop some images, stored locally and online. I am using Trevor Harmon's tutorial which implements UIImage+Resize. On my iPhone 4(iOS 4.3.1) everything works OK, I have no problems. But on my iPhone 3G (iOS 3.2)…
Andrei Neacsu
  • 1,453
  • 3
  • 20
  • 33
10
votes
1 answer

How do I create an alpha only bitmap context

Apple tech note QA1037 says "To create an alpha-only bitmap context simply pass NULL for the colorspace parameter." However, I am not sure what to pass for the bitmapInfo parameter. I was trying something like this, with kCGImageAlphaOnly:…
Skotch
  • 3,072
  • 2
  • 23
  • 43
8
votes
1 answer

Crash CGDataProviderCreateWithCopyOfData: vm_copy failed: status 1

I am facing a crash with following error: "CGDataProviderCreateWithCopyOfData: vm_copy failed: status 1." I have multiple questions and you can help. What does status 1 stand for in vm_copy failed? This crash happens only when I set a break point…
TorukMakto
  • 2,066
  • 2
  • 24
  • 38
5
votes
1 answer

Swift 2&3: How to Use CGBitmapContextCreate

I have the following code: let ref:CGContextRef = CGBitmapContextCreate(nil , 200, 130, CGImageGetBitsPerComponent(self.CGImage), 0, CGImageGetColorSpace(self.CGImage), CGImageGetBitmapInfo(self.CGImage)) The problem is that I get this…
zumzum
  • 17,984
  • 26
  • 111
  • 172
5
votes
8 answers

iPhone - UIImage Leak, CGBitmapContextCreateImage Leak

Alright I am having a world of difficulty tracking down this memory leak. When running this script I do not see any memory leaking, but my objectalloc is climbing. Instruments points to CGBitmapContextCreateImage > create_bitmap_data_provider >…
bbullis21
  • 741
  • 3
  • 9
  • 21
4
votes
1 answer

UIGraphicsBeginImageContext vs CGBitmapContextCreate

I'm trying to change color of an image in a background thread. Apple doc says UIGraphicsBeginImageContext can only be called from main thread, and I'm trying to use CGBitmapContextCreate: context = CGBitmapContextCreate (bitmapData, …
eugene
  • 39,839
  • 68
  • 255
  • 489
4
votes
2 answers

CGContext & CGBitmapContextCreateImage errors, how to fix?

I've been at this for hours now, and don't even know how to debug this error. Maybe there's an SO expert who knows what's going on. - (void) prepareSubset { CGSize size = [image size]; float scale = fminf(1.0f, fmaxf(SUBSET_SIZE /…
Raphael Caixeta
  • 7,808
  • 9
  • 51
  • 76
4
votes
1 answer

Drawing CGImage into Bitmap context, with UIBezierPath drawn into the context beforehand

this is my first question so please bear with me! Im trying to write up a simple drawing app basically, I was using Core Graphics before, and the only problem was it was too slow, and when I drew with my finger it lagged, a hell of alot! So, now I'm…
4
votes
2 answers

"CGBitmapContextCreate: invalid data bytes/row" ... why is camera+ filtering messing up my image cropping routine?

Original image: Filtered image: I am trying to crop UIImages (photos in a phone's camera roll) into squares. Here is part of the code I am using, where 'image' is the image that is being cropped: if( image.size.height > image.size.width ) { …
cowfaboo
  • 709
  • 1
  • 8
  • 15
1
2 3 4 5