feat: the site's third-round corrections on acceptance, DPI and the final file

Residue and thin strokes can be accepted on ready sheets and loose art,
with the consent and its time kept on the order. The resolution rule is
96/200 DPI, and a final file must be a transparent 300 DPI PNG. The art
score leaves the customer's cart and buy box (Dropstar, 2026-11-05).
This commit is contained in:
Cauê Faleiros
2026-11-06 10:41:14 -03:00
parent 94f1bfa733
commit 0fc01315c7
13 changed files with 135 additions and 54 deletions

View File

@@ -61,7 +61,7 @@ function novoMapa(wPx,hPx,larguraCm){
for(let x=0;x<wPx;x++) colDe[x]=Math.min(cw-1,Math.floor(x/pxCel));
return {wPx,hPx,larguraCm,pxPorCm,passo,pxCel,cw,ch,colDe,bits:new Uint8Array(n),
x0:new Uint32Array(n),x1:new Uint32Array(n),y0:new Uint32Array(n),y1:new Uint32Array(n),tinta:0,
traco:novoTraco(wPx,wPx/(larguraCm/2.54))};
traco:novoTraco(wPx,wPx/(larguraCm/2.54),hPx)};
}
// ── Traço mais fino (Dropstar, 30/10/2026): a contração do Flexi vem dele.
// Tinta é alfa acima de 40; a distância de cada pixel de tinta ao fundo sai de
@@ -89,13 +89,14 @@ function tintaPerto(t,lim,r,de,ate){
// O contexto de cada faixa: as linhas acima e abaixo que ela lê sem medir. Um
// cisco (menos de 30 px de tinta a 300 DPI) tem menos linhas que isso, então
// a faixa sempre o vê inteiro; o que encosta na borda cortada é traço.
function novoTraco(wPx,dpi){
function novoTraco(wPx,dpi,hPx){
const cisco=Math.ceil(TRACO_CISCO*(dpi/300)**2), ctx=Math.min(120,Math.max(TRACO_D,cisco));
const linhas=TRACO_FAIXA+2*ctx;
return {w:wPx,dpi,linhas,ctx,cisco,tinta:new Uint8Array(wPx*linhas),dist:new Uint16Array(wPx*linhas),
rot:new Int32Array(wPx*linhas),pai:new Int32Array((wPx*linhas>>1)+2),area:new Int32Array((wPx*linhas>>1)+2),
prox:new Int32Array(TRACO_FAIXA+2*ctx),
n:0,inicio:0,hist:new Float64Array(2*TRACO_D+2),total:0,tintaPx:0,largosPx:0,finosPx:0};
n:0,inicio:0,hist:new Float64Array(2*TRACO_D+2),total:0,tintaPx:0,largosPx:0,finosPx:0,
hPx,windowRows:Math.max(1,Math.round(dpi/2.54*15)),windows:[]};
}
// Como a sala mede (Dropstar, 30/10/2026): componentes de tinta com menos de
// 30 px não são traço e saem antes da distância. Vizinhos nas oito direções.
@@ -183,7 +184,9 @@ function tracoFaixa(t,fim){
// conta, na última faixa, ou dois pixels soltos de borda viram o menor
// traço de uma arte toda chapada. O comprimento do eixo é cerca de metade
// do contorno da região além do limite.
if(d>=CAP){ if(at(x-1,y)<CAP||at(x+1,y)<CAP||at(x,y-1)<CAP||at(x,y+1)<CAP){hist[max]+=0.5;t.total+=0.5;} continue; }
if(d>=CAP){ if(at(x-1,y)<CAP||at(x+1,y)<CAP||at(x,y-1)<CAP||at(x,y+1)<CAP){
const wi=Math.floor((t.inicio+y)/t.windowRows), wh=t.windows[wi]||(t.windows[wi]=new Float64Array(hist.length));
hist[max]+=0.5;wh[max]+=0.5;t.total+=0.5;} continue; }
// No eixo do traço a distância não é menor que a de nenhum vizinho; perto
// de um canto sempre há um vizinho mais fundo, e o canto não conta.
let iguais=0, eixo=true;
@@ -197,7 +200,8 @@ function tracoFaixa(t,fim){
// Largura par: o eixo tem dois pixels, e os iguais passam de dois.
const larg=iguais>=4?2*d/10:2*d/10-1;
const i=Math.max(1,Math.min(max,Math.round(larg*escala)));
hist[i]++;t.total++;
const wi=Math.floor((t.inicio+y)/t.windowRows), wh=t.windows[wi]||(t.windows[wi]=new Float64Array(hist.length));
hist[i]++;wh[i]++;t.total++;
}
// As últimas linhas ficam como contexto da próxima faixa.
if(!fim){
@@ -216,8 +220,18 @@ function tracoFim(t){
if(!t.total) return t.lido=null;
let soma=0, px=1;
for(let i=1;i<t.hist.length;i++){ soma+=t.hist[i]; if(soma>=t.total*0.01){ px=i; break; } }
// largos: a parte da tinta em áreas chapadas, de 20 px ou mais (item 16)
return t.lido={px, classe:px<=4?'C1':px<=19?'C2':'C3', largos:t.tintaPx?t.largosPx/t.tintaPx:0, finos:t.tintaPx?t.finosPx/t.tintaPx:0};
// Choose the 15 cm stretch with the finest 1st-percentile stroke.
let best=0, bestPx=Infinity;
t.windows.forEach((histogram,index)=>{
if(!histogram)return;
const count=histogram.reduce((a,b)=>a+b,0);
if(count<20)return;
let seen=0, width=histogram.length-1;
for(let i=1;i<histogram.length;i++){seen+=histogram[i];if(seen>=count*0.01){width=i;break;}}
if(width<bestPx){bestPx=width;best=index;}
});
return t.lido={px, classe:px<=4?'C1':px<=19?'C2':'C3', largos:t.tintaPx?t.largosPx/t.tintaPx:0, finos:t.tintaPx?t.finosPx/t.tintaPx:0,
proofYFraction:Math.min(1,best*t.windowRows/t.hPx)};
}
// A linha y da folha: o alfa de cada pixel em alfa[inicio + x*de].
function mapaLinha(m,y,alfa,inicio,de){
@@ -306,4 +320,3 @@ function analisarMapa(m){
traco: m.traco ? tracoFim(m.traco) : null
};
}