5,603,981 Members 45,543 Now Online
XDA Developers Android and Mobile Development Forum

[API]3D Interlace library v4

Tip us?
 
HJ200
Old
(Last edited by HJ200; 16th October 2013 at 11:51 PM.)
#1  
HJ200's Avatar
Recognized Developer - OP
Thanks Meter 458
Posts: 378
Join Date: Dec 2008
Prompt [API]3D Interlace library v4

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, 249 views)
File Type: jar Tools3D_v3.jar - [Click for QR Code] (9.2 KB, 16 views)
File Type: jar Tools3D_v4.jar - [Click for QR Code] (14.3 KB, 73 views)
The Following 21 Users Say Thank You to HJ200 For This Useful Post: [ Click to Expand ]
 
HJ200
Old
(Last edited by HJ200; 14th October 2013 at 01:10 PM.)
#2  
HJ200's Avatar
Recognized Developer - OP
Thanks Meter 458
Posts: 378
Join Date: Dec 2008
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;
The Following 7 Users Say Thank You to HJ200 For This Useful Post: [ Click to Expand ]
 
HJ200
Old
(Last edited by HJ200; 14th October 2013 at 01:10 PM.)
#3  
HJ200's Avatar
Recognized Developer - OP
Thanks Meter 458
Posts: 378
Join Date: Dec 2008
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
   }
}
The Following 7 Users Say Thank You to HJ200 For This Useful Post: [ Click to Expand ]
 
HJ200
Old
(Last edited by HJ200; 14th October 2013 at 01:12 PM.)
#4  
HJ200's Avatar
Recognized Developer - OP
Thanks Meter 458
Posts: 378
Join Date: Dec 2008
Prompt API: Load 2D bitmaps

Code:
// Load 2D left eye of a 3D file
imageview.setImageBitmap(Tools3D.load2D(file));
The Following 3 Users Say Thank You to HJ200 For This Useful Post: [ Click to Expand ]
 
Chillisaus
Old
#5  
Junior Member
Thanks Meter 4
Posts: 2
Join Date: Nov 2009
Default 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 4 Users Say Thank You to Chillisaus For This Useful Post: [ Click to Expand ]
 
bihariel
Old
#6  
bihariel's Avatar
Senior Member
Thanks Meter 862
Posts: 699
Join Date: Apr 2010

 
DONATE TO ME
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.
 
HJ200
Old
#7  
HJ200's Avatar
Recognized Developer - OP
Thanks Meter 458
Posts: 378
Join Date: Dec 2008
Quote:
Originally Posted by bihariel View Post
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: [ Click to Expand ]
 
HJ200
Old
(Last edited by HJ200; 14th October 2013 at 01:15 PM.) Reason: Added to Tools3D_v3
#8  
HJ200's Avatar
Recognized Developer - OP
Thanks Meter 458
Posts: 378
Join Date: Dec 2008
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, 42 views)
The Following 3 Users Say Thank You to HJ200 For This Useful Post: [ Click to Expand ]
 
mynote
Old
#9  
Member
Thanks Meter 12
Posts: 52
Join Date: Sep 2009
Quote:
Originally Posted by HJ200 View Post
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
 
HJ200
Old
#10  
HJ200's Avatar
Recognized Developer - OP
Thanks Meter 458
Posts: 378
Join Date: Dec 2008
Default 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: [ Click to Expand ]
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes