objective c - Static background for CGContext -
objective c - Static background for CGContext -
this first question here, hello everyone. have spent time wrapping mind around next problem , not come solution. i'd happy if point me in right direction.
i'm using cgcontext draw various layers of graphical representations of live info should refreshed @ reasonable framerate of @ to the lowest degree 50fps. want utilize static image background. re-drawing image using context every cycle slows downwards frame-rate. thought using uiimageview display image once. problem here want utilize blendmodes provided cgcontext in order accomplish more sophisticated overlays setting alpha-value each layer. since uiimageview displaying background image not part of context, it's not affected blendmodes. have thought how accomplish desired behavior without affecting frame-rate much? help.
a phone call cgcontextdrawimage
cgimageref
the same size dimensions cgrect fast. setup cgimageref
background image in code gets run less every frame, such view's initialization code. if background image changing, build image in programme logic code, not draw refresh code.
the worst can access image file each time. time can saved not accessing cgimageref
within heavier object. phone call [someuiimageobject cgimage]
add together overhead of message send, whereas access cgimageref
type ivar in same object containing drawing code not.
if source image not right size, first draw cgimageref
@ needed size once, , reuse in drawing code.
objective-c ios core-animation core-graphics cgcontext
Comments
Post a Comment