Welcome to XDA

Search to go directly to your device's forum

Register an account

Unlock full posting privileges

Ask a question

No registration required
Post Reply

[API]3D Interlace library v4

OP HJ200

30th September 2012, 02:03 PM   |  #1  
Hi folks,

A lot of people asked for the code to interlace images (used for the 3D Wallpaper Picker).

So here's a library to use in your own code projects.

License:
Free, as long as you mention my username in the credits. I also would like to know via PM if you published any app using it

Projects currently using this lib
[APP]AOSP 4.3 Gallery with 3D - View jps and mpo in 3D
[APP] ImageView 3D
[APP][v2.5] 3D Wallpapers picker
[liveWallpaper][evoStereo3D] JellyBeansGLES2 3D customizable interactive
[APP] [SENSE 4.0/4.1] Gallery 3D PlugIn [11 Oct 12]

Changelog
v4: Huge rewrite to improve speed and reduce OutOfMemory exceptions. Also added fillmode, to resize image inside or outside given bounds. Improved 2D loading speed
v3: Added HTC 3D switching (no-su), improved 3D loading, added new Activity3D, added load2D (left eye)
v2: Improved mpo decoding
v1: Initial version

Thanks
jmztaylor, who created the first app to enable the 3D display, which can be found in the Play Store.
Chillisaus for the help on the mpo decoding.
Attached Files
File Type: jar Tools3D_v2.jar - [Click for QR Code] (7.8 KB, 264 views)
File Type: jar Tools3D_v3.jar - [Click for QR Code] (9.2 KB, 19 views)
File Type: jar Tools3D_v4.jar - [Click for QR Code] (14.3 KB, 101 views)
Last edited by HJ200; 17th October 2013 at 12:51 AM.
The Following 21 Users Say Thank You to HJ200 For This Useful Post: [ View ]
30th September 2012, 02:03 PM   |  #2  
Prompt API: Scale, crop and interlace bitmap
Code:
/**
 * Create a Tools3D object with default dimension
 *  @param orientation Bitmap output in either LANDSCAPE or PORTRAIT
 */
public Tools3D(Orientation orientation);
Code:
/**
 * Create a Tools3D object with a given output dimension
 *  @param outputDimension Bitmap output width x height
 */
 public Tools3D(Dimension outputDimension);
Code:
/**
 * Interlace a bitmap
 *  @param pathName Location of the image to interlace (.mpo, .jps and side-by-side images supported)
 *  @return Interlaced bitmap for the given screen dimension or default HTC EVO 3D screen size
 *  @Throws ParserException
 */
public Bitmap interlace(String pathName) throws ParserException, OutOfMemoryError;
Last edited by HJ200; 14th October 2013 at 02:10 PM.
The Following 7 Users Say Thank You to HJ200 For This Useful Post: [ View ]
30th September 2012, 02:04 PM   |  #3  
Prompt API: Force 3D mode
Code:
/**
 * Force 3D mode <b>WARNING! USER NEEDS TO HAVE SU INSTALLED</b>
 * @param mode3D OFF, LANDSCAPE or PORTRAIT
 */
public static void set3DMode(Mode3D mode3D) throws IOException;
Code:
/**
 * Make a Activity view 3D by default
 */
public MyActivity extends Activity3D{

   public void onCreate(Bundle savedInstance) {
      set3D(true); // Orientation will find out Landscape or Portrait
   }
}
Last edited by HJ200; 14th October 2013 at 02:10 PM.
The Following 7 Users Say Thank You to HJ200 For This Useful Post: [ View ]
17th October 2012, 12:30 AM   |  #4  
Prompt API: Load 2D bitmaps
Code:
// Load 2D left eye of a 3D file
imageview.setImageBitmap(Tools3D.load2D(file));
Last edited by HJ200; 14th October 2013 at 02:12 PM.
The Following 3 Users Say Thank You to HJ200 For This Useful Post: [ View ]
17th October 2012, 11:14 AM   |  #5  
Junior Member
Thanks Meter: 5
 
2 posts
Join Date:Joined: Nov 2009
Github
For anyone interested in the code:
github.com/mtoonen/mpo2jps
You can fork us, and if you have improvements, make a pull request.
The Following 5 Users Say Thank You to Chillisaus For This Useful Post: [ View ]
19th October 2012, 08:40 PM   |  #6  
bihariel's Avatar
Senior Member
Thanks Meter: 867
 
727 posts
Join Date:Joined: Apr 2010
Donate to Me
More
If any Android apps developer could create/modify a gallery app ( for example modifying an open source app) to use this tool to view 3D images, it would be awesome. I hope some one could do it.
19th October 2012, 10:47 PM   |  #7  
Quote:
Originally Posted by bihariel

If any Android apps developer could create/modify a gallery app ( for example modifying an open source app) to use this tool to view 3D images, it would be awesome. I hope some one could do it.

Did you see the 3rd url in the fipo?

Sent from my HTC EVO 3D X515m using xda premium
The Following User Says Thank You to HJ200 For This Useful Post: [ View ]
4th January 2013, 10:55 AM   |  #8  
Thumbs up
Hi folks,

As some of you might have read, I've found out how to enable the 3D screen without the need of root permissions. Here's a small library I made (it's not updated in the interlace library)

Note: this code only works on Sense 3.6 and Sense 4.0 roms, so you might want to implement the old method as a fallback (catch all Exceptions)

Code:
int LANDSCAPE = 0;
int PORTRAIT = 1;
int NORMAL = 2;

IDisplayService display = IDisplayService.Stub.asInterface(ServiceManager.getService("display"));
display.set3DMode(LANDSCAPE, "3dToggleTag");
Update: A fail-safe way to enable 3D is implemented in Tools3D_v3
Attached Files
File Type: jar framework-3d.jar - [Click for QR Code] (6.0 KB, 49 views)
Last edited by HJ200; 14th October 2013 at 02:15 PM. Reason: Added to Tools3D_v3
The Following 3 Users Say Thank You to HJ200 For This Useful Post: [ View ]
4th October 2013, 06:11 PM   |  #9  
Member
Thanks Meter: 12
 
52 posts
Join Date:Joined: Sep 2009
Quote:
Originally Posted by HJ200

Hi folks,

As some of you might have read, I've found out how to enable the 3D screen without the need of root permissions. Here's a small library I made (it's not updated in the interlace library)

Note: this code only works on Sense 3.6 and Sense 4.0 roms, so you might want to implement the old method as a fallback (catch all Exceptions)

Code:
int LANDSCAPE = 0;
int PORTRAIT = 1;
int NORMAL = 2;

IDisplayService display = IDisplayService.Stub.asInterface(ServiceManager.getService("display"));
display.set3DMode(LANDSCAPE, "3dToggleTag");

Ist that easy? Thank you!! ill try this out later
14th October 2013, 02:13 PM   |  #10  
Tools3D_v3 released
Hi everyone,

I posted a new version of the library, please report any problems. Feature list added to FIPO, updated API examples.

The Following 2 Users Say Thank You to HJ200 For This Useful Post: [ View ]
Post Reply Subscribe to Thread
Previous Thread Next Thread
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes