App
Interpolator.java
Go to the documentation of this file.
1 package mhr.appcore.interpolators;
2 
3 import mhr.appcore.bitmap.NBitmap;
4 import mhr.appcore.bitmap.NativeType;
5 import mhr.appcore.exceptions.AlreadyDisposedException;
6 
10 public class Interpolator {
11 
12  //===================================================================================================================================================//
13  //===== PUBLIC ==============================================================================================================================//
14  //----- interface a třídy -------------------------------------------------------------------------------------------------------------------//
15  //----- pole --------------------------------------------------------------------------------------------------------------------------------//
16  //----- acesory a primitivní metody ---------------------------------------------------------------------------------------------------------//
17  //----- konstruktory ------------------------------------------------------------------------------------------------------------------------//
18  //----- destruktory -------------------------------------------------------------------------------------------------------------------------//
19  //----- metody ------------------------------------------------------------------------------------------------------------------------------//
28  public static int resampleTo(NBitmap src, NBitmap dst) throws AlreadyDisposedException, IllegalArgumentException {
29  if (src.getAdress() == 0) {
30  throw new AlreadyDisposedException("Bitmap is already disposed.");
31  }
32  if (src.getNativeType() != dst.getNativeType()) {
33  throw new IllegalArgumentException("Source and destination type doesn't match.");
34  }
35  return resampleTo(src.getNativeType().getValue(), src.getAdress(), dst.getAdress());
36  }
37 
39  public static int resampleTo(NBitmap src, NBitmap dst, InterpolatorType iType) throws AlreadyDisposedException, IllegalArgumentException {
40  if (iType == InterpolatorType.INVALID_TYPE) {
41  return 0;
42  }
43  if (src.getAdress() == 0) {
44  throw new AlreadyDisposedException("Bitmap is already disposed.");
45  }
46  if (src.getNativeType() != dst.getNativeType()) {
47  throw new IllegalArgumentException("Source and destination type doesn't match.");
48  }
49  return resampleTo(src.getNativeType().getValue(), src.getAdress(), dst.getAdress(), iType.getValue());
50  }
51 
53  public static int resampleTo(NBitmap src, NBitmap dst, InterpolatorType iType, double force) throws AlreadyDisposedException, IllegalArgumentException {
54  if (iType == InterpolatorType.INVALID_TYPE) {
55  return 0;
56  }
57  if (src.getAdress() == 0) {
58  throw new AlreadyDisposedException("Bitmap is already disposed.");
59  }
60  if (src.getNativeType() != dst.getNativeType()) {
61  throw new IllegalArgumentException("Source and destination type doesn't match.");
62  }
63  return resampleTo(src.getNativeType().getValue(), src.getAdress(), dst.getAdress(), iType.getValue(), force);
64  }
65 
66  //===================================================================================================================================================//
67  //===== NON-PUBLIC ==========================================================================================================================//
68  //----- interface a třídy -------------------------------------------------------------------------------------------------------------------//
69  //----- pole --------------------------------------------------------------------------------------------------------------------------------//
70  //----- acesory a primitivní metody ---------------------------------------------------------------------------------------------------------//
71  //----- konstruktory ------------------------------------------------------------------------------------------------------------------------//
75  protected Interpolator() {
76  }
77 
78  //----- destruktory -------------------------------------------------------------------------------------------------------------------------//
79  //----- metody ------------------------------------------------------------------------------------------------------------------------------//
80 
82  protected static native int resampleTo(int nativeType, long srcAdress, long dstAdress);
83  protected static native int resampleTo(int nativeType, long srcAdress, long dstAdress, int iType);
84  protected static native int resampleTo(int nativeType, long srcAdress, long dstAdress, int iType, double force);
85 
86  //===================================================================================================================================================//
87  //===== DEPRECATED ==========================================================================================================================//
88 
89 }