Fix transparency for black-and-white rendering

This commit is contained in:
Bradlee Speice 2023-07-07 20:46:28 +00:00
parent ce4fdd154a
commit ea946b2ae9
4 changed files with 7 additions and 7 deletions

View File

@ -46,7 +46,7 @@ class AccumulateBinary extends Accumulator {
image.data[iIdx + 0] = value;
image.data[iIdx + 1] = value;
image.data[iIdx + 2] = value;
image.data[iIdx + 3] = 0xff;
image.data[iIdx + 3] = value ? 0xff : 0;
}
}
}

View File

@ -18,7 +18,7 @@ export class AccumulateLinear extends Accumulator {
image.data[iIdx + 0] = value;
image.data[iIdx + 1] = value;
image.data[iIdx + 2] = value;
image.data[iIdx + 3] = 0xff;
image.data[iIdx + 3] = 0xff - value;
}
}
}

View File

@ -24,7 +24,7 @@ export class AccumulateLogarithmic extends Accumulator {
image.data[iIdx + 0] = value;
image.data[iIdx + 1] = value;
image.data[iIdx + 2] = value;
image.data[iIdx + 3] = 0xff;
image.data[iIdx + 3] = 0xff - value;
}
}
}

View File

@ -22,7 +22,7 @@ export default function () {
});
return (
<Layout>
{/* <div>
<div>
<Canvas f={gasket} />
<Canvas f={renderBaseline} />
</div>
@ -33,10 +33,10 @@ export default function () {
<div>
<Canvas f={renderLinear} />
<Canvas f={renderLogarithmic} />
</div> */}
<Canvas f={renderTransform1} />
</div>
{/* <Canvas f={renderTransform1} />
<Canvas f={renderTransform2} />
<Canvas f={renderTransform3} />
<Canvas f={renderTransform3} /> */}
</Layout>
);
}