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.

objective c - Having a hard time understanding NSBezierPath's curveToPoint: method -


i'm trying grips drawing (fairly basic) shapes in cocoa. understand how create paths straight edges (duh!), when comes doing curves, can't head around inputs produce shaped curve. specifically, have no idea how controlpoint1: , controlpoint2: arguments method influence shape.

i'm trying approximate shape of tab in google chrome:

google chrome tab

and code i'm using is:

-(void)drawrect:(nsrect)dirtyrect {     nssize size = [self bounds].size;      cgfloat height = size.height;     cgfloat width = size.width;      nsbezierpath *path = [nsbezierpath bezierpath];     [path setlinewidth:1];      [path movetopoint:nsmakepoint(0, 0)];      [path curvetopoint:nsmakepoint(width * 0.1, height)          controlpoint1:nsmakepoint(width * 0.05, height)          controlpoint2:nsmakepoint(width * 0.03, height * 0.05)];      [path linetopoint:nsmakepoint(width * 0.9, height)];      [path curvetopoint:nsmakepoint(width, 0)          controlpoint1:nsmakepoint(width * 0.95, height)          controlpoint2:nsmakepoint(width * 0.97, height * 0.05)];      [path closepath];      [[nscolor colorwithcalibratedwhite:0.98 alpha:1] set];     [path fill];      [[nscolor colorwithcalibratedwhite:0.6 alpha:1] set];     [path stroke]; } 

i'm failing horribly.

see, why can't have nice things :(

my attempt

can give me pointers how think when comes drawing curves? example draws path great too, it's understanding these inputs curvetopoint:controlpoint1:controlpoint2: that's holding me back.

update | @ahruman's answer got start taking shape. it's not 100% (missing curves on bottom corners, it's symmetrical shape @ least :)

getting there

the line between current drawing point (implicit) , control point 1 tangent of curve @ beginning. line between control point 2 , “to” point tangent @ end of curve. these correspond ends of 2 tangent controls see in vector drawing application bézier paths. if haven’t used one, inkscape free.


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 -