[Webkit-unassigned] [Bug 278454] New: globalAlpha is ignored for some values of globalCompositeOperation

bugzilla-daemon at webkit.org bugzilla-daemon at webkit.org
Wed Aug 21 01:39:26 PDT 2024


https://bugs.webkit.org/show_bug.cgi?id=278454

            Bug ID: 278454
           Summary: globalAlpha is ignored for some values of
                    globalCompositeOperation
           Product: WebKit
           Version: Safari 17
          Hardware: Mac (Apple Silicon)
                OS: macOS 14
            Status: NEW
          Severity: Normal
          Priority: P2
         Component: Canvas
          Assignee: webkit-unassigned at lists.webkit.org
          Reporter: eaton.alf at gmail.com
                CC: sabouhallawa at apple.com

Created attachment 472255

  --> https://bugs.webkit.org/attachment.cgi?id=472255&action=review

Screenshot of demo in Safari

When drawing in a canvas, some values of globalCompositeOperation (source-in, source-out, destination-in, destination-atop) cause the current globalAlpha value to be ignored, which results in transparency being lost.

This bug is preventing PDF.js from rendering soft masks in PDF images, when used in Safari (unlike both Chrome and Firefox, which handle this correctly).

https://github.com/mozilla/pdf.js/issues/18634

A demonstration of all the globalCompositeOperation values:

https://codepen.io/invisiblecomma/pen/poXLPaZ

Minimal code to reproduce:

  const canvas = document.createElement("canvas");
  canvas.width = "40";
  canvas.height = "60";
  document.body.append(canvas);

  const ctx = canvas.getContext("2d");
  ctx.font = "50px Impact";
  ctx.fillStyle = "#777777";
  ctx.fillText("A", 10, 40);

  ctx.globalCompositeOperation = 'destination-atop';
  ctx.globalAlpha = 0.5;
  ctx.fillStyle = "#ff0000";
  ctx.fillText("B", 10, 60);

-- 
You are receiving this mail because:
You are the assignee for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.webkit.org/pipermail/webkit-unassigned/attachments/20240821/77c4791d/attachment.htm>


More information about the webkit-unassigned mailing list