03-25-2012 04:41 PM
03-26-2012 09:15 AM
Can you clarify what your question is?
Are you seeing unexpected behavior when running your code on the PlayBook, or is this a general question about using canvas?
03-26-2012 09:23 AM
sorry my mistake, for some reason I did not send the whole query.
I have not a question directly, but rather I wonder if anyone can confirm this behavior in webworks application with tablet OS 2
03-26-2012 10:23 AM
Gotcha, I understand now. I can reproduce your error with your code sample above.
Try changing the data type of the image to the following (jpg instead of jpeg):
dataUrl = canvas.toDataURL('image/jpg');
This seems to work.
I'm curious if Canvas doesn't like the image/jpeg MIME type? When using that on PlayBook I see a runtime exception in Web Inspector for "GET data:image/jpeg;base64" (where the type is undefined). When running the same code in Chrome, I see improved results, but it is still erroneous (black background).
03-26-2012 10:44 AM
When you use "image/jpg" its incorect type and returned image is png as default value same as use image/png as content type
Description: The argument, if provided, controls the type of the image to be returned (e.g. PNG or JPEG). The default is image/png; that type is also used if the given type isn't supported.
"When using that on PlayBook I see a runtime exception in Web Inspector for "GET data:image/jpeg;base64" (where the type is undefined)."
yes this is the error
canvas.toDataURL can use content types "image/png" and "image/jpeg" with second parametr as qualiti (range 0.1 - 1.0)
image/png work correct
image/jpeg return empty data value and result is only data:image/jpeg;base64,
i dont know if image/jpeg before os2 work correctly, but from API reference it seams that it should work but dont work
its ok original image is transparent which jpeg dont interpretate and use black background color
03-26-2012 01:20 PM
Alright thanks for helping to flesh this out.
This sounds like a bug in the Web platform on PlayBook. I'll file an issue in the DIT, and escalate it internally to the browser dev team.