1 /* 2 * Copyright (c) 2011, 2016, Oracle and/or its affiliates. All rights reserved. 3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 4 * 5 * This code is free software; you can redistribute it and/or modify it 6 * under the terms of the GNU General Public License version 2 only, as 7 * published by the Free Software Foundation. Oracle designates this 8 * particular file as subject to the "Classpath" exception as provided 9 * by Oracle in the LICENSE file that accompanied this code. 10 * 11 * This code is distributed in the hope that it will be useful, but WITHOUT 12 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 13 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 14 * version 2 for more details (a copy is included in the LICENSE file that 15 * accompanied this code). 16 * 17 * You should have received a copy of the GNU General Public License version 18 * 2 along with this work; if not, write to the Free Software Foundation, 19 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 20 * 21 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 22 * or visit www.oracle.com if you need additional information or have any 23 * questions. 24 */ 25 26 package com.sun.javafx.scene.transform; 27 28 import javafx.scene.transform.Transform; 29 30 /** 31 * Internal utilities for transformations 32 */ 33 public class TransformUtils { 34 35 /** 36 * Creates an immutable arbitrary transformation. 37 * This method is not intended for public use, users should use the Affine 38 * class. 39 */ 40 public static Transform immutableTransform( 41 double mxx, double mxy, double mxz, double tx, 42 double myx, double myy, double myz, double ty, 43 double mzx, double mzy, double mzz, double tz) { 44 return TransformHelper.createImmutableTransform( 45 mxx, mxy, mxz, tx, 46 myx, myy, myz, ty, 47 mzx, mzy, mzz, tz); 48 } 49 50 /** 51 * Creates an immutable transformation filled with current values 52 * from the given transformation. 53 * This method is not intended for public use, users should use the Affine 54 * class. 55 */ 56 public static Transform immutableTransform(Transform t) { 57 return TransformHelper.createImmutableTransform( 58 t.getMxx(), t.getMxy(), t.getMxz(), t.getTx(), 59 t.getMyx(), t.getMyy(), t.getMyz(), t.getTy(), 60 t.getMzx(), t.getMzy(), t.getMzz(), t.getTz()); 61 } 62 63 /** 64 * Creates an immutable arbitrary transformation. 65 * If the given instance is not null, it is reused. 66 * This method is not intended for public use, users should use the Affine 67 * class. 68 * @throws ClassCastException if the given transform to be reused 69 * is not instance of ImmutableTransform 70 */ 71 public static Transform immutableTransform(Transform reuse, 72 double mxx, double mxy, double mxz, double tx, 73 double myx, double myy, double myz, double ty, 74 double mzx, double mzy, double mzz, double tz) { 75 76 return TransformHelper.createImmutableTransform(reuse, 77 mxx, mxy, mxz, tx, 78 myx, myy, myz, ty, 79 mzx, mzy, mzz, tz); 80 } 81 82 /** 83 * Creates an immutable transformation filled with current values 84 * from the given transformation. 85 * If the given instance is not null, it is reused. 86 * This method is not intended for public use, users should use the Affine 87 * class. 88 * @throws ClassCastException if the given transform to be reused 89 * is not instance of ImmutableTransform 90 */ 91 public static Transform immutableTransform(Transform reuse, 92 Transform t) { 93 return TransformHelper.createImmutableTransform(reuse, 94 t.getMxx(), t.getMxy(), t.getMxz(), t.getTx(), 95 t.getMyx(), t.getMyy(), t.getMyz(), t.getTy(), 96 t.getMzx(), t.getMzy(), t.getMzz(), t.getTz()); 97 } 98 99 /** 100 * Creates an immutable transformation filled with concatenation 101 * of the given transformations. 102 * If the given instance is not null, it is reused. 103 * This method is not intended for public use, users should use the Affine 104 * class. 105 * @throws ClassCastException if one of the given transforms 106 * is not instance of ImmutableTransform 107 */ 108 public static Transform immutableTransform(Transform reuse, 109 Transform left, Transform right) { 110 111 return TransformHelper.createImmutableTransform(reuse, left, right); 112 } 113 114 }