← Back to team overview

duetto-beta-testers team mailing list archive

Some canvas-related questions

 

Hello,

I enjoy being one of first 100 Duetto beta testers. Thanks for this opportunity!

After reading header files in include/duetto, some question regarding canvas have arisen:

1. HTMLCanvasElement and CanvasRenderingContext2D are defined both in canvas.h and clientlib.h - what's the reason for that? Looks like definitions in clientlib.h are far more complete. Should I use them and not those in canvas.h?

2. CanvasRenderingContext2D::getImageData() always expects Object * as its first argument. Given the name imageDataOrSw I suppose it's a way to overload the method according to spec [1]: getImageData(double, double) and getImageData(ImageData). How is it supposed to be called if I want ImageData of given width and height? What are the reasons for not overloading it in a 'straight' way:
ImageData * CanvasRenderingContext2D::getImageData(double, double)
ImageData * CanvasRenderingContext2D::getImageData(Imagedata *)?

3. What is the most idiomatic way to draw an existing PNG file on a canvas? I've come up with different solutions, including using createImageData()/putImageData() and [[server]] method returning bitmap array; using drawImage() and [[server]] method returning image as data: url; using drawImage() and HTTP backend to serve static for HTMLImageElement. Which one should be preferred?

Thank you very much for the clarifications!

--
Sincerely,
Valentine Sinitsyn