0 Replies - 2631 Views - Last Post: 29 June 2013 - 09:14 AM

#1 tony12095  Icon User is offline

  • D.I.C Head
  • member icon

Reputation: 14
  • View blog
  • Posts: 109
  • Joined: 23-October 12

Using Filters

Posted 29 June 2013 - 09:14 AM

I am currently trying to use a group of UIImageView(s) to show the preview of an image that I have in another class. What I want is for the main class to present a modal view controller, and as the modal controller appears, I want the imageviews to show the image and allow me to apply filters to them. Would I have to use a protocol for this? Or is there just a simpler way of doing this? Here is my code:

-(IBAction) closeFilters:(id)sender {
	[self dismissModalViewControllerAnimated:YES];
	[self filterChosenWithTag:t];
}

-(void) filterChosenWithTag:(NSInteger)tag {
	tag = t;
		
	//setting the image to the view controller's image
	image = vC.imageview.image;
	
	switch (t) {
		case 0:
			filtersView.image = [image greyscale];
			break;
			
		case 1:
			filtersView.image = [image sepia];
			break;
			
		case 2:
			filtersView.image = [image posterize:100];
			break;
			
		case 3:
			filtersView.image = [image saturate:100.0];
			break;
			
		case 4:
			filtersView.image = [image brightness:100.0];
			break;
			
		case 5:
			filtersView.image = [image gamma:100.0];
			break;
			
		case 6:
			filtersView.image = [image contrast:100.0];
			 break;
			
		case 7:
			filtersView.image = [image invert];
			break;
			
		case 8:
			filtersView.image = [image noise:100.0];
			break;
			
		default:
			break;
	}
}



Is This A Good Question/Topic? 0
  • +

Page 1 of 1