转一个类: ESCursors提供了各种各样的箭头光标

ElasticSearch - 解决ES的深分页问题 (游标 scroll) ES为了避免深分页,不允许使用分页(from&size)查询10000条以后的数据,因此如果要查询第10000条以后的数据,要使用ES提供的 scroll(游标) 来查询假设取的页数较大时(深分页),如请求第20页,Elasticsearch不得不取出所有分片上的第1页到第20页的所有文档,并做排序,最终再取出from后的size条结果作爲最终的返回值假设你有16个分片,则需要在coord... 阅读详情
 ESCursors提供了各种各样的箭头光标。
 
 特别是它提供旋转版本的游标其中NSCursor 不提供。 
  
 对于每一个游标类型有一个类方法提供了游标
 这些所谓的辅助方法,创造的Bézier路径
 形状,利用它的大小合适的黑色与白色的边界,
 旋转和缩放理想的规模和回报它作为NSCursor
  1. //ESCursors.h
  2. #import <Cocoa/Cocoa.h>
  3. @interface ESCursors : NSObject {
  4. }
  5. #pragma mark CURVED CURSORS
  6. /*
  7.     CURVED CURSORS
  8.     A cross shaped cursor whose horizontal stroke is slightly curved to the bottom.
  9.     The options specify which of the arrows should exist, not all of them should be NO.
  10.     The arrow heads in these cursors overlap which gives the right look at small size but looks bad at huge sizes.
  11.     The third variant with an 'underlay' lets you pass an image that is drawn beneath the cursor image. 
  12. */
  13. + (NSBezierPath *) curvedCursorBezierPathWithRightArrow:(BOOL) rightArrow
  14.                                                 upArrow:(BOOL) upArrow 
  15.                                               leftArrow:(BOOL) leftArrow 
  16.                                               downArrow: (BOOL) downArrow 
  17.                                                forAngle: (CGFloat) angle;
  18. + (NSCursor *) curvedCursorWithRightArrow:(BOOL) rightArrow 
  19.                                   upArrow:(BOOL) upArrow 
  20.                                 leftArrow:(BOOL) leftArrow downArrow: (BOOL) downArrow 
  21.                                  forAngle: (CGFloat) angle 
  22.                                      size: (CGFloat) size;
  23. + (NSCursor *) curvedCursorWithRightArrow:(BOOL) rightArrow 
  24.                                   upArrow:(BOOL) upArrow 
  25.                                 leftArrow:(BOOL) leftArrow 
  26.                                 downArrow: (BOOL) downArrow 
  27.                                  forAngle: (CGFloat) angle 
  28.                                      size: (CGFloat) size 
  29.                                  underlay:(NSImage*) underlay;
  30. #pragma mark STRAIGHT CURSORS
  31. /*
  32.     STRAIGHT CURSORS
  33.     
  34.     cross shaped
  35.     threePronged (oriented like an upside-down T)
  36.     right angle shaped (oriented like an L)
  37.     straight line shaped (horizontal)
  38.     semi-straight line shaped (horizontal, shorter and with a bar at the left end)
  39. */
  40. + (NSBezierPath *) crossCursorBezierPathForAngle: (CGFloat) angle;
  41. + (NSCursor *) crossCursorForAngle: (CGFloat) angle withSize: (CGFloat) size;
  42. + (NSBezierPath *) threeProngedCursorBezierPathForAngle: (CGFloat) angle;
  43. + (NSCursor *) threeProngedCursorForAngle: (CGFloat) angle withSize: (CGFloat) size;
  44. + (NSBezierPath *) angleCursorBezierPathForAngle: (CGFloat) angle;
  45. + (NSCursor *) angleCursorForAngle: (CGFloat) angle withSize: (CGFloat) size;
  46. + (NSBezierPath *) straightCursorBezierPathForAngle: (CGFloat) angle;
  47. + (NSCursor *) straightCursorForAngle: (CGFloat) angle withSize: (CGFloat) size;
  48. + (NSBezierPath *) halfStraightCursorBezierPathForAngle: (CGFloat) angle;
  49. + (NSCursor *) halfStraightCursorForAngle: (CGFloat) angle withSize: (CGFloat) size;
  50. #pragma mark HELPER METHODS
  51. /* 
  52.     HELPER METHODS
  53.     to do the actual drawing.
  54. */
  55. + (NSCursor *) cursorForBezierPath: (NSBezierPath *) path 
  56.                       withRotation: (CGFloat) angle 
  57.                            andSize: (CGFloat) size;
  58. + (NSCursor *) cursorForBezierPath: (NSBezierPath *) bP 
  59.                       withRotation: (CGFloat) angle 
  60.                               size: (CGFloat) size 
  61.                        andUnderlay:(NSImage *) underlay;
  62. @end
  1. //  Cursors.m
  2. //  NSBezierPath+Cursors.m
  3. //  Copyright 2008 earthlingsoft. All rights reserved.
  4. //
  5. #import "ESCursors.h"
  6. #define ARROWSIZE 0.525
  7. #define LINETHICKNESS 0.18
  8. @implementation ESCursors
  9. #pragma mark CURVED CURSORS 
  10. + (NSBezierPath *) curvedCursorBezierPathWithRightArrow:(BOOL) rightArrow upArrow:(BOOL) upArrow leftArrow:(BOOL) leftArrow downArrow: (BOOL) downArrow forAngle: (CGFloat) angle {
  11.     const CGFloat handleFraction = 1.0 / 8.0;
  12.     const CGFloat phi = pi / 20.0;
  13.     NSAffineTransform * rotate = [NSAffineTransform transform];
  14.     [rotate rotateByRadians:-phi];
  15.     NSAffineTransform * rotate2 = [NSAffineTransform transform];
  16.     [rotate2 rotateByRadians:-2.0 * phi];
  17.     NSPoint pt;
  18.     
  19.     // left / right end points
  20.     const NSPoint p1 = NSMakePoint(1.0, - sin(phi));
  21.     const NSPoint p20 = NSMakePoint(-p1.x, p1.y);
  22.     
  23.     // left / right arrow top corner
  24.     pt = [rotate transformPoint: NSMakePoint(-ARROWSIZE, ARROWSIZE)];
  25.     const NSPoint p2 = NSMakePoint(p1.x + pt.x, p1.y + pt.y);
  26.     const NSPoint p19 = NSMakePoint(-p2.x, p2.y);
  27.     const NSPoint p38 = NSMakePoint(p1.x - pt.y, p1.y + pt.x);
  28.     const NSPoint p21 = NSMakePoint(-p38.x, p38.y);
  29.     
  30.     // left/ right arrow bottom corner
  31.     pt = [rotate transformPoint: NSMakePoint(0.0,  -(ARROWSIZE - LINETHICKNESS))];
  32.     const NSPoint p3 = NSMakePoint(p2.x +  pt.x, p2.y + pt.y);
  33.     const NSPoint p18 = NSMakePoint(-p3.x, p3.y);
  34.     const NSPoint p37 = NSMakePoint(p38.x - pt.x, p38.y - pt.y);
  35.     const NSPoint p22 = NSMakePoint(-p37.x, p37.y);
  36.     
  37.     // start handles for Bezier path
  38.     pt = [rotate2 transformPoint: NSMakePoint(-handleFraction, 0.0)];
  39.     const NSPoint p4 = NSMakePoint(p3.x + pt.x * 1.1, p3.y + pt.y * 1.1);
  40.     const NSPoint p17 = NSMakePoint(-p4.x, p4.y);
  41.     const NSPoint p36 = NSMakePoint(p37.x + pt.x * 0.9, p37.y + pt.y * 0.9);
  42.     const NSPoint p23 = NSMakePoint(-p36.x, p36.y); 
  43.     
  44.     // off centre arrive point for Bezier path
  45.     const CGFloat theta = asin(LINETHICKNESS);
  46.     CGFloat correction = (1 - cos(theta));
  47.     const NSPoint p7 = NSMakePoint(LINETHICKNESS, LINETHICKNESS - correction);
  48.     const NSPoint p14 = NSMakePoint(-LINETHICKNESS, p7.y);
  49.     const NSPoint p33 = NSMakePoint(LINETHICKNESS, - LINETHICKNESS - correction);
  50.     const NSPoint p26 = NSMakePoint(-LINETHICKNESS, p33.y);
  51.     // off centre arrive handles for Bezier path
  52.     correction = 0.0;
  53.     const NSPoint p5 = NSMakePoint(p7.x + 0.9 * handleFraction, p7.y - correction);
  54.     const NSPoint p16 = NSMakePoint(- p5.x, p5.y);
  55.     const NSPoint p35 = NSMakePoint(p33.x + 0.81 * handleFraction, p33.y - correction);
  56.     const NSPoint p24 = NSMakePoint(-p35.x, p35.y);
  57.     
  58.     // central points and handles for Bezier path
  59.     const NSPoint p8 = NSMakePoint(0.0, LINETHICKNESS);
  60.     const NSPoint p27 = NSMakePoint(0.0, -LINETHICKNESS);
  61.     const NSPoint p6 = NSMakePoint(handleFraction, LINETHICKNESS);
  62.     const NSPoint p15 = NSMakePoint(-handleFraction, LINETHICKNESS);
  63.     const NSPoint p34 = NSMakePoint(handleFraction, LINETHICKNESS);
  64.     const NSPoint p25 = NSMakePoint(-handleFraction, LINETHICKNESS);
  65.     
  66.     // up arrow 
  67.     NSPoint upArrowPoints [6];
  68.     upArrowPoints[0] = NSMakePoint(LINETHICKNESS, 1.0 - ARROWSIZE);
  69.     upArrowPoints[1] = NSMakePoint(ARROWSIZE, 1.0 - ARROWSIZE);
  70.     upArrowPoints[2] = NSMakePoint(0.0, 1.0);
  71.     upArrowPoints[3] = NSMakePoint(- ARROWSIZE, 1.0 - ARROWSIZE);
  72.     upArrowPoints[4] = NSMakePoint(-LINETHICKNESS, 1.0 - ARROWSIZE);
  73.     upArrowPoints[5] = p14;
  74.     
  75.     // down arrow
  76.     NSPoint downArrowPoints [6];
  77.     downArrowPoints[0] = NSMakePoint(-LINETHICKNESS, -1.0 + ARROWSIZE);
  78.     downArrowPoints[1] = NSMakePoint(-ARROWSIZE, -1.0 + ARROWSIZE);
  79.     downArrowPoints[2] = NSMakePoint(0.0, -1.0);
  80.     downArrowPoints[3] = NSMakePoint(ARROWSIZE, -1.0 + ARROWSIZE);
  81.     downArrowPoints[4] = NSMakePoint(LINETHICKNESS, -1.0 + ARROWSIZE);
  82.     downArrowPoints[5] = p33;
  83.     
  84.     // now draw the paths
  85.     NSBezierPath * bP = [NSBezierPath bezierPath];
  86.     
  87.     if (rightArrow) {
  88.         [bP moveToPoint:p1];
  89.         [bP lineToPoint:p2];
  90.         [bP lineToPoint:p3];
  91.         if (upArrow || !leftArrow) {
  92.             // we are not drawing the long curve
  93.             [bP curveToPoint:p7 controlPoint1:p4 controlPoint2:p5];
  94.         }
  95.         else {
  96.             // we are going all the way to the left
  97.             [bP curveToPoint:p8 controlPoint1:p4 controlPoint2:p6];
  98.             [bP curveToPoint:p18 controlPoint1:p15 controlPoint2:p17];
  99.         }
  100.     }
  101.     else {
  102.         // there is no right arrow, begin at p7
  103.         [bP moveToPoint:p7];
  104.     }
  105.     
  106.     if (upArrow) {
  107.         // we are at p7 now, draw the arrow
  108.         [bP appendBezierPathWithPoints:upArrowPoints count:6];
  109.     }
  110.     else if (!upArrow && (!rightArrow || ! leftArrow) && !(rightArrow && leftArrow)) {
  111.         // just move on in a straight line
  112.         [bP lineToPoint:p14];
  113.     }
  114.     // we already covered the !upArrow && leftArrow situation above
  115.     
  116.     
  117.     if (leftArrow) {
  118.         if (upArrow || (!upArrow && !rightArrow)) {
  119.             // we are at p14 and draw line to the the left arrow
  120.             [bP curveToPoint:p18 controlPoint1:p16 controlPoint2:p17];
  121.         }
  122.         
  123.         // We're at p18 now and draw the arrow tip itself
  124.         [bP lineToPoint:p19];
  125.         [bP lineToPoint:p20];
  126.         [bP lineToPoint:p21];
  127.         [bP lineToPoint:p22];
  128.         if (downArrow || !rightArrow) {
  129.             // we need to go to p26
  130.             [bP curveToPoint:p26 controlPoint1:p23 controlPoint2:p24];
  131.         }
  132.         else {
  133.             // we need to stroke all the way to the right arrow
  134.             [bP curveToPoint:p27 controlPoint1:p23 controlPoint2:p25];
  135.             [bP curveToPoint:p37 controlPoint1:p34 controlPoint2:p36];
  136.         }
  137.     
  138.     }
  139.     if (downArrow) {
  140.         // we are at p26 (if leftArrow) or p14 (if !leftArrow) now, insert the arrow
  141.         [bP appendBezierPathWithPoints:downArrowPoints count:6];
  142.     }
  143.     else {
  144.         if (leftArrow) {
  145.             if (!rightArrow) {
  146.                 // we are at p26, move to p33
  147.                 [bP lineToPoint:p33];
  148.             }
  149.         }
  150.         else {
  151.             // we are at p14, stroke to p33
  152.             [bP lineToPoint:p26];
  153.             [bP lineToPoint:p33];
  154.         }
  155.     }
  156.     
  157.     if (rightArrow) {
  158.         if (! (leftArrow && !downArrow)) {
  159.             // we are at p33, curve to p37
  160.             [bP curveToPoint:p37 controlPoint1:p35 controlPoint2:p36];
  161.         }
  162.         // finishing stroke
  163.         [bP lineToPoint:p38];
  164.     }
  165.     // if !rightArrow we started at p7
  166.     
  167.     // close path to get the missing stroke
  168.     [bP closePath];
  169.     
  170.     return bP;
  171.     }
  172.     
  173.     
  174.     
  175. + (NSCursor *) curvedCursorWithRightArrow:(BOOL) rightArrow upArrow:(BOOL) upArrow leftArrow:(BOOL) leftArrow downArrow: (BOOL) downArrow forAngle: (CGFloat) angle size: (CGFloat) size {
  176.     NSBezierPath * bP = [ESCursors curvedCursorBezierPathWithRightArrow:rightArrow upArrow:upArrow leftArrow:leftArrow downArrow:downArrow forAngle: angle];
  177.     
  178.     return [ESCursors cursorForBezierPath:bP withRotation: angle andSize: size];        
  179. }
  180. + (NSCursor *) curvedCursorWithRightArrow:(BOOL) rightArrow upArrow:(BOOL) upArrow leftArrow:(BOOL) leftArrow downArrow: (BOOL) downArrow forAngle: (CGFloat) angle size: (CGFloat) size underlay:(NSImage*) underlay {
  181.     NSBezierPath * bP = [ESCursors curvedCursorBezierPathWithRightArrow:rightArrow upArrow:upArrow leftArrow:leftArrow downArrow:downArrow forAngle: angle];
  182.     
  183.     return [ESCursors cursorForBezierPath:bP withRotation: angle size: size andUnderlay: underlay];     
  184. }
  185. #pragma mark CROSSED CURSORS
  186. + (NSBezierPath *) crossCursorBezierPathForAngle: (CGFloat) angle {
  187.     NSPoint pointArray[6];
  188.     pointArray[0] = NSMakePoint(1.0 - ARROWSIZE, ARROWSIZE);
  189.     pointArray[1] = NSMakePoint(1.0 - ARROWSIZE, LINETHICKNESS);
  190.     pointArray[2] = NSMakePoint(LINETHICKNESS, LINETHICKNESS);
  191.     pointArray[3] = NSMakePoint(LINETHICKNESS, 1.0 - ARROWSIZE);
  192.     pointArray[4] = NSMakePoint(ARROWSIZE, 1.0 - ARROWSIZE);
  193.     pointArray[5] = NSMakePoint(0.0, 1.0);
  194.     
  195.     NSBezierPath * bP = [NSBezierPath bezierPath];
  196.     [bP moveToPoint:NSMakePoint(1.0, 0.0)];
  197.     
  198.     NSAffineTransform * aT = [NSAffineTransform transform];
  199.     [aT rotateByDegrees:-90.0];
  200.     for (NSUInteger i=0; i<4; i++) {
  201.         [bP appendBezierPathWithPoints:pointArray count:6];
  202.         [bP transformUsingAffineTransform:aT];
  203.     }
  204.     
  205.     [bP closePath];
  206.     
  207.     return bP;
  208. }
  209. + (NSCursor *) crossCursorForAngle: (CGFloat) angle withSize: (CGFloat) size {
  210.     NSBezierPath * bP = [ESCursors crossCursorBezierPathForAngle: angle];
  211.     
  212.     return [ESCursors cursorForBezierPath:bP withRotation: angle andSize: size];    
  213. }
  214. #pragma mark THREE PRONGED CURSORS
  215. + (NSBezierPath *) threeProngedCursorBezierPathForAngle: (CGFloat) angle {
  216.     NSPoint pointArray[17];
  217.     pointArray[0] = NSMakePoint(1.0 - ARROWSIZE, ARROWSIZE);
  218.     pointArray[1] = NSMakePoint(1.0 - ARROWSIZE, LINETHICKNESS);
  219.     pointArray[2] = NSMakePoint(LINETHICKNESS, LINETHICKNESS);
  220.     pointArray[3] = NSMakePoint(LINETHICKNESS, 1.0 - ARROWSIZE);
  221.     pointArray[4] = NSMakePoint(ARROWSIZE, 1.0 - ARROWSIZE);
  222.     pointArray[5] = NSMakePoint(0.0, 1.0);
  223.     pointArray[6] = NSMakePoint(- ARROWSIZE, 1.0 - ARROWSIZE);
  224.     pointArray[7] = NSMakePoint(- LINETHICKNESS, 1.0 - ARROWSIZE);
  225.     pointArray[8] = NSMakePoint(- LINETHICKNESS, LINETHICKNESS);
  226.     pointArray[9] = NSMakePoint(-1.0 + ARROWSIZE, LINETHICKNESS);
  227.     pointArray[10] = NSMakePoint(-1.0 + ARROWSIZE, ARROWSIZE);
  228.     pointArray[11] = NSMakePoint(-1.0 , 0.0);
  229.     pointArray[12] = NSMakePoint(- ARROWSIZE, - ARROWSIZE);
  230.     pointArray[13] = NSMakePoint(- ARROWSIZE, - LINETHICKNESS);
  231.     pointArray[14] = NSMakePoint(1.0 - ARROWSIZE, - LINETHICKNESS);
  232.     pointArray[15] = NSMakePoint(1.0 - ARROWSIZE, - ARROWSIZE);
  233.     pointArray[16] = NSMakePoint(1.0, 0.0);
  234.     
  235.     NSBezierPath * bP = [NSBezierPath bezierPath];
  236.     
  237.     [bP appendBezierPathWithPoints:pointArray count:17];
  238.     [bP closePath];
  239.     
  240.     return bP;
  241. }
  242. + (NSCursor *) threeProngedCursorForAngle: (CGFloat) angle withSize: (CGFloat) size {
  243.     NSBezierPath * bP = [ESCursors threeProngedCursorBezierPathForAngle: angle];
  244.     
  245.     return [ESCursors cursorForBezierPath: bP withRotation: angle andSize: size];   
  246. }
  247. #pragma mark ANGLE CURSORS
  248. + (NSBezierPath *) angleCursorBezierPathForAngle: (CGFloat) angle {
  249.     NSPoint pointArray[12];
  250.     pointArray[0] = NSMakePoint(1.0 - ARROWSIZE, ARROWSIZE);
  251.     pointArray[1] = NSMakePoint(1.0 - ARROWSIZE, LINETHICKNESS);
  252.     pointArray[2] = NSMakePoint(LINETHICKNESS, LINETHICKNESS);
  253.     pointArray[3] = NSMakePoint(LINETHICKNESS, 1.0 - ARROWSIZE);
  254.     pointArray[4] = NSMakePoint(ARROWSIZE, 1.0 - ARROWSIZE);
  255.     pointArray[5] = NSMakePoint(0.0, 1.0);
  256.     pointArray[6] = NSMakePoint(- ARROWSIZE, 1.0 - ARROWSIZE);
  257.     pointArray[7] = NSMakePoint(- LINETHICKNESS, 1.0 - ARROWSIZE);
  258.     pointArray[8] = NSMakePoint(- LINETHICKNESS, -LINETHICKNESS);
  259.     pointArray[9] = NSMakePoint(1.0 - ARROWSIZE, - LINETHICKNESS);
  260.     pointArray[10] = NSMakePoint(1.0 - ARROWSIZE, - ARROWSIZE);
  261.     pointArray[11] = NSMakePoint(1.0, 0.0);
  262.     
  263.     NSBezierPath * bP = [NSBezierPath bezierPath];
  264.     
  265.     [bP appendBezierPathWithPoints:pointArray count:12];
  266.     [bP closePath];
  267.     
  268.     return bP;
  269. }
  270. + (NSCursor *) angleCursorForAngle: (CGFloat) angle withSize: (CGFloat) size {
  271.     NSBezierPath * bP = [ESCursors angleCursorBezierPathForAngle: angle];
  272.     
  273.     return [ESCursors cursorForBezierPath: bP withRotation: angle andSize: size];   
  274. }
  275. #pragma mark STRAIGHT CURSORS
  276. + (NSBezierPath *) straightCursorBezierPathForAngle: (CGFloat) angle {
  277.     NSPoint pointArray[5];
  278.     pointArray[0] = NSMakePoint(1.0 - ARROWSIZE, ARROWSIZE);
  279.     pointArray[1] = NSMakePoint(1.0 - ARROWSIZE, LINETHICKNESS);
  280.     pointArray[2] = NSMakePoint(-1.0 + ARROWSIZE, LINETHICKNESS);
  281.     pointArray[3] = NSMakePoint(-1.0 + ARROWSIZE, ARROWSIZE);
  282.     pointArray[4] = NSMakePoint(-1.0, 0.0);
  283.     
  284.     NSBezierPath * bP = [NSBezierPath bezierPath];
  285.     [bP moveToPoint:NSMakePoint(1.0, 0.0)];
  286.     
  287.     NSAffineTransform * aT = [NSAffineTransform transform];
  288.     [aT rotateByDegrees:180.0];
  289.     
  290.     [bP appendBezierPathWithPoints:pointArray count:5];
  291.     [bP transformUsingAffineTransform:aT];
  292.     [bP appendBezierPathWithPoints:pointArray count:5];
  293.     [bP closePath];
  294.     
  295.     return bP;
  296. }
  297. + (NSCursor *) straightCursorForAngle: (CGFloat) angle withSize: (CGFloat) size {
  298.     NSBezierPath * bP = [ESCursors straightCursorBezierPathForAngle: angle];
  299.     
  300.     return [ESCursors cursorForBezierPath: bP withRotation: angle andSize: size];   
  301. }
  302. + (NSBezierPath *) halfStraightCursorBezierPathForAngle: (CGFloat) angle {
  303.     NSPoint pointArray[10];
  304.     pointArray[0] = NSMakePoint(1.0 - ARROWSIZE, ARROWSIZE);
  305.     pointArray[1] = NSMakePoint(1.0 - ARROWSIZE, LINETHICKNESS);
  306.     pointArray[2] = NSMakePoint(-0.2 * LINETHICKNESS, LINETHICKNESS);
  307.     pointArray[3] = NSMakePoint(-0.2 * LINETHICKNESS, 1.0);
  308.     pointArray[4] = NSMakePoint(- 2.5 * LINETHICKNESS, 1.0);
  309.     pointArray[5] = NSMakePoint(- 2.5 * LINETHICKNESS, -1.0);
  310.     pointArray[6] = NSMakePoint(-0.2 * LINETHICKNESS, - 1.0);
  311.     pointArray[7] = NSMakePoint(-0.2 * LINETHICKNESS, - LINETHICKNESS);
  312.     pointArray[8] = NSMakePoint(1.0 - ARROWSIZE, - LINETHICKNESS);
  313.     pointArray[9] = NSMakePoint(1.0 - ARROWSIZE, - ARROWSIZE);
  314.     
  315.     NSBezierPath * bP = [NSBezierPath bezierPath];
  316.     [bP moveToPoint:NSMakePoint(1.0, 0.0)];
  317.     
  318.     [bP appendBezierPathWithPoints:pointArray count:10];
  319.     [bP closePath];
  320.     
  321.     return bP;
  322. }
  323. + (NSCursor *) halfStraightCursorForAngle: (CGFloat) angle withSize: (CGFloat) size {
  324.     NSBezierPath * bP = [ESCursors halfStraightCursorBezierPathForAngle: angle];
  325.     
  326.     return [ESCursors cursorForBezierPath: bP withRotation: angle andSize: size];   
  327. }
  328. #pragma mark HELPER METHODS
  329. #define OUTLINEWIDTH 1.0
  330. + (NSCursor *) cursorForBezierPath: (NSBezierPath *) bP withRotation: (CGFloat) angle andSize: (CGFloat) size {
  331.     return [ESCursors  cursorForBezierPath: bP withRotation: angle size: size andUnderlay:nil];
  332. }
  333. + (NSCursor *) cursorForBezierPath: (NSBezierPath *) bP withRotation: (CGFloat) angle size: (CGFloat) size andUnderlay:(NSImage *) underlay {
  334.     // NSLog(@"Redrawing cursor");
  335.     const CGFloat s = size * sqrt(2.0);     
  336.     NSAffineTransform * aT = [NSAffineTransform transform];
  337.     [aT rotateByRadians:angle];
  338.     [aT scaleBy:size / 2.0 ];
  339.     [bP transformUsingAffineTransform:aT];
  340.     
  341.     aT = [NSAffineTransform transform];
  342.     [aT translateXBy: s/2.0 + 0.65 yBy: s/2.0 + 0.65];
  343.     [bP transformUsingAffineTransform:aT];
  344.     
  345.     NSImage * image = [[NSImage alloc] initWithSize:NSMakeSize(s, s)];
  346.     [image lockFocus];
  347.     if (underlay) {
  348.         [underlay compositeToPoint:NSMakePoint(s/2.0 - underlay.size.width / 2.0 + 0.65, s/2.0 - underlay.size.height/2.0 + 0.65) operation:NSCompositeCopy];
  349.     }
  350.     [[NSColor blackColor] set];
  351.     [bP fill];
  352.     [[NSColor whiteColor] set];
  353.     bP.lineWidth = 1.0;
  354.     [bP stroke];
  355.     // [bP drawPointsAndHandles];
  356.     [image unlockFocus];
  357.     
  358.     NSCursor * theCursor = [[NSCursor alloc] initWithImage:image hotSpot:NSMakePoint(s/2.0, s/2.0)];
  359.     
  360.     return theCursor;
  361. }
  362. @end

 

 

