cgcontextsavegstate與cgcontextrestoregstate的作用
uigraphicsbeginimagecontextwithoptions(targetrect.size, yes, 0.0);
cgcontextref context
= uigraphicsgetcurrentcontext();
float myfillcolor[] = {1,0,0,1}; //red;
cgcontextsavegstate(context);
cgcontextsetrgbfillcolor(context, 0,1,1,1);
cgcontextfillrect(context, targetrect);
cgcontextsetfillcolor(context, myfillcolor);
cgcontextfillellipseinrect(context, targetrect);
cgcontextfillpath(context);
cgcontextrestoregstate(context);
uiimage *uiimage
= uigraphicsgetimagefromcurrentimagecontext();
uigraphicsendimagecontext();