native of bitmap to save pit

Development project when it came before saving two-dimensional code, or certificate needs a few keys, but use h5 a label save some networks do not support images, so the thought of using navite the bitmap may be better

After the original image bitmap js packaged objects 

There are two ways that a read is to use img path ( "../../img/img.png") is to use base64

1 bitmap=new plus.naviteObj.bitmap();
bitmap.load=(paht或base64,successCallback,errorCallback)

After obtaining the path or base64 because this function is asynchronous, so we ask to write methods in its success callback function

1 successCallback () {
 2      // this time has been read 
3     // Save image to memory Note that this is not a system memory, stored in the phone memory album 
4 // can not see where I was pit a 
5 bitmap.save ( '_ DOC / imgName.png' , Options, successCallback, errorCallback)

 6 }
 // successCallback successfully saved a callback function which is the asynchronous method to be used next to a gallery album objects as this will save the bitmap file to system

gallery

successCallback (E) {
 // E is bitmap.save successful callback function for carrying a parameter for e.target 
// saved to the location in memory 
// gallery.save first argument is the file to be saved file address 
plus.gallery.save (e.target, successCB, errorCB); // save the file to the system album 
}
 // gallery.save success callback function comes with a parameter, the parameter value of a 
// property is path to save the image position, bringing the picture was completely preserved at this time do not forget to clear the bitmap objects because it accounts for memory bitmap.clear ()

 

Guess you like

Origin www.cnblogs.com/wrhbk/p/11315805.html