Closed Bug 1074951 Opened 10 years ago Closed 10 years ago

CanvasRenderingContext2D drawImage ignores globalAlpha for "data:image/svg+xml" source

Categories

(Firefox :: Untriaged, defect)

31 Branch
x86
macOS
defect
Not set
normal

Tracking

()

RESOLVED DUPLICATE of bug 1074948

People

(Reporter: fischer.th, Unassigned)

Details

User Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_9_5) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/37.0.2062.124 Safari/537.36

Steps to reproduce:

canvas = document.body.appendChild(
  document.createElement('CANVAS')
);
canvas.width = canvas.height = 42;
context = canvas.getContext('2d');
context.globalAlpha = .5;

svg =
  '<svg xmlns="http://www.w3.org/2000/svg" width="42px" height="42px">' +
  '<rect width="42" height="42" style="fill:rgb(255,0,0);"/></svg>';
img = document.createElement('IMG');
img.onload = function() { context.drawImage(img, 0, 0, 42, 42); };
img.src = 'data:image/svg+xml;charset=utf-8,' + encodeURIComponent(svg);



Actual results:

The image (a red rectangle) is drawn full opaque


Expected results:

The image should be drawn HALF opaque, because of:
    context.globalAlpha = .5;
Status: UNCONFIRMED → RESOLVED
Closed: 10 years ago
Resolution: --- → DUPLICATE
You need to log in before you can comment on or make changes to this bug.