Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Not work with iPhone 6 simulator #6

Closed
JasonHuang opened this issue Sep 25, 2012 · 5 comments
Closed

Not work with iPhone 6 simulator #6

JasonHuang opened this issue Sep 25, 2012 · 5 comments

Comments

@JasonHuang
Copy link

Hi, Omid Hashemi

Thanks for your effort for the amazing library, but lately I 'm trying to run my app on iPhone 6 simulator, It halt with a EXEC_BAD_ACCESS on this line

        outData[outIndex]     = [self safe:r];

any hint help me work through this?

many thanks

Jason.

@OmidH
Copy link
Owner

OmidH commented Sep 25, 2012

I'm sorry I won't be able to respond to you for at least two week as I am in vacation. I will respond once I have returned and recovered.

Thanks in advance,

Omid Hashemi

@ChoiBongKyu
Copy link

Blocked from this problem too difficult.
People to be worried and I'll teach you.

unsigned char * data = malloc (_height * _width * 4);

Under part

            data [outIndex] = [self safe: r];
            data [outIndex + 1] = [self safe: g];
            data [outIndex + 2] = [self safe: b];
            data [outIndex + 3] = 255;
        }
    }
    
    return data;

So after I fix the build.

@sprite2005
Copy link

Fix:

-(id) convolve:(NSArray *) kernel {

CGContextRef cgctx = [self createARGBBitmapContextFromImage:self.CGImage];
size_t _width = CGImageGetWidth(self.CGImage);
size_t _height = CGImageGetHeight(self.CGImage);

unsigned char* inData = CGBitmapContextGetData (cgctx);
NSData* pixelData = (__bridge NSData*) CGDataProviderCopyData(CGImageGetDataProvider(self.CGImage));
NSMutableData* mutablePixelData = [pixelData mutableCopy];
//unsigned char* outData = (unsigned char*)[pixelData bytes];
unsigned char* outData = (unsigned char*)[mutablePixelData mutableBytes];

outData = [self convolveRaw:kernel InData:inData OuData:outData Height:_height Width:_width];

UIImage *newImage = [self createImageFromPixels:outData Length:pixelData.length];

// if(outData) free(outData);
if(inData) free(inData);

return newImage;

}

@darkmeton
Copy link

Tried both methods. The second one by sprite2005 seemed to work better. Thank you. You should probably update the code in the repo

@OmidH
Copy link
Owner

OmidH commented Nov 11, 2012

The code is now updated. Thank you to all of you!

@OmidH OmidH closed this as completed Nov 11, 2012
OmidH pushed a commit that referenced this issue Nov 11, 2012
OmidH pushed a commit that referenced this issue Nov 11, 2012
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants