1 Reply Latest reply on Dec 5, 2012 12:39 PM by roymeo_

    Bitmap To FREBitmapData error...

    cbigb

      hi, all..

       

      I want to load Bitmap to URL, and convert Bitmap to FREBitmapData..

      I used below code..

      but Bitmap is incorrect.

       

      how to bitmap to FREBitmapData??

       

      // load Bitmap From URL

      Bitmap bitmap = null;

      URL url = new URL(urlString);

      HttpURLConnection urlConnection = (HttpURLConnection) url.openConnection();

      urlConnection.setDoInput(true);

      urlConnection.connect();

      InputStream inputStream = urlConnection.getInputStream();

       

      // create Bitmap

      BitmapFactory.Options options = new BitmapFactory.Options();

      options.inPreferredConfig = Bitmap.Config.ARGB_8888;

      bitmap = BitmapFactory.decodeStream(inputStream, null, options);

       

      // Convert Bitmap to FREBitmapData

      FREBitmapData bitmapData = null;

      Byte[] fillColor = {(byte)0xff, (byte)0xff, (byte)0xff, (byte)0xff};

      bitmapData = FREBitmapData.newBitmapData(bitmap.getWidth(), bitmap.getHeight(), true, fillColor);

      bitmapData.acquire();

      bitmap.copyPixelsToBuffer(bitmapData.getBits());

      bitmapData.release();