Possible Duplicate:
Can I achieve a torchlight effect (lighter area around a light source) in a 2D game?

I want to have a picture as a background, say this:


Then I would like to apply a mask, just a circle with blurred edges, so it looks like this:


The idea is to simulate something emitting. Is this a good way of simulating light or should I use another method? And if so how? And I'm not really sure how to apply this method.

  • \$\begingroup\$ I think your question is a duplicate of the one I linked. For posterity, I have also edited your question to contain the same content as the SO question you linked to, since I have also flagged the SO question to be closed/deleted as a duplicate of this one (it is more appropriate here). \$\endgroup\$
    – user1430
    Commented Aug 11, 2012 at 18:13
  • \$\begingroup\$ well you removed the iPad out of the title so no i got an answer for mac osx not for iOS so yeah thanks.. \$\endgroup\$ Commented Aug 11, 2012 at 20:45
  • \$\begingroup\$ @user1586195 You can always edit your post and add "iPad" back in if that's so important to you. Also: The Core Image Framework is available on iOS, so the answer you got applies to iOS as well. \$\endgroup\$
    – bummzack
    Commented Aug 12, 2012 at 8:51

1 Answer 1


You could use the Core Image CISpotLight filter:

CIImage *inputImage = // your image here
CIFilter *spotlight = [CIFilter filterWithName:@"CISpotLight"];
[spotlight setDefaults];
[spotlight setValue:inputImage forKey:@"inputImage"];
CIImage *spotlightImage = [spotlight valueForKey:@"outputImage"];

See the Core Image Programming Guide for more information.


Not the answer you're looking for? Browse other questions tagged .