Spec-Zone .ru
спецификации, руководства, описания, API
|
001/* 002 * Copyright (c) 2012, 2013, Oracle and/or its affiliates. All rights reserved. 003 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 004 * 005 * This code is free software; you can redistribute it and/or modify it 006 * under the terms of the GNU General Public License version 2 only, as 007 * published by the Free Software Foundation. Oracle designates this 008 * particular file as subject to the "Classpath" exception as provided 009 * by Oracle in the LICENSE file that accompanied this code. 010 * 011 * This code is distributed in the hope that it will be useful, but WITHOUT 012 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 013 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 014 * version 2 for more details (a copy is included in the LICENSE file that 015 * accompanied this code). 016 * 017 * You should have received a copy of the GNU General Public License version 018 * 2 along with this work; if not, write to the Free Software Foundation, 019 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 020 * 021 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 022 * or visit www.oracle.com if you need additional information or have any 023 * questions. 024 */ 025 026package javafx.scene.transform; 027 028/** 029 * Specifies type of transformation matrix. 030 */ 031public enum MatrixType { 032 /** 033 * A 2D affine transformation matrix of 2 rows and 3 columns containing 034 * the following values: 035 * <pre> 036 * mxx, mxy, tx, 037 * myx, myy, ty 038 * </pre> 039 */ 040 MT_2D_2x3(2, 3), 041 042 /** 043 * A 2D transformation matrix of 3 rows and 3 columns. For affine transforms 044 * the last line is constant, so the matrix contains the following values: 045 * <pre> 046 * mxx, mxy, tx, 047 * myx, myy, ty, 048 * 0, 0, 1 049 * </pre> 050 */ 051 MT_2D_3x3(3, 3), 052 053 /** 054 * A 3D affine transformation matrix of 3 rows and 4 columns containing 055 * the following values: 056 * <pre> 057 * mxx, mxy, mxz, tx, 058 * myx, myy, myz, ty, 059 * mzx, mzy, mzz, tz 060 * </pre> 061 */ 062 MT_3D_3x4(3, 4), 063 064 /** 065 * A 3D transformation matrix of 4 rows and 4 columns. For affine transforms 066 * the last line is constant, so the matrix contains the following values: 067 * <pre> 068 * mxx, mxy, mxz, tx, 069 * myx, myy, myz, ty, 070 * mzx, mzy, mzz, tz, 071 * 0, 0, 0, 1 072 * </pre> 073 */ 074 MT_3D_4x4(4, 4); 075 076 private int rows; 077 private int cols; 078 079 private MatrixType(int rows, int cols) { 080 this.rows = rows; 081 this.cols = cols; 082 } 083 084 /** 085 * Returns the number of elements in the matrix of this type. 086 * @return the number of elements in the matrix of this type 087 */ 088 public int elements() { 089 return rows * cols; 090 } 091 092 /** 093 * Returns the number of rows in the matrix of this type. 094 * @return the number of rows in the matrix of this type 095 */ 096 public int rows() { 097 return rows; 098 } 099 100 /** 101 * Returns the number of columns in the matrix of this type. 102 * @return the number of columns in the matrix of this type 103 */ 104 public int columns() { 105 return cols; 106 } 107 108 /** 109 * Specifies if this is a 2D transformation matrix 110 * @return true if this is a 2D transformation matrix, false if this 111 * is a 3D transformation matrix 112 */ 113 public boolean is2D() { 114 return this == MT_2D_2x3 || this == MT_2D_3x3; 115 } 116}