background image

Iphone 之选择图片滤镜功能的实现

    大家在做关于自拍软件的时候,会涉及到这样的功能,就是说给图片加滤镜 ,

比如黑白,复古等效果,来使照片显示不同的效果。下面代码,就是如何实现了

这一功能,当然,你可以加上你自己的效果,

个实现的效果如图:

1

#import <UIKit/UIKit.h>

2

#import <QuartzCore/QuartzCore.h>

3
4

@interface PhotoSelectViewController : UIViewController

5

{

6
7

IBOutlet UIImageView *imageView;//图片

8
9

IBOutlet UIScrollView *scrollerView;//滚动视图显示所有滤镜图片

10
11 UIImage *theImage;//原始图片
12
13 int selectIndex;//选择的第几个图片
14 }
15 @end

———————————————————————————————————————

1

/******各种颜色的设定*******/

2

//LOMO

3

const float colormatrix_lomo[] = {

4

1.7f,  0.1f, 0.1f, 0, -73.1f,

5

0,  1.7f, 0.1f, 0, -73.1f,

6

0,  0.1f, 1.6f, 0, -73.1f,

7

0,  0, 0, 1.0f, 0 };

8
9

//黑白

10 const float colormatrix_heibai[] = {

                   找软件资料,就到一览软件文库

http://wk.yl1001.com/rj/