I've this function of getting pixels from an image written in Java. I'm converting it into Objective C. p1 is my object of Pixel class. Inside getpixels function, the first two lines shows how to get the image width and height and store it into p1.width and p1.height. The third line is meant to create a series of ints equal to number of pixels of image and store them into pixels array.(i.e. to create an int for every pixel of image)
public void getpixels(Bitmap image, Effect temp)
{
p1.width=image.getWidth();
p1.height=image.getHeight();
p1.pixels=new int[p1.width*p1.height];
}
I've converted the first two lines but I don't know how to convert the third one.
-(void) getpixels: (UIImage *) image :(Effect *) temp
{
p1.width= (int) image.size.width;
p1.height=(int) image.size.height;
int size= ([p1 width]*[p1 height]);
//array =(
}
Any help will be appreciated. Thanks.