Hello,
I'm a new one here but I want to learn.
I'm trying to use NsMutableArray.
For this I create a code which permit to take one by one pixel from a picture and put the RBG color of each pixel in a NsMutableArray.
Everything works fine except at the end. Indeed after fill each RGB color of each pixel, my NsMutableArray is empty (after the for loop).
Does anyone have an idea why it is reset? THanks
I put the code below. To make it easy to read, I've removed the table blue and greem. I put only red table.
Thanks for your help
NSMutableArray * ligneR = [[NSMutableArray alloc] init];
NSMutableArray * colonneR = [[NSMutableArray alloc] init];
for (NSUInteger i = 0; i < ghostSize.width; i++) {
[colonneR addObject:[[NSMutableString alloc]init ]];
}
for (NSUInteger j = 0; j < ghostSize.height; j++) {
for (NSUInteger i = 0; i < ghostSize.width; i++) {
UInt32 * inputPixel = inputPixels + j * inputWidth + i + offsetPixelCountForInput;
UInt32 inputColor = *inputPixel;
UInt32 * ghostPixel = ghostPixels + j * (int)ghostSize.width + i;
UInt32 ghostColor = *ghostPixel;
int newR = R(ghostColor) ;
NSNumber *R=[NSNumber numberWithInt:newR];
[colonneR replaceObjectAtIndex:i withObject:R];
*inputPixel = RGBAMake(newR, newG, newB, A(inputColor));
}
[ligneR addObject:colonneR];
}