ios - Optimize UIBezierPath drawing -
i have problem hoping in community may have expertise in. working on drawing app. it's far , why, @ each touchesmoved:withevent, process of re-calculating approximate bezier curve must take place , redrawn. approximation algorithm such that, @ given moment cubic curve can become quadratic , back. therefore, bounding box of entire curve can change rather drastically point point. naive approach take bounds of bezier curve , pass setneedsdisplayinrect:, that's much, better calling setneedsdisplay, when profile code, of course, huge amount of time spent inside drawrect. comes problem, hoping reduce that.
now, if stroke call inside of uibezierpath has sufficient overhead, render moot minimizing volume of rectangle needs re-drawn. case, , using naive approach becomes best alternative. that's possibility #1. hoping try, however, create algorithm minimizes aggregate volume of set of rectangles cover bezier path. in other words, instead of calling setneedsdisplayinrect once, calling few times. union of rects covers uibezierpath. wish write out more formally in latex or something, want reduce area need redraw caveat entire bezier path part of union of these rects. think dominoes. if can choose infinite set of dominoes of every shape , size, how go computing set of dominoes cover arbitrary bezier path such volume of dominoes minimal.
Comments
Post a Comment