【Elasticsearch】SQL操作相关 本文主要介绍了SQL在ES上的应用,语法上基本没啥变化 阅读详情

相关推荐

从零到一:FAST_LIO与FAST_LIO2算法环境搭建与实战评测

本文详细介绍了FAST_LIO与FAST_LIO2算法的环境搭建与实战评测,包括算法原理、环境配置避坑指南、源码编译技巧及性能对比。FAST_LIO2凭借ikd-tree数据结构在动态环境中表现优异,处理速度提升至15ms,内存占用降低40%。文章还提供了常见问题排查和进阶优化技巧,助力开发者高效实现SLAM应用。

weixin_29271053的博客 486

Elasticsearch Scroll (游标)API详解

http://www.16php.com/archives/380 今天我们来探讨一下Elasticsearch Scroll API,在这之前我们先回顾一下数据库的知识。 1. 相关数据库知识(帮助理解) 传统数据库游标:游标(cursor)是系统为用户开设的一个数据缓冲区,存放SQL语句的执行结果。每个游标区都有一个名字,用户可以用SQL语句逐一从游标中获取记录,并赋

kevin_xiang的专栏 8681

(P2)PALM软件的基本使用流程

上一篇介绍了PALM在Ubuntu系统上的下载安装及安装后的目录文件结构,这一篇以自带的案例介绍软件的基本操作流程。(请转至example_cbl项目) 输入 声明:官网均有各个变量的说明,以下代码来自软件自带案例 palm的最小输入文件是p3d文件,以下是example_cbl_p3d的详细说明。(文件语言格式Fortran,请自行先学习下语言的基本语法。笔者也是新学者,有非常多的问题,很多参数也不能准确的说出是什么意思,还请不吝赐教,谢谢!!!) !几点说明 !1、该运行文件基本由三大块组成:1)in

