Package net.rim.device.api.system

Examples of net.rim.device.api.system.PNGEncodedImage


      FileConnection fconn = (FileConnection) Connector.open(filePath, Connector.READ_WRITE);
      if (!fconn.exists()) fconn.create();

      if (image != null)
      {
        PNGEncodedImage encodedImage = PNGEncodedImage.encode(image);
        byte[] imageBytes = encodedImage.getData();
        OutputStream out = fconn.openOutputStream();
        out.write(imageBytes);
        out.close();
        result = true;
      }
View Full Code Here


    public static String bitmapToBase64Str(Bitmap bitmap) {
        if(bitmap == null) {
            return null;
        }
       
        final PNGEncodedImage pngImage = PNGEncodedImage.encode(bitmap);
        final byte[] pngData = pngImage.getData();
        try {
            final byte[] base64PngData = Base64OutputStream.encode(pngData, 0, pngData.length, false, false);
            return "data:image/png;base64," + new String(base64PngData, "UTF-8");
        } catch(Exception e) {
            return null;
View Full Code Here

TOP

Related Classes of net.rim.device.api.system.PNGEncodedImage

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.