1 /* 2 * Copyright (c) 2007, 2017, 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. 8 * 9 * This code is distributed in the hope that it will be useful, but WITHOUT 10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 12 * version 2 for more details (a copy is included in the LICENSE file that 13 * accompanied this code). 14 * 15 * You should have received a copy of the GNU General Public License version 16 * 2 along with this work; if not, write to the Free Software Foundation, 17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 18 * 19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 20 * or visit www.oracle.com if you need additional information or have any 21 * questions. 22 */ 23 package org.jemmy.image; 24 25 26 import org.jemmy.Dimension; 27 import org.jemmy.Point; 28 import org.jemmy.Rectangle; 29 30 31 /** 32 * 33 * @author Alexander Kouznetsov <mrkam@mail.ru> 34 */ 35 public class Utils { 36 37 /** 38 * 39 * @param r 40 * @return java.awt.Rectangle 41 */ 42 public static java.awt.Rectangle convert(Rectangle r) { 43 return new java.awt.Rectangle(r.x, r.y, r.width, r.height); 44 } 45 46 /** 47 * 48 * @param r 49 * @return org.jemmy.Rectangle 50 */ 51 public static Rectangle convert(java.awt.Rectangle r) { 52 return new Rectangle(r.x, r.y, r.width, r.height); 53 } 54 55 /** 56 * 57 * @param p 58 * @return java.awt.Point 59 */ 60 public static java.awt.Point convert(Point p) { 61 return new java.awt.Point(p.x, p.y); 62 } 63 64 /** 65 * 66 * @param p 67 * @return org.jemmy.Point 68 */ 69 public static Point convert(java.awt.Point p) { 70 return new Point(p.x, p.y); 71 } 72 73 /** 74 * 75 * @param d 76 * @return java.awt.Dimension 77 */ 78 public static java.awt.Dimension convert(Dimension d) { 79 return new java.awt.Dimension(d.width, d.height); 80 } 81 82 /** 83 * 84 * @param d 85 * @return org.jemmy.Dimension 86 */ 87 public static Dimension convert(java.awt.Dimension d) { 88 return new Dimension(d.width, d.height); 89 } 90 91 }