初步实现瞳距调节逻辑

This commit is contained in:
bluesea 2024-04-22 15:35:18 +08:00
parent e43bd28aaa
commit 9c3ec43bb4
4 changed files with 41 additions and 9 deletions

View File

@ -1048,7 +1048,7 @@
ASSETCATALOG_COMPILER_GLOBAL_ACCENT_COLOR_NAME = AccentColor;
CODE_SIGN_IDENTITY = "Apple Development";
CODE_SIGN_STYLE = Automatic;
CURRENT_PROJECT_VERSION = 1.1;
CURRENT_PROJECT_VERSION = 1.3;
DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym";
DEVELOPMENT_TEAM = 8DQD6BV6H9;
ENABLE_APP_SANDBOX = NO;
@ -1101,7 +1101,7 @@
ASSETCATALOG_COMPILER_GLOBAL_ACCENT_COLOR_NAME = AccentColor;
CODE_SIGN_IDENTITY = "Apple Development";
CODE_SIGN_STYLE = Automatic;
CURRENT_PROJECT_VERSION = 1.1;
CURRENT_PROJECT_VERSION = 1.3;
DEVELOPMENT_TEAM = 8DQD6BV6H9;
ENABLE_APP_SANDBOX = NO;
GCC_PREPROCESSOR_DEFINITIONS = (

View File

@ -16,7 +16,7 @@ class UserInfo: NSObject {
var paymentProductIdentifier:String? //id
var isMemberShip:Bool {
get {
return true
// return true
return paymentState
}
}

View File

@ -176,22 +176,43 @@ class PlayByTransferConvertor {
//
func joinImages( leftImage:CIImage, rightImage:CIImage) -> CIImage {
let scale = 0.7//0.5
let scale = 1.0 //,0.5
let ed = 5 //, 1:2, -30 ~ +30
let edS = 30 //
let left = UIImage(ciImage: leftImage )
let right = UIImage(ciImage: rightImage )
let imageWidth = left.size.width/2
let imageHeight = left.size.height
//
let n_left = getImgWithScale(image: left, scale: scale - 0.5)
let n_right = getImgWithScale(image: right, scale: scale - 0.5)
//
let x_offset = CGFloat(abs(ed) * edS) //x
let imageWidth = left.size.width/2 - x_offset
let imageHeight = left.size.height
let ed_left = getImgWithED(image: n_left, imgWidth: imageWidth)
let ed_right = getImgWithED(image: n_right, imgWidth: imageWidth)
let newImageSize = left.size //CGSize(width:imageWidth, height: left.size.height);
let newImageSize = left.size
UIGraphicsBeginImageContextWithOptions(newImageSize, false, 1);
n_left.draw(in: CGRect(x:0, y:0, width:imageWidth, height:imageHeight))
n_right.draw(in: CGRect(x:imageWidth, y:0, width:imageWidth, height:imageHeight))
if (ed > 0) {//,x0;,x
ed_left.draw(in: CGRect(x:0, y:0, width:imageWidth, height:imageHeight))
ed_right.draw(in: CGRect(x:left.size.width/2 + x_offset, y:0, width:imageWidth, height:imageHeight))
}
else if (ed < 0) {
ed_left.draw(in: CGRect(x:x_offset, y:0, width:imageWidth, height:imageHeight))
ed_right.draw(in: CGRect(x:imageWidth, y:0, width:imageWidth, height:imageHeight))
}
else {//
ed_left.draw(in: CGRect(x:0, y:0, width:imageWidth, height:imageHeight))
ed_right.draw(in: CGRect(x:imageWidth, y:0, width:imageWidth, height:imageHeight))
}
let image = UIGraphicsGetImageFromCurrentImageContext()!
UIGraphicsEndImageContext();
@ -199,6 +220,7 @@ class PlayByTransferConvertor {
return ci
}
//
func getImgWithScale(image:UIImage,scale:CGFloat) -> UIImage {
let dRect = CGSizeMake(image.size.width*0.5, image.size.height)
let imgWidth = image.size.width*scale
@ -210,6 +232,16 @@ class PlayByTransferConvertor {
return newImage
}
//
func getImgWithED(image:UIImage,imgWidth:CGFloat) -> UIImage {
let dRect = CGSizeMake(imgWidth, image.size.height)
UIGraphicsBeginImageContextWithOptions(dRect, false, 1);
image.draw(in: CGRectMake((dRect.width - imgWidth)*0.5, 0, imgWidth, dRect.height))
let newImage = UIGraphicsGetImageFromCurrentImageContext()!
UIGraphicsEndImageContext();
return newImage
}
func joinImages_backup( leftImage:CIImage, rightImage:CIImage) -> CIImage {
let left = UIImage(ciImage: leftImage )
let right = UIImage(ciImage: rightImage )