feat: add non-destructive adjustment layers
This commit is contained in:
26
core/adjustment-layer.ts
Normal file
26
core/adjustment-layer.ts
Normal file
@@ -0,0 +1,26 @@
|
||||
import type { BaseLayer } from "./base-layer";
|
||||
|
||||
export type ColorAdjustment = {
|
||||
brightness: number;
|
||||
contrast: number;
|
||||
saturation: number;
|
||||
colorBalance: { red: number; green: number; blue: number };
|
||||
};
|
||||
|
||||
/**
|
||||
* A non-destructive adjustment affecting pixels already composited beneath it
|
||||
* on its artboard. Adjustment layers are top-level artboard nodes so live WebGL
|
||||
* and exported PNG compositing have identical scope. Transform and masks are
|
||||
* intentionally unsupported.
|
||||
*/
|
||||
export type AdjustmentLayer = BaseLayer & {
|
||||
type: "adjustment";
|
||||
adjustment: ColorAdjustment;
|
||||
};
|
||||
|
||||
export const neutralColorAdjustment: ColorAdjustment = {
|
||||
brightness: 0,
|
||||
contrast: 0,
|
||||
saturation: 0,
|
||||
colorBalance: { red: 0, green: 0, blue: 0 },
|
||||
};
|
||||
@@ -15,6 +15,8 @@ export type {
|
||||
} from "./geometry";
|
||||
export type { ArtboardId, AssetId, DocumentId, GenerationCandidateId, GenerationJobId, LayerId } from "./id";
|
||||
export type { ImageLayer } from "./image-layer";
|
||||
export type { AdjustmentLayer, ColorAdjustment } from "./adjustment-layer";
|
||||
export { neutralColorAdjustment } from "./adjustment-layer";
|
||||
export type { Layer } from "./layer";
|
||||
export type { LayerMask } from "./layer-mask";
|
||||
export { getLayerMask, hasLayerMask } from "./layer-mask-utils";
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
import type { ImageLayer } from "./image-layer";
|
||||
import type { LayerGroup } from "./layer-group";
|
||||
import type { RasterLayer } from "./raster-layer";
|
||||
import type { AdjustmentLayer } from "./adjustment-layer";
|
||||
|
||||
export type Layer = ImageLayer | RasterLayer | LayerGroup;
|
||||
export type Layer = ImageLayer | RasterLayer | LayerGroup | AdjustmentLayer;
|
||||
|
||||
Reference in New Issue
Block a user