ysqzhatian的博客 3271

【elasticsearch】进阶检索

三、进阶检索 1、SearchAPI ES支持两种基本方式检索 : 一个是通过使用 REST request URI 发送搜索参数(uri+检索参数) 另一个是通过使用 REST request body 来发送它们(uri+请求体) 1)、检索信息  一切检索从_search开始 GET bank/_search 检索bank下所有信息,包括type和docs GET bank/_sea...

sdaujsj1的博客 307

基于Apache SeaTunnel构建CDC数据同步管道

Apache SeaTunnel是一个数据集成开发平台,其发展经历了几个重要阶段:ETL时代(90年代):面向结构化数据库的数据同步,用于构建数据仓库。MPP和分布式技术流行:使用技术如Hive进行数据仓库的构建。此阶段主要使用mapreduce程序进行数据搬运和转换。数据湖技术流行:重视数据集成,强调先同步数据至数据湖仓储,再进行业务面向的转换和设计。CDC,即变更数据捕获,是一种捕获数据库变更事件(如插入、更新、删除)的技术。

weixin_54625990的博客 2181

告别VBA!用Python+PyWin32自动化你的SolidWorks建模流程(附完整代码)

本文详细介绍了如何利用Python和PyWin32实现SolidWorks建模流程的自动化,替代传统的VBA宏开发。通过环境配置、宏代码转换、高级开发模式及工程化实践等实战内容,帮助机械设计师构建高效、可维护的自动化工作流,显著提升设计效率。

