🚀 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 (
|
return (
|
||||||
<Canvas
|
<Canvas
|
||||||
frameloop="demand"
|
frameloop="demand"
|
||||||
|
gl={{ preserveDrawingBuffer: true }}
|
||||||
{...canvasProps}
|
{...canvasProps}
|
||||||
shadows={shadowConfig}
|
shadows={shadowConfig}
|
||||||
onCreated={(state) => {
|
onCreated={(state) => {
|
||||||
|
|||||||
@@ -73,9 +73,8 @@ export async function captureCanvasImage(
|
|||||||
outW = Math.round((outH / srcH) * srcW);
|
outW = Math.round((outH / srcH) * srcW);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (outW === srcW && outH === srcH) {
|
// Removido o short-circuit (outW === srcW) para forçar a passagem pelo canvas 2D
|
||||||
return canvasToDataURL(canvas, format, quality);
|
// e garantir que o fundo transparente seja preenchido de branco.
|
||||||
}
|
|
||||||
|
|
||||||
const off = document.createElement('canvas');
|
const off = document.createElement('canvas');
|
||||||
off.width = outW;
|
off.width = outW;
|
||||||
@@ -85,6 +84,11 @@ export async function captureCanvasImage(
|
|||||||
|
|
||||||
ctx.imageSmoothingEnabled = true;
|
ctx.imageSmoothingEnabled = true;
|
||||||
ctx.imageSmoothingQuality = 'high';
|
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);
|
ctx.drawImage(canvas, 0, 0, outW, outH);
|
||||||
|
|
||||||
return off.toDataURL(`image/${format}`, quality);
|
return off.toDataURL(`image/${format}`, quality);
|
||||||
|
|||||||
Reference in New Issue
Block a user