Constructor
new Stippling(canvas_height, canvas_width, amount_of_init_stipples, delta_threshold, is_black_white, img_values)
Constructor
Parameters:
Name | Type | Description |
---|---|---|
canvas_height |
Number | The height of the canvas where the stippling data is sampled |
canvas_width |
Number | The height of the canvas where the stippling data is sampled |
amount_of_init_stipples |
Number | The initial amount of stipples |
delta_threshold |
Number | The amount the error threshold will be increased in each iteration |
is_black_white |
Boolean | Type of input data, either rgb image or greyscale |
img_values |
Array.<Number> | The data values on which the stippling should be performed |
- Source:
Methods
drawStipples()
Draw the stipples to the target svg
- Source:
iterate() → {Array.<Number>}
Iterate performs one iteration of the stippling algorithm
Here a single stipple is deleted, split or moved
- Source:
Returns:
- An array that contains the number of split and deleted stipples
- Type
- Array.<Number>
rgbToInt(red, green, blue) → {Number}
Convert an rgb value to an integer. If the image is greyscale only the red channel is used
Parameters:
Name | Type | Description |
---|---|---|
red |
Number | Red value (0-255) |
green |
Number | Green value (0-255) |
blue |
Number | Blue value (0-255) |
- Source:
Returns:
- An integer value between 0 and 16 581 375
- Type
- Number