How to flip an image

All your problems with Audio, Video and Images.

How to flip an image

Postby shaamu786 » Fri Oct 23, 2009 11:00 am

Hi friends , somebody have any idea how to flip an image in android like J2ME in which just pass an argument to drawImage() method of Graphics class.
xgw
shaamu786
Junior Developer
Junior Developer
 
Posts: 16
Joined: Tue Sep 01, 2009 7:17 am
Location: Delhi

Top

Postby azraeal » Fri Oct 23, 2009 6:45 pm

This flips on the x-axis (vertically mirrored)

Syntax: [ Download ] [ Hide ]
Using java Syntax Highlighting
  1.  
  2. sprite = BitmapFactory.decodeResource(appContext.getResources(),
  3.  
  4. R.drawable.spritegfx);
  5.  
  6. Matrix aMatrix = new Matrix();
  7.  
  8. aMatrix.preScale(-1.0f, 1.0f); //Line of interest
  9.  
  10. flippedSprite = Bitmap.createBitmap(sprite, 0, 0, sprite.width(),sprite.height(), aMatrix, false);
Parsed in 0.032 seconds, using GeSHi 1.0.8.4
azraeal
Experienced Developer
Experienced Developer
 
Posts: 71
Joined: Fri Sep 04, 2009 6:34 pm
Location: California

Postby Caballero » Sun Apr 25, 2010 1:45 pm

I'm trying to flip the whole display of my app. Any idea ?
Mobile : HTC Desire
Applications : aTrip
Caballero
Freshman
Freshman
 
Posts: 7
Joined: Thu Mar 11, 2010 11:03 pm

Postby azraeal » Mon Apr 26, 2010 6:06 pm

I assume you meant changing the orientation of the app.
Syntax: [ Download ] [ Hide ]
Using java Syntax Highlighting
  1. Activity.setRequestedOrientation(...)
Parsed in 0.031 seconds, using GeSHi 1.0.8.4


http://developer.android.com/reference/ ... n%28int%29

Android only has 2 orientations, landscape and portrait. You're not going to get a left facing portrait nor upside-down landscape.
azraeal
Experienced Developer
Experienced Developer
 
Posts: 71
Joined: Fri Sep 04, 2009 6:34 pm
Location: California

Postby Caballero » Mon Apr 26, 2010 9:35 pm

no, I'd like to apply like a mirror effect on my display : like if I were looking it in a mirror.
Mobile : HTC Desire
Applications : aTrip
Caballero
Freshman
Freshman
 
Posts: 7
Joined: Thu Mar 11, 2010 11:03 pm

Top

Return to Multimedia Problems

Who is online

Users browsing this forum: No registered users and 10 guests