painbrush

1.0.21.1.0
src/color/brush.js
+src/color/brush.jsNew file
+14
Index: package/src/color/brush.js
===================================================================
--- package/src/color/brush.js
+++ package/src/color/brush.js
@@ -0,0 +1,14 @@
+import { getPixelXYCoords } from "../pixel.js";
+import { COLOR_ALPHA, COLOR_BLACK } from "./utils.js";
+export const solidFillBrush = (color) => () => color;
+export const borderBrush = (size = 1, borderColor = COLOR_BLACK, innerColor = COLOR_ALPHA) => (index, layer) => {
+    const { x, y } = getPixelXYCoords(index, layer);
+    if (y < size || layer.height - size <= y) {
+        return borderColor;
+    }
+    if (x < size || layer.width - size <= x) {
+        return borderColor;
+    }
+    return innerColor;
+};
+export const alphaBrush = () => () => COLOR_ALPHA;