weixin_30485379的博客 377

es sql查询分页问题

1.操作版本 7.12 2.es分页问题总结 1.es的sql分页不支持 limit startIndex,endIndex。开始

yuguang的博客 3455

Win10系统下Protel 99 SE元件库导入报错?3步搞定File is not recognized问题

本文详细介绍了在Win10系统下解决Protel 99 SE元件库导入报错'File is not recognized'的3步终极方案。通过手动修改配置文件、使用专用工具和优化系统兼容性设置,帮助用户快速解决这一经典PCB设计软件的兼容性问题,提升工作效率。

m3n5b7v8c9x的博客 813

Elasticsearch入门

搜索引擎

smilecb的博客 1230

QGIS-空间分析-核密度分析

本文在QGIS软件中使用核密度估计法分析全球历年的地震数据,旨在分析出地震频发且严重的区域,为地震防控提供参考依据。全球历年地震数据来源于网络,仅用于技术学习探索。通过核密度分析,可以观察到南美、美国西部海岸线和太平洋北部区域在全球地震分布状态中是最为集中和强烈的。

imxiezy的博客 2477

VMware ESXi 直通GPU

虚拟机需要独享GPU资源,那么就需要用到DirectPath I/O (直通),ESXi hypervisor 把 GPU 设备直接映射成虚机中的 GPU 设备,供应用使用。注意,内存注意一定要勾选预留,否则开机后报错如下:无法打开虚拟机 win10 的电源。1.ESXi主机,管理,硬件,PCI设备,勾选GPU卡,切换直通,会提示要求重启主机,重启主机之后,该GPU设备直通一栏显示为“活动”。先确认虚拟机是否EFI引导:编辑虚拟机 - 虚拟机选项 - 引导选项 - 固件 - EFI。

