W3C home > Mailing lists > Public > whatwg@whatwg.org > December 2013

Re: [whatwg] Bicubic filtering on context.drawImage

From: Tingan Ho <tingan@p1.cn>
Date: Mon, 9 Dec 2013 20:29:33 +0100
Message-ID: <CAOr4atWqxoxDREg-U5ddWuOT94BCYFFsyMgvYyHonNiKvMharA@mail.gmail.com>
To: Rik Cabanier <cabanier@gmail.com>
Cc: WHATWG <whatwg@lists.whatwg.org>, Glenn Maynard <glenn@zewt.org>, "Tab Atkins Jr." <jackalmage@gmail.com>
>
> Tingan, would it be acceptable for you to do the resampling in JavaScript?


First, writing it in Javascript is less performant. Since natively you can
have access to the GPU. Second, it is abstract a layer for JS developers,
since they don't need to care about bicubic resampling algoritmen. Third,
it kind of make sense if you set imageSmothingEnabled to true in the
context object, that all down-scaling should use bicubic resampling(I
haven't tried yet, but I think the scale use bicubic sampling). I think it
is is a miss in the specification that the method drawImage doesn't use
bicubic resampling. It is a method of the context objext on des
down-scaling.


On Mon, Dec 9, 2013 at 7:22 PM, Rik Cabanier <cabanier@gmail.com> wrote:

>
>
>
> On Mon, Dec 9, 2013 at 7:06 AM, Glenn Maynard <glenn@zewt.org> wrote:
>
>> On Mon, Dec 9, 2013 at 1:21 AM, Tab Atkins Jr. <jackalmage@gmail.com>
>> wrote:
>>
>> > Hm, I wonder if image-interpolation on the <canvas> should affect
>> > this?  It's defined to only have an effect when you scale the <canvas>
>> > element itself, but I think it probably makes sense that whatever
>> > scaling intent you specify for the element should probably apply to
>> > images you draw into it with a scale.
>> >
>>
>> What is "image-interpolation"?  It looks like a CSS property, but Google
>> doesn't distinguish between "image-interpolation" and "image
>> interpolation", so it's impossible to search for.
>>
>> If it is, having CSS state affect drawing of 2d canvas seems wrong.  Aside
>> from the bad layering, it would lead to different rendering if you draw to
>> a Canvas before stylesheets finish loading (equivalent to not waiting for
>> images, but much easier to get wrong without noticing), and if you
>> offscreen render a Canvas before actually putting it in a document.
>
>
> Yes, CSS properties should not affect 'drawImage'.
> The spec currently doesn't enforce what resampling algorithm to use; it
> just allows you to turn it off.
>
> Tingan, would it be acceptable for you to do the resampling in JavaScript?
>



-- 
Sincerely,

Tingan Ho
tingan@p1.cn
Received on Monday, 9 December 2013 19:30:02 UTC

This archive was generated by hypermail 2.4.0 : Wednesday, 22 January 2020 17:00:14 UTC