[android-developers] Re: Bitmap issue and Webview rendering issue in ICS

2012-11-07 Thread bob
Have you tried this:

android:largeHeap = “true”


On Monday, November 5, 2012 2:15:05 PM UTC-6, sourabh deshpande wrote:

 Hi,

 1) I am developing an application which has very high quality image 
 contents. To load these images asynchronously I am using 

 https://github.com/nostra13/Android-Universal-Image-Loader

 This library has many options of using memory cache and disc cache. I am 
 using memory cache in onCreateView() of fragment and clearing the memory 
 cache in destroyView() of fragments. But still I am facing the 
 OutOfMemoryException. I have even tried calling Bitmap.recycle() but no 
 luck.What is the best way to clear the bitmap memory?

 2) The application has one local html5 component which is hosed in 
 webview. The html component rendering is extremely slow in 4.0 and above. I 
 have tested it with Galaxy Nexus. Its extremely slow. We can see each frame 
 of animation. I have alredy tried enabling and disabling the hardware 
 acceleration. But both does not work.How can I handle this?

 Sourabh Deshpande.


-- 
You received this message because you are subscribed to the Google
Groups Android Developers group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

Re: [android-developers] Re: Bitmap issue and Webview rendering issue in ICS

2012-11-07 Thread shiva pendem
Hi,

i have used this even but this doesnt make any difference on low end devices

we can see the difference on high end devices like S3 but we wont get the
issue of heap on those devices,  using this will make lots of drawbacks for
the device environment,

please refer to
http://stackoverflow.com/questions/7596950/android-heap-memory-increasewhich
has the same issue of larger heap

Thanks
Shiva

On Wed, Nov 7, 2012 at 9:24 PM, bob b...@coolfone.comze.com wrote:

 Have you tried this:

 android:largeHeap = “true”


 On Monday, November 5, 2012 2:15:05 PM UTC-6, sourabh deshpande wrote:

 Hi,

 1) I am developing an application which has very high quality image
 contents. To load these images asynchronously I am using

 https://github.com/nostra13/**Android-Universal-Image-Loaderhttps://github.com/nostra13/Android-Universal-Image-Loader

 This library has many options of using memory cache and disc cache. I am
 using memory cache in onCreateView() of fragment and clearing the memory
 cache in destroyView() of fragments. But still I am facing the
 OutOfMemoryException. I have even tried calling Bitmap.recycle() but no
 luck.What is the best way to clear the bitmap memory?

 2) The application has one local html5 component which is hosed in
 webview. The html component rendering is extremely slow in 4.0 and above. I
 have tested it with Galaxy Nexus. Its extremely slow. We can see each frame
 of animation. I have alredy tried enabling and disabling the hardware
 acceleration. But both does not work.How can I handle this?

 Sourabh Deshpande.

  --
 You received this message because you are subscribed to the Google
 Groups Android Developers group.
 To post to this group, send email to android-developers@googlegroups.com
 To unsubscribe from this group, send email to
 android-developers+unsubscr...@googlegroups.com
 For more options, visit this group at
 http://groups.google.com/group/android-developers?hl=en


-- 
You received this message because you are subscribed to the Google
Groups Android Developers group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

[android-developers] Re: Bitmap issue and Webview rendering issue in ICS

2012-11-06 Thread shiva pendem

Hi

I had worked with the same issue for longer period but i haven't find the 
solution to work on images of longer width and height(BITMAP),
finally i have used it by resizing the image,

if we see the size required to create the image it need width*height*4 
bytes which is not supported for all the devices
the supported size for all the images is 512*512

the solution i have suggest for larger images is as follows

yourSelectedImage = BitmapFactory.decodeFile(path);
Float Ratio=(float) 
((yourSelectedImage.getWidth()*1.0)/yourSelectedImage.getHeight());
Float byratio=480/Ratio;

if(yourSelectedImage.getHeight()490||yourSelectedImage.getWidth()490)
{

yourSelectedImage=Bitmap.createScaledBitmap(BitmapFactory.decodeFile(path),(int)(byratio*1.0),
 
640, true );
}

the resultant will be re sized with the same ratio,


this is the main reason why all the apps of photo editor have a negitive 
rating saying low image quality

Thanks
Shiva,