liwension的博客 6306

用 ESCursors 自定义箭头光标:从 NSCursor 到 NSBezierPath 的 Cocoa 实践与 TaoToken 配置

用 ESCursors 的 NSBezierPath 绘制旋转箭头光标,在 Xcode 中为 ESCursors.m 加 -fno-objc-arc 即可编译,再配合 TaoToken 官网 https://taotoken.net/?utm_source=taotoken_aicg_blog_end 的统一 Key 验证接口链路,一次跑通光标资源加载与请求自检。

weixin_42103128的博客 188

31、编程中的循环控制:从基础到应用

本文深入探讨了编程中的循环控制结构,涵盖从基础概念到实际应用的多个方面。内容包括预测试与后测试循环的区别、For...Next语句的语法与执行流程、计数器变量的作用域及循环条件的控制机制,并通过太空飞船、学生成绩统计等实例演示了循环在真实场景中的使用。同时提供了常见错误分析、优化建议和拓展应用思路,帮助读者全面掌握循环结构的编程技巧。

swift5iosmith的博客 43

ESCursors 光标类怎么用 TaoToken 统一 Key 接入 AI 编码工具

ESCursors 光标类开发中,用 NSBezierPath 旋转生成 NSCursor 时反复调参效率低。本文给出 Cline、Cursor、Claude Code、Codex 四套可复制配置,统一 Base URL 指向 TaoToken 官网 https://taotoken.net/?utm_source=taotoken_aicg_blog_end ,同一 Key 通道接入 AI 编码工具,并附 curl 验证与 401、local proxy failed 等报错对照。

