Skip to content

Commit ec7265d

Browse files
committed
Support dashed strokes in (lispkit draw). Bump LispKit version to 1.5.0 and LispKit Shell version to 2.0.1.
1 parent 6ab7cc9 commit ec7265d

File tree

6 files changed

+39
-7
lines changed

6 files changed

+39
-7
lines changed

CHANGELOG.md

+9
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,14 @@
11
# Changelog
22

3+
## 1.5.0 (2018-08-10)
4+
- Allow importing multiple libraries with one `import` invocation
5+
- Mark continuations correctly and fix `continuation?`
6+
- Turn `current-input-port`, `current-output-port`, and `current-error-port` into parameter objects
7+
- New library: `(lispkit draw)`
8+
- New SRFI libraries: SRFI 111, SRFI 112, SRFI 113
9+
- Fixed bugs in SRFI 69
10+
- Extend `(lispkit test)` to be more compatible to similar libraries
11+
312
## 1.4.1 (2018-06-23)
413
- Fix memory leaks
514
- Provide a comfortable command-line interface supporting both a read-eval-print loop and the execution of scripts

Sources/LispKit/Info.plist

+1-1
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
<key>CFBundlePackageType</key>
1616
<string>FMWK</string>
1717
<key>CFBundleShortVersionString</key>
18-
<string>1.4.1</string>
18+
<string>1.5.0</string>
1919
<key>CFBundleSignature</key>
2020
<string>????</string>
2121
<key>CFBundleVersion</key>

Sources/LispKit/Primitives/DrawingLibrary.swift

+26-3
Original file line numberDiff line numberDiff line change
@@ -123,6 +123,7 @@ public final class DrawingLibrary: NativeLibrary {
123123
self.define(Procedure("enable-transformation", enableTransformation))
124124
self.define(Procedure("disable-transformation", disableTransformation))
125125
self.define(Procedure("draw", draw))
126+
self.define(Procedure("draw-dashed", drawDashed))
126127
self.define(Procedure("fill", fill))
127128
self.define(Procedure("draw-text", drawText))
128129
self.define(Procedure("draw-image", drawImage))
@@ -326,9 +327,9 @@ public final class DrawingLibrary: NativeLibrary {
326327
throw RuntimeError.eval(.invalidSize, size)
327328
}
328329
try self.drawing(from: drawing).append(.setShadow(try self.color(from: color),
329-
dx: w,
330-
dy: h,
331-
blurRadius: try r.asDouble(coerce: true)))
330+
dx: w,
331+
dy: h,
332+
blurRadius: try r.asDouble(coerce: true)))
332333
return .void
333334
}
334335

@@ -353,6 +354,28 @@ public final class DrawingLibrary: NativeLibrary {
353354
return .void
354355
}
355356

357+
private func drawDashed(shape: Expr,
358+
lengths: Expr,
359+
phase: Expr,
360+
width: Expr?,
361+
drawing: Expr?) throws -> Expr {
362+
let shape = try self.shape(from: shape)
363+
var dashLengths: [Double] = []
364+
var list = lengths
365+
while case .pair(let len, let rest) = list {
366+
dashLengths.append(try len.asDouble(coerce: true))
367+
list = rest
368+
}
369+
guard list.isNull else {
370+
throw RuntimeError.type(lengths, expected: [.properListType])
371+
}
372+
let phase = try phase.asDouble(coerce: true)
373+
let width = try width?.asDouble(coerce: true) ?? 1.0
374+
try self.drawing(from: drawing).append(
375+
.strokeDashed(shape, width: width, lengths: dashLengths, phase: phase))
376+
return .void
377+
}
378+
356379
private func fill(shape: Expr, drawing: Expr?) throws -> Expr {
357380
try self.drawing(from: drawing).append(.fill(try self.shape(from: shape)))
358381
return .void

Sources/LispKitRepl/AppInfo.swift

+1-1
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ public struct AppInfo {
3232
// Version of the application
3333
public static let version =
3434
(Bundle.main.infoDictionary?["CFBundleShortVersionString"] as? String) ??
35-
"2.0.0"
35+
"2.0.1"
3636

3737
// Copyright message
3838
public static let copyright =

Sources/LispKitRepl/Info.plist

+1-1
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
<key>CFBundlePackageType</key>
1616
<string>APPL</string>
1717
<key>CFBundleShortVersionString</key>
18-
<string>2.0.0</string>
18+
<string>2.0.1</string>
1919
<key>CFBundleSignature</key>
2020
<string>????</string>
2121
<key>CFBundleVersion</key>

Sources/LispKitRepl/main.swift

+1-1
Original file line numberDiff line numberDiff line change
@@ -123,7 +123,7 @@ var cmdLineArgs = flags.parameters.isEmpty ? [CommandLine.arguments.first!] : fl
123123
#if SPM
124124
let context = Context(console: console,
125125
implementationName: "LispKit",
126-
implementationVersion: "1.4.1",
126+
implementationVersion: "1.5.0",
127127
commandLineArguments: cmdLineArgs,
128128
includeInternalResources: false,
129129
includeDocumentPath: searchDocs.wasSet ? "LispKit" : nil)

0 commit comments

Comments
 (0)