Opened 9 years ago

Closed 9 years ago

#12226 closed defect (fixed)

[patch][CCLA] canvas renderer does not take into account the x/y/width/height attributes of a pattern fill style.

Reported by: Patrick Ruzand Owned by: Eugene Lazutkin
Priority: high Milestone: 1.6
Component: DojoX GFX Version: 1.6.0b1
Keywords: canvas pattern gfx Cc:
Blocked By: Blocking:

Description

The canvas renderer does not taken into account the x/y/width/height attributes of a pattern fill style.

In the current implementation, the pattern image is created via the new Image(w,h) ctor, specifying the fillstyle with/height. However, the canvas spec. tells that the original image data must be used when creating the pattern, therefore the image scaling done in the ctor is not taken into account by the context2d (as we can see by running the dojox/gfx/tests/test_pattern.html sample with the canvas renderer enabled).

Proposed fix: the image scaling needs to be done in an temporary canvas via a call to drawImage(), and then pass this temp. canvas element to the ctx.createPattern() method. See patch attached.

Patches attached (canvas.js, test_pattern.html) submitted by Patrick Ruzand, IBM (CCLA)

Attachments (2)

test_pattern.patch (454 bytes) - added by Patrick Ruzand 9 years ago.
modify test to add x/y offset and aspect ratio testing
canvas_patternbug.patch (2.3 KB) - added by Patrick Ruzand 9 years ago.
fix pattern scaling and offset support

Download all attachments as: .zip

Change History (4)

Changed 9 years ago by Patrick Ruzand

Attachment: test_pattern.patch added

modify test to add x/y offset and aspect ratio testing

Changed 9 years ago by Patrick Ruzand

Attachment: canvas_patternbug.patch added

fix pattern scaling and offset support

comment:1 Changed 9 years ago by Eugene Lazutkin

Milestone: tbd1.6
Status: newassigned

comment:2 Changed 9 years ago by Eugene Lazutkin

Resolution: fixed
Status: assignedclosed

Fixed in [23684].

Note: See TracTickets for help on using tickets.