views:

61

answers:

1

The function I need to implement is like this: 1> select an small area of an image. This small area could be various shape, not only rectangle.

2> manipulate this area. for example: blurring

Is there any way to do it?

Thanks.

A: 

You've got your work cut out for you. Here is one way to do it. Make the selection. Whether you do it with CG paths, or some other way, you want to take the selected image, and make all the unselected area have an alpha of zero. YOu can accomplish this with blendmodes.

Then get the pixel data. See: http://developer.apple.com/mac/library/qa/qa2007/qa1509.html

Then you go through the data and anywhere where your alpha isn't zero, you average the pixel with the pixel one before it, one after it, one above it, and one below it. Of course there are many different ways to blur and this is a poor man's routine.

mahboudz