weixin_42575505的博客 145

怀旧版电脑GBC模拟器

再现原版GBC掌机的界面,电脑运行连游戏界面都一样大小,很怀旧,很真实,(英文版)强烈推荐,很小的文件,很难才找到的。

visio安装包

Microsoft Office Visio 是一款专业的制图软件。利用经过更新的形状、协作工具和数据链接图表,创建专业级图表以简化复杂的信息。

SWEEZY CURSORS网站开发实战:从0到1全流程

自定义区域是最有趣的部分。用户可以通过滑块调整指针大小(从16px到64px)、选择颜色(提供调色板)和控制动画速度(慢速、中速、快速)。这些调整会实时反映在预览区域,利用了React的状态管理特性。

SilverMoon18的博客 684

Camera2Demo

在Camera2 的基础上进行封装,使得Camera2一堆初始化逻辑与Activity分离,降低耦合度,完成预览拍照并保存的操作

改变鼠标指针和光标的网站

这是一个Chrome浏览器的一个插件,可以改变鼠标的指针和光标,然后你也可以自定义。网站的名字叫做sweezy cursors。教程的话可以通过这个链接到我。

qc820512的博客 2万+

Outlook Express 6 (OE6) for Win7/Win8/Win10

英文版 Outlook Express6.0, 兼容Win7/Win10/WinXP,解压就可用。

