ios - 在横向时如何将 GPUImageView 图像顺时针旋转 90 度?
<p><p>我正在使用 GPUImage 创建照片应用程序,相关应用程序始终处于横向模式。我想知道如何将显示的图像顺时针旋转 90 度,因为目前它的方向不正确。</p>
<p>我尝试更改以下行,但它抛出了裁剪。</p>
<pre><code> _stillCamera.outputImageOrientation = UIInterfaceOrientationPortrait;
</code></pre>
<p>这是我目前使用的代码。</p>
<pre><code>;
if(.bounds.size.width == 667){
if(cameraPosition == 1){
_stillCamera = [ initWithSessionPreset:AVCaptureSessionPreset1920x1080 cameraPosition:AVCaptureDevicePositionBack];
}else {
_stillCamera = [ initWithSessionPreset:AVCaptureSessionPreset1920x1080 cameraPosition:AVCaptureDevicePositionFront];
}
}
else if(.bounds.size.width == 568){
if(cameraPosition == 1){
_stillCamera = [ initWithSessionPreset:AVCaptureSessionPreset1280x720 cameraPosition:AVCaptureDevicePositionBack];
}else {
_stillCamera = [ initWithSessionPreset:AVCaptureSessionPreset1280x720 cameraPosition:AVCaptureDevicePositionFront];
}
} else{
if(cameraPosition == 1){
_stillCamera = [ initWithSessionPreset:AVCaptureSessionPreset640x480 cameraPosition:AVCaptureDevicePositionBack];
}else {
_stillCamera = [ initWithSessionPreset:AVCaptureSessionPreset640x480 cameraPosition:AVCaptureDevicePositionFront];
}
}
_stillCamera.outputImageOrientation = UIInterfaceOrientationPortrait;
_cropFilter = [ initWithCropRegion:CGRectMake(0.f, 0.125f, 1.f, .75f)];
self.lookupImageSource = [ initWithImage:];
;
self.filterLookup = [ init];
;
;
;
;
//;
//;
;
;
;
</code></pre></p>
<br><hr><h1><strong>Best Answer-推荐答案</ strong></h1><br>
<p><p>您可以通过以下代码旋转您的 <code>GPUImageView</code> 图片。</p>
<pre><code>;
</code></pre>
<p>不同的<code>InputRotation</code>模式如下。</p>
<pre><code>kGPUImageNoRotation,
kGPUImageRotateLeft,
kGPUImageRotateRight,
kGPUImageFlipVertical,
kGPUImageFlipHorizonal,
kGPUImageRotateRightFlipVertical,
kGPUImageRotateRightFlipHorizontal,
kGPUImageRotate180
</code></pre>
<p>希望这会有所帮助。</p></p>
<p style="font-size: 20px;">关于ios - 在横向时如何将 GPUImageView 图像顺时针旋转 90 度?,我们在Stack Overflow上找到一个类似的问题:
<a href="https://stackoverflow.com/questions/32457231/" rel="noreferrer noopener nofollow" style="color: red;">
https://stackoverflow.com/questions/32457231/
</a>
</p>
页:
[1]