1. /*
  2. * @(#)TransformAttribute.java 1.6 01/11/29
  3. *
  4. * Copyright 2002 Sun Microsystems, Inc. All rights reserved.
  5. * SUN PROPRIETARY/CONFIDENTIAL. Use is subject to license terms.
  6. */
  7. /*
  8. * (C) Copyright Taligent, Inc. 1996 - 1997, All Rights Reserved
  9. * (C) Copyright IBM Corp. 1996 - 1998, All Rights Reserved
  10. *
  11. * The original version of this source code and documentation is
  12. * copyrighted and owned by Taligent, Inc., a wholly-owned subsidiary
  13. * of IBM. These materials are provided under terms of a License
  14. * Agreement between Taligent and Sun. This technology is protected
  15. * by multiple US and International patents.
  16. *
  17. * This notice and attribution to Taligent may not be removed.
  18. * Taligent is a registered trademark of Taligent, Inc.
  19. *
  20. */
  21. package java.awt.font;
  22. import java.awt.geom.AffineTransform;
  23. import java.io.Serializable;
  24. /**
  25. * The <code>TransformAttribute</code> class provides an immutable
  26. * wrapper for a transform so that it is safe to use as an attribute.
  27. */
  28. public final class TransformAttribute implements Serializable {
  29. private AffineTransform transform;
  30. /**
  31. * Wraps the specified transform. The transform is cloned and a
  32. * reference to the clone is kept. The original transform is unchanged.
  33. * @param transform the specified {@link AffineTransform} to be wrapped
  34. */
  35. public TransformAttribute(AffineTransform transform) {
  36. if (transform == null) {
  37. throw new IllegalArgumentException("transform may not be null");
  38. }
  39. this.transform = new AffineTransform(transform);
  40. }
  41. /**
  42. * Returns a copy of the wrapped transform.
  43. * @return a <code>AffineTransform</code> that is a copy of the wrapped
  44. * transform of this <code>TransformAttribute</code>.
  45. */
  46. public AffineTransform getTransform() {
  47. return new AffineTransform(transform);
  48. }
  49. }