On Tuesday, November 6, 2012 1:45:05 AM UTC+5:30, sourabh deshpande wrote:

 Hi,

 1) I am developing an application which has very high quality image 
 contents. To load these images asynchronously I am using 

 https://github.com/nostra13/Android-Universal-Image-Loader

 This library has many options of using memory cache and disc cache. I am 
 using memory cache in onCreateView() of fragment and clearing the memory 
 cache in destroyView() of fragments. But still I am facing the 
 OutOfMemoryException. I have even tried calling Bitmap.recycle() but no 
 luck.What is the best way to clear the bitmap memory?

 2) The application has one local html5 component which is hosed in 
 webview. The html component rendering is extremely slow in 4.0 and above. I 
 have tested it with Galaxy Nexus. Its extremely slow. We can see each frame 
 of animation. I have alredy tried enabling and disabling the hardware 
 acceleration. But both does not work.How can I handle this?

 Sourabh Deshpande.


-- 
You received this message because you are subscribed to the Google
Groups Android Developers group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

[android-developers] Re: Bitmap issue ...

2008-09-24 Thread Mike Reed
There is no way to write to a bitmap in its native format in 1.0, but  
you can read the values by calling copyPixelsToBuffer(). This fills  
out the buffer with whatever the native config is (alpha_8, 565, ,  
).

If you could extend the api post 1.0, what functionality would you  
like to see?

mike

On Sep 23, 2008, at 2:53 PM, Kurt Jacobs wrote:

Mike,
Thanks for the explanation.  Is there a way (method that I could  
call) that I can convert the raw bitmap
to the multiplied version because doing the setPixel?

Thanks,
Kurt


On Tue, Sep 23, 2008 at 11:34 AM, Mike Reed [EMAIL PROTECTED] wrote:

The confusion (and I will try to update the dox to make this clearer)
is that the color int is in unpremultipled form, but the internal
format for Bitmap pixels is premultiplied.

premultiplied means that the r,g,b components have already been
multiplied by their respective alpha value. Thus 50% transparent Red
would be stored as 0x8080

unpremultipled means that the r,g,b components are stored in their
raw form, independent of the alpha value. Thus 50% transparent Red
would be stored as 0x80FF

Thus when you specify 0x08040201 in unpremultiplied form (as you
should for the input to setPixels), that color is internally converted
to its premultiplied equivalent, which in this case happens to be
0x0800. When you call getPixels(), the values are converted back
to unpremultiplied form automatically, but in this case there is no
change.

mike

On Sep 23, 2008, at 10:40 AM, JakeMaui wrote:


I have a bitmap issue.  I created a simple PNG that was 1 pixel high,
16 wide pure white.
I loaded the bitmap, extracted the pixels, changed the first one and
then created a bitmap
from the altered data.  The issue is that I thought that until I save
it, I would have a raw bitmap will all the bits set as I had set
them.  I found that the bits changed.
Does anybody know what I need to do to preserve the bitmap with the
bits that I set
into it?

sample code ...
  int picw= bitmap.getWidth();
  int pich=bitmap.getHeight();
  int[] pix = new int[picw*pich];
  bitmap.getPixels(pix, 0, picw, 0, 0, picw, pich);

  // It's pure white at this point.
  // I set the first byte to this but when I pull it out of the newly
constructed
  // bitmap, it's 0x800
  pix[0]=0x08040201;
  createdBitmap = Bitmap.createBitmap(picw, pich,
Bitmap.Config.ARGB_);
  createdBitmap.setPixels(pix, 0, picw, 0, 0, picw, pich);

   // get pixels of newly created bitmap
   int picw=embeddedBitmap.getWidth();
   int pich=embeddedBitmap.getHeight();
   int[] pix = new int[picw*pich];
   createdBitmap.getPixels(pix, 0, picw, 0, 0, picw, pich);

Results 
1000 0100 0010 0001 before
1000   000










--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google
Groups Android Developers group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
[EMAIL PROTECTED]
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en
-~--~~~~--~~--~--~---



[android-developers] Re: Bitmap issue ...

2008-09-24 Thread Kurt Jacobs
Mike,
   To be honest with you, I'd need to develop more to have a better feel for
it.  I will however, let you know in the future.

Thanks again for you help,
Kurt


On Wed, Sep 24, 2008 at 7:17 AM, Mike Reed [EMAIL PROTECTED] wrote:

 There is no way to write to a bitmap in its native format in 1.0, but you
 can read the values by calling copyPixelsToBuffer(). This fills out the
 buffer with whatever the native config is (alpha_8, 565, , ).
 If you could extend the api post 1.0, what functionality would you like to
 see?

 mike


 On Sep 23, 2008, at 2:53 PM, Kurt Jacobs wrote:

 Mike,
