summaryrefslogtreecommitdiffstats
path: root/bundles/org.eclipse.swt/Eclipse SWT PI/gtk/org/eclipse/swt/internal/gtk/GDKPIXBUF.java
blob: d84a0bec1809f11749d268a80f099f3934c92722 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
package org.eclipse.swt.internal.gtk;

/*
 * Copyright (c) IBM Corp. 2000, 2001.  All rights reserved.
 *
 * The contents of this file are made available under the terms
 * of the GNU Lesser General Public License (LGPL) Version 2.1 that
 * accompanies this distribution (lgpl-v21.txt).  The LGPL is also
 * available at http://www.gnu.org/licenses/lgpl.html.  If the version
 * of the LGPL at http://www.gnu.org is different to the version of
 * the LGPL accompanying this distribution and there is any conflict
 * between the two license versions, the terms of the LGPL accompanying
 * this distribution shall govern.
 */

import org.eclipse.swt.internal.Library;

public class GDKPIXBUF extends OS {

	/* GdkColorspace enumeration */
	/* R/G/B additive color space */
	public static final native int GDK_COLORSPACE_RGB();
	
	/* GIF-like animation overlay modes for frames */
	public final static int GDK_PIXBUF_FRAME_RETAIN = 0;
	public final static int GDK_PIXBUF_FRAME_DISPOSE = 1;
	public final static int GDK_PIXBUF_FRAME_REVERT = 2;
	
	/* Alpha compositing mode */
	public final static int GDK_PIXBUF_ALPHA_BILEVEL = 0;
	public final static int GDK_PIXBUF_ALPHA_FULL = 1;

	/* Interpolation modes */
	public final static int GDK_INTERP_NEAREST = 0;
	public final static int GDK_INTERP_TILES = 1;
	public final static int GDK_INTERP_BILINEAR = 2;
	public final static int GDK_INTERP_HYPER = 3;


/*
 * NATIVES
 */

/* GdkPixbuf accessors */

/**
 * Returns the colorspace of the pixbuf argument
 */
public static final native int gdk_pixbuf_get_colorspace (int pixbuf);

/**
 * Returns the number of channels in the pixbuf argument
 */
public static final native int gdk_pixbuf_get_n_channels (int pixbuf);

/**
 * Returns true if the pixbuf specified by the argument has an alpha channel
 * (opacity information), and false otherwise.
 */
public static final native boolean gdk_pixbuf_get_has_alpha (int pixbuf);

/**
 * Returns the number of bits per pixel in each channel.
 * Normally 8.
 */
public static final native int gdk_pixbuf_get_bits_per_sample (int pixbuf);

/**
 * Returns the address of the actual image data in the OS memory.
 */
public static final native int gdk_pixbuf_get_pixels (int pixbuf);

/**
 * Returns the width of the pixbuf specified by the argument.
 */
public static final native int gdk_pixbuf_get_width (int pixbuf);

/**
 * Returns the height of the pixbuf specified by the argument.
 */
public static final native int gdk_pixbuf_get_height (int pixbuf);

/**
 * Returns the rowstride of the pixbuf specified by the argument.
 */
public static final native int gdk_pixbuf_get_rowstride (int pixbuf);


/* PIXBUF CREATION FROM DATA IN MEMORY */

/**
 * Create a blank pixbuf with an optimal rowstride and a new buffer
 */
public static final native int gdk_pixbuf_new (
				int colorspace,
				boolean has_alpha,
				int bits_per_sample,
				int width,
				int height);

public static final native int gdk_pixbuf_copy(int source);

public static final native int gdk_pixbuf_new_from_data (
				byte[] data,
				int colorspace,
				boolean has_alpha,
				int bits_per_sample,
				int width,
				int height,
				int rowstride,
				int destroy_fn,
				int destroy_fn_data);

public static final native int gdk_pixbuf_new_from_xpm_data (int pdata);


/* PIXBUF CREATION - FILE LOADING */

public static final native int gdk_pixbuf_new_from_file (byte[] filename);



/* RENDERING TO A DRAWABLE */


public static final native void gdk_pixbuf_render_to_drawable_alpha (int pixbuf,
				int drawable,
				int src_x, int src_y,
				int dest_x, int dest_y,
				int width, int height,
				int alpha_mode,
				int alpha_threshold,
				int dither,
				int x_dither, int y_dither);

public static final native void gdk_pixbuf_render_to_drawable (int pixbuf,
				int drawable,
				int gc,
				int src_x, int src_y,
				int dest_x, int dest_y,
				int width, int height,
				int dither,
				int x_dither, int y_dither);

/* SCALING */

public static final native void gdk_pixbuf_scale (
				int src, int dest,
				int dest_x,
                int dest_y,
                int dest_width,
                int dest_height,
                double offset_x,
                double offset_y,
                double scale_x,
                double scale_y,
                int interp_type);

public static final native void gdk_pixbuf_composite (
				int src, int dest,
				int dest_x,
				int dest_y,
				int dest_width,
				int dest_height,
				double offset_x,
				double offset_y,
				double scale_x,
				double scale_y,
				int interp_type,
				int overall_alpha);

public static final native void gdk_pixbuf_composite_color (
				int src,
				int dest,
				int dest_x,
				int dest_y, 
				int dest_width,
				int dest_height,
				double offset_x,
				double offset_y,
				double scale_x,double scale_y,
				int interp_type,
				int overall_alpha,
				int check_x,
				int check_y,
				int check_size,
				int color1,
				int color2);

public static final native int gdk_pixbuf_scale_simple (
				int src,
				int dest_width,
				int dest_height,
				int interp_type);

public static final native int gdk_pixbuf_composite_color_simple (
				int src,int dest_width,
				int dest_height,
				int interp_type,
				int overall_alpha,
				int check_size,
				int color1,
				int color2);



public static final native int gdk_pixbuf_get_from_drawable (
				int dest,
				int src,
				int cmap,
				int src_x,
				int src_y,
				int dest_x,
				int dest_y,
				int width,
				int height);

}