ES深度分页查询详解

ES分页查询详解

弹指天下 3万+

sweezycursors鼠标光标更换

《如何更换Windows电脑鼠标光标》摘要:在sweezy-cursors.com网站选择喜欢的鼠标样式,下载"正常选择"和"链接选择"两个文件。通过设置-个性化-主题-鼠标光标路径,用下载文件替换默认指针即可完成更换。操作简单,支持自定义电脑光标外观。(字数:88)

wirepuller_king的博客 3万+

实战应用:将sweezy-cursors集成到电商网站提升用户交互体验

主图区域预留了500x500px的展示空间,这是后续实现悬停放大效果的关键容器。上特别流畅,它的实时预览能立即看到光标效果变化,比传统开发方式省去了反复刷新页面的时间。最惊喜的是部署功能,完成开发后直接一键发布,自动生成的访问链接发给产品经理验收特别方便。上线后用户停留时间平均增加了23%,特别是虚拟试穿功能的转化率提升明显。这种增强型交互确实能有效提升电商体验,关键是要把握好动画的克制使用,避免过度设计影响核心购物流程。最近在做一个电商项目时,发现用户对页面交互的流畅度特别敏感。

SilverMoon18的博客 98

Sway光标主题:自定义鼠标指针与动画效果

还在为Sway桌面环境中单调的鼠标指针而烦恼吗?想要打造个性化的光标主题来提升桌面体验?本文将为你全面解析Sway光标主题的自定义配置,从基础设置到高级动画效果,助你打造独一无二的桌面交互体验。 ## 读完本文你将获得 - ✅ Sway光标主题的完整配置方法 - ✅ 环境变量与配置文件的双重控制技巧 - ✅ 多座位(multi-seat)环境下的光标管理 - ✅ XWayland兼容性配置...

