Featured post

c# - Usage of Server Side Controls in MVC Frame work -

i using asp.net 4.0 , mvc 2.0 web application. project requiremrnt have use server side control in application not possibl in noraml case. ideally want use adrotator control , datalist control. i saw few samples , references in codepleax mvc controllib howwver found less useful. can tell how utilize theese controls in asp.net application along mvc. note: please provide functionalities related adrotator , datalist controls not equivalent functionalities thanks in advace. mvc pages not use normal .net solution makes use of normal .net components impossible. a normal .net page use event driven solution call different methods service side mvc use actions , view completly different way handle things. also, mvc not use viewstate normal .net controlls require. found article discussing mixing of normal .net , mvc.

iphone - using UIImage drawInRect still renders it upside down -


i have read posts on website using drawinrect instead of cgcontext draw methods. still draws upside down? thought using drawinrect print right side coordinate system originating @ top left?

-(void) drawimage:(uiimage*) image atx:(float) x andy:(float) y withwidth:(float) width andheight:(float) height oncontext:(cgcontextref) context{ uigraphicspushcontext(context); [image drawinrect:cgrectmake(x, size.height-y-height, width, height)]; uigraphicspopcontext(); } 

notice i'm doing size.height-y-height , if don't doesn't go expect (assuming drawinrect using topleft coordinate system). renders in correct spot above code still upside down. help!!!!!!

update

thanks answer below working method

-(void) drawimage:(uiimage*) image atx:(float) x andy:(float) y withwidth:(float) width andheight:(float) height oncontext:(cgcontextref) context{ uigraphicspushcontext(context); cgcontextsavegstate(context);  cgcontexttranslatectm(context, 0, size.height); cgcontextscalectm(context, 1.0, -1.0); [image drawinrect:cgrectmake(x, y, width, height)]; cgcontextrestoregstate(context); uigraphicspopcontext(); } 

    uigraphicsbeginimagecontext(imageviewsize); cgcontextref imagecontext = uigraphicsgetcurrentcontext();  // draw image in upper left corner (0,0) actual size cgcontextdrawimage(imagecontext, imageviewrect, oldimage.cgimage);  //  draws image lower right corner,  //  following code flip side down vertically.   cgcontexttranslatectm(imagecontext, 0.0, 0.0); cgcontextscalectm(imagecontext, 1.0, -1.0);  cgcontextdrawimage(imagecontext, imageviewrect, oldimage.cgimage); 

Comments

Popular posts from this blog

c# - Usage of Server Side Controls in MVC Frame work -

cocoa - Nesting arrays into NSDictionary object (Objective-C) -

ios - Very simple iPhone App crashes on UILabel settext -