|  | @@ -44,6 +44,9 @@ public class PQCompositionExporter {
 | 
											
												
													
														|  |    
 |  |    
 | 
											
												
													
														|  |      /// Use serial queue to ensure that the picture is smooth
 |  |      /// Use serial queue to ensure that the picture is smooth
 | 
											
												
													
														|  |      var createFiltersQueue: DispatchQueue!
 |  |      var createFiltersQueue: DispatchQueue!
 | 
											
												
													
														|  | 
 |  | +    
 | 
											
												
													
														|  | 
 |  | +    //导出时是否添加水印
 | 
											
												
													
														|  | 
 |  | +    var isAddWatermark:Bool = false
 | 
											
												
													
														|  |  
 |  |  
 | 
											
												
													
														|  |      public init(asset: AVAsset, videoComposition: AVVideoComposition? = nil, audioMix: AVAudioMix? = nil, filters: [ImageProcessingOperation]? = nil,stickers:[PQEditVisionTrackMaterialsModel]? = nil, animationTool: AVVideoCompositionCoreAnimationTool? = nil, exportURL: URL) {
 |  |      public 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
 | 
											
										
											
												
													
														|  | @@ -191,6 +194,46 @@ public class PQCompositionExporter {
 | 
											
												
													
														|  |              }
 |  |              }
 | 
											
												
													
														|  |              input!.removeAllTargets()
 |  |              input!.removeAllTargets()
 | 
											
												
													
														|  |              let currentTarget: ImageSource = input!
 |  |              let currentTarget: ImageSource = input!
 | 
											
												
													
														|  | 
 |  | +            
 | 
											
												
													
														|  | 
 |  | +            //是否添加水印
 | 
											
												
													
														|  | 
 |  | +            var weatMaskFilter:PQBaseFilter?
 | 
											
												
													
														|  | 
 |  | +            if(isAddWatermark){
 | 
											
												
													
														|  | 
 |  | +                //创建水印filter
 | 
											
												
													
														|  | 
 |  | +                let  weatMaskSticker:PQEditVisionTrackMaterialsModel = PQEditVisionTrackMaterialsModel.init()
 | 
											
												
													
														|  | 
 |  | +                weatMaskSticker.locationPath = "watermark"
 | 
											
												
													
														|  | 
 |  | +                weatMaskSticker.timelineIn = mStickers?.first?.timelineIn ?? 0.0
 | 
											
												
													
														|  | 
 |  | +                weatMaskSticker.timelineOut =  mStickers?.last?.timelineIn ?? 0.0
 | 
											
												
													
														|  | 
 |  | +                /*
 | 
											
												
													
														|  | 
 |  | +                1080P        最短的一边 ≥1080    100%     距右40,距下30
 | 
											
												
													
														|  | 
 |  | +                720P         最短的一边 ≥720,<1080    66.60%    距右27,距下20
 | 
											
												
													
														|  | 
 |  | +                480P及以下    最短的一边<720    44.40%    距右18,距下14
 | 
											
												
													
														|  | 
 |  | +                */
 | 
											
												
													
														|  | 
 |  | +                let postion:PQEditMaterialPositionModel = PQEditMaterialPositionModel.init()
 | 
											
												
													
														|  | 
 |  | +                let minSlider = min(input?.mShowVidoSize.width ?? 0, input?.mShowVidoSize.height ?? 0)
 | 
											
												
													
														|  | 
 |  | +                postion.width = 350 
 | 
											
												
													
														|  | 
 |  | +                postion.height = 100
 | 
											
												
													
														|  | 
 |  | +                if(minSlider >= 1080){
 | 
											
												
													
														|  | 
 |  | +                    postion.x = Int(input?.mShowVidoSize.width ?? 0) - 40 - postion.width
 | 
											
												
													
														|  | 
 |  | +                    postion.y = Int(input?.mShowVidoSize.height ?? 0) - 30 - postion.height
 | 
											
												
													
														|  | 
 |  | +                }else if(minSlider >= 720 && minSlider < 1080){
 | 
											
												
													
														|  | 
 |  | +                    postion.width = Int(Float(postion.width) * 0.666)
 | 
											
												
													
														|  | 
 |  | +                    postion.height = Int(Float(postion.height) * 0.666)
 | 
											
												
													
														|  | 
 |  | +                    postion.x = Int(input?.mShowVidoSize.width ?? 0) - 27 - postion.width
 | 
											
												
													
														|  | 
 |  | +                    postion.y = Int(input?.mShowVidoSize.height ?? 0) - 20 - postion.height
 | 
											
												
													
														|  | 
 |  | +                
 | 
											
												
													
														|  | 
 |  | +                }else if(minSlider < 720){
 | 
											
												
													
														|  | 
 |  | +                    postion.width = Int(Float(postion.width) * 0.444)
 | 
											
												
													
														|  | 
 |  | +                    postion.height = Int(Float(postion.height) * 0.444)
 | 
											
												
													
														|  | 
 |  | +                    postion.x = Int(input?.mShowVidoSize.width ?? 0) - 18 - postion.width
 | 
											
												
													
														|  | 
 |  | +                    postion.y = Int(input?.mShowVidoSize.height ?? 0) - 14 - postion.height
 | 
											
												
													
														|  | 
 |  | +                    
 | 
											
												
													
														|  | 
 |  | +                }
 | 
											
												
													
														|  | 
 |  | +                weatMaskSticker.materialPosition = postion
 | 
											
												
													
														|  | 
 |  | +               
 | 
											
												
													
														|  | 
 |  | +                weatMaskFilter = PQImageFilter(sticker: weatMaskSticker, isExport: true)
 | 
											
												
													
														|  | 
 |  | +                
 | 
											
												
													
														|  | 
 |  | +            }
 | 
											
												
													
														|  | 
 |  | +            
 | 
											
												
													
														|  |              if(currentSticker?.type == StickerType.IMAGE.rawValue && showGaussianBlur){
 |  |              if(currentSticker?.type == StickerType.IMAGE.rawValue && showGaussianBlur){
 | 
											
												
													
														|  |                  //高斯层
 |  |                  //高斯层
 | 
											
												
													
														|  |                  let json = currentSticker?.toJSONString(prettyPrint: false)
 |  |                  let json = currentSticker?.toJSONString(prettyPrint: false)
 | 
											
										
											
												
													
														|  | @@ -209,12 +252,25 @@ public class PQCompositionExporter {
 | 
											
												
													
														|  |                  currentTarget.addTarget(showGaussianFitler, atTargetIndex: 0)
 |  |                  currentTarget.addTarget(showGaussianFitler, atTargetIndex: 0)
 | 
											
												
													
														|  |                  
 |  |                  
 | 
											
												
													
														|  |                  iosb.addTarget(showFitler!)
 |  |                  iosb.addTarget(showFitler!)
 | 
											
												
													
														|  | -     
 |  | 
 | 
											
												
													
														|  | -                showFitler?.addTarget(output!, atTargetIndex: 0)
 |  | 
 | 
											
												
													
														|  | 
 |  | +                
 | 
											
												
													
														|  | 
 |  | +                if(weatMaskFilter != nil){
 | 
											
												
													
														|  | 
 |  | +                    showFitler?.addTarget(weatMaskFilter!, atTargetIndex: 0)
 | 
											
												
													
														|  | 
 |  | +                    weatMaskFilter?.addTarget(output!,atTargetIndex: 0)
 | 
											
												
													
														|  | 
 |  | +                }else{
 | 
											
												
													
														|  | 
 |  | +                    showFitler?.addTarget(output!, atTargetIndex: 0)
 | 
											
												
													
														|  | 
 |  | +                }
 | 
											
												
													
														|  | 
 |  | +              
 | 
											
												
													
														|  |              }else{
 |  |              }else{
 | 
											
												
													
														|  | -                currentTarget.addTarget(showFitler!, atTargetIndex: 0)
 |  | 
 | 
											
												
													
														|  | -                showFitler?.addTarget(output!, atTargetIndex: 0)
 |  | 
 | 
											
												
													
														|  | -
 |  | 
 | 
											
												
													
														|  | 
 |  | +                if(weatMaskFilter != nil){
 | 
											
												
													
														|  | 
 |  | +                    
 | 
											
												
													
														|  | 
 |  | +                    currentTarget.addTarget(showFitler!, atTargetIndex: 0)
 | 
											
												
													
														|  | 
 |  | +                    showFitler?.addTarget(weatMaskFilter!, atTargetIndex: 0)
 | 
											
												
													
														|  | 
 |  | +                    weatMaskFilter?.addTarget(output!, atTargetIndex: 0)
 | 
											
												
													
														|  | 
 |  | +                }else{
 | 
											
												
													
														|  | 
 |  | +                    currentTarget.addTarget(showFitler!, atTargetIndex: 0)
 | 
											
												
													
														|  | 
 |  | +                    showFitler?.addTarget(output!, atTargetIndex: 0)
 | 
											
												
													
														|  | 
 |  | +                }
 | 
											
												
													
														|  | 
 |  | + 
 | 
											
												
													
														|  |              }
 |  |              }
 | 
											
												
													
														|  |  
 |  |  
 | 
											
												
													
														|  |              lastshowSticker = currentSticker
 |  |              lastshowSticker = currentSticker
 |