2 * Meviz - Various tools collection to work with multimedia.
3 * Copyright (C) 2012, Svjatoslav Agejenko, svjatoslav@svjatoslav.eu
5 * This program is free software; you can redistribute it and/or
6 * modify it under the terms of version 2 of the GNU General Public License
7 * as published by the Free Software Foundation.
10 package eu.svjatoslav.meviz.htmlindexer.metadata;
12 import java.io.Serializable;
15 * Corresponds to single image dimensions.
18 public class Dimension implements Serializable, Comparable<Dimension> {
20 private static final long serialVersionUID = -1039288266937331829L;
30 public Dimension(final Dimension origial) {
31 width = origial.width;
32 height = origial.height;
35 public Dimension(final int width, final int height) {
41 public int compareTo(final Dimension anotherDimension) {
42 if (width < anotherDimension.width)
44 if (width > anotherDimension.width)
47 if (height < anotherDimension.height)
49 if (height > anotherDimension.height)
55 public boolean equals(final Dimension anotherDimension) {
56 if (compareTo(anotherDimension) == 0)
61 public int getArea() {
62 return width * height;
65 public java.awt.Dimension getAwtDimension() {
66 return new java.awt.Dimension(width, height);
69 public Dimension getScaled(final double multiplicationFactor) {
70 final Dimension result = new Dimension();
72 result.width = (int) ((width) * multiplicationFactor);
73 result.height = (int) ((height) * multiplicationFactor);