0

有一个VCSimpleSession类型为 filter 的属性VCFilter

typedef NS_ENUM(NSInteger, VCFilter) {
    VCFilterNormal,
    VCFilterGray,
    VCFilterInvertColors,
    VCFilterSepia,
    VCFilterFisheye,
    VCFilterGlow
};

这些过滤器的实现在哪里?我该如何使用它们?

4

1 回答 1

0

每个过滤器都位于 filters/Basic 目录中自己的文件中,并在运行时添加FilterFactory.cpp

FilterFactory::FilterFactory() {
    {
        filters::BasicVideoFilterBGRA b;
        filters::GrayscaleVideoFilter g;
        filters::InvertColorsVideoFilter i;
        filters::SepiaVideoFilter s;
        filters::FisheyeVideoFilter f;
        filters::GlowVideoFilter gl;
    }
}

setFilter:您可以使用该方法设置过滤器。示例应用程序使用UIButton 遍历所有过滤器,如下所示:

- (IBAction)btnFilterTouch:(id)sender {
    switch (_session.filter) {
        case VCFilterNormal:
            [_session setFilter:VCFilterGray];
            break;
        case VCFilterGray:
            [_session setFilter:VCFilterInvertColors];
            break;
        case VCFilterInvertColors:
            [_session setFilter:VCFilterSepia];
            break;
        case VCFilterSepia:
            [_session setFilter:VCFilterFisheye];
            break;
        case VCFilterFisheye:
            [_session setFilter:VCFilterGlow];
            break;
        case VCFilterGlow:
            [_session setFilter:VCFilterNormal];
            break;
        default:
            break;
    }
}
于 2015-11-05T02:11:50.060 回答