按钮旋转GPUImage

时间:2013-03-10 16:37:54

标签: rotation gpuimage

我想构建一个按钮,每次按下时都会将图像旋转90°。我试图这样做,但它不起作用

 (IBAction)Rotate:(id)sender {
    staticPictureOriginalOrientation=UIImageOrientationLeft;
    [self.imageView setInputRotation:staticPictureOriginalOrientation atIndex:0];
    [staticPicture addTarget:filter];
    [staticPicture processImage];
}

我得到的是这个

点击按钮+ 90°旋转图像和processImage

1 个答案:

答案 0 :(得分:0)

我正在使用此代码做同样的事情:

selectedFilter = [[GPUImageTransformFilter alloc] init];

[(GPUImageTransformFilter *)selectedFilter setAffineTransform:CGAffineTransformMakeRotation((M_PI)*0.5)];

self.img = [selectedFilter imageByFilteringImage:self.img];
self.mainImage.image = self.img;
self.originalImage = self.img;