The returned pictured is stretched.


On Tue, May 1, 2012 at 11:04 PM, Justin Anderson <magouyaw...@gmail.com>wrote:

> What do you mean by distorted?
> On May 1, 2012 12:41 PM, "Mohamed ElSanousi" <mmurtad...@gmail.com> wrote:
>
>> I'm doing a facial parameter software that doctors could use to extract
>> angles and ratios of the nose. This is what i have so far, I even tried to
>> rotate the picture and still the returned image is distorted.
>>
>>  Code:
>>
>>  Bitmap b = BitmapFactory.decodeFile(getIntent().getStringExtra(
>> "imagePath"));
>>
>>         float rotation = (float) this.getIntent().getFloatExtra(
>> "resource", 0);
>>
>>
>>
>>
>>
>>         DisplayMetrics displayMetrics = new DisplayMetrics();
>>
>>         WindowManager wm = (WindowManager)
>> getApplicationContext().getSystemService(Context.WINDOW_SERVICE); // the
>> results will be higher than using the activity context object or the
>> getWindowManager() shortcut
>>
>>         wm.getDefaultDisplay().getMetrics(displayMetrics);
>>
>>         int screenWidth = displayMetrics.widthPixels;
>>
>>         int screenHeight = displayMetrics.heightPixels;
>>
>>
>>
>>         Matrix matrix = new Matrix();
>>
>>        // float rotation =
>> PhotoTaker.rotationForImage(this.getApplicationContext(), uri);
>>
>>         if (rotation != 0f) {
>>
>>              matrix.preRotate(rotation);
>>
>>         }
>>
>>
>>
>>         Bitmap scaled = Bitmap.createBitmap(b, 0, 0, b.getWidth(),
>> b.getHeight(), matrix, true);
>>
>>
>>
>>         //b.createScaledBitmap(b, 320, 480, true);
>>
>>
>>
>>         n.setBackGround(scaled,screenWidth,screenHeight);
>>
>>
>>
>>         //preview.setImageBitmap(b);
>>
>>         setContentView(n);
>>
>> On Tue, May 1, 2012 at 2:18 AM, Jim Graham <spooky1...@gmail.com> wrote:
>>
>>> One point here:  the assumption I'm making is that this is for a
>>> wallpaper.
>>>
>>> On Mon, Apr 30, 2012 at 03:46:37PM -0600, Justin Anderson wrote:
>>> > >
>>> > > And if you're about to question that, I got this directly from Dianne
>>> > > Hackborn in a thread I
>>> > > started over a year ago (maybe two...I'm not even sure now).
>>> > >
>>> > Do you happen to have a link to said thread?
>>>
>>> If I did, don't you think I'd be able to say how long ago it was?  ;-}
>>> But given the source of the information---direct from one of THE
>>> Android developers (as in, the platform itself), I think it's safe to
>>> say that you're nuts if you don't listen to what she said.
>>>
>>> > I have done image scaling before and have never run into this... My
>>> > constraints were slightly different though... I simply scaled the image
>>> > so that it was as large as possible while maintaining the aspect
>>> > ration.
>>>
>>> Yeah, and I tried all of that stuff, too....and no matter what, it kept
>>> getting stretched off-screen when you set it as wallpaper.
>>>
>>> > On Mon, Apr 30, 2012 at 3:26 PM, Mohamed ElSanousi <
>>> mmurtad...@gmail.com>wrote:
>>> > >
>>> > >  Your joking, my whole project is depending. I need to resize this
>>> bitmap
>>> > > to fit the screen size, because I want to do calculation on the
>>> picture :(
>>>
>>> Wait a second...is this for a wallpaper (or lwp)?  Or are you just trying
>>> to set an ImageView to full screen?  If the former, no, you can't do it.
>>> If the latter, RTFM (http://developer.android.com/guide/index.html).
>>> That's so simple I never even considered that that's what you were
>>> asking.  And you don't need to calculate the screen size or anything to
>>> do that.  Just the right settings (in XML and maybe also in Java) for an
>>> ImageView.
>>>
>>> Later,
>>>   --jim
>>>
>>> --
>>> THE SCORE:  ME:  2  CANCER:  0
>>> 73 DE N5IAL (/4)        | "> There it was, right in the title bar:
>>> spooky1...@gmail.com    |  > Microsoft Operations POS."
>>> < Running FreeBSD 7.0 > |
>>> ICBM / Hurricane:       | "Never before has a TLA been so appropriately
>>>   30.44406N 86.59909W  |  mis-parsed."         (alt.sysadmin.recovery)
>>>
>>> Android Apps Listing at http://www.jstrack.org/barcodes.html
>>>
>>> --
>>> 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
>
>  --
> 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

Reply via email to