From 231ec09a767e6328c7d1af7171e27446275763ae Mon Sep 17 00:00:00 2001 From: Marcos Date: Mon, 13 Jul 2026 18:29:33 +0000 Subject: [PATCH] =?UTF-8?q?=F0=9F=9A=80=20Auto-deploy:=20BrainWind=20atual?= =?UTF-8?q?izado=20em=2013/07/2026=2018:29:33?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/src/components/SceneCanvas.tsx | 1 + app/src/lib/canvas-capture.ts | 10 +++++++--- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/app/src/components/SceneCanvas.tsx b/app/src/components/SceneCanvas.tsx index b554703..fca7dc9 100644 --- a/app/src/components/SceneCanvas.tsx +++ b/app/src/components/SceneCanvas.tsx @@ -41,6 +41,7 @@ function CanvasInner({ fallback: _, shadows, ...canvasProps }: SceneCanvasProps) return ( { diff --git a/app/src/lib/canvas-capture.ts b/app/src/lib/canvas-capture.ts index 5a20676..ce1f952 100644 --- a/app/src/lib/canvas-capture.ts +++ b/app/src/lib/canvas-capture.ts @@ -73,9 +73,8 @@ export async function captureCanvasImage( outW = Math.round((outH / srcH) * srcW); } - if (outW === srcW && outH === srcH) { - return canvasToDataURL(canvas, format, quality); - } + // Removido o short-circuit (outW === srcW) para forçar a passagem pelo canvas 2D + // e garantir que o fundo transparente seja preenchido de branco. const off = document.createElement('canvas'); off.width = outW; @@ -85,6 +84,11 @@ export async function captureCanvasImage( ctx.imageSmoothingEnabled = true; ctx.imageSmoothingQuality = 'high'; + + // Preencher fundo com branco para evitar preto em áreas transparentes (especialmente em JPEGs ou PDFs) + ctx.fillStyle = '#ffffff'; + ctx.fillRect(0, 0, outW, outH); + ctx.drawImage(canvas, 0, 0, outW, outH); return off.toDataURL(`image/${format}`, quality);