🚀 Auto-deploy: BrainWind atualizado em 13/07/2026 18:29:33
This commit is contained in:
@@ -41,6 +41,7 @@ function CanvasInner({ fallback: _, shadows, ...canvasProps }: SceneCanvasProps)
|
||||
return (
|
||||
<Canvas
|
||||
frameloop="demand"
|
||||
gl={{ preserveDrawingBuffer: true }}
|
||||
{...canvasProps}
|
||||
shadows={shadowConfig}
|
||||
onCreated={(state) => {
|
||||
|
||||
@@ -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);
|
||||
|
||||
Reference in New Issue
Block a user