ios - drawInRect: losing Quality of Image resolution -



ios - drawInRect: losing Quality of Image resolution -

i trying erase image using next code

cgcolorref strokecolor = [uicolor whitecolor].cgcolor; uigraphicsbeginimagecontext(imgforeground.frame.size); cgcontextref context = uigraphicsgetcurrentcontext(); [imgforeground.image drawinrect:cgrectmake(0, 0, imgforeground.frame.size.width, imgforeground.frame.size.height)]; cgcontextsetlinecap(context, kcglinecapround); cgcontextsetlinewidth(context, 10); cgcontextsetstrokecolorwithcolor(context, strokecolor); cgcontextsetblendmode(context, kcgblendmodeclear); cgcontextbeginpath(context); cgcontextmovetopoint(context, lastpoint.x, lastpoint.y); cgcontextaddlinetopoint(context, currentpoint.x, currentpoint.y); cgcontextstrokepath(context); imgforeground.image = uigraphicsgetimagefromcurrentimagecontext(); uigraphicsendimagecontext();

but find out image losing resolution due drawinrect.

you should go uigraphicsbeginimagecontextwithoptions instead of uigraphicsbeginimagecontext, scale factor can specified.

for example, utilize scale factor of device's main screen:

uigraphicsbeginimagecontextwithoptions(imgforeground.frame.size, no, 0);

ios cocoa-touch uiimage quartz-graphics cgcontext

Comments

Popular posts from this blog

web services - java.lang.NoClassDefFoundError: Could not initialize class net.sf.cglib.proxy.Enhancer -

Accessing MATLAB's unicode strings from C -

javascript - mongodb won't find my schema method in nested container -