|
@@ -8,6 +8,7 @@
|
|
|
|
|
|
import AVFoundation
|
|
import AVFoundation
|
|
import Foundation
|
|
import Foundation
|
|
|
|
+import ObjectMapper
|
|
// import GPUImage
|
|
// import GPUImage
|
|
|
|
|
|
public class PQCompositionExporter {
|
|
public class PQCompositionExporter {
|
|
@@ -32,6 +33,9 @@ public class PQCompositionExporter {
|
|
|
|
|
|
//最后一次显示的 sticker
|
|
//最后一次显示的 sticker
|
|
var lastshowSticker:PQEditVisionTrackMaterialsModel?
|
|
var lastshowSticker:PQEditVisionTrackMaterialsModel?
|
|
|
|
+
|
|
|
|
+ //是否显示高斯
|
|
|
|
+ var showGaussianBlur:Bool = false
|
|
|
|
|
|
init(asset: AVAsset, videoComposition: AVVideoComposition? = nil, audioMix: AVAudioMix? = nil, filters: [ImageProcessingOperation]? = nil,stickers:[PQEditVisionTrackMaterialsModel]? = nil, animationTool: AVVideoCompositionCoreAnimationTool? = nil, exportURL: URL) {
|
|
init(asset: AVAsset, videoComposition: AVVideoComposition? = nil, audioMix: AVAudioMix? = nil, filters: [ImageProcessingOperation]? = nil,stickers:[PQEditVisionTrackMaterialsModel]? = nil, animationTool: AVVideoCompositionCoreAnimationTool? = nil, exportURL: URL) {
|
|
self.asset = asset
|
|
self.asset = asset
|
|
@@ -163,8 +167,32 @@ public class PQCompositionExporter {
|
|
}
|
|
}
|
|
input!.removeAllTargets()
|
|
input!.removeAllTargets()
|
|
let currentTarget: ImageSource = input!
|
|
let currentTarget: ImageSource = input!
|
|
- currentTarget.addTarget(showFitler!, atTargetIndex: 0)
|
|
|
|
- showFitler?.addTarget(output!, atTargetIndex: 0)
|
|
|
|
|
|
+ if(currentSticker?.type == StickerType.IMAGE.rawValue && showGaussianBlur){
|
|
|
|
+ //高斯层
|
|
|
|
+ let json = currentSticker?.toJSONString(prettyPrint: false)
|
|
|
|
+ if json == nil {
|
|
|
|
+ BFLog(message: "数据转换有问题 跳转")
|
|
|
|
+ return
|
|
|
|
+ }
|
|
|
|
+ let blurStickerModel: PQEditVisionTrackMaterialsModel? = Mapper<PQEditVisionTrackMaterialsModel>().map(JSONString: json!)
|
|
|
|
+ blurStickerModel?.canvasFillType = stickerContentMode.aspectFillStr.rawValue
|
|
|
|
+ let showGaussianFitler:PQBaseFilter = PQImageFilter(sticker: blurStickerModel!)
|
|
|
|
+
|
|
|
|
+ let iosb:GaussianBlur = GaussianBlur.init()
|
|
|
|
+ iosb.blurRadiusInPixels = 20
|
|
|
|
+ showGaussianFitler.addTarget(iosb)
|
|
|
|
+
|
|
|
|
+ currentTarget.addTarget(showGaussianFitler, atTargetIndex: 0)
|
|
|
|
+
|
|
|
|
+ iosb.addTarget(showFitler!)
|
|
|
|
+
|
|
|
|
+ showFitler?.addTarget(output!, atTargetIndex: 0)
|
|
|
|
+ }else{
|
|
|
|
+ currentTarget.addTarget(showFitler!, atTargetIndex: 0)
|
|
|
|
+ showFitler?.addTarget(output!, atTargetIndex: 0)
|
|
|
|
+
|
|
|
|
+ }
|
|
|
|
+
|
|
lastshowSticker = currentSticker
|
|
lastshowSticker = currentSticker
|
|
}
|
|
}
|
|
|
|
|