Open Bug 1070011 Opened 10 years ago Updated 2 years ago

Add support for ColorTransforms

Categories

(Core :: Graphics: Canvas2D, defect)

defect

Tracking

()

People

(Reporter: till, Unassigned)

References

Details

(Whiteboard: [shumway:m2])

Spin-off from bug 927892.

As an analogue to `globalAlpha`, it'd be great to have the ability to specify a color transform similar to Flash's DisplayObject#transform.colorTransform[1].

Rationale: implementing color transform in JS is complicated and slow. Even for simple colors it requires parsing and modifying the CSS color definition. For putImageData it requires iterating over the bitmap data and applying the transform for each pixel individually. For gradients and patterns, it's simply not possible without replacing all usages with custom non-opaque objects.

Given that color transforms are used extensively in Flash, it appears like they're a feature that would find substantial use in Canvas 2D, too.


[1] http://help.adobe.com/en_US/FlashPlatform/reference/actionscript/3/flash/geom/ColorTransform.html
Could you apply an SVG feComponentTransfer filter to the content? http://www.w3.org/TR/SVG/filters.html#feComponentTransferElement looks like a linear one is what you want.

That should apply to a canvas element.
That does indeed look promising. Once the CanvasContext2D#filter property is available we can experiment with this filter. Thanks for the pointer.
Severity: normal → S3
You need to log in before you can comment on or make changes to this bug.