painbrush
1.0.21.1.0
src/layer/transform.d.ts+
src/layer/transform.d.tsNew file+42
Index: package/src/layer/transform.d.ts
===================================================================
--- package/src/layer/transform.d.ts
+++ package/src/layer/transform.d.ts
@@ -0,0 +1,42 @@
+import { type XYCoords } from "../pixel.ts";
+import { type Color } from "../color/utils.ts";
+import { type Brush } from "../color/brush.ts";
+import type { Layer, FourChannelLayer, SingleChannelLayer } from "../layer.ts";
+/**
+ * Applies what i think is a nearest-neighbor transform to the layer. only integer transforms _really_ work for precise results but you can get some cool effects with floats
+ * */
+export declare const scaleLayer: (source: Layer, { x: scaleX, y: scaleY }: XYCoords) => Layer;
+export declare const paintLayer: (layer: Layer, painter: (existingColor: Color) => Brush) => Layer;
+/**
+ * Helper for quickly spazzing out layouts, easier than manually
+ * moving stuff
+ */
+export declare const padLayer: (source: Layer, offset: XYCoords) => Layer;
+/**
+ * Turns a 4 bit layer into a 3 bit layer.
+ * */
+export declare const deflateLayer: (layer: FourChannelLayer) => Layer;
+/**
+ * Turns a 1 bit layer into a 3 bit layer.
+ *
+ * Note!!! 1 bit layers are only really supported for fonts bc its a pain to reason about both at once
+ * */
+export declare const inflateLayer: (layer: SingleChannelLayer, fgBrush?: Brush, bgBrush?: Brush) => Layer;
+type LayerParams = {
+ offset?: XYCoords;
+};
+export declare const punchLayerOver: (source: Layer, target: Layer, { offset }?: LayerParams) => void;
+export declare const overlayLayerOver: (source: Layer, target: Layer, { offset }?: LayerParams) => {
+ data: number[];
+ width: number;
+ height: number;
+ id: number;
+ isSingleChannel?: true;
+ isFourChannel?: true;
+};
+/**
+ * Join a bunch of layers.
+ * Note that this is reversed (front to back) so it matches how most layers work in software. its confusing if you think about it but makes sense if you do
+ */
+export declare const overlayLayersOver: (...args: [Layer, LayerParams?][]) => Layer;
+export {};