ag-psd
Version:
Library for reading and writing PSD files
197 lines (196 loc) • 5.63 kB
TypeScript
import { BlendMode, PatternInfo } from './psd';
export interface Abr {
brushes: Brush[];
samples: SampleInfo[];
patterns: PatternInfo[];
}
export interface SampleInfo {
id: string;
bounds: {
x: number;
y: number;
w: number;
h: number;
};
alpha: Uint8Array;
}
export interface BrushDynamics {
control: 'off' | 'fade' | 'pen pressure' | 'pen tilt' | 'stylus wheel' | 'initial direction' | 'direction' | 'initial rotation' | 'rotation';
steps: number;
jitter: number;
minimum: number;
}
type DynamicBrushShapeShape = 'round point' | 'round blunt' | 'round curve' | 'round angle' | 'round fan' | 'flat point' | 'flat blunt' | 'flat curve' | 'flat angle' | 'flat fan';
type TipsBrushShapeShape = 'erodible point' | 'erodible flat' | 'erodible round' | 'erodible square' | 'erodible triangle' | 'custom';
export type BrushShape = ComputedBrushShape | SampledBrushShape | TipsBrushShape | DynamicBrushShape;
interface ComputedBrushShape {
type: 'computed';
size: number;
angle: number;
roundness: number;
hardness: number;
spacingOn: boolean;
spacing: number;
flipX: boolean;
flipY: boolean;
}
interface SampledBrushShape {
type: 'sampled';
name: string;
size: number;
angle: number;
roundness: number;
spacingOn: boolean;
spacing: number;
flipX: boolean;
flipY: boolean;
sampledData: string;
}
interface TipsBrushShape {
type: 'tips';
angle: number;
size: number;
shape: DynamicBrushShapeShape;
physics: boolean;
spacing: number;
spacingOn: boolean;
flipX: boolean;
flipY: boolean;
tipsType: TipsBrushShapeShape;
tipsLengthRatio: number;
tipsHardness: number;
tipsGridSize?: number;
tipsErodibleTipHeightMap?: number[];
tipsAirbrushCutoffAngle: number;
tipsAirbrushGranularity: number;
tipsAirbrushStreakiness: number;
tipsAirbrushSplatSize: number;
tipsAirbrushSplatCount: number;
}
interface DynamicBrushShape {
type: 'dynamic';
size: number;
angle: number;
shape: DynamicBrushShapeShape;
density: number;
length: number;
clumping: number;
thickness: number;
stiffness: number;
physics: boolean;
spacing: number;
spacingOn: boolean;
flipX: boolean;
flipY: boolean;
}
export interface Brush {
name: string;
shape: BrushShape;
shapeDynamics?: {
sizeDynamics: BrushDynamics;
minimumDiameter: number;
tiltScale: number;
angleDynamics: BrushDynamics;
roundnessDynamics: BrushDynamics;
minimumRoundness: number;
flipX: boolean;
flipY: boolean;
brushProjection: boolean;
};
scatter?: {
bothAxes: boolean;
scatterDynamics: BrushDynamics;
countDynamics: BrushDynamics;
count: number;
};
texture?: {
id: string;
name: string;
invert: boolean;
scale: number;
brightness: number;
contrast: number;
blendMode: BlendMode;
depth: number;
depthMinimum: number;
depthDynamics: BrushDynamics;
textureEachTip: boolean;
};
dualBrush?: {
flip: boolean;
shape: BrushShape;
blendMode: BlendMode;
useScatter: boolean;
spacing: number;
count: number;
bothAxes: boolean;
countDynamics: BrushDynamics;
scatterDynamics: BrushDynamics;
};
colorDynamics?: {
foregroundBackground: BrushDynamics;
hue: number;
saturation: number;
brightness: number;
purity: number;
perTip: boolean;
};
transfer?: {
flowDynamics: BrushDynamics;
opacityDynamics: BrushDynamics;
wetnessDynamics: BrushDynamics;
mixDynamics: BrushDynamics;
};
brushPose?: {
overrideAngle: boolean;
overrideTiltX: boolean;
overrideTiltY: boolean;
overridePressure: boolean;
pressure: number;
tiltX: number;
tiltY: number;
angle: number;
};
noise: boolean;
wetEdges: boolean;
protectTexture?: boolean;
spacing: number;
brushGroup?: undefined;
interpretation?: boolean;
useBrushSize: boolean;
toolOptions?: {
type: 'brush' | 'mixer brush' | 'smudge brush';
brushPreset: boolean;
flow: number;
wetness?: number;
dryness?: number;
mix?: number;
smooth: number;
mode: BlendMode;
opacity: number;
smoothing: boolean;
smoothingValue: number;
smoothingRadiusMode: boolean;
smoothingCatchup: boolean;
smoothingCatchupAtEnd: boolean;
smoothingZoomCompensation: boolean;
pressureSmoothing: boolean;
usePressureOverridesSize: boolean;
usePressureOverridesOpacity: boolean;
useLegacy: boolean;
autoFill?: boolean;
autoClean?: boolean;
loadSolidColorOnly?: boolean;
sampleAllLayers?: boolean;
flowDynamics?: BrushDynamics;
opacityDynamics?: BrushDynamics;
sizeDynamics?: BrushDynamics;
smudgeFingerPainting?: boolean;
smudgeSampleAllLayers?: boolean;
strength?: number;
};
}
export declare function readAbr(buffer: ArrayBufferView, options?: {
logMissingFeatures?: boolean;
}): Abr;
export {};