painbrush
1.0.21.1.0
src/layer/make-rectangle.ts−
src/layer/make-rectangle.tsDeleted−42
Index: package/src/layer/make-rectangle.ts
===================================================================
--- package/src/layer/make-rectangle.ts
+++ package/src/layer/make-rectangle.ts
@@ -1,42 +0,0 @@
-import { COLOR_BLACK } from "../color/utils.ts";
-import {
- type Brush,
- solidFillBrush,
- alphaBrush,
-} from "../color/brush.ts";
-import type { Layer } from "../layer.ts";
-import type { XYCoords } from "../pixel.ts";
-
-/**
-This makes a rectangle with any fill.
-Useful for the initial canvas
-*/
-export const makeRectangleLayer = (
- { x: width, y: height }: XYCoords,
- brush: Brush = solidFillBrush(COLOR_BLACK),
-): Layer => {
- let data = [];
- const meta = {
- width,
- id: Math.random(),
- height,
- };
-
- for (let index = 0; index < width * height * 3; index = index + 3) {
- const color = brush(index, meta);
- data.push(color[0]);
- data.push(color[1]);
- data.push(color[2]);
- }
-
- return {
- ...meta,
- data,
- };
-};
-
-/**
- * Utility method to make a blank rectangle, makes a great bg
- */
-export const makeBlankLayer = (coords: XYCoords) =>
- makeRectangleLayer(coords, alphaBrush());