cgbitmapcontextcreate

Crash CGDataProviderCreateWithCopyOfData: vm_copy failed: status 1

和自甴很熟 提交于 2020-01-03 08:46:10
问题 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 in the inner for loop of data copy. And then resume and remove the breakpoint. If there is no breakpoint, function executes but I get a blank image. How do I ensure that even if I don't set a break point, such crashes are caught and application stops

UIGraphicsBeginImageContext vs CGBitmapContextCreate

僤鯓⒐⒋嵵緔 提交于 2019-12-30 03:31:49
问题 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, pixelsWide, pixelsHigh, 8, // bits per component bitmapBytesPerRow, colorSpace, kCGImageAlphaPremultipliedFirst); I have two versions of "changeColor" first one using UIGraphisBeginImageContext, second one using CGBitmapContextCreate. The first one correctly

Help please with CGBitmapContext and 16 bit images

你说的曾经没有我的故事 提交于 2019-12-24 00:47:08
问题 I'd LOVE to know what I'm doing wrong here. I'm a bit of a newbie with CGImageRefs so any advice would help. I'm trying to create a bitmap image that has as it's pixel values a weighted sum of the pixels from another bitmap, and both bitmaps are 16bits per channel. For some reason I had no trouble getting this to work with 8bit images but it fails miserably with 16bit. My guess is that I'm just not setting things up correctly. I've tried using CGFloats, floats and UInt16s as the data types

CGContext & CGBitmapContextCreateImage errors, how to fix?

孤街浪徒 提交于 2019-12-23 12:13:53
问题 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 / cropRect.size.width, SUBSET_SIZE / cropRect.size.height)); CGPoint offset = CGPointMake(-cropRect.origin.x, -cropRect.origin.y); subsetWidth = cropRect.size.width * scale; subsetHeight = cropRect.size.height * scale; subsetBytesPerRow = ((subsetWidth + 0xf) >> 4) <<

iPhone - UIImage Leak, ObjectAlloc Building

流过昼夜 提交于 2019-12-23 05:45:07
问题 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 > malloc, this takes up 60% of my objectalloc. This code is called several times with a NSTimer. How do I clear that reUIImage after I return it? ...or How can I make it so that UIImage imageWithCGImage does not build my ObjectAlloc? //I shorten the code

iPhone - Multiple CGBitmapContextCreateImage Calls - ObjectAlloc climbing

為{幸葍}努か 提交于 2019-12-22 01:02:43
问题 Has anyone else come across this problem? ObjectAlloc climbs as a result of the CGBitmapContextCreateImage. Does Apple's software not fully releasing the objectalloc? I am resizing images 12 times a second with a NSTimer. During resizing of the image I am also adding a photoshop like Gaussian blur effect by including interpolationQuality. After using Instruments it does not show any memory leaks but my objectalloc just continues to climb. It points directly to CGBitmapContextCreateImage .

Convert an image to a 16bit color image

亡梦爱人 提交于 2019-12-18 09:21:20
问题 I'm looking for a way to optimize my images by converting its color from 32bit to 16bit rather than just solely resize it. So this is what I'm doing: - (UIImage *)optimizeImage:(UIImage *)image { float newWidth = image.size.width; float newHeight = image.size.height; CGColorSpaceRef colorSpace = CGColorSpaceCreateDeviceRGB(); CGContextRef context = CGBitmapContextCreate(NULL, newWidth, newHeight, 5, newWidth * 4, colorSpace, kCGImageAlphaNone | kCGBitmapByteOrder32Big); CGColorSpaceRelease

iPhone - Multiple CGBitmapContextCreateImage Calls - ObjectAlloc climbing

依然范特西╮ 提交于 2019-12-04 22:49:01
Has anyone else come across this problem? ObjectAlloc climbs as a result of the CGBitmapContextCreateImage. Does Apple's software not fully releasing the objectalloc? I am resizing images 12 times a second with a NSTimer. During resizing of the image I am also adding a photoshop like Gaussian blur effect by including interpolationQuality. After using Instruments it does not show any memory leaks but my objectalloc just continues to climb. It points directly to CGBitmapContextCreateImage . CGBitmapContextCreateImage > create_ bitmap_ data_provide > malloc Anyone know of a solution? or Even

Alpha Detection in Layer OK on Simulator, not iPhone

↘锁芯ラ 提交于 2019-12-01 10:22:50
问题 First, check out this very handy extension to CALayer from elsewhere on SO. It helps you determine if a point in a layer's contents-assigned CGImageRef is or isn't transparent. n.b.: There is no guarantee about a layer's contents being representable or responding as if it was a CGImageRef . (This can have implications for broader use of the extension referenced above, granted.) In my case, however, I know that the layers I'm testing have contents that were assigned a CGImageRef . (Hopefully

How do I create an alpha only bitmap context

拈花ヽ惹草 提交于 2019-12-01 03:41:50
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: CGContextRef ctx = CGBitmapContextCreate(NULL, scaledSize.width, scaledSize.height, 8, scaledSize.width, NULL, kCGImageAlphaOnly); But this gives me an warning about the enum being wrong. What should I put there instead? The docs clearly state you can use values from the CGImageAlphaInfo even though the parameter is defined as needed a value from the