fix: avoid protected person mask rectangle fill
This commit is contained in:
parent
4ab60cc7a3
commit
f16c54c3a9
@ -1715,6 +1715,7 @@ function filterScaleAdjustStructureComponents(params: {
|
|||||||
Boolean(protectedPersonMask) &&
|
Boolean(protectedPersonMask) &&
|
||||||
protectedPersonOverlap > 0 &&
|
protectedPersonOverlap > 0 &&
|
||||||
touchesProtectedPersonSide;
|
touchesProtectedPersonSide;
|
||||||
|
const allowSurfaceFill = !protectedPersonSide;
|
||||||
const isProtectedPersonPixel = (pixelX: number, pixelY: number) => {
|
const isProtectedPersonPixel = (pixelX: number, pixelY: number) => {
|
||||||
const pixelIndex = pixelY * width + pixelX;
|
const pixelIndex = pixelY * width + pixelX;
|
||||||
if (protectedPersonMask?.[pixelIndex]) return true;
|
if (protectedPersonMask?.[pixelIndex]) return true;
|
||||||
@ -1756,7 +1757,7 @@ function filterScaleAdjustStructureComponents(params: {
|
|||||||
!edgeSliver &&
|
!edgeSliver &&
|
||||||
!broadTopBackground
|
!broadTopBackground
|
||||||
) {
|
) {
|
||||||
if (fillSurfaceComponent) {
|
if (fillSurfaceComponent && allowSurfaceFill) {
|
||||||
for (let fillY = minY; fillY <= maxY; fillY += 1) {
|
for (let fillY = minY; fillY <= maxY; fillY += 1) {
|
||||||
for (let fillX = minX; fillX <= maxX; fillX += 1) {
|
for (let fillX = minX; fillX <= maxX; fillX += 1) {
|
||||||
if (isProtectedPersonPixel(fillX, fillY)) continue;
|
if (isProtectedPersonPixel(fillX, fillY)) continue;
|
||||||
@ -4785,7 +4786,7 @@ export async function POST(request: NextRequest) {
|
|||||||
scaleAdjustPromptStrategy: isScaleAdjustOperation
|
scaleAdjustPromptStrategy: isScaleAdjustOperation
|
||||||
? scaleAdjustPatchReference
|
? scaleAdjustPatchReference
|
||||||
? useScaleAdjustFullFrameStructurePatch
|
? useScaleAdjustFullFrameStructurePatch
|
||||||
? "full-frame-structure-locked-draft-v2-protected-direction-one-shot"
|
? "full-frame-structure-locked-draft-v3-no-protected-fill-one-shot"
|
||||||
: scaleAdjustPatchReference.structureLockedDraft
|
: scaleAdjustPatchReference.structureLockedDraft
|
||||||
? "ai-patch-workspace-structure-locked-draft-v87-subject-alpha-clipped-one-shot"
|
? "ai-patch-workspace-structure-locked-draft-v87-subject-alpha-clipped-one-shot"
|
||||||
: "ai-patch-workspace-draft-v75-soft-wipe-erase-ghost-one-shot"
|
: "ai-patch-workspace-draft-v75-soft-wipe-erase-ghost-one-shot"
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user