devgeeks / Canvas2ImagePlugin

PhoneGap / Cordova plugin for iOS to save the contents of an HTML canvas to the device's Photo Library
211 stars 218 forks source link

Add Android equivalent to the iOS plugin. #18

Closed veloek closed 11 years ago

veloek commented 11 years ago

I made the Android version of the plugin. You can still use the same javascript file.

devgeeks commented 11 years ago

@veloek -

Thanks so much for doing this! I have been "meaning to get around to it" for what seems like forever.

Would it be possible for you to add the section to the plugin.xml for this so that I can test it with Plugman/CLI installation? If you don't have any experience with the PhoneGap/Cordova 3.x style plugin.xml let me know and I'll see if I can do it.

One other tiny thing... Your Android version saves the file as a JPG, correct? The iOS version uses PNG as the saved format. For consistency, would it be very difficult to get the Android version to save as a PNG instead? Again, if that's difficult it's not a huge deal. I was actually thinking of making the iOS configurable so you could choose to do PNG or JPG when saving.

Again, thanks SOO much for this.

devgeeks commented 11 years ago

@veloek

It's OK, I ended up tweaking it to work and adding the plugin.xml stuff...

If you know what changes would be needed to have PNG support instead (or as well as) I would love to get that in too :)

veloek commented 11 years ago

@devgeeks

At line 100 you can see the constant Bitmap.CompressFormat.JPEG being used. To change the plugin to use PNG, you need only change this to Bitmap.CompressFormat.PNG. Also, the file ending must correspond with the encoding, so if you change it to PNG, you must also change line 97 to get the ".png" ending.

devgeeks commented 11 years ago

Fantastic, thanks.