I'm trying to apply texture on CALayer from UIColor pattern image. Texture is applying but it's not correctly perspective transformed. Looks like there is an issue with my drawing logic i.e I need to use a texture image and map it on to the irregular shape. I did some research and come to know this thing can be achievable through OpenGL or metal by mapping texture image to irregular shape in 2d image.
Looking for some kind of guidance, How i can correctly perspective transform tile patterns?
let image = UIImage(named: "roofTiles_square")?.flattened if let realImage = image { let color = UIColor(patternImage: realImage) controller.quadView.quadLayer.fillColor = color.cgColor }
Any help would be much appreciated.
Thanks
https://stackoverflow.com/questions/67228421/how-to-apply-texture-on-irregular-shapes-in-2d-image April 23, 2021 at 06:35PM
没有评论:
发表评论