Soften WebGL paper rendering
This commit is contained in:
@@ -62,6 +62,8 @@ class BookTextureRendererModule extends BaseModule {
|
||||
this.pageFormat = this.getModule('book-page-format');
|
||||
this.pagination = this.getModule('book-pagination');
|
||||
this.localization = this.getModule('localization');
|
||||
this.reportProgress(10, 'Waiting for book fonts');
|
||||
if (document.fonts?.ready) await document.fonts.ready;
|
||||
this.reportProgress(20, 'Preparing page texture canvases');
|
||||
this.createPageCanvases();
|
||||
this.drawEmptySpread();
|
||||
@@ -120,18 +122,18 @@ class BookTextureRendererModule extends BaseModule {
|
||||
if (!canvas || !ctx) return;
|
||||
|
||||
ctx.clearRect(0, 0, canvas.width, canvas.height);
|
||||
ctx.fillStyle = '#fff7dc';
|
||||
ctx.fillStyle = '#f2ead0';
|
||||
ctx.fillRect(0, 0, canvas.width, canvas.height);
|
||||
|
||||
const shade = ctx.createLinearGradient(0, 0, canvas.width, 0);
|
||||
if (side === 'left') {
|
||||
shade.addColorStop(0, 'rgba(255, 255, 255, 0.10)');
|
||||
shade.addColorStop(0, 'rgba(255, 255, 255, 0.06)');
|
||||
shade.addColorStop(0.78, 'rgba(255, 255, 255, 0)');
|
||||
shade.addColorStop(1, 'rgba(82, 42, 14, 0.16)');
|
||||
shade.addColorStop(1, 'rgba(70, 48, 28, 0.08)');
|
||||
} else {
|
||||
shade.addColorStop(0, 'rgba(82, 42, 14, 0.16)');
|
||||
shade.addColorStop(0, 'rgba(70, 48, 28, 0.08)');
|
||||
shade.addColorStop(0.22, 'rgba(255, 255, 255, 0)');
|
||||
shade.addColorStop(1, 'rgba(255, 255, 255, 0.10)');
|
||||
shade.addColorStop(1, 'rgba(255, 255, 255, 0.06)');
|
||||
}
|
||||
ctx.fillStyle = shade;
|
||||
ctx.fillRect(0, 0, canvas.width, canvas.height);
|
||||
|
||||
Reference in New Issue
Block a user