01: /*
02: * @(#)CursorImage.java 1.13 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.porting.graphicssystem;
29:
30: import java.awt.Image;
31:
32: /**
33: * CursorImage is an object which encapsulates the bitmap and hotspot
34: * data describing a cursor. It is used simply to hold all of the
35: * required information in one place. It also enables the native
36: * implementation to build a cursor from this image data and cache it.
37: *
38: * @version 1.8, 08/19/02
39: */
40: public abstract class CursorImage {
41: /**
42: * An image which contains the shape of the cursor. Image transparency
43: * is used to determine which pixels of the cursor are painted and which
44: * are not. Colors in the image should be retained whenever possible (e.g.
45: * if the underlying graphics system supports colored cursors). At a
46: * minimum, three pixel values (black, white, transparent) should be
47: * significant.
48: */
49: protected java.awt.Image image;
50: /**
51: * The x coordinate of the cursor hot spot, i.e. the coordinate within
52: * the image that corresponds to the cursor's location on screen.
53: */
54: protected int hotX;
55: /**
56: * The y coordinate of the cursor hot spot, i.e. the coordinate within
57: * the image that corresponds to the cursor's location on screen.
58: */
59: protected int hotY;
60:
61: /**
62: * Create a new CursorImage object from the given image data and hotspot.
63: * It is the responsibility of the caller to make sure that the image data
64: * contains no more colors than are supported by the graphics system, and
65: * that the size of the cursor image is supported.
66: * @param imageData An image, probably with transparency, which describes
67: * the shape and coloration of the cursor.
68: * @param x The x coordinate of the cursor hotspot.
69: * @param y The y coordinate of the cursor hotspot.
70: * @see GraphicsSystem#getMaximumCursorColors
71: * @see GraphicsSystem#getMaximumCursorSize
72: * @see GraphicsSystem#getBestCursorSize
73: */
74: public CursorImage(java.awt.Image imageData, int x, int y) {
75: image = imageData;
76: hotX = x;
77: hotY = y;
78: }
79: }
|