PandaActivity.java 2.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859
  1. /**
  2. * PANDA 3D SOFTWARE
  3. * Copyright (c) Carnegie Mellon University. All rights reserved.
  4. *
  5. * All use of this software is subject to the terms of the revised BSD
  6. * license. You should have received a copy of this license along
  7. * with this source code in a file named "LICENSE."
  8. *
  9. * @file PandaActivity.java
  10. * @author rdb
  11. * @date 2013-01-22
  12. */
  13. package org.panda3d.android;
  14. import android.app.NativeActivity;
  15. import android.graphics.Bitmap;
  16. import android.graphics.BitmapFactory;
  17. import org.panda3d.android.NativeIStream;
  18. /**
  19. * The entry point for a Panda-based activity. Loads the Panda libraries and
  20. * also provides some utility functions.
  21. */
  22. public class PandaActivity extends NativeActivity {
  23. protected static BitmapFactory.Options readBitmapSize(long istreamPtr) {
  24. BitmapFactory.Options options = new BitmapFactory.Options();
  25. options.inJustDecodeBounds = true;
  26. options.inScaled = false;
  27. NativeIStream stream = new NativeIStream(istreamPtr);
  28. BitmapFactory.decodeStream(stream, null, options);
  29. return options;
  30. }
  31. protected static Bitmap readBitmap(long istreamPtr, int sampleSize) {
  32. BitmapFactory.Options options = new BitmapFactory.Options();
  33. // options.inPreferredConfig = Bitmap.Config.RGBA_8888;
  34. options.inScaled = false;
  35. options.inSampleSize = sampleSize;
  36. NativeIStream stream = new NativeIStream(istreamPtr);
  37. return BitmapFactory.decodeStream(stream, null, options);
  38. }
  39. protected static String getCurrentThreadName() {
  40. return Thread.currentThread().getName();
  41. }
  42. static {
  43. System.loadLibrary("gnustl_shared");
  44. System.loadLibrary("p3dtool");
  45. System.loadLibrary("p3dtoolconfig");
  46. System.loadLibrary("pandaexpress");
  47. System.loadLibrary("panda");
  48. System.loadLibrary("p3android");
  49. System.loadLibrary("p3framework");
  50. System.loadLibrary("pandaegg");
  51. System.loadLibrary("pandagles");
  52. }
  53. }