You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

RegionViewport.java 1.5KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455
  1. /*
  2. * $Id$
  3. * Copyright (C) 2001 The Apache Software Foundation. All rights reserved.
  4. * For details on use and redistribution please refer to the
  5. * LICENSE file included with these sources.
  6. */
  7. package org.apache.fop.area;
  8. import java.awt.geom.Rectangle2D;
  9. import java.io.Serializable;
  10. import java.io.IOException;
  11. public class RegionViewport implements Serializable {
  12. // this rectangle is relative to the page
  13. Rectangle2D regionArea;
  14. boolean clip = false;
  15. Region region;
  16. public RegionViewport(Rectangle2D area) {
  17. regionArea = area;
  18. }
  19. public void setRegion(Region reg) {
  20. region = reg;
  21. }
  22. public Rectangle2D getViewArea() {
  23. return regionArea;
  24. }
  25. public Region getRegion() {
  26. return region;
  27. }
  28. private void writeObject(java.io.ObjectOutputStream out)
  29. throws IOException {
  30. out.writeFloat((float) regionArea.getX());
  31. out.writeFloat((float) regionArea.getY());
  32. out.writeFloat((float) regionArea.getWidth());
  33. out.writeFloat((float) regionArea.getHeight());
  34. out.writeBoolean(clip);
  35. out.writeObject(region);
  36. }
  37. private void readObject(java.io.ObjectInputStream in)
  38. throws IOException, ClassNotFoundException {
  39. regionArea = new Rectangle2D.Float(in.readFloat(), in.readFloat(),
  40. in.readFloat(), in.readFloat());
  41. clip = in.readBoolean();
  42. region = (Region) in.readObject();
  43. }
  44. }