/Frameworks/AppKit/rhino.platform/CPBezierPath.j

http://github.com/jfahrenkrug/MapKit-HelloWorld · Unknown · 133 lines · 133 code · 0 blank · 0 comment · 0 complexity · bfdba1ef76963ea7f45a993ce189ae31 MD5 · raw file

  1. I;26;AppKit/CPGraphicsContext.jI;21;Foundation/CPObject.jc;4497;
  2. var _1=1;
  3. var _2=objj_allocateClassPair(CPObject,"CPBezierPath"),_3=_2.isa;
  4. class_addIvars(_2,[new objj_ivar("_path"),new objj_ivar("_lineWidth")]);
  5. objj_registerClassPair(_2);
  6. objj_addClassForBundle(_2,objj_getBundleWithPath(OBJJ_CURRENT_BUNDLE.path));
  7. class_addMethods(_2,[new objj_method(sel_getUid("init"),function(_4,_5){
  8. with(_4){
  9. if(_4=objj_msgSendSuper({receiver:_4,super_class:objj_getClass("CPObject")},"init")){
  10. _path=CGPathCreateMutable();
  11. _lineWidth=objj_msgSend(objj_msgSend(_4,"class"),"defaultLineWidth");
  12. }
  13. return _4;
  14. }
  15. }),new objj_method(sel_getUid("moveToPoint:"),function(_6,_7,_8){
  16. with(_6){
  17. CGPathMoveToPoint(_path,nil,_8.x,_8.y);
  18. }
  19. }),new objj_method(sel_getUid("lineToPoint:"),function(_9,_a,_b){
  20. with(_9){
  21. CGPathAddLineToPoint(_path,nil,_b.x,_b.y);
  22. }
  23. }),new objj_method(sel_getUid("curveToPoint:controlPoint1:controlPoint2:"),function(_c,_d,_e,_f,_10){
  24. with(_c){
  25. CGPathAddCurveToPoint(_path,nil,_f.x,_f.y,_10.x,_10.y,_e.x,_e.y);
  26. }
  27. }),new objj_method(sel_getUid("closePath"),function(_11,_12){
  28. with(_11){
  29. CGPathCloseSubpath(_path);
  30. }
  31. }),new objj_method(sel_getUid("stroke"),function(_13,_14){
  32. with(_13){
  33. var ctx=objj_msgSend(objj_msgSend(CPGraphicsContext,"currentContext"),"graphicsPort");
  34. CGContextBeginPath(ctx);
  35. CGContextAddPath(ctx,_path);
  36. CGContextSetLineWidth(ctx,objj_msgSend(_13,"lineWidth"));
  37. CGContextClosePath(ctx);
  38. CGContextStrokePath(ctx);
  39. }
  40. }),new objj_method(sel_getUid("fill"),function(_16,_17){
  41. with(_16){
  42. var ctx=objj_msgSend(objj_msgSend(CPGraphicsContext,"currentContext"),"graphicsPort");
  43. CGContextBeginPath(ctx);
  44. CGContextAddPath(ctx,_path);
  45. CGContextSetLineWidth(ctx,objj_msgSend(_16,"lineWidth"));
  46. CGContextClosePath(ctx);
  47. CGContextFillPath(ctx);
  48. }
  49. }),new objj_method(sel_getUid("lineWidth"),function(_19,_1a){
  50. with(_19){
  51. return _lineWidth;
  52. }
  53. }),new objj_method(sel_getUid("setLineWidth:"),function(_1b,_1c,_1d){
  54. with(_1b){
  55. _lineWidth=_1d;
  56. }
  57. }),new objj_method(sel_getUid("elementCount"),function(_1e,_1f){
  58. with(_1e){
  59. return _path.count;
  60. }
  61. }),new objj_method(sel_getUid("isEmpty"),function(_20,_21){
  62. with(_20){
  63. return CGPathIsEmpty(_path);
  64. }
  65. }),new objj_method(sel_getUid("currentPoint"),function(_22,_23){
  66. with(_22){
  67. return CGPathGetCurrentPoint(_path);
  68. }
  69. }),new objj_method(sel_getUid("appendBezierPathWithPoints:count:"),function(_24,_25,_26,_27){
  70. with(_24){
  71. CGPathAddLines(_path,nil,_26,_27);
  72. }
  73. }),new objj_method(sel_getUid("appendBezierPathWithRect:"),function(_28,_29,_2a){
  74. with(_28){
  75. CGPathAddRect(_path,nil,_2a);
  76. }
  77. }),new objj_method(sel_getUid("appendBezierPathWithOvalInRect:"),function(_2b,_2c,_2d){
  78. with(_2b){
  79. CGPathAddPath(_path,nil,CGPathWithEllipseInRect(_2d));
  80. }
  81. }),new objj_method(sel_getUid("appendBezierPathWithRoundedRect:xRadius:yRadius:"),function(_2e,_2f,_30,_31,_32){
  82. with(_2e){
  83. CGPathAddPath(_path,nil,CGPathWithRoundedRectangleInRect(_30,_31,_32,YES,YES,YES,YES));
  84. }
  85. }),new objj_method(sel_getUid("appendBezierPath:"),function(_33,_34,_35){
  86. with(_33){
  87. CGPathAddPath(_path,nil,_35._path);
  88. }
  89. }),new objj_method(sel_getUid("removeAllPoints"),function(_36,_37){
  90. with(_36){
  91. _path=CGPathCreateMutable();
  92. }
  93. })]);
  94. class_addMethods(_3,[new objj_method(sel_getUid("bezierPath"),function(_38,_39){
  95. with(_38){
  96. return objj_msgSend(objj_msgSend(objj_msgSend(_38,"class"),"alloc"),"init");
  97. }
  98. }),new objj_method(sel_getUid("bezierPathWithOvalInRect:"),function(_3a,_3b,_3c){
  99. with(_3a){
  100. var _3d=objj_msgSend(objj_msgSend(_3a,"class"),"bezierPath");
  101. objj_msgSend(_3d,"appendBezierPathWithOvalInRect:",_3c);
  102. return _3d;
  103. }
  104. }),new objj_method(sel_getUid("bezierPathWithRect:"),function(_3e,_3f,_40){
  105. with(_3e){
  106. var _41=objj_msgSend(objj_msgSend(_3e,"class"),"bezierPath");
  107. objj_msgSend(_41,"appendBezierPathWithRect:",_40);
  108. return _41;
  109. }
  110. }),new objj_method(sel_getUid("defaultLineWidth"),function(_42,_43){
  111. with(_42){
  112. return _1;
  113. }
  114. }),new objj_method(sel_getUid("setDefaultLineWidth:"),function(_44,_45,_46){
  115. with(_44){
  116. _1=_46;
  117. }
  118. }),new objj_method(sel_getUid("fillRect:"),function(_47,_48,_49){
  119. with(_47){
  120. objj_msgSend(objj_msgSend(objj_msgSend(_47,"class"),"bezierPathWithRect:",_49),"fill");
  121. }
  122. }),new objj_method(sel_getUid("strokeRect:"),function(_4a,_4b,_4c){
  123. with(_4a){
  124. objj_msgSend(objj_msgSend(objj_msgSend(_4a,"class"),"bezierPathWithRect:",_4c),"stroke");
  125. }
  126. }),new objj_method(sel_getUid("strokeLineFromPoint:toPoint:"),function(_4d,_4e,_4f,_50){
  127. with(_4d){
  128. var _51=objj_msgSend(objj_msgSend(_4d,"class"),"bezierPath");
  129. objj_msgSend(_51,"moveToPoint:",_4f);
  130. objj_msgSend(_51,"lineToPoint:",_50);
  131. objj_msgSend(_51,"stroke");
  132. }
  133. })]);