Skip to content

Commit 914943f

Browse files
committed
Refactor documentation for clarity and consistency across API files
1 parent 2610649 commit 914943f

File tree

14 files changed

+124
-88
lines changed

14 files changed

+124
-88
lines changed

README.md

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,11 @@
11
# Stipple Effect API specification
22

3-
This is the API (application programming interface) specification for scripting in *Stipple Effect*. It covers all the extensions made to the [*DeltaScript* base language](https://github.com/jbunke/deltascript) for scripting in *Stipple Effect*.
3+
This is the API (application programming interface) specification for scripting in *Stipple Effect*. It covers all the extensions made to the [*DeltaScript* base language![](./assets/external.png)](https://github.com/jbunke/deltascript) for scripting in *Stipple Effect*.
44

55
For a general overview of scripting, please visit [the documentation](../docs/scripting.md).
66

77
### Content
8+
89
* Namespaces
910
* [Global namespace (`$SE`)](global.md)
1011
* [`$Graphics`](graphics.md)
@@ -20,13 +21,14 @@ For a general overview of scripting, please visit [the documentation](../docs/sc
2021
* [`color`](color.md)
2122

2223
### Changelog
23-
See changes made to the API across releases [here](changelog.md).
2424

25-
___
25+
See changes made to the API across *Stipple Effect* releases [here](changelog.md).
26+
27+
---
2628

2729
**SEE ALSO**
2830

29-
* [*Stipple Effect* source code](https://github.com/stipple-effect/stipple-effect)
30-
* [Script examples](https://github.com/stipple-effect/script-examples)
31-
* [*DeltaScript for Stipple Effect* - VS Code syntax highlighting extension](https://marketplace.visualstudio.com/items?itemName=jordanbunke.deltascript-for-stipple-effect)
32-
* [*Stipple Effect* video playlist (w/ tutorials)](https://www.youtube.com/playlist?list=PLy71S74rTLnPEwYYtAXvh2er8QBvWIwRL)
31+
* [Script examples![](./assets/external.png)](https://github.com/stipple-effect/script-examples)
32+
* [*DeltaScript for Stipple Effect* - VS Code syntax highlighting extension![](./assets/external.png)](https://marketplace.visualstudio.com/items?itemName=jordanbunke.deltascript-for-stipple-effect)
33+
* [*Stipple Effect* video playlist (w/ tutorials)![](./assets/external.png)](https://www.youtube.com/playlist?list=PLy71S74rTLnPEwYYtAXvh2er8QBvWIwRL)
34+
* [*Stipple Effect* source code![](./assets/external.png)](https://github.com/stipple-effect/stipple-effect)

api-sidebar.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
* [`$SE`](global.md) (global)
33
* [`$Graphics`](graphics.md)
44
* [`$Math`](math.md)
5-
* Types
5+
* API types
66
* [`layer`](layer.md)
77
* [`light`](light.md)
88
* [`palette`](palette.md)

assets/external.png

108 Bytes
Loading

changelog.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
1-
# API Changelog
2-
31
[`< Home`](README.md)
42

3+
# API Changelog
4+
55
## 1.2.2
66

77
### Added:

color.md

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
1-
# `color` extension
2-
31
[`< API`](README.md)
42

5-
This API inherits the `color` type from the *DeltaScript* base language and extends it in the ways described below.
3+
# `color` extension
4+
5+
This API inherits the `color` type from the [*DeltaScript* base language![](./assets/external.png)](https://github.com/jbunke/deltascript/blob/master/docs/color-sl.md) and extends it in the ways described below.
66

77
## Properties
88

@@ -12,16 +12,20 @@ These definitions use the arbitrary `color` object `C` as the caller.
1212
```js
1313
C.hue -> float
1414
```
15-
Returns the hue of a color `C` as a `float` ranging from 0.0 to 1.0. Since hue is a circular/angular property, a hue of 0.0 and a hue of 1.0 are identical. A hue of 0.0 is conventionally assigned to red ([`#ff0000`](https://en.wikipedia.org/wiki/Red), for example), while green is assigned to 1/3 (120°) and blue is assigned to 2/3 (240°). You can read more about hue [here](https://en.wikipedia.org/wiki/Hue#Defining_hue_in_terms_of_RGB).
15+
Returns the hue of a color `C` as a `float` ranging from 0.0 to 1.0. Since hue is a circular/angular property, a hue of 0.0 and a hue of 1.0 are identical. A hue of 0.0 is conventionally assigned to red ([`#ff0000`![](./assets/external.png)](https://en.wikipedia.org/wiki/Red), for example), while green is assigned to 1/3 (120°) and blue is assigned to 2/3 (240°).
16+
17+
**Read more:**
18+
19+
* [Defining hue in terms of RGB![](./assets/external.png)](https://en.wikipedia.org/wiki/Hue#Defining_hue_in_terms_of_RGB)
1620

1721
### Saturation (`sat`)
1822
```js
1923
C.sat -> float
2024
```
21-
Returns the [saturation](https://en.wikipedia.org/wiki/Colorfulness#Saturation) of a color `C` as a `float` ranging from 0.0 to 1.0.
25+
Returns the [saturation![](./assets/external.png)](https://en.wikipedia.org/wiki/Colorfulness#Saturation) of a color `C` as a `float` ranging from 0.0 to 1.0.
2226

2327
### Value (`val`)
2428
```js
2529
C.val -> float
2630
```
27-
Returns the [value](https://en.wikipedia.org/wiki/HSL_and_HSV) of a color `C` as a `float` ranging from 0.0 to 1.0.
31+
Returns the [value![](./assets/external.png)](https://en.wikipedia.org/wiki/HSL_and_HSV) of a color `C` as a `float` ranging from 0.0 to 1.0.

global.md

Lines changed: 13 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,10 @@
1+
[`< API`](README.md)
2+
13
# Global namespace (`$SE`)
24

35
[`< API`](README.md)
46

5-
The global namespace for this API is `$SE`. Most Stipple Effect functions that are not called on an object are called on the global namespace.
7+
The global namespace for this API is `$SE`. Most API functions that are not called on an object are called on the global namespace.
68

79
---
810

@@ -104,7 +106,7 @@ Any of the following will result in runtime errors:
104106
{ '/', '\\', ':', '*', '?', '"', '<', '>', '|', '{', '}' }
105107
```
106108

107-
**Reading material:**
109+
**Read more:**
108110
* [Save type constants](global.md/#save-type-constants)
109111

110112
### `read_script`
@@ -122,7 +124,7 @@ Any of the following will result in runtime errors:
122124

123125
Script execution will terminate if the child script fails its semantic error check.
124126

125-
**Reading material:**
127+
**Read more:**
126128
* [Child scripts in the documentation](../docs/child-scripts.md)
127129

128130
### `transform`
@@ -245,7 +247,11 @@ Any of the following will cause the function not to execute:
245247
```js
246248
$SE.outline(int[]{} selection, int[] side_mask) -> int[]{}
247249
```
248-
Returns the outline of the initial selection `selection` when outlined with the side mask `side_mask`. The outlining algorithm can be found [here](https://github.com/stipple-effect/stipple-effect/blob/master/src/com/jordanbunke/stipple_effect/selection/Outliner.java).
250+
Returns the outline of the initial selection `selection` when outlined with the side mask `side_mask`.
251+
252+
**Read more:**
253+
254+
* [Outlining algorithm in the source code![](./assets/external.png)](https://github.com/stipple-effect/stipple-effect/blob/master/src/com/jordanbunke/stipple_effect/selection/Outliner.java)
249255

250256
**Throws:**
251257

@@ -301,8 +307,9 @@ Returns a set of ordered pairs that represent the pixel coordinates of the resul
301307
* if `true`, adjacency is defined as cardinal adjacency + diagonal adjacency
302308
* if `false`, pixels must be cardinally adjacent in order to be considered
303309

304-
**Reading material:**
305-
* [`wand` and `fill` search algorithm implementation](https://github.com/stipple-effect/stipple-effect/blob/master/src/com/jordanbunke/stipple_effect/tools/ToolThatSearches.java)
310+
**Read more:**
311+
312+
* [`wand` and `fill` search algorithm implementation![](./assets/external.png)](https://github.com/stipple-effect/stipple-effect/blob/master/src/com/jordanbunke/stipple_effect/tools/ToolThatSearches.java)
306313

307314
### ![](https://raw.githubusercontent.com/stipple-effect/stipple-effect/master/res/icons/fill.png) `fill`
308315
```js

graphics.md

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
1-
# `$Graphics`
2-
31
[`< API`](README.md)
42

3+
# `$Graphics`
4+
55
The `$Graphics` namespace houses graphics utilities for processing images and colors.
66

77
---
@@ -24,7 +24,7 @@ $Graphics.DL_BR = [ 1.0, -1.0, 1.0 ] // From the bottom-right
2424
$Graphics.DL_DIRECT = [ 0.0, 0.0, 1.0 ] // Frontlit
2525
```
2626

27-
**Reading material:**
27+
**Read more:**
2828
* [`light`](./light.md)
2929
* [Directional light constructor](#dir_light)
3030

@@ -43,7 +43,7 @@ A directional light, as opposed to a point light, shines with a non-dimming lumi
4343

4444
`light` objects are mutable. Arguments `luminosity`, `c`, and `direction` passed to the constructor can be overridden by using the mutator methods of `light`.
4545

46-
**Reading material:**
46+
**Read more:**
4747
* [Light direction constants](#light-direction-constants)
4848

4949
### `gen_lookup`
@@ -53,8 +53,8 @@ $Graphics.gen_lookup(image source, bool dim) -> image
5353

5454
Takes an image `source` and generates a corresponding lookup image where every non-transparent pixel in `source` is assigned a unique opaque RGB color. The flag `dim` determines whether the lookup will have vertical or horizontal striping.
5555

56-
**Reading material:**
57-
* [Lookup generation algorithm implementation](https://github.com/jbunke/delta-time/blob/master/sprite/src/com/jordanbunke/delta_time/sprite/UVMapping.java#L85)
56+
**Read more:**
57+
* [Lookup generation algorithm implementation![](./assets/external.png)](https://github.com/jbunke/delta-time/blob/master/sprite/src/com/jordanbunke/delta_time/sprite/UVMapping.java#L85)
5858
* [Dimension constants](./global.md#dimension-constants)
5959

6060
### `lerp_color`
@@ -118,6 +118,6 @@ Otherwise, returns the following image:
118118
* sets position `(ax, ay)` of the output image to `c`
119119

120120

121-
**Reading material:**
122-
* [UV mapping algorithm implementation](https://github.com/jbunke/delta-time/blob/master/sprite/src/com/jordanbunke/delta_time/sprite/UVMapping.java#L40)
121+
**Read more:**
122+
* [UV mapping algorithm implementation![](./assets/external.png)](https://github.com/jbunke/delta-time/blob/master/sprite/src/com/jordanbunke/delta_time/sprite/UVMapping.java#L40)
123123
* [`gen_lookup()`](#gen_lookup) - generating a naive lookup map for a `texture`

layer.md

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,12 @@
1+
[`< API`](README.md)
2+
13
# `layer`
24

3-
[`< API`](README.md)
5+
`layer` objects created in scripts are internally represented by the [`LayerRep`![](./assets/external.png)](https://github.com/stipple-effect/stipple-effect/blob/master/src/com/jordanbunke/stipple_effect/scripting/util/LayerRep.java) class from the *Stipple Effect* source code.
46

5-
`layer`'s correspondent type in the Stippe Effect source code is [`LayerRep`](https://github.com/stipple-effect/stipple-effect/blob/master/src/com/jordanbunke/stipple_effect/scripting/util/LayerRep.java).
7+
**Note:**
68

7-
**Note:** `LayerRep` stores an immutable reference to the project that contains the layer, and to its layer index. This means that a `layer` reference in script can be "spoiled" - i.e. cease to refer to the same layer or no longer refer to a valid layer at all - if the number of layers in the project are changed, or if the order of the layers in the project is changed.
9+
`LayerRep` stores an immutable reference to the project that contains the layer, and to its layer index. This means that a `layer` reference in script can be "spoiled" - i.e. cease to refer to the same layer or no longer refer to a valid layer at all - if the number of layers in the project are changed, or if the order of the layers in the project is changed.
810

911
---
1012

light.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
1-
# `light`
2-
31
[`< API`](README.md)
42

5-
`light`'s correspondent type in the Stippe Effect source code is [`Light`](https://github.com/stipple-effect/stipple-effect/blob/master/src/com/jordanbunke/stipple_effect/scripting/util/Light.java).
3+
# `light`
4+
5+
`light` objects created in scripts are internally represented by the [`Light`![](./assets/external.png)](https://github.com/stipple-effect/stipple-effect/blob/master/src/com/jordanbunke/stipple_effect/scripting/util/Light.java) class from the *Stipple Effect* source code.
66

77
---
88

math.md

Lines changed: 17 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,12 @@
1-
# `$Math`
2-
31
[`< API`](README.md)
42

3+
# `$Math`
4+
55
The `$Math` namespace houses mathematical constants and functions that may be useful when writing scripts.
66

77
**Note:**
88

9-
There are additional mathematical functions available in DeltaScript that are implemented as native functions. These include:
10-
* `abs()` - [absolute value](https://en.wikipedia.org/wiki/Absolute_value)
11-
* `min()`, `max()` - minimum/maximum of two numbers or of a collection
12-
* `clamp(min, v, max)` - returns `min` if `v < min`, `max` if `v > max`, `v` otherwise
13-
14-
[**\[read more\]**](https://github.com/jbunke/deltascript) <!-- TODO - update link -->
9+
There are additional mathematical functions available in *DeltaScript* that are included as part of the [standard library![](./assets/external.png)](https://github.com/jbunke/deltascript/blob/master/docs/std-lib.md).
1510

1611
---
1712

@@ -21,13 +16,15 @@ There are additional mathematical functions available in DeltaScript that are im
2116
```js
2217
$Math.PI
2318
```
24-
[Pi](https://en.wikipedia.org/wiki/Pi) represented as a `float`.
19+
[Pi![](./assets/external.png)](https://en.wikipedia.org/wiki/Pi) represented as a `float`.
2520

2621
**Note:**
2722

28-
The `float` type in DeltaScript is actually implemented as a [double-precision floating point number](https://en.wikipedia.org/wiki/Double-precision_floating-point_format), and is internally mapped to Java's `double` primitive type.
23+
The `float` type in DeltaScript is actually implemented as a [double-precision floating point number![](./assets/external.png)](https://en.wikipedia.org/wiki/Double-precision_floating-point_format), and is internally mapped to Java's `double` primitive type.
24+
25+
**Read more:**
2926

30-
[**\[`Double` wrapper class Java documentation\]**](https://docs.oracle.com/javase/8/docs/api/java/lang/Double.html)
27+
* [`Double` wrapper class Java documentation![](./assets/external.png)](https://docs.oracle.com/javase/8/docs/api/java/lang/Double.html)
3128

3229
---
3330

@@ -39,55 +36,55 @@ $Math.cos(float rad) -> float
3936
```
4037
Returns the cosine of an angle (expressed in radians) `rad`.
4138

42-
**Wraps** Java's [`Math.cos(double)`](https://docs.oracle.com/javase/8/docs/api/java/lang/Math.html#cos-double-) function
39+
**Wraps** Java's [`Math.cos(double)`![](./assets/external.png)](https://docs.oracle.com/javase/8/docs/api/java/lang/Math.html#cos-double-) function
4340

4441
### `sin`
4542
```js
4643
$Math.sin(float rad) -> float
4744
```
4845
Returns the sine of an angle (expressed in radians) `rad`.
4946

50-
**Wraps** Java's [`Math.sin(double)`](https://docs.oracle.com/javase/8/docs/api/java/lang/Math.html#sin-double-) function
47+
**Wraps** Java's [`Math.sin(double)`![](./assets/external.png)](https://docs.oracle.com/javase/8/docs/api/java/lang/Math.html#sin-double-) function
5148

5249
### `tan`
5350
```js
5451
$Math.tan(float rad) -> float
5552
```
5653
Returns the tangent of an angle (expressed in radians) `rad`.
5754

58-
**Wraps** Java's [`Math.tan(double)`](https://docs.oracle.com/javase/8/docs/api/java/lang/Math.html#tan-double-) function
55+
**Wraps** Java's [`Math.tan(double)`![](./assets/external.png)](https://docs.oracle.com/javase/8/docs/api/java/lang/Math.html#tan-double-) function
5956

6057
### `acos`
6158
```js
6259
$Math.acos(float ratio) -> float
6360
```
6461
Returns the arc cosine of `ratio`.
6562

66-
**Wraps** Java's [`Math.acos(double)`](https://docs.oracle.com/javase/8/docs/api/java/lang/Math.html#acos-double-) function
63+
**Wraps** Java's [`Math.acos(double)`![](./assets/external.png)](https://docs.oracle.com/javase/8/docs/api/java/lang/Math.html#acos-double-) function
6764

6865
### `asin`
6966
```js
7067
$Math.asin(float ratio) -> float
7168
```
7269
Returns the arc sine of `ratio`.
7370

74-
**Wraps** Java's [`Math.asin(double)`](https://docs.oracle.com/javase/8/docs/api/java/lang/Math.html#asin-double-) function
71+
**Wraps** Java's [`Math.asin(double)`![](./assets/external.png)](https://docs.oracle.com/javase/8/docs/api/java/lang/Math.html#asin-double-) function
7572

7673
### `atan`
7774
```js
7875
$Math.atan(float ratio) -> float
7976
```
8077
Returns the arc tangent of `ratio`.
8178

82-
**Wraps** Java's [`Math.atan(double)`](https://docs.oracle.com/javase/8/docs/api/java/lang/Math.html#atan-double-) function
79+
**Wraps** Java's [`Math.atan(double)`![](./assets/external.png)](https://docs.oracle.com/javase/8/docs/api/java/lang/Math.html#atan-double-) function
8380

8481
### `sqrt`
8582
```js
8683
$Math.sqrt(float n) -> float
8784
```
8885
Returns the square root of a value `n`.
8986

90-
**Wraps** Java's [`Math.sqrt(double)`](https://docs.oracle.com/javase/8/docs/api/java/lang/Math.html#sqrt-double-) function
87+
**Wraps** Java's [`Math.sqrt(double)`![](./assets/external.png)](https://docs.oracle.com/javase/8/docs/api/java/lang/Math.html#sqrt-double-) function
9188

9289
### `round`
9390
```js
@@ -101,12 +98,12 @@ $Math.floor(float n) -> float
10198
```
10299
Returns the largest integer less than or equal to `n`, expressed as a `float`.
103100

104-
**Wraps** Java's [`Math.floor(double)`](https://docs.oracle.com/javase/8/docs/api/java/lang/Math.html#floor-double-) function
101+
**Wraps** Java's [`Math.floor(double)`![](./assets/external.png)](https://docs.oracle.com/javase/8/docs/api/java/lang/Math.html#floor-double-) function
105102

106103
### `ceil`
107104
```js
108105
$Math.ceil(float n) -> float
109106
```
110107
Returns the smallest integer greater than or equal to `n`, expressed as a `float`.
111108

112-
**Wraps** Java's [`Math.ceil(double)`](https://docs.oracle.com/javase/8/docs/api/java/lang/Math.html#ceil-double-) function
109+
**Wraps** Java's [`Math.ceil(double)`![](./assets/external.png)](https://docs.oracle.com/javase/8/docs/api/java/lang/Math.html#ceil-double-) function

palette.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
1-
# `palette`
2-
31
[`< API`](README.md)
42

5-
`palette`'s correspondent type in the Stippe Effect source code is [`Palette`](https://github.com/stipple-effect/stipple-effect/blob/master/src/com/jordanbunke/stipple_effect/palette/Palette.java).
3+
# `palette`
4+
5+
`palette` objects created in scripts are internally represented by the [`Palette`![](./assets/external.png)](https://github.com/stipple-effect/stipple-effect/blob/master/src/com/jordanbunke/stipple_effect/palette/Palette.java) class from the *Stipple Effect* source code.
66

77
---
88

0 commit comments

Comments
 (0)