[android-developers] Re: Image scaling by BitmapFactory.decodeResource()

2009-10-01 Thread Tom Gibara
Possibly not as happy as it made me :) It really must have saved so much effort on my part. 2009/10/1 Dianne Hackborn > On Thu, Oct 1, 2009 at 3:27 PM, Tom Gibara wrote: > >> So far I've adapted two applications with no code changes whatsoever >> (other than the aforementioned workaround). > >

[android-developers] Re: Image scaling by BitmapFactory.decodeResource()

2009-10-01 Thread Dianne Hackborn
On Thu, Oct 1, 2009 at 3:27 PM, Tom Gibara wrote: > So far I've adapted two applications with no code changes whatsoever (other > than the aforementioned workaround). That makes me happy. :) -- Dianne Hackborn Android framework engineer hack...@android.com Note: please don't send private que

[android-developers] Re: Image scaling by BitmapFactory.decodeResource()

2009-10-01 Thread Tom Gibara
I realize based on my previous response that yes - I can't say 1.5 and 1.6 are incompatible. I retract that statement. Though I'm struggling to find a simple word to describe the situation. In any case, this is a very minor issue - the support for different densities is * terrific* - and I would mu

[android-developers] Re: Image scaling by BitmapFactory.decodeResource()

2009-10-01 Thread Dianne Hackborn
Put -v4 at the end of the resource directory to limit it to platform 4 or later. This isn't any different than any other new API -- you need to make sure you don't use it on older versions of the platform or you will break. That just a basic fact of life. On Thu, Oct 1, 2009 at 3:03 PM, Tom Gibar

[android-developers] Re: Image scaling by BitmapFactory.decodeResource()

2009-10-01 Thread Tom Gibara
That's exactly what my code does. :) 2009/10/1 Romain Guy > > > * I can't disable the scaling with the Option flag (not supported in 1.5) > > Use reflection to set the flag in Options. > > > ergo. > > 1.5 and 1.6 are incompatible with each other, at least as far as my > > application is concerne

[android-developers] Re: Image scaling by BitmapFactory.decodeResource()

2009-10-01 Thread Romain Guy
> * I can't disable the scaling with the Option flag (not supported in 1.5) Use reflection to set the flag in Options. > ergo. > 1.5 and 1.6 are incompatible with each other, at least as far as my > application is concerned (and I'm sure some others). > Tom. > 2009/10/1 Dianne Hackborn >> >> Th

[android-developers] Re: Image scaling by BitmapFactory.decodeResource()

2009-10-01 Thread Tom Gibara
It's a compatibility issue in this sense: * I have an app currently targeted at 1.5. * I need to target 1.6 to support devices with lower screen densities. * For current users I need to continue supporting 1.5. * My code generates a picture based on bitmaps loaded via BitmapFactory.decodeRe

[android-developers] Re: Image scaling by BitmapFactory.decodeResource()

2009-10-01 Thread Dianne Hackborn
This isn't a compatibility issue -- 1.5 doesn't know anything about "nodpi" so if you try to use it there you will not get the right result. (I am pretty sure what happens is it sees this as a really high dpi and thus scales it down.) It's just a case of not being able to use newer APIs on an old

[android-developers] Re: Image scaling by BitmapFactory.decodeResource()

2009-10-01 Thread Romain Guy
> As far as I understand from this thread, after changing target SDK to > android:targetSdkVersion="4, method BitmapFactory.decodeResource > changes behavior and now scales images according to screen dpi. Is > that right? The targetSdkVersion does not matter. > So if I got it right, after moving

[android-developers] Re: Image scaling by BitmapFactory.decodeResource()

2009-10-01 Thread Marcin_GUmeR
As far as I understand from this thread, after changing target SDK to android:targetSdkVersion="4, method BitmapFactory.decodeResource changes behavior and now scales images according to screen dpi. Is that right? I have lots of bitmaps, in standard drawable directory, which are pushed to OpenGL

[android-developers] Re: Image scaling by BitmapFactory.decodeResource()

2009-09-21 Thread Tom Gibara
Even with if one specifies inScaled=false, there's a surprise lurking: 1) Using BitmapFactory.decodeResource(), I load a background bitmap (which I don't want scaled), create a mutable copy of it and wrap it with a canvas. 2) Using Bitmap.create() I create a bitmap (into which I render a flower) 3)

[android-developers] Re: Image scaling by BitmapFactory.decodeResource()

2009-09-17 Thread Tom Gibara
I just published a simple class for dealing with this minor compatibility issue; it seems to be working well for my application and it might be useful for anyone else in the same situation. http://blog.tomgibara.com/post/190539066/android-unscaled-bitmaps Tom.

[android-developers] Re: Image scaling by BitmapFactory.decodeResource()

2009-09-17 Thread Tom Gibara
Hmm, interesting... Just had a chance to try this out on 1.5. If I move my bitmaps into a drawable-nodpi directory then the application compiles and executes, but I don't see the images. Inspection with the debugger (plus logging just to make sure) indicates that the bitmaps, when loaded from "nod

[android-developers] Re: Image scaling by BitmapFactory.decodeResource()

2009-09-17 Thread Romain Guy
> wtf? IMHO decodeResource() shouldn't make any assumptions on usage. Yes it should in this case. Otherwise your application just won't work on displays with different densities. > > -- > jason.vp.engineering.particle > > > > -- Romain Guy Android framework engineer romain...@android.com No

[android-developers] Re: Image scaling by BitmapFactory.decodeResource()

2009-09-17 Thread Romain Guy
Give it a try, 1.5 already had all the scaling code based on display's density. I don't know about nodpi specifically but it's worth the try. On Thu, Sep 17, 2009 at 11:46 AM, Tom Gibara wrote: > Duh, I misread the docs for the inScaled flag. Thanks for pointing that out. > The drawable-nodpi/ s

[android-developers] Re: Image scaling by BitmapFactory.decodeResource()

2009-09-17 Thread Tom Gibara
Duh, I misread the docs for the inScaled flag. Thanks for pointing that out. The drawable-nodpi/ sounds perfect, but I'm guessing I can't use that and remain compatible with API 3, since I don't see "nodpi" listed the documentation for resources in 1.5. Tom. 2009/9/17 Romain Guy > > > private B

[android-developers] Re: Image scaling by BitmapFactory.decodeResource()

2009-09-17 Thread Jason Proctor
>and discovered that the BitmapFactory.decodeResource method now >performs scaling based on screen density. wtf? IMHO decodeResource() shouldn't make any assumptions on usage. -- jason.vp.engineering.particle --~--~-~--~~~---~--~~ You received this message beca

[android-developers] Re: Image scaling by BitmapFactory.decodeResource()

2009-09-17 Thread Romain Guy
> private Bitmap loadBitmap(int resId) { BitmapFactory.Options options = new > BitmapFactory.Options(); options.inTargetDensity = 1; options.inDensity = 1; > return BitmapFactory.decodeResource(context.getResources(), resId, options); > } That's the wrong way to do it. You're assigning your bitma