Open Fredosixx opened 3 years ago
Are there cases outside of images generated by Canvas?
Looking at the Canvas API it looks like it provides the bitmap data - which should be possible to pass to Ruby and into an ImageRep. https://developer.mozilla.org/en-US/docs/Web/API/Canvas_API/Tutorial/Pixel_manipulation_with_canvas
If you are looking for the content of a canvas generated image then that would probably be preferable over grabbing an image of the whole window.
Looking at the Canvas API it looks like it provides the bitmap data - which should be possible to pass to Ruby and into an ImageRep
I did not find a way to save canvas to a real image file, probably for security reason related to the browser. Getting the image raw data and then loading something as an ImageRep is something I can try (but it only works for SU2018 and above).
I think reconducting the same write_image
method as UI::WebDialog would be simpler for all developers however.
I can see the use case for both. 👍
Yes I missed this old method in the new class as well.
Getting the image raw data and then loading something as an ImageRep is something I can try (but it only works for SU2018 and above).
Any change to the class would only work from that release forward and not be backward compatible anyway.
Using Canvas and ImageRep works fine, but this is indeed a limitation (and a complication) versus a one-line call.
There used to be a
write_image
for UI::WebDialog.This has not been reconducted in UI::HtmlDialog.
This is actually useful in case you wish to compose and generate custom images, for instance based on a HTML Canvas, among other cases.
REQUEST: If it is technically feasible, reintroduce a
write_image
method, same definition as for UI::WebDialog.