gitblog_00760的博客 1184

用AI生成炫酷光标:SWEEZY CURSORS开发指南

预设模板可以降低用户使用门槛,自定义设置则满足个性化需求,实时预览让调整更直观,代码导出方便直接应用到项目中。比如描述需求后,AI能立即给出光标动画的实现思路和示例代码,大大节省了前期调研时间。不需要配置复杂的环境,代码写好后直接就能在线预览效果,还能生成可分享的演示链接。通过特性检测和渐进增强的方式,确保在各种浏览器上都能有良好的表现。关键在于建立一个响应式的预览区域,当用户调整参数时,通过JavaScript动态更新CSS样式。这里需要考虑代码的模块化和可维护性,方便用户直接集成到自己的项目中。

SilverMoon18的博客 1976

How to convert Windows cursor to Linux xcursor

Warning: Now, we get a Windows cursor theme. The Windows cursor theme structure like: We can see Windows cursor filetype is . The is a install script, It donesn’t work on linux, only careful the files Ofcause, the also Windows cursor filetype. How to co

PY_user的博客 2401

推荐文章:Oreo Cursors —— 为你的桌面注入甜蜜的触控体验

推荐文章:Oreo Cursors —— 为你的桌面注入甜蜜的触控体验 项目介绍 在众多开源宝藏中,Oreo Cursors 如同一颗美味的奥利奥,以其独特的设计和自定义能力,为Linux用户的桌面体验增添了新的风味。这款开源项目提供了一套精美绝伦的鼠标指针主题,模仿了我们所爱的奥利奥饼干风格,不仅让人眼前一亮,更让日常操作变得有趣且个性化。 项目技术分析 Oreo Cursors采用了高效且灵活...

gitblog_00094的博客 805

ES:SQL 查询

ES: sql 查询

zhuchunyan_aijia的博客 4435

人大金仓数据库KingbaseES PLSQL的游标变量声明

游标变量就像一个显式游标,不限于一个查询。要创建游标变量,要么声明预定义类型 SYS_REFCURSOR 的变量,要么定义 REF CURSOR 类型,然后声明该类型的变量。游标变量的声明语法[ RETURN游标变量声明语法的解读type:正在定义的REF CURSOR类型的名称RETURN: 指定 RETURN 以定义强 REF CURSOR 类型。省略 RETURN 定义弱 REF CURSOR 类型。db_table_or_view:数据库表或视图的名称,在声明时必须可访问。

arthemis_14的博客 1066
上一篇: 对NSImage的一个扩展
下一篇: NSAffineTransform Examples
nitghost
博客等级 码龄19年 32粉丝 111原创
评论
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

个

红包个数最小为10个

元

红包金额最低5元

当前余额3.43元 前往充值 >
需支付:10.00元
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付元
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值
⌂ 换网址