diff options
| author | Bo Lindbergh <blgl@stacken.kth.se> | 2015-09-02 21:58:55 +0200 |
|---|---|---|
| committer | Simon Tatham <anakin@pobox.com> | 2015-09-02 22:24:47 +0100 |
| commit | eda5a867872e718b62ea52373ec9f44aa0c3bda2 (patch) | |
| tree | a866b7ee863787ba9846ca5d8477b634152e16a9 /osx.m | |
| parent | 6f5386c4b9fea279da29cf9d86b6ae041e95ab6b (diff) | |
| download | puzzles-eda5a867872e718b62ea52373ec9f44aa0c3bda2.zip puzzles-eda5a867872e718b62ea52373ec9f44aa0c3bda2.tar.gz puzzles-eda5a867872e718b62ea52373ec9f44aa0c3bda2.tar.bz2 puzzles-eda5a867872e718b62ea52373ec9f44aa0c3bda2.tar.xz | |
Implement osx_draw_thick_line
Diffstat (limited to 'osx.m')
| -rw-r--r-- | osx.m | 21 |
1 files changed, 21 insertions, 0 deletions
@@ -1352,6 +1352,26 @@ static void osx_draw_line(void *handle, int x1, int y1, int x2, int y2, int colo NSRectFill(NSMakeRect(x1, fe->h-y1-1, 1, 1)); NSRectFill(NSMakeRect(x2, fe->h-y2-1, 1, 1)); } + +static void osx_draw_thick_line( + void *handle, float thickness, + float x1, float y1, + float x2, float y2, + int colour) +{ + frontend *fe = (frontend *)handle; + NSBezierPath *path = [NSBezierPath bezierPath]; + + assert(colour >= 0 && colour < fe->ncolours); + [fe->colours[colour] set]; + [[NSGraphicsContext currentContext] setShouldAntialias: YES]; + [path setLineWidth: thickness]; + [path setLineCapStyle: NSButtLineCapStyle]; + [path moveToPoint: NSMakePoint(x1, fe->h-y1)]; + [path lineToPoint: NSMakePoint(x2, fe->h-y2)]; + [path stroke]; +} + static void osx_draw_rect(void *handle, int x, int y, int w, int h, int colour) { frontend *fe = (frontend *)handle; @@ -1541,6 +1561,7 @@ const struct drawing_api osx_drawing = { NULL, NULL, NULL, NULL, NULL, NULL, /* {begin,end}_{doc,page,puzzle} */ NULL, NULL, /* line_width, line_dotted */ osx_text_fallback, + osx_draw_thick_line, }; void deactivate_timer(frontend *fe) |