将GPUImage中的类GPUImageBilateralFilter从iOS转换为Android

时间:2015-04-09 09:59:31

标签: android ios

我想将类GPUImageBilateralFilter从iOS(GPUImage库)转换为Android。 我在iOS上创建了基于该类的VERTEXT和FRAGMENT SHADER,但我不知道要做什么,因为我不知道iOS程序。我能怎么做 ?对我有任何建议

更新:在文件.m扩展名中有代码段:

@implementation GPUImageBilateralFilter

@synthesize distanceNormalizationFactor = _distanceNormalizationFactor;

- (id)init;
{
    
    if (!(self = [super initWithFirstStageVertexShaderFromString:kGPUImageBilateralBlurVertexShaderString
                              firstStageFragmentShaderFromString:kGPUImageBilateralFilterFragmentShaderString
                               secondStageVertexShaderFromString:kGPUImageBilateralBlurVertexShaderString
                             secondStageFragmentShaderFromString:kGPUImageBilateralFilterFragmentShaderString])) {
        return nil;
    }
    
    firstDistanceNormalizationFactorUniform  = [filterProgram uniformIndex:@"distanceNormalizationFactor"];
    secondDistanceNormalizationFactorUniform = [filterProgram uniformIndex:@"distanceNormalizationFactor"];

    self.texelSpacingMultiplier = 4.0;
    self.distanceNormalizationFactor = 8.0;

    
    return self;
}
 #pragma mark -
 #pragma mark Accessors

- (void)setDistanceNormalizationFactor:(CGFloat)newValue
{
    _distanceNormalizationFactor = newValue;
    
    [self setFloat:newValue
        forUniform:firstDistanceNormalizationFactorUniform
           program:filterProgram];    
    [self setFloat:newValue
        forUniform:secondDistanceNormalizationFactorUniform
           program:secondFilterProgram];
}
@end

在.h扩展名中:

#import "GPUImageGaussianBlurFilter.h"

@interface GPUImageBilateralFilter : GPUImageGaussianBlurFilter
{
    CGFloat firstDistanceNormalizationFactorUniform;
    CGFloat secondDistanceNormalizationFactorUniform;
}
// A normalization factor for the distance between central color and sample color.
@property(nonatomic, readwrite) CGFloat distanceNormalizationFactor;
@end

如何将其转换为Android

0 个答案:

没有答案