01: /*
02: * @(#)ConstrainableGraphics.java 1.8 06/10/10
03: *
04: * Copyright 1990-2006 Sun Microsystems, Inc. All Rights Reserved.
05: * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER
06: *
07: * This program is free software; you can redistribute it and/or
08: * modify it under the terms of the GNU General Public License version
09: * 2 only, as published by the Free Software Foundation.
10: *
11: * This program is distributed in the hope that it will be useful, but
12: * WITHOUT ANY WARRANTY; without even the implied warranty of
13: * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14: * General Public License version 2 for more details (a copy is
15: * included at /legal/license.txt).
16: *
17: * You should have received a copy of the GNU General Public License
18: * version 2 along with this work; if not, write to the Free Software
19: * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
20: * 02110-1301 USA
21: *
22: * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa
23: * Clara, CA 95054 or visit www.sun.com if you need additional
24: * information or have any questions.
25: *
26: */
27:
28: package sun.awt;
29:
30: /**
31: * This interface can be implemented on a Graphics object to allow
32: * the lightweight component code to permanently install a rectangular
33: * maximum clip that cannot be extended with setClip and which works in
34: * conjunction with the hit() and getTransform() methods of Graphics2D
35: * to make it appear as if there really was a component with these
36: * dimensions.
37: */
38: public interface ConstrainableGraphics {
39: /**
40: * Constrain this graphics object to have a permanent device space
41: * origin of (x, y) and a permanent maximum clip of (x,y,w,h).
42: * Calling this method is roughly equivalent to:
43: * g.translate(x, y);
44: * g.clipRect(0, 0, w, h);
45: * except that the clip can never be extended outside of these
46: * bounds, even with setClip() and for the fact that the (x,y)
47: * become a new device space coordinate origin.
48: *
49: * These methods are recursive so that you can further restrict
50: * the object by calling the constrain() method more times, but
51: * you can never enlarge its restricted maximum clip.
52: */
53: public void constrain(int x, int y, int w, int h);
54: }
|