Re: [Gnoga-list] When to get a new Context_2D

2023-09-22 Thread Jeffrey R. Carter via Gnoga-list
On 22 September 2023 19:37:52 UTC, Blady  wrote:
>
>> Le 20 sept. 2023 à 15:12, Jeffrey R. Carter via Gnoga-list 
>>  a écrit :
>> 
>> If I have a canvas, I can get a context for it with Get_Drawing_Context_2D 
>> and do lots of things with that context. But there are operations that 
>> change the canvas, such as changing the width or height, that I would think 
>> would invalidate an existing context and require getting a new context. Am I 
>> correct about this? If so, is there a list of operations that require this? 
>
>Hello Jeff,
>
>The underlying behavior is given by Javascript.
>As I'm not a specialist, I look at the documentation:
>https://developer.mozilla.org/en-US/docs/Web/API/HTMLCanvasElement/getContext
>
>It says:
>The HTMLCanvasElement.getContext() method returns a drawing context on the 
>canvas, or null if the context identifier is not supported, or the canvas has 
>already been set to a different context mode.
>Later calls to this method on the same canvas element, with the same 
>contextTypeargument, will always return the same drawing context instance as 
>was returned the first time the method was invoked. It is not possible to get 
>a different drawing context object on a given canvas element.
>
>It seems that the context stay valid as it is unique.
>
>Regards, Pascal.
>https://blady.pagesperso-orange.fr
>
>

Interesting. Thanks for that information. 
--
Jeff Carter
"Now go away or I shall taunt you a second time."
Monty Python and the Holy Grail___
Gnoga-list mailing list
Gnoga-list@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/gnoga-list


Re: [Gnoga-list] When to get a new Context_2D

2023-09-22 Thread Blady via Gnoga-list

> Le 20 sept. 2023 à 15:12, Jeffrey R. Carter via Gnoga-list 
>  a écrit :
> 
> If I have a canvas, I can get a context for it with Get_Drawing_Context_2D 
> and do lots of things with that context. But there are operations that change 
> the canvas, such as changing the width or height, that I would think would 
> invalidate an existing context and require getting a new context. Am I 
> correct about this? If so, is there a list of operations that require this? 

Hello Jeff,

The underlying behavior is given by Javascript.
As I'm not a specialist, I look at the documentation:
https://developer.mozilla.org/en-US/docs/Web/API/HTMLCanvasElement/getContext

It says:
The HTMLCanvasElement.getContext() method returns a drawing context on the 
canvas, or null if the context identifier is not supported, or the canvas has 
already been set to a different context mode.
Later calls to this method on the same canvas element, with the same 
contextTypeargument, will always return the same drawing context instance as 
was returned the first time the method was invoked. It is not possible to get a 
different drawing context object on a given canvas element.

It seems that the context stay valid as it is unique.

Regards, Pascal.
https://blady.pagesperso-orange.fr




___
Gnoga-list mailing list
Gnoga-list@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/gnoga-list