我正在尝试定义uiElementInput(imageSequence是一个UIImageView)大小和定位但没有成功。 电影是在图像拉伸的情况下生成的。
我被困在这几天了。 任何帮助都会很感激!
这是我到目前为止所拥有的:
videoCamera.outputImageOrientation = UIInterfaceOrientationLandscapeLeft;
videoCamera.horizontallyMirrorFrontFacingCamera = NO;
videoCamera.horizontallyMirrorRearFacingCamera = NO;
filter = [[GPUImageFilter alloc] init];
[videoCamera addTarget:filter];
blendFilter = [[GPUImageAlphaBlendFilter alloc] init];
[(GPUImageAlphaBlendFilter *)blendFilter setMix:1.0];
[blendFilter forceProcessingAtSizeRespectingAspectRatio:CGSizeMake(148, 250)];
imageSequence = [[UIImageView alloc] initWithFrame:CGRectMake(0, 0, 148, 250)];
imageSequence.contentMode = UIViewContentModeScaleAspectFit;
uiElementInput = [[GPUImageUIElement alloc] initWithView:imageSequence];
filterTrans1 = [[GPUImageTransformFilter alloc] init];
[filterTrans1 forceProcessingAtSize:CGSizeMake(148, 250)];
[filter addTarget:blendFilter];
[filterTrans1 addTarget:blendFilter];
[uiElementInput addTarget:blendFilter];
pathToMovie = [NSTemporaryDirectory() stringByAppendingPathComponent:@"moviez.m4v"];
unlink([pathToMovie UTF8String]);
movieURL = [NSURL fileURLWithPath:pathToMovie];
movieWriter = [[GPUImageMovieWriter alloc] initWithMovieURL:movieURL size:CGSizeMake(480.0, 320.0)];
[blendFilter addTarget:movieWriter];
__unsafe_unretained GPUImageUIElement *weakUIElementInput = uiElementInput;
[filter setFrameProcessingCompletionBlock:^(GPUImageOutput * filter, CMTime frameTime){
if (imageIndex == 20)
imageIndex = 1;
if (imageFrames == 5)
{
imageFrames = 0;
imageSequence.frame = CGRectMake(20, 20, 148, 250);
imageSequence.contentMode = UIViewContentModeScaleAspectFit;
imageSequence.image = [UIImage imageNamed:[NSString stringWithFormat:@"testeImage%i", imageIndex]];
[weakUIElementInput update];
imageIndex++;
}
imageFrames++;
}];
[videoCamera startCameraCapture];
...