I want to extend Context2d in order to create a specific method that can be invoked by context.myMethod();
Using this class:
class MyContext extends Context2d {
public myMethod();
}
BUT I'm creating the canvas by Canvas canvas = Canvas.createIfSupported();
and thus I would get the Context2d by canvas.getContext2d();
How can I now force the latest method to return MyContext
class which extends the Context2d
, as there is no setContext2d
() on a canvas element...