< prev index next >

modules/javafx.graphics/src/main/java/com/sun/javafx/util/Utils.java

Print this page




  27 
  28 import static com.sun.javafx.FXPermissions.ACCESS_WINDOW_LIST_PERMISSION;
  29 import javafx.geometry.BoundingBox;
  30 import javafx.geometry.Bounds;
  31 import javafx.geometry.HPos;
  32 import javafx.geometry.NodeOrientation;
  33 import javafx.geometry.Point2D;
  34 import javafx.geometry.Rectangle2D;
  35 import javafx.geometry.VPos;
  36 import javafx.scene.Node;
  37 import javafx.scene.Scene;
  38 import javafx.scene.paint.Color;
  39 import javafx.scene.paint.Stop;
  40 import javafx.stage.Screen;
  41 import javafx.stage.Stage;
  42 import javafx.stage.Window;
  43 import java.util.List;
  44 import com.sun.javafx.PlatformUtil;
  45 import java.security.AccessController;
  46 import java.security.PrivilegedAction;


  47 
  48 /**
  49  * Some basic utilities which need to be in java (for shifting operations or
  50  * other reasons), which are not toolkit dependent.
  51  *
  52  */
  53 public class Utils {
  54 
  55     /***************************************************************************
  56      *                                                                         *
  57      * Math-related utilities                                                  *
  58      *                                                                         *
  59      **************************************************************************/
  60 
  61     /**
  62      * Simple utility function which clamps the given value to be strictly
  63      * between the min and max values.
  64      */
  65     public static float clamp(float min, float value, float max) {
  66         if (value < min) return min;


 943                                 }
 944                                 d = result1;
 945                                 code = (code << 4) + d;
 946                             }
 947                             if (d >= 0) {
 948                                 ch = (char)code;
 949                                 unicodeConversionBp = bp;
 950                             }
 951                         }
 952                         //lexError(bp, "illegal.unicode.esc");
 953                     } else {
 954                         bp--;
 955                         ch = '\\';
 956                     }
 957                 }
 958             }
 959             dst[dstIndex++] = ch;
 960         }
 961 
 962         return new String(dst, 0, dstIndex);















 963     }
 964 }


  27 
  28 import static com.sun.javafx.FXPermissions.ACCESS_WINDOW_LIST_PERMISSION;
  29 import javafx.geometry.BoundingBox;
  30 import javafx.geometry.Bounds;
  31 import javafx.geometry.HPos;
  32 import javafx.geometry.NodeOrientation;
  33 import javafx.geometry.Point2D;
  34 import javafx.geometry.Rectangle2D;
  35 import javafx.geometry.VPos;
  36 import javafx.scene.Node;
  37 import javafx.scene.Scene;
  38 import javafx.scene.paint.Color;
  39 import javafx.scene.paint.Stop;
  40 import javafx.stage.Screen;
  41 import javafx.stage.Stage;
  42 import javafx.stage.Window;
  43 import java.util.List;
  44 import com.sun.javafx.PlatformUtil;
  45 import java.security.AccessController;
  46 import java.security.PrivilegedAction;
  47 import com.sun.glass.utils.NativeLibLoader;
  48 import com.sun.prism.impl.PrismSettings;
  49 
  50 /**
  51  * Some basic utilities which need to be in java (for shifting operations or
  52  * other reasons), which are not toolkit dependent.
  53  *
  54  */
  55 public class Utils {
  56 
  57     /***************************************************************************
  58      *                                                                         *
  59      * Math-related utilities                                                  *
  60      *                                                                         *
  61      **************************************************************************/
  62 
  63     /**
  64      * Simple utility function which clamps the given value to be strictly
  65      * between the min and max values.
  66      */
  67     public static float clamp(float min, float value, float max) {
  68         if (value < min) return min;


 945                                 }
 946                                 d = result1;
 947                                 code = (code << 4) + d;
 948                             }
 949                             if (d >= 0) {
 950                                 ch = (char)code;
 951                                 unicodeConversionBp = bp;
 952                             }
 953                         }
 954                         //lexError(bp, "illegal.unicode.esc");
 955                     } else {
 956                         bp--;
 957                         ch = '\\';
 958                     }
 959                 }
 960             }
 961             dst[dstIndex++] = ch;
 962         }
 963 
 964         return new String(dst, 0, dstIndex);
 965     }
 966 
 967     public static synchronized void loadNativeSwingLibrary() {
 968         AccessController.doPrivileged((PrivilegedAction<Void>) () -> {
 969             String libName = "prism_common";
 970 
 971             if (PrismSettings.verbose) {
 972                 System.out.println("Loading Prism common native library ...");
 973             }
 974             NativeLibLoader.loadLibrary(libName);
 975             if (PrismSettings.verbose) {
 976                 System.out.println("\tsucceeded.");
 977             }
 978             return null;
 979         });
 980     }
 981 }
< prev index next >