1 /*
2 * Copyright (c) 2011, 2014, 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
739 @Override
740 public String toString() {
741 final StringBuilder sb = new StringBuilder("Scale [");
742
743 sb.append("x=").append(getX());
744 sb.append(", y=").append(getY());
745 sb.append(", z=").append(getZ());
746 sb.append(", pivotX=").append(getPivotX());
747 sb.append(", pivotY=").append(getPivotY());
748 sb.append(", pivotZ=").append(getPivotZ());
749
750 return sb.append("]").toString();
751 }
752
753 /* *************************************************************************
754 * *
755 * Internal implementation stuff *
756 * *
757 **************************************************************************/
758
759 /**
760 * @treatAsPrivate implementation detail
761 * @deprecated This is an internal API that is not intended for use and will be removed in the next version
762 */
763 @Deprecated
764 @Override
765 public void impl_apply(final Affine3D trans) {
766 if (getPivotX() != 0 || getPivotY() != 0 || getPivotZ() != 0) {
767 trans.translate(getPivotX(), getPivotY(), getPivotZ());
768 trans.scale(getX(), getY(), getZ());
769 trans.translate(-getPivotX(), -getPivotY(), -getPivotZ());
770 } else {
771 trans.scale(getX(), getY(), getZ());
772 }
773 }
774
775 /**
776 * @treatAsPrivate implementation detail
777 * @deprecated This is an internal API that is not intended for use and will be removed in the next version
778 */
779 @Deprecated
780 @Override
781 public BaseTransform impl_derive(BaseTransform trans) {
782 if (isIdentity()) {
783 return trans;
784 }
785 if (getPivotX() != 0 || getPivotY() != 0 || getPivotZ() != 0) {
786 trans = trans.deriveWithTranslation(getPivotX(), getPivotY(), getPivotZ());
787 trans = trans.deriveWithScale(getX(), getY(), getZ());
788 return trans.deriveWithTranslation(-getPivotX(), -getPivotY(), -getPivotZ());
789 } else {
790 return trans.deriveWithScale(getX(), getY(), getZ());
791 }
792 }
793
794 @Override
795 void validate() {
796 getX(); getPivotX();
797 getY(); getPivotY();
798 getZ(); getPivotZ();
799 }
800
801 @Override
|
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
739 @Override
740 public String toString() {
741 final StringBuilder sb = new StringBuilder("Scale [");
742
743 sb.append("x=").append(getX());
744 sb.append(", y=").append(getY());
745 sb.append(", z=").append(getZ());
746 sb.append(", pivotX=").append(getPivotX());
747 sb.append(", pivotY=").append(getPivotY());
748 sb.append(", pivotZ=").append(getPivotZ());
749
750 return sb.append("]").toString();
751 }
752
753 /* *************************************************************************
754 * *
755 * Internal implementation stuff *
756 * *
757 **************************************************************************/
758
759 @Override
760 void apply(final Affine3D trans) {
761 if (getPivotX() != 0 || getPivotY() != 0 || getPivotZ() != 0) {
762 trans.translate(getPivotX(), getPivotY(), getPivotZ());
763 trans.scale(getX(), getY(), getZ());
764 trans.translate(-getPivotX(), -getPivotY(), -getPivotZ());
765 } else {
766 trans.scale(getX(), getY(), getZ());
767 }
768 }
769
770 @Override
771 BaseTransform derive(BaseTransform trans) {
772 if (isIdentity()) {
773 return trans;
774 }
775 if (getPivotX() != 0 || getPivotY() != 0 || getPivotZ() != 0) {
776 trans = trans.deriveWithTranslation(getPivotX(), getPivotY(), getPivotZ());
777 trans = trans.deriveWithScale(getX(), getY(), getZ());
778 return trans.deriveWithTranslation(-getPivotX(), -getPivotY(), -getPivotZ());
779 } else {
780 return trans.deriveWithScale(getX(), getY(), getZ());
781 }
782 }
783
784 @Override
785 void validate() {
786 getX(); getPivotX();
787 getY(); getPivotY();
788 getZ(); getPivotZ();
789 }
790
791 @Override
|