OSDN Git Service

Imported GNU Classpath 0.20
[pf3gnuchains/gcc-fork.git] / libjava / classpath / native / jni / gtk-peer / gtkcairopeer.h
1 #ifndef __GTKCAIROPEER_H__
2 #define __GTKCAIROPEER_H__
3
4 /* gtkcairopeer.h -- Some global variables and #defines
5    Copyright (C) 1998, 1999 Free Software Foundation, Inc.
6
7 This file is part of GNU Classpath.
8
9 GNU Classpath is free software; you can redistribute it and/or modify
10 it under the terms of the GNU General Public License as published by
11 the Free Software Foundation; either version 2, or (at your option)
12 any later version.
13
14 GNU Classpath is distributed in the hope that it will be useful, but
15 WITHOUT ANY WARRANTY; without even the implied warranty of
16 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
17 General Public License for more details.
18
19 You should have received a copy of the GNU General Public License
20 along with GNU Classpath; see the file COPYING.  If not, write to the
21 Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
22 02110-1301 USA.
23
24 Linking this library statically or dynamically with other modules is
25 making a combined work based on this library.  Thus, the terms and
26 conditions of the GNU General Public License cover the whole
27 combination.
28
29 As a special exception, the copyright holders of this library give you
30 permission to link this library with independent modules to produce an
31 executable, regardless of the license terms of these independent
32 modules, and to copy and distribute the resulting executable under
33 terms of your choice, provided that you also meet, for each linked
34 independent module, the terms and conditions of the license of that
35 module.  An independent module is a module which is not derived from
36 or based on this library.  If you modify this library, you may extend
37 this exception to your version of the library, but you are not
38 obligated to do so.  If you do not wish to do so, delete this
39 exception statement from your version. */
40
41 #include "gtkpeer.h"
42 #include <cairo.h>
43 #include <gdk-pixbuf/gdk-pixbuf.h>
44
45 /* 
46    A graphics2d struct is both simpler and uglier than a graphics
47    struct. 
48
49    Most of the graphics2d drawing state is held in the referenced cairo_t
50    and corresponding cairo_surface_t, so we can ignore it.
51
52    In addition to the cairo_t, we need to hold an extra reference to the
53    underlying GdkDrawable so its refcount matches the lifecycle of the java
54    Graphics object which is peering with us; also a reference to a byte
55    buffer and cairo_surface_t which contain the pattern you're drawing from
56    (if it exists).
57
58    Finally, it is possible that we are using a non-RENDER capable X server,
59    therefore we will be drawing to an cairo_surface_t which is actually a
60    pixbuf. When this is the case, the pointer to a GdkPixbuf will be
61    non-NULL and any drawing operation needs to be bracketed by pixbuf
62    load/save operations. If the GdkPixbuf pointer is NULL, we will treat
63    the cairo_surface_t as RENDER-capable.
64  */
65
66 struct graphics2d
67 {
68   cairo_t *cr;
69   cairo_surface_t *surface;
70   GdkDrawable *drawable;
71   GdkWindow *win;
72   GdkPixbuf *drawbuf;
73   char *pattern_pixels;
74   cairo_surface_t *pattern_surface;
75   cairo_pattern_t *pattern;
76   gboolean debug;
77   enum 
78     { 
79       MODE_DRAWABLE_WITH_RENDER,
80       MODE_DRAWABLE_NO_RENDER,
81       MODE_JAVA_ARRAY
82     } 
83   mode;
84
85   /* Support for MODE_JAVA_ARRAY */
86   jintArray jarray;
87   jint width, height;
88   jint *javabuf;
89   jint *javabuf_copy;
90   jboolean isCopy;
91 };
92
93 #endif /* __GTKCAIROPEER_H */