3rdaiOhpinFully commited on
Commit
192e656
·
verified ·
1 Parent(s): 39e0cb0

Create lib/aopHoodieMappingRules.ts

Browse files
Files changed (1) hide show
  1. lib/aopHoodieMappingRules.ts +101 -0
lib/aopHoodieMappingRules.ts ADDED
@@ -0,0 +1,101 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ export type RegionType =
2
+ | "PRIMARY_FOCAL_REGION"
3
+ | "SECONDARY_FOCAL_REGION"
4
+ | "ENVIRONMENT_REGION"
5
+ | "LOWER_ANCHOR_REGION"
6
+ | "LEFT_EDGE_FLOW_REGION"
7
+ | "RIGHT_EDGE_FLOW_REGION"
8
+ | "TEXT_REGION"
9
+ | "LOGO_REGION";
10
+
11
+ export type CropStrategy =
12
+ | "centered_focal"
13
+ | "wide_dramatic"
14
+ | "vertical_texture"
15
+ | "upper_continuation"
16
+ | "dark_texture"
17
+ | "lower_anchor"
18
+ | "texture_band";
19
+
20
+ export type HoodiePieceRule = {
21
+ pieceId: string;
22
+ preferredRegions: RegionType[];
23
+ forbiddenRegions: RegionType[];
24
+ allowText: boolean;
25
+ allowFace: boolean;
26
+ allowLogo: boolean;
27
+ avoidSeams: boolean;
28
+ avoidBleed: boolean;
29
+ avoidPocketOverlap: boolean;
30
+ cropStrategy: CropStrategy;
31
+ minSafePaddingPercent: number;
32
+ uniquenessRequired: boolean;
33
+ qualityWeight: number;
34
+ };
35
+
36
+ export const AOP_HOODIE_MAPPING_RULES: HoodiePieceRule[] = [
37
+ {
38
+ pieceId: "front_body",
39
+ preferredRegions: ["PRIMARY_FOCAL_REGION"],
40
+ forbiddenRegions: [],
41
+ allowText: true,
42
+ allowFace: true,
43
+ allowLogo: true,
44
+ avoidSeams: true,
45
+ avoidBleed: true,
46
+ avoidPocketOverlap: true,
47
+ cropStrategy: "centered_focal",
48
+ minSafePaddingPercent: 12,
49
+ uniquenessRequired: true,
50
+ qualityWeight: 1.0,
51
+ },
52
+ {
53
+ pieceId: "back_body",
54
+ preferredRegions: ["SECONDARY_FOCAL_REGION", "ENVIRONMENT_REGION"],
55
+ forbiddenRegions: [],
56
+ allowText: true,
57
+ allowFace: true,
58
+ allowLogo: true,
59
+ avoidSeams: true,
60
+ avoidBleed: true,
61
+ avoidPocketOverlap: false,
62
+ cropStrategy: "wide_dramatic",
63
+ minSafePaddingPercent: 10,
64
+ uniquenessRequired: true,
65
+ qualityWeight: 0.95,
66
+ },
67
+ {
68
+ pieceId: "left_sleeve",
69
+ preferredRegions: ["LEFT_EDGE_FLOW_REGION", "ENVIRONMENT_REGION"],
70
+ forbiddenRegions: ["PRIMARY_FOCAL_REGION", "TEXT_REGION", "LOGO_REGION"],
71
+ allowText: false,
72
+ allowFace: false,
73
+ allowLogo: false,
74
+ avoidSeams: true,
75
+ avoidBleed: true,
76
+ avoidPocketOverlap: false,
77
+ cropStrategy: "vertical_texture",
78
+ minSafePaddingPercent: 8,
79
+ uniquenessRequired: true,
80
+ qualityWeight: 0.65,
81
+ },
82
+ {
83
+ pieceId: "right_sleeve",
84
+ preferredRegions: ["RIGHT_EDGE_FLOW_REGION", "ENVIRONMENT_REGION"],
85
+ forbiddenRegions: ["PRIMARY_FOCAL_REGION", "TEXT_REGION", "LOGO_REGION"],
86
+ allowText: false,
87
+ allowFace: false,
88
+ allowLogo: false,
89
+ avoidSeams: true,
90
+ avoidBleed: true,
91
+ avoidPocketOverlap: false,
92
+ cropStrategy: "vertical_texture",
93
+ minSafePaddingPercent: 8,
94
+ uniquenessRequired: true,
95
+ qualityWeight: 0.65,
96
+ },
97
+ ];
98
+
99
+ export function getHoodieRule(pieceId: string) {
100
+ return AOP_HOODIE_MAPPING_RULES.find((rule) => rule.pieceId === pieceId);
101
+ }