diff --git a/examples/iOS/FilterShowcase/FilterShowcase/ShowcaseFilterViewController.m b/examples/iOS/FilterShowcase/FilterShowcase/ShowcaseFilterViewController.m index 32bb7c271..376f85abc 100755 --- a/examples/iOS/FilterShowcase/FilterShowcase/ShowcaseFilterViewController.m +++ b/examples/iOS/FilterShowcase/FilterShowcase/ShowcaseFilterViewController.m @@ -1278,7 +1278,9 @@ - (void)setupFilter; default: filter = [[GPUImageSepiaFilter alloc] init]; break; } - if (filterType == GPUIMAGE_FILECONFIG) + [filter forceProcessingAtSize:CGSizeMake(480.0, 640.0)]; + + if (filterType == GPUIMAGE_FILECONFIG) { self.title = @"File Configuration"; pipeline = [[GPUImageFilterPipeline alloc] initWithConfigurationFile:[[NSBundle mainBundle] URLForResource:@"SampleConfiguration" withExtension:@"plist"] diff --git a/framework/Source/GPUImageBulgeDistortionFilter.m b/framework/Source/GPUImageBulgeDistortionFilter.m index 4883d54cf..1f778ada7 100755 --- a/framework/Source/GPUImageBulgeDistortionFilter.m +++ b/framework/Source/GPUImageBulgeDistortionFilter.m @@ -67,6 +67,8 @@ void main() @interface GPUImageBulgeDistortionFilter () +- (void)adjustAspectRatio; + @property (readwrite, nonatomic) CGFloat aspectRatio; @end @@ -103,6 +105,24 @@ - (id)init; #pragma mark - #pragma mark Accessors +- (void)adjustAspectRatio; +{ + if (GPUImageRotationSwapsWidthAndHeight(inputRotation)) + { + [self setAspectRatio:(inputTextureSize.width / inputTextureSize.height)]; + } + else + { + [self setAspectRatio:(inputTextureSize.height / inputTextureSize.width)]; + } +} + +- (void)forceProcessingAtSize:(CGSize)frameSize; +{ + [super forceProcessingAtSize:frameSize]; + [self adjustAspectRatio]; +} + - (void)setInputSize:(CGSize)newSize atIndex:(NSInteger)textureIndex; { CGSize oldInputSize = inputTextureSize; @@ -110,14 +130,7 @@ - (void)setInputSize:(CGSize)newSize atIndex:(NSInteger)textureIndex; if ( (!CGSizeEqualToSize(oldInputSize, inputTextureSize)) && (!CGSizeEqualToSize(newSize, CGSizeZero)) ) { - if (GPUImageRotationSwapsWidthAndHeight(inputRotation)) - { - [self setAspectRatio:(inputTextureSize.width / inputTextureSize.height)]; - } - else - { - [self setAspectRatio:(inputTextureSize.height / inputTextureSize.width)]; - } + [self adjustAspectRatio]; } } @@ -132,6 +145,7 @@ - (void)setInputRotation:(GPUImageRotationMode)newInputRotation atIndex:(NSInteg { [super setInputRotation:newInputRotation atIndex:textureIndex]; [self setCenter:self.center]; + [self adjustAspectRatio]; } - (void)setRadius:(CGFloat)newValue; diff --git a/framework/Source/GPUImageGaussianBlurPositionFilter.m b/framework/Source/GPUImageGaussianBlurPositionFilter.m index c9174f3ad..d73a227f8 100755 --- a/framework/Source/GPUImageGaussianBlurPositionFilter.m +++ b/framework/Source/GPUImageGaussianBlurPositionFilter.m @@ -116,6 +116,8 @@ void main() @interface GPUImageGaussianBlurPositionFilter () +- (void)adjustAspectRatio; + @property (readwrite, nonatomic) CGFloat aspectRatio; @end @@ -157,25 +159,43 @@ - (id)init; secondStageFragmentShaderFromString:nil]; } +- (void)adjustAspectRatio; +{ + if (GPUImageRotationSwapsWidthAndHeight(inputRotation)) + { + [self setAspectRatio:(inputTextureSize.width / inputTextureSize.height)]; + } + else + { + [self setAspectRatio:(inputTextureSize.height / inputTextureSize.width)]; + } +} + +- (void)forceProcessingAtSize:(CGSize)frameSize; +{ + [super forceProcessingAtSize:frameSize]; + [self adjustAspectRatio]; +} + - (void)setInputSize:(CGSize)newSize atIndex:(NSInteger)textureIndex; { CGSize oldInputSize = inputTextureSize; [super setInputSize:newSize atIndex:textureIndex]; - + if ( (!CGSizeEqualToSize(oldInputSize, inputTextureSize)) && (!CGSizeEqualToSize(newSize, CGSizeZero)) ) { - if (GPUImageRotationSwapsWidthAndHeight(inputRotation)) - { - [self setAspectRatio:(inputTextureSize.width / inputTextureSize.height)]; - } - else - { - [self setAspectRatio:(inputTextureSize.height / inputTextureSize.width)]; - } + [self adjustAspectRatio]; } } -#pragma mark Getters and Setters +- (void)setInputRotation:(GPUImageRotationMode)newInputRotation atIndex:(NSInteger)textureIndex; +{ + [super setInputRotation:newInputRotation atIndex:textureIndex]; + [self adjustAspectRatio]; +} + +#pragma mark - +#pragma mark Accessors - (void)setBlurSize:(CGFloat)newValue; { diff --git a/framework/Source/GPUImagePinchDistortionFilter.m b/framework/Source/GPUImagePinchDistortionFilter.m index 9a571cc23..76d790967 100755 --- a/framework/Source/GPUImagePinchDistortionFilter.m +++ b/framework/Source/GPUImagePinchDistortionFilter.m @@ -70,6 +70,8 @@ void main() @interface GPUImagePinchDistortionFilter () +- (void)adjustAspectRatio; + @property (readwrite, nonatomic) CGFloat aspectRatio; @end @@ -106,6 +108,24 @@ - (id)init; #pragma mark - #pragma mark Accessors +- (void)adjustAspectRatio; +{ + if (GPUImageRotationSwapsWidthAndHeight(inputRotation)) + { + [self setAspectRatio:(inputTextureSize.width / inputTextureSize.height)]; + } + else + { + [self setAspectRatio:(inputTextureSize.height / inputTextureSize.width)]; + } +} + +- (void)forceProcessingAtSize:(CGSize)frameSize; +{ + [super forceProcessingAtSize:frameSize]; + [self adjustAspectRatio]; +} + - (void)setInputSize:(CGSize)newSize atIndex:(NSInteger)textureIndex; { CGSize oldInputSize = inputTextureSize; @@ -113,14 +133,7 @@ - (void)setInputSize:(CGSize)newSize atIndex:(NSInteger)textureIndex; if ( (!CGSizeEqualToSize(oldInputSize, inputTextureSize)) && (!CGSizeEqualToSize(newSize, CGSizeZero)) ) { - if (GPUImageRotationSwapsWidthAndHeight(inputRotation)) - { - [self setAspectRatio:(inputTextureSize.width / inputTextureSize.height)]; - } - else - { - [self setAspectRatio:(inputTextureSize.height / inputTextureSize.width)]; - } + [self adjustAspectRatio]; } } @@ -128,6 +141,7 @@ - (void)setInputRotation:(GPUImageRotationMode)newInputRotation atIndex:(NSInteg { [super setInputRotation:newInputRotation atIndex:textureIndex]; [self setCenter:self.center]; + [self adjustAspectRatio]; } - (void)setAspectRatio:(CGFloat)newValue; diff --git a/framework/Source/GPUImagePixellateFilter.h b/framework/Source/GPUImagePixellateFilter.h index c101dd533..d0f6ae048 100755 --- a/framework/Source/GPUImagePixellateFilter.h +++ b/framework/Source/GPUImagePixellateFilter.h @@ -8,4 +8,5 @@ // The fractional width of the image to use as a size for the pixels in the resulting image. Values below one pixel width in the source image are ignored. @property(readwrite, nonatomic) CGFloat fractionalWidthOfAPixel; + @end diff --git a/framework/Source/GPUImagePixellateFilter.m b/framework/Source/GPUImagePixellateFilter.m index 1be736b05..88430d090 100755 --- a/framework/Source/GPUImagePixellateFilter.m +++ b/framework/Source/GPUImagePixellateFilter.m @@ -42,6 +42,8 @@ @interface GPUImagePixellateFilter () @property (readwrite, nonatomic) CGFloat aspectRatio; +- (void)adjustAspectRatio; + @end @implementation GPUImagePixellateFilter @@ -77,6 +79,30 @@ - (id)initWithFragmentShaderFromString:(NSString *)fragmentShaderString; return self; } +- (void)adjustAspectRatio; +{ + if (GPUImageRotationSwapsWidthAndHeight(inputRotation)) + { + [self setAspectRatio:(inputTextureSize.width / inputTextureSize.height)]; + } + else + { + [self setAspectRatio:(inputTextureSize.height / inputTextureSize.width)]; + } +} + +- (void)setInputRotation:(GPUImageRotationMode)newInputRotation atIndex:(NSInteger)textureIndex; +{ + [super setInputRotation:newInputRotation atIndex:textureIndex]; + [self adjustAspectRatio]; +} + +- (void)forceProcessingAtSize:(CGSize)frameSize; +{ + [super forceProcessingAtSize:frameSize]; + [self adjustAspectRatio]; +} + - (void)setInputSize:(CGSize)newSize atIndex:(NSInteger)textureIndex; { CGSize oldInputSize = inputTextureSize; @@ -84,14 +110,7 @@ - (void)setInputSize:(CGSize)newSize atIndex:(NSInteger)textureIndex; if ( (!CGSizeEqualToSize(oldInputSize, inputTextureSize)) && (!CGSizeEqualToSize(newSize, CGSizeZero)) ) { - if (GPUImageRotationSwapsWidthAndHeight(inputRotation)) - { - [self setAspectRatio:(inputTextureSize.width / inputTextureSize.height)]; - } - else - { - [self setAspectRatio:(inputTextureSize.height / inputTextureSize.width)]; - } + [self adjustAspectRatio]; } } diff --git a/framework/Source/GPUImagePixellatePositionFilter.m b/framework/Source/GPUImagePixellatePositionFilter.m index 90d70618a..fad31a4dd 100755 --- a/framework/Source/GPUImagePixellatePositionFilter.m +++ b/framework/Source/GPUImagePixellatePositionFilter.m @@ -62,6 +62,8 @@ void main() @interface GPUImagePixellatePositionFilter () +- (void)adjustAspectRatio; + @property (readwrite, nonatomic) CGFloat aspectRatio; @end @@ -112,20 +114,38 @@ - (void)setInputSize:(CGSize)newSize atIndex:(NSInteger)textureIndex; if ( (!CGSizeEqualToSize(oldInputSize, inputTextureSize)) && (!CGSizeEqualToSize(newSize, CGSizeZero)) ) { - if (GPUImageRotationSwapsWidthAndHeight(inputRotation)) - { - [self setAspectRatio:(inputTextureSize.width / inputTextureSize.height)]; - } - else - { - [self setAspectRatio:(inputTextureSize.height / inputTextureSize.width)]; - } + [self adjustAspectRatio]; } } #pragma mark - #pragma mark Accessors +- (void)setInputRotation:(GPUImageRotationMode)newInputRotation atIndex:(NSInteger)textureIndex; +{ + [super setInputRotation:newInputRotation atIndex:textureIndex]; + [self setCenter:self.center]; + [self adjustAspectRatio]; +} + +- (void)adjustAspectRatio; +{ + if (GPUImageRotationSwapsWidthAndHeight(inputRotation)) + { + [self setAspectRatio:(inputTextureSize.width / inputTextureSize.height)]; + } + else + { + [self setAspectRatio:(inputTextureSize.height / inputTextureSize.width)]; + } +} + +- (void)forceProcessingAtSize:(CGSize)frameSize; +{ + [super forceProcessingAtSize:frameSize]; + [self adjustAspectRatio]; +} + - (void)setFractionalWidthOfAPixel:(CGFloat)newValue; { CGFloat singlePixelSpacing; diff --git a/framework/Source/GPUImageSphereRefractionFilter.m b/framework/Source/GPUImageSphereRefractionFilter.m index ca1e6fe9b..b0f540423 100644 --- a/framework/Source/GPUImageSphereRefractionFilter.m +++ b/framework/Source/GPUImageSphereRefractionFilter.m @@ -60,6 +60,8 @@ void main() @interface GPUImageSphereRefractionFilter () +- (void)adjustAspectRatio; + @property (readwrite, nonatomic) CGFloat aspectRatio; @end @@ -113,24 +115,36 @@ - (void)setInputSize:(CGSize)newSize atIndex:(NSInteger)textureIndex; if (!CGSizeEqualToSize(oldInputSize, inputTextureSize) && (!CGSizeEqualToSize(newSize, CGSizeZero)) ) { - if (GPUImageRotationSwapsWidthAndHeight(inputRotation)) - { - [self setAspectRatio:(inputTextureSize.width / inputTextureSize.height)]; - } - else - { - [self setAspectRatio:(inputTextureSize.height / inputTextureSize.width)]; - } + [self adjustAspectRatio]; } } #pragma mark - #pragma mark Accessors +- (void)adjustAspectRatio; +{ + if (GPUImageRotationSwapsWidthAndHeight(inputRotation)) + { + [self setAspectRatio:(inputTextureSize.width / inputTextureSize.height)]; + } + else + { + [self setAspectRatio:(inputTextureSize.height / inputTextureSize.width)]; + } +} + - (void)setInputRotation:(GPUImageRotationMode)newInputRotation atIndex:(NSInteger)textureIndex; { [super setInputRotation:newInputRotation atIndex:textureIndex]; [self setCenter:self.center]; + [self adjustAspectRatio]; +} + +- (void)forceProcessingAtSize:(CGSize)frameSize; +{ + [super forceProcessingAtSize:frameSize]; + [self adjustAspectRatio]; } - (void)setRadius:(CGFloat)newValue;