Thanks for the explanation.  Is there a way (method that I could call)
 that I can convert the raw bitmap
 to the multiplied version because doing the setPixel?

 Thanks,
 Kurt


 On Tue, Sep 23, 2008 at 11:34 AM, Mike Reed [EMAIL PROTECTED] wrote:


 The confusion (and I will try to update the dox to make this clearer)
 is that the color int is in unpremultipled form, but the internal
 format for Bitmap pixels is premultiplied.

 premultiplied means that the r,g,b components have already been
 multiplied by their respective alpha value. Thus 50% transparent Red
 would be stored as 0x8080

 unpremultipled means that the r,g,b components are stored in their
 raw form, independent of the alpha value. Thus 50% transparent Red
 would be stored as 0x80FF

 Thus when you specify 0x08040201 in unpremultiplied form (as you
 should for the input to setPixels), that color is internally converted
 to its premultiplied equivalent, which in this case happens to be
 0x0800. When you call getPixels(), the values are converted back
 to unpremultiplied form automatically, but in this case there is no
 change.

 mike

 On Sep 23, 2008, at 10:40 AM, JakeMaui wrote:


 I have a bitmap issue.  I created a simple PNG that was 1 pixel high,
 16 wide pure white.
 I loaded the bitmap, extracted the pixels, changed the first one and
 then created a bitmap
 from the altered data.  The issue is that I thought that until I save
 it, I would have a raw bitmap will all the bits set as I had set
 them.  I found that the bits changed.
 Does anybody know what I need to do to preserve the bitmap with the
 bits that I set
 into it?

 sample code ...
  int picw= bitmap.getWidth();
  int pich=bitmap.getHeight();
  int[] pix = new int[picw*pich];
  bitmap.getPixels(pix, 0, picw, 0, 0, picw, pich);

  // It's pure white at this point.
  // I set the first byte to this but when I pull it out of the newly
 constructed
  // bitmap, it's 0x800
  pix[0]=0x08040201;
  createdBitmap = Bitmap.createBitmap(picw, pich,
 Bitmap.Config.ARGB_);
  createdBitmap.setPixels(pix, 0, picw, 0, 0, picw, pich);

   // get pixels of newly created bitmap
   int picw=embeddedBitmap.getWidth();
   int pich=embeddedBitmap.getHeight();
   int[] pix = new int[picw*pich];
   createdBitmap.getPixels(pix, 0, picw, 0, 0, picw, pich);

 Results 
 1000 0100 0010 0001 before
 1000   000











 


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google
Groups Android Developers group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
[EMAIL PROTECTED]
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en
-~--~~~~--~~--~--~---



[android-developers] Re: Bitmap issue ...

2008-09-23 Thread Mike Reed

The confusion (and I will try to update the dox to make this clearer)  
is that the color int is in unpremultipled form, but the internal  
format for Bitmap pixels is premultiplied.

premultiplied means that the r,g,b components have already been  
multiplied by their respective alpha value. Thus 50% transparent Red  
would be stored as 0x8080

unpremultipled means that the r,g,b components are stored in their  
raw form, independent of the alpha value. Thus 50% transparent Red  
would be stored as 0x80FF

Thus when you specify 0x08040201 in unpremultiplied form (as you  
should for the input to setPixels), that color is internally converted  
to its premultiplied equivalent, which in this case happens to be  
0x0800. When you call getPixels(), the values are converted back  
to unpremultiplied form automatically, but in this case there is no  
change.

mike

On Sep 23, 2008, at 10:40 AM, JakeMaui wrote:


I have a bitmap issue.  I created a simple PNG that was 1 pixel high,
16 wide pure white.
I loaded the bitmap, extracted the pixels, changed the first one and
then created a bitmap
from the altered data.  The issue is that I thought that until I save
it, I would have a raw bitmap will all the bits set as I had set
them.  I found that the bits changed.
Does anybody know what I need to do to preserve the bitmap with the
bits that I set
into it?

sample code ...
  int picw= bitmap.getWidth();
  int pich=bitmap.getHeight();
  int[] pix = new int[picw*pich];
  bitmap.getPixels(pix, 0, picw, 0, 0, picw, pich);

  // It's pure white at this point.
  // I set the first byte to this but when I pull it out of the newly
constructed
  // bitmap, it's 0x800
  pix[0]=0x08040201;
  createdBitmap = Bitmap.createBitmap(picw, pich,
Bitmap.Config.ARGB_);
  createdBitmap.setPixels(pix, 0, picw, 0, 0, picw, pich);

   // get pixels of newly created bitmap
   int picw=embeddedBitmap.getWidth();
   int pich=embeddedBitmap.getHeight();
   int[] pix = new int[picw*pich];
   createdBitmap.getPixels(pix, 0, picw, 0, 0, picw, pich);

Results 
1000 0100 0010 0001 before
1000   000




--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google
Groups Android Developers group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
[EMAIL PROTECTED]
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en
-~--~~~~--~~--~--~---