MaLiang
MaLiang copied to clipboard
lag if set canvas inside scroll view , and canvas has bouds more than 2500
i make drawing app, and if i set brish width like 250 and canvas bounds is 2500+ it have big lags
MaLiang's Canvas
is not compatiable with UIScrollView
, please use ScrollableCanvas
instead
but, if use not with scrollaview, how to zoom/move background image , and one more question, with MaLiang`s can draw with glitter? i mean can i set color like this func createGlitterColor(image: UIImage, forBG: Bool = false) -> UIColor{ let glitterImage = image let imageView = UIImageView(frame: CGRect(x: 0, y: 0, width: forBG ? 80 : 800, height: forBG ? 80 : 800))
imageView.image = glitterImage
imageView.contentMode = .scaleAspectFit
let layer = imageView.layer
UIGraphicsBeginImageContextWithOptions(imageView.layer.frame.size, false, 0)
guard let cgContext = UIGraphicsGetCurrentContext() else
{
return .white
}
layer.render(in: cgContext)
guard let screenshot = UIGraphicsGetImageFromCurrentImageContext() else
{
return .white
}
UIGraphicsEndImageContext()
let glitterColor = UIColor.init(patternImage: screenshot)
return glitterColor
}
Zoom background with canvas is truly the problem now. In fact there's many problem with scrolling too. Zoomming feature is only at toy level currently. I'm not quite understand what glitter is? can you show me some examples?
glitter is a image, so in upper function is describe how it work, it like copy multiple time photo, and paste with brush when you draw, so you draw with image :D
@VJosan If you are tring to draw an image to the canvas, just use the Chartlet apis
yeah, i tryed