@pictogrammers/components 0.5.6 → 0.5.7

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@pictogrammers/components",
3
3
  "type": "module",
4
- "version": "0.5.6",
4
+ "version": "0.5.7",
5
5
  "license": "MIT",
6
6
  "author": "Austin Andrews",
7
7
  "scripts": {
@@ -1412,6 +1412,28 @@ export default class PgInputPixelEditor extends HTMLElement {
1412
1412
  });
1413
1413
  }
1414
1414
 
1415
+ /**
1416
+ * Draw pixel.
1417
+ * @param grid 2d grid of colors
1418
+ * @param layer Layer to apply the pixel.
1419
+ */
1420
+ drawGrid(grid: number[][], layer = this.#layer) {
1421
+ grid.forEach((row, y) => {
1422
+ row.forEach((color, x) => {
1423
+ this.#setPixel(x, y, color, layer);
1424
+ });
1425
+ })
1426
+ }
1427
+
1428
+ /**
1429
+ * Draw a single pixel.
1430
+ */
1431
+ drawPixel(x: number, y: number, color: number, layer = this.#layer) {
1432
+ this.#setPixel(x, y, color, layer);
1433
+ }
1434
+
1435
+ // todo: add other draw commands
1436
+
1415
1437
  /**
1416
1438
  * Flatten layers, always merges to lowest layer
1417
1439
  * Note 0 is the lowest layer.