[whatwg] Canvas draw quality

Andrew Fedoniouk news at terrainformatica.com
Fri Oct 20 22:44:45 PDT 2006

Dave, various implementations use different libraries/approaches for the Graphics.
Way of tuning parameters and their set can be different. I think that it is simply not possible
to generalize them all. At least something generic like preference=quality/speed switch makes real sense.

Technically it is better to allow to get two Graphics instances for the same canvas and use 
them at the same time if really needed. In any case 2D and 3D graphics shall coexist on the same surface. 
So why not 2D and 2D-fast ?

In any case it is up to UA to provide multiple implementation for different values of contextID.
contextID as a string is there in purpose I belive. That is the one.

Andrew Fedoniouk.

  ----- Original Message ----- 
  From: David Hyatt 
  To: Andrew Fedoniouk 
  Cc: Benjamin Joffe ; whatwg at whatwg.org 
  Sent: Friday, October 20, 2006 10:12 PM
  Subject: Re: [whatwg] Canvas draw quality

  I don't think a totally different context is a good idea.  Sometimes you want to mix antialiased and non-antialiased modes.

  The API in CG is part of the graphics state...


  I don't think an API like this should be vague about what it's doing... e.g., just using vague terms like "quality."  We should say what we mean... antialiasing for example.

  On Oct 20, 2006, at 10:01 PM, Andrew Fedoniouk wrote:

      ----- Original Message -----
      From: Benjamin Joffe
      To: whatwg at whatwg.org
      Sent: Friday, October 20, 2006 9:09 PM
      Subject: [whatwg] Canvas draw quality

      I would like to see a property added to the 2d canvas context that would allow quality to be lowered for drawing functions. Normally any time a shape is drawn, pixels close to the boundary are made semi transparent to make it look smooth, this is usually favourable but I have had a need to draw shapes and lines with pixel sharp boundaries in the same way as Java normally does. I would imagine that with the setting enabled, only the integer part of linewidth would be used. This setting would also affect drawing images, making them have no blurring or approximating when scaled or rotated. 

      This could easily be implemented without affecting old scripts, making a property such as lowQuality = true; (default false). Or perhaps allowing more control: a float from 0 (low quality) to 1 (high quality), and interperating null as 1 for backwards compatibility. 

      This property could also be handy in instaces where both fill() and stroke() are being called. Low quality could be used on the fill() to improve performace while stroke() could be used with high quality so it still draws smoothly.

    I think that the best way is just to define different values for the context ID:
DOMObject getContext(in DOMString contextID);Something like "2D" and "2D-fast" or "2D-simple".
    Another option would be to add one optional parameter to the getContext() function.

    I doubt that someone will need to switch it in the middle of drawing so
    having such switch as an attribute is redundant.

    Andrew Fedoniouk.

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.whatwg.org/pipermail/whatwg-whatwg.org/attachments/20061020/f8c9c792/attachment-0001.htm>

More information about the whatwg mailing list