|
@@ -40,6 +40,10 @@ open class PQImageFilter: PQBaseFilter {
|
|
|
// print("mSticker path : \(String(describing: mSticker!.locationPath))")
|
|
|
|
|
|
newImage = UIImage(contentsOfFile: documensDirectory + sticker.locationPath)
|
|
|
+ //支持 bundle 加载图片
|
|
|
+ if(newImage == nil){
|
|
|
+ newImage = UIImage().BF_Image(named: sticker.locationPath)
|
|
|
+ }
|
|
|
|
|
|
// 如果是预览时 对原图进行缩放处理
|
|
|
if !isExport {
|
|
@@ -136,9 +140,21 @@ open class PQImageFilter: PQBaseFilter {
|
|
|
imageTexture = PQGPUImageTools.setupTexture(image: newImage!.cgImage!)
|
|
|
}
|
|
|
|
|
|
+
|
|
|
let texturePropertiesimagetwo = InputTextureProperties(textureCoordinates: textureCoordinates, texture: imageTexture)
|
|
|
|
|
|
- let verticesPoint: [GLfloat] = PQGPUImageTools.getVerticesPoint(sticker: mSticker!, textureSize: newImage!.size, cannvasSize: inputSize)
|
|
|
+ var verticesPoint: [GLfloat] = PQGPUImageTools.getVerticesPoint(sticker: mSticker!, textureSize: newImage!.size, cannvasSize: inputSize)
|
|
|
+
|
|
|
+ //如果设置过大小位置,使用设置值,比如水印
|
|
|
+ if(stickerInfo?.materialPosition?.width != 0){
|
|
|
+ verticesPoint = PQGPUImageTools.computeVertices(viewSize: CGSize.init(width: CGFloat(inputSize.width), height: CGFloat(inputSize.height)), _bounds: CGRect.init(x: 0, y: 0, width: stickerInfo?.materialPosition?.width ?? 0, height: stickerInfo?.materialPosition?.height ?? 0))
|
|
|
+ }
|
|
|
+
|
|
|
+ // 设置融合模式支持 alpha
|
|
|
+ glEnable(GLenum(GL_DEPTH_TEST))
|
|
|
+ glEnable(GLenum(GL_BLEND))
|
|
|
+ glBlendFunc(GLenum(GL_SRC_ALPHA), GLenum(GL_ONE_MINUS_SRC_ALPHA))
|
|
|
+
|
|
|
renderQuadWithShader(shader,
|
|
|
uniformSettings: uniformSettings,
|
|
|
vertexBufferObject: PQGPUImageTools.NXGenerateVBO(for: verticesPoint),
|