01: /*
02: * @(#)GdkImageRepresentation.java 1.10 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.gtk;
29:
30: import sun.awt.image.ImageRepresentation;
31: import java.awt.Color;
32: import java.awt.Graphics;
33: import java.awt.image.ColorModel;
34:
35: /** Defines the representation used to store images in Gdk. The image is stored as a Gdk pixmap
36: (server side image). */
37:
38: class GdkImageRepresentation extends ImageRepresentation {
39: private static native void initIDs();
40:
41: static {
42: initIDs();
43: }
44:
45: GdkImageRepresentation(GdkImage image) {
46: super (image, 0);
47: }
48:
49: protected native void offscreenInit(Color bg);
50:
51: protected native boolean setBytePixels(int x, int y, int w, int h,
52: ColorModel model, byte pix[], int off, int scansize);
53:
54: protected native boolean setIntPixels(int x, int y, int w, int h,
55: ColorModel model, int pix[], int off, int scansize);
56:
57: protected native boolean finish(boolean force);
58:
59: protected native synchronized void imageDraw(Graphics g, int x,
60: int y, Color c);
61:
62: protected native synchronized void imageStretch(Graphics g,
63: int dx1, int dy1, int dx2, int dy2, int sx1, int sy1,
64: int sx2, int sy2, Color c);
65:
66: protected native void disposeImage();
67:
68: native int getRGB(ColorModel cm, int x, int y);
69:
70: native void getRGBs(ColorModel cm, int startX, int startY, int w,
71: int h, int[] rgbArray, int offset, int scansize);
72: }
|