[PLUGIN] c2i - canvas/base64/screenshot to image

Post your completed addons to share with the community

Post » Fri Apr 06, 2012 5:59 pm

@Wishy: Thanks for reporting this bug so clearly. I'm working on the WebGL support- but currently I have no plan how to convince a WebGL-Chrome to save a canvas as an (not-empty) image. I've tried different ways for the WebGL and had success - problem is - only for Firefox and that is working already. Joe72012-04-06 18:03:02
B
14
S
6
G
5
Posts: 173
Reputation: 4,742

Post » Sat Apr 07, 2012 3:18 pm

@Joe7 Allright, looking forward for a fix :-)
keep up the good work, here's something i'm working on with this plugin:
http://www.youtube.com/watch?v=X_W9uOIbmQM

Another small addition, when testing on my Android device, it also resulted in a white exported png :s
B
22
S
11
G
9
Posts: 133
Reputation: 6,572

Post » Sun Apr 08, 2012 12:40 am

Updated to v 1.4: WebGL hopefully fixed
Next step: Support for mobile devices..

[Edit]Seems that Canvas.toDataURL is broken for Android (2.x)-devices - http://code.google.com/p/android/issues/detail?id=7901
I suppose this causes the blank images. I've tried to implement a workaround for them (http://code.google.com/p/todataurl-png-js/) but the translationtime for the saving is much too long - I think waiting for a good Webkit-Androidimplementation makes more sense - or anybody knows a better way..

@Wishy: Awesome App. On desktop-browsers the saving should work. Joe72012-04-08 18:05:32
B
14
S
6
G
5
Posts: 173
Reputation: 4,742

Post » Mon Apr 09, 2012 3:29 pm

Thanks for the update Joe7,

Text isn't saving on the exported image in WebGL though, it does in Canvas.

=)
B
22
S
11
G
9
Posts: 133
Reputation: 6,572

Post » Mon Apr 09, 2012 9:26 pm

Getting this error

B
13
S
5
G
2
Posts: 306
Reputation: 3,262

Post » Tue Apr 10, 2012 2:58 am

@aridale you must copy the canvas2Image.png to your project folder, had the same issue

@Joe7 when trying to export big files like this one, the saving process hangs and the error console gives this error:
Error: uncaught exception: [Exception... "Security error" code: "1000" nsresult: "0x805303e8 (NS_ERROR_DOM_SECURITY_ERR)" location: "http://ohrly.net/meme/c2runtime.js Line: 8159"]
B
22
S
11
G
9
Posts: 133
Reputation: 6,572

Post » Tue Apr 10, 2012 4:19 am

ok... what png? there isnt one in the zip.

Have you tested the new version? Even your example page doesnt work all I get no matter what I push is the normal sized shield img and in my own program the On Saving Complete is never getting called its not even attempting to save my imgaridale2012-04-10 04:35:12
B
13
S
5
G
2
Posts: 306
Reputation: 3,262

Post » Tue Apr 10, 2012 8:25 am

@aridale: Sorry, have forgotten it - I did't thought on that.
It complains about the missing image that gets drawn on the canvas of the plugin.
copy the following image in the export folder or replace it with an own (in C2 open the 'image-loading-dialog')
canvas2image.png

@Wishy: I haven't implemented anything about jpg - hope that causes the error and that it's not a browser-"timeout"-error or something similar..

@Wishy -Textsaving: Yes, I recognized that with the "Text"-object too. Is this a problem? I suppose C2 handles the Text-object a little different when using canvas2d or WebGL renderer - or this comes perhaps directly from the renderer.. (I haven't implemented anything for the renderering of text in the plugin.)

Joe72012-04-10 22:09:36
B
14
S
6
G
5
Posts: 173
Reputation: 4,742

Post » Tue Apr 10, 2012 3:21 pm

@Joe7 Never mind, i found the issue with big pictures & jpg's, they are getting exported just fine.
In my project I paste all images on a canvas [URL=http://www.scirra.com/forum/plugin-canvas_topic46006.html]Canvas Plugin[/URL , and then export that canvas.
It is bugging in this step.

About the Text-Saving, when using canvas2d the text is exporting just fine, only in WebGL it doesn't work.

I'll have a look at the Android fix once I've cleared this issue

Thanks for the fast updates btwWishy2012-04-10 15:22:12
B
22
S
11
G
9
Posts: 133
Reputation: 6,572

Post » Tue Apr 10, 2012 10:45 pm

History - c2i:

[Update3] c2i - v 1.3:
1) The php-file 'createImg.php' gets now created from C2 when exporting the project.
2) Demo - changed: The demo-project is forced via the project-properties to use the canvas2d renderer. --> should work now properly on whatever.
[= current workaround to avoid the WebGL-bug - see posts on side 2]
3) Refactored plugin-sourcecode - no improvements to recognize during edittime but the plugin has now fewer codelines and works as the last release.

Demo - canvas/sprite/screenshot + Plugin(v 1.3)+capx

____________
[Update2] c2i - v 1.2:
Screenshots are possible now
Demo - canvas/sprite/screenshot + Plugin(v 1.2)+capx(WebGL renderer - if possible)

Known bug: WebKit+WebGL:
If WebKit-Browsers(Chrome) are forced with the setting in the project-properties to use the WebGL-renderer they create only blank images. Firefox has no problem with WebGL enabled.
Workaround for now: Use the "canvas2d" renderer. This should work on whatever..

[/Update2]
____________
[Update] c2i - v 1.1:
Now the saving of Base64-Strings to images is possible. Together with Pode's behavior "Extract Sprite to base64 string" it's possible to save sprites to images.
B
14
S
6
G
5
Posts: 173
Reputation: 4,742

PreviousNext

Return to Completed Addons

Who is online

Users browsing this forum: gamecorpstudio, matriax and 1 guest