mirror of
https://github.com/YuzuZensai/Pien-Studio.git
synced 2026-09-02 14:18:35 +00:00
✨ feat: layer effects, bucket fill, simple brush
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
import { z } from "zod";
|
||||
|
||||
export const LayerTypeSchema = z.enum(["image", "text", "sticker"]);
|
||||
export const LayerTypeSchema = z.enum(["raster", "text", "sticker"]);
|
||||
|
||||
export const FaceBlurMethodSchema = z.enum(["gaussian", "pixelate", "censor"]);
|
||||
|
||||
@@ -14,20 +14,25 @@ export const FaceBlurRegionSchema = z.object({
|
||||
censorColor: z.string().optional(),
|
||||
});
|
||||
|
||||
export const FaceBlurSettingsSchema = z.object({
|
||||
export const FaceBlurEffectSchema = z.object({
|
||||
kind: z.literal("face-blur"),
|
||||
enabled: z.boolean().default(true),
|
||||
method: FaceBlurMethodSchema,
|
||||
amount: z.number().int().min(4).max(40),
|
||||
regions: z.array(FaceBlurRegionSchema),
|
||||
censorColor: z.string().optional(),
|
||||
});
|
||||
|
||||
export const LayerEffectSchema = FaceBlurEffectSchema;
|
||||
|
||||
export const LayerSchema = z.object({
|
||||
id: z.string(),
|
||||
type: LayerTypeSchema,
|
||||
name: z.string().optional(),
|
||||
assetId: z.string().optional(),
|
||||
sourceUri: z.string().optional(),
|
||||
faceBlur: FaceBlurSettingsSchema.optional(),
|
||||
effects: z.array(LayerEffectSchema).default([]),
|
||||
visible: z.boolean().default(true),
|
||||
x: z.number(),
|
||||
y: z.number(),
|
||||
width: z.number().optional(),
|
||||
@@ -116,7 +121,10 @@ export const ProjectFileSchema = ProjectFileV1Schema;
|
||||
export type Project = z.infer<typeof ProjectSchema>;
|
||||
export type Layer = z.infer<typeof LayerSchema>;
|
||||
export type LayerType = z.infer<typeof LayerTypeSchema>;
|
||||
export type LayerEffect = z.infer<typeof LayerEffectSchema>;
|
||||
export type FaceBlurMethod = z.infer<typeof FaceBlurMethodSchema>;
|
||||
export type FaceBlurRegion = z.infer<typeof FaceBlurRegionSchema>;
|
||||
export type FaceBlurSettings = z.infer<typeof FaceBlurSettingsSchema>;
|
||||
export type FaceBlurEffect = z.infer<typeof FaceBlurEffectSchema>;
|
||||
// Kept for compatibility with existing renderer code
|
||||
export type FaceBlurSettings = Omit<FaceBlurEffect, "kind">;
|
||||
export type ProjectFile = z.infer<typeof ProjectFileSchema>;
|
||||
|
||||
Reference in New Issue
Block a user