KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > eclipse > swt > internal > cairo > Cairo


1 /* ***** BEGIN LICENSE BLOCK *****
2  * Version: MPL 1.1
3  *
4  * The contents of this file are subject to the Mozilla Public License Version
5  * 1.1 (the "License"); you may not use this file except in compliance with
6  * the License. You may obtain a copy of the License at
7  * http://www.mozilla.org/MPL/
8  *
9  * Software distributed under the License is distributed on an "AS IS" basis,
10  * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
11  * for the specific language governing rights and limitations under the
12  * License.
13  *
14  * Contributor(s):
15  *
16  * IBM
17  * - Binding to permit interfacing between Cairo and SWT
18  * - Copyright (C) 2005 IBM Corp. All Rights Reserved.
19  *
20  * ***** END LICENSE BLOCK ***** */

21 package org.eclipse.swt.internal.cairo;
22
23 import org.eclipse.swt.internal.Library;
24
25 public class Cairo {
26     static {
27         Library.loadLibrary("swt-cairo");
28     }
29
30     /** Constants */
31     public static final int CAIRO_FORMAT_ARGB32 = 0;
32     public static final int CAIRO_FORMAT_RGB24 = 1;
33     public static final int CAIRO_FORMAT_A8 = 2;
34     public static final int CAIRO_FORMAT_A1 = 3;
35     public static final int CAIRO_OPERATOR_CLEAR = 0;
36     public static final int CAIRO_OPERATOR_SRC = 1;
37     public static final int CAIRO_OPERATOR_DST = 2;
38     public static final int CAIRO_OPERATOR_OVER = 3;
39     public static final int CAIRO_OPERATOR_OVER_REVERSE = 4;
40     public static final int CAIRO_OPERATOR_IN = 5;
41     public static final int CAIRO_OPERATOR_IN_REVERSE = 6;
42     public static final int CAIRO_OPERATOR_OUT = 7;
43     public static final int CAIRO_OPERATOR_OUT_REVERSE = 8;
44     public static final int CAIRO_OPERATOR_ATOP = 9;
45     public static final int CAIRO_OPERATOR_ATOP_REVERSE = 10;
46     public static final int CAIRO_OPERATOR_XOR = 11;
47     public static final int CAIRO_OPERATOR_ADD = 12;
48     public static final int CAIRO_OPERATOR_SATURATE = 13;
49     public static final int CAIRO_FILL_RULE_WINDING = 0;
50     public static final int CAIRO_FILL_RULE_EVEN_ODD = 1;
51     public static final int CAIRO_LINE_CAP_BUTT = 0;
52     public static final int CAIRO_LINE_CAP_ROUND = 1;
53     public static final int CAIRO_LINE_CAP_SQUARE = 2;
54     public static final int CAIRO_LINE_JOIN_MITER = 0;
55     public static final int CAIRO_LINE_JOIN_ROUND = 1;
56     public static final int CAIRO_LINE_JOIN_BEVEL = 2;
57     public static final int CAIRO_FONT_SLANT_NORMAL = 0;
58     public static final int CAIRO_FONT_SLANT_ITALIC = 1;
59     public static final int CAIRO_FONT_SLANT_OBLIQUE = 2;
60     public static final int CAIRO_FONT_WEIGHT_NORMAL = 0;
61     public static final int CAIRO_FONT_WEIGHT_BOLD = 1;
62     public static final int CAIRO_STATUS_SUCCESS = 0;
63     public static final int CAIRO_STATUS_NO_MEMORY = 1;
64     public static final int CAIRO_STATUS_INVALID_RESTORE = 2;
65     public static final int CAIRO_STATUS_INVALID_POP_GROUP = 3;
66     public static final int CAIRO_STATUS_NO_CURRENT_POINT = 4;
67     public static final int CAIRO_STATUS_INVALID_MATRIX = 5;
68     public static final int CAIRO_STATUS_NO_TARGET_SURFACE = 6;
69     public static final int CAIRO_STATUS_NULL_POINTER =7;
70     public static final int CAIRO_FILTER_FAST = 0;
71     public static final int CAIRO_FILTER_GOOD = 1;
72     public static final int CAIRO_FILTER_BEST = 2;
73     public static final int CAIRO_FILTER_NEAREST = 3;
74     public static final int CAIRO_FILTER_BILINEAR = 4;
75     public static final int CAIRO_FILTER_GAUSSIAN = 5;
76     public static final int CAIRO_EXTEND_NONE = 0;
77     public static final int CAIRO_EXTEND_REPEAT = 1;
78     public static final int CAIRO_EXTEND_REFLECT = 2;
79     public static final int CAIRO_PATH_MOVE_TO = 0;
80     public static final int CAIRO_PATH_LINE_TO = 1;
81     public static final int CAIRO_PATH_CURVE_TO = 2;
82     public static final int CAIRO_PATH_CLOSE_PATH = 3;
83     
84 /** 64*/
85 public static final synchronized native int cairo_font_extents_t_sizeof ();
86 public static final synchronized native int cairo_path_data_t_sizeof ();
87 public static final synchronized native int cairo_path_t_sizeof ();
88     
89 /** Natives */
90 public static final synchronized native int /*long*/ cairo_create (int /*long*/ target);
91 public static final synchronized native void cairo_reference (int /*long*/ cr);
92 public static final synchronized native void cairo_destroy (int /*long*/ cr);
93 public static final synchronized native void cairo_save (int /*long*/ cr);
94 public static final synchronized native void cairo_restore (int /*long*/ cr);
95 public static final synchronized native void cairo_set_operator (int /*long*/ cr, int op);
96 public static final synchronized native void cairo_set_source_rgb(int /*long*/ cr, double red, double green, double blue);
97 public static final synchronized native void cairo_set_source_rgba(int /*long*/ cr, double red, double green, double blue, double alpha);
98 public static final synchronized native void cairo_set_source(int /*long*/ cr, int /*long*/ source);
99 public static final synchronized native void cairo_set_source_surface(int /*long*/ cr, int /*long*/ surface, double x, double y);
100 public static final synchronized native void cairo_set_tolerance (int /*long*/ cr, double tolerance);
101 public static final synchronized native void cairo_set_fill_rule (int /*long*/ cr, int fill_rule);
102 public static final synchronized native void cairo_set_line_width (int /*long*/ cr, double width);
103 public static final synchronized native void cairo_set_line_cap (int /*long*/ cr, int line_cap);
104 public static final synchronized native void cairo_set_line_join (int /*long*/ cr, int line_join);
105 public static final synchronized native void cairo_set_dash (int /*long*/ cr, double[] dashes, int ndash, double offset);
106 public static final synchronized native void cairo_set_miter_limit (int /*long*/ cr, double limit);
107 public static final synchronized native void cairo_translate (int /*long*/ cr, double tx, double ty);
108 public static final synchronized native void cairo_scale (int /*long*/ cr, double sx, double sy);
109 public static final synchronized native void cairo_rotate (int /*long*/ cr, double angle);
110 public static final synchronized native void cairo_transform (int /*long*/ cr, double[] matrix);
111 public static final synchronized native void cairo_set_matrix (int /*long*/ cr, double[] matrix);
112 public static final synchronized native void cairo_identity_matrix (int /*long*/ cr);
113 public static final synchronized native void cairo_user_to_device (int /*long*/ cr, double[] x, double[] y);
114 public static final synchronized native void cairo_user_to_device_distance (int /*long*/ cr, double[] dx, double[] dy);
115 public static final synchronized native void cairo_device_to_user (int /*long*/ cr, double[] x, double[] y);
116 public static final synchronized native void cairo_device_to_user_distance (int /*long*/ cr, double[] dx, double[] dy);
117 public static final synchronized native void cairo_new_path (int /*long*/ cr);
118 public static final synchronized native void cairo_move_to (int /*long*/ cr, double x, double y);
119 public static final synchronized native void cairo_line_to (int /*long*/ cr, double x, double y);
120 public static final synchronized native void cairo_curve_to (int /*long*/ cr, double x1, double y1, double x2, double y2, double x3, double y3);
121 public static final synchronized native void cairo_arc (int /*long*/ cr, double xc, double yc, double radius, double angle1, double angle2);
122 public static final synchronized native void cairo_arc_negative (int /*long*/ cr, double xc, double yc, double radius, double angle1, double angle2);
123 //public static final synchronized native void cairo_arc_to (int /*long*/ cr, double x1, double y1, double x2, double y2, double radius);
124
public static final synchronized native void cairo_rel_move_to (int /*long*/ cr, double dx, double dy);
125 public static final synchronized native void cairo_rel_line_to (int /*long*/ cr, double dx, double dy);
126 public static final synchronized native void cairo_rel_curve_to (int /*long*/ cr, double dx1, double dy1, double dx2, double dy2, double dx3, double dy3);
127 public static final synchronized native void cairo_rectangle (int /*long*/ cr, double x, double y, double width, double height);
128 public static final synchronized native void cairo_close_path (int /*long*/ cr);
129 public static final synchronized native void cairo_paint (int /*long*/ cr);
130 public static final synchronized native void cairo_paint_with_alpha (int /*long*/ cr, double alpha);
131 public static final synchronized native void cairo_mask (int /*long*/ cr, int /*long*/ pattern);
132 public static final synchronized native void cairo_mask_surface (int /*long*/ cr, int /*long*/ surface, double surface_x, double surface_y);
133 public static final synchronized native void cairo_stroke (int /*long*/ cr);
134 public static final synchronized native void cairo_stroke_preserve (int /*long*/ cr);
135 public static final synchronized native void cairo_fill (int /*long*/ cr);
136 public static final synchronized native void cairo_fill_preserve (int /*long*/ cr);
137 public static final synchronized native void cairo_copy_page (int /*long*/ cr);
138 public static final synchronized native void cairo_show_page (int /*long*/ cr);
139 public static final synchronized native int cairo_in_stroke (int /*long*/ cr, double x, double y);
140 public static final synchronized native int cairo_in_fill (int /*long*/ cr, double x, double y);
141 public static final synchronized native void cairo_stroke_extents (int /*long*/ cr, double[] x1, double[] y1, double[] x2, double[] y2);
142 public static final synchronized native void cairo_fill_extents (int /*long*/ cr, double[] x1, double[] y1, double[] x2, double[] y2);
143 public static final synchronized native void cairo_clip (int /*long*/ cr);
144 public static final synchronized native void cairo_clip_preserve (int /*long*/ cr);
145 public static final synchronized native void cairo_reset_clip (int /*long*/ cr);
146 public static final synchronized native void cairo_select_font_face (int /*long*/ cr, byte[] family, int slant, int weight);
147 public static final synchronized native void cairo_set_font_size (int /*long*/ cr, double size);
148 public static final synchronized native void cairo_set_font_matrix (int /*long*/ cr, double[] matrix);
149 public static final synchronized native void cairo_get_font_matrix (int /*long*/ cr, double[] matrix);
150 public static final synchronized native void cairo_show_text (int /*long*/ cr, byte[] utf8);
151 public static final synchronized native void cairo_show_glyphs (int /*long*/ cr, int /*long*/ glyphs, int num_glyphs);
152 public static final synchronized native int cairo_get_font_face (int /*long*/ cr);
153 public static final synchronized native void cairo_font_extents (int /*long*/ cr, cairo_font_extents_t extents);
154 public static final synchronized native void cairo_set_font_face (int /*long*/ cr, int /*long*/ font_face);
155 public static final synchronized native void cairo_text_extents (int /*long*/ cr, byte[] utf8, int /*long*/ extents);
156 public static final synchronized native void cairo_glyph_extents (int /*long*/ cr, int /*long*/ glyphs, int num_glyphs, int /*long*/ extents);
157 public static final synchronized native void cairo_text_path (int /*long*/ cr, byte[] utf8);
158 public static final synchronized native void cairo_glyph_path (int /*long*/ cr, int /*long*/ glyphs, int num_glyphs);
159 public static final synchronized native int cairo_get_operator (int /*long*/ cr);
160 public static final synchronized native int /*long*/ cairo_get_source (int /*long*/ cr);
161 public static final synchronized native double cairo_get_tolerance (int /*long*/ cr);
162 public static final synchronized native void cairo_get_current_point (int /*long*/ cr, double[] x, double[] y);
163 public static final synchronized native int cairo_get_fill_rule (int /*long*/ cr);
164 public static final synchronized native double cairo_get_line_width (int /*long*/ cr);
165 public static final synchronized native int cairo_get_line_cap (int /*long*/ cr);
166 public static final synchronized native int cairo_get_line_join (int /*long*/ cr);
167 public static final synchronized native double cairo_get_miter_limit (int /*long*/ cr);
168 public static final synchronized native void cairo_get_matrix (int /*long*/ cr, double[] matrix);
169 public static final synchronized native int /*long*/ cairo_get_target (int /*long*/ cr);
170 public static final synchronized native int /*long*/ cairo_copy_path (int /*long*/ cr);
171 public static final synchronized native int /*long*/ cairo_copy_path_flat (int /*long*/ cr);
172 public static final synchronized native void cairo_append_path (int /*long*/ cr, int /*long*/ path);
173 public static final synchronized native void cairo_path_destroy (int /*long*/ path);
174 public static final synchronized native int cairo_status (int /*long*/ cr);
175 public static final synchronized native int /*long*/ cairo_status_to_string (int status);
176 public static final synchronized native int /*long*/ cairo_image_surface_create (int format, int width, int height);
177 public static final synchronized native int /*long*/ cairo_image_surface_create_for_data (int /*long*/ data, int format, int width, int height, int stride);
178 public static final synchronized native int cairo_image_surface_get_width (int /*long*/ surface);
179 public static final synchronized native int cairo_image_surface_get_height (int /*long*/ surface);
180 public static final synchronized native int /*long*/ cairo_surface_create_similar (int /*long*/ other, int format, int width, int height);
181 public static final synchronized native void cairo_surface_reference (int /*long*/ surface);
182 public static final synchronized native void cairo_surface_destroy (int /*long*/ surface);
183 public static final synchronized native int cairo_surface_finish (int /*long*/ surface);
184 public static final synchronized native int cairo_surface_set_user_data (int /*long*/ surface, int /*long*/ key, int /*long*/ user_data, int /*long*/ destroy);
185 public static final synchronized native int /*long*/ cairo_surface_get_user_data (int /*long*/ surface, int /*long*/ key);
186 public static final synchronized native void cairo_surface_set_device_offset (int /*long*/ surface, double x_offset, double y_offset);
187 public static final synchronized native int /*long*/ cairo_pattern_create_for_surface (int /*long*/ surface);
188 public static final synchronized native int /*long*/ cairo_pattern_create_linear (double x0, double y0, double x1, double y1);
189 public static final synchronized native int /*long*/ cairo_pattern_create_radial (double cx0, double cy0, double radius0, double cx1, double cy1, double radius1);
190 public static final synchronized native void cairo_pattern_reference (int /*long*/ pattern);
191 public static final synchronized native void cairo_pattern_destroy (int /*long*/ pattern);
192 public static final synchronized native void cairo_pattern_add_color_stop_rgb (int /*long*/ pattern, double offset, double red, double green, double blue);
193 public static final synchronized native void cairo_pattern_add_color_stop_rgba (int /*long*/ pattern, double offset, double red, double green, double blue, double alpha);
194 public static final synchronized native void cairo_pattern_set_matrix (int /*long*/ pattern, double[] matrix);
195 public static final synchronized native void cairo_pattern_get_matrix (int /*long*/ pattern, double[] matrix);
196 public static final synchronized native void cairo_pattern_set_extend (int /*long*/ pattern, int extend);
197 public static final synchronized native int cairo_pattern_get_extend (int /*long*/ pattern);
198 public static final synchronized native void cairo_pattern_set_filter (int /*long*/ pattern, int filter);
199 public static final synchronized native int cairo_pattern_get_filter (int /*long*/ pattern);
200 public static final synchronized native void cairo_matrix_init (double[] matrix, double xx, double yx, double xy, double yy, double x0, double y0);
201 public static final synchronized native void cairo_matrix_init_identity (double[] matrix);
202 public static final synchronized native void cairo_matrix_init_translate (double[] matrix, double tx, double ty);
203 public static final synchronized native void cairo_matrix_init_scale (double[] matrix, double sx, double sy);
204 public static final synchronized native void cairo_matrix_init_rotate (double[] matrix, double radians);
205 public static final synchronized native void cairo_matrix_translate (double[] matrix, double tx, double ty);
206 public static final synchronized native void cairo_matrix_scale (double[] matrix, double sx, double sy);
207 public static final synchronized native void cairo_matrix_rotate (double[] matrix, double radians);
208 public static final synchronized native int cairo_matrix_invert (double[] matrix);
209 public static final synchronized native void cairo_matrix_multiply (double[] result, double[] a, double[] b);
210 public static final synchronized native void cairo_matrix_transform_distance (double[] matrix, double[] dx, double[] dy);
211 public static final synchronized native void cairo_matrix_transform_point (double[] matrix, double[] x, double[] y);
212 public static final synchronized native int /*long*/ cairo_xlib_surface_create (int /*long*/ dpy, int /*long*/ drawable, int /*long*/ visual, int width, int height);
213 public static final synchronized native int /*long*/ cairo_xlib_surface_create_for_bitmap (int /*long*/ dpy, int /*long*/ pixmap, int width, int height);
214 public static final synchronized native void cairo_xlib_surface_set_size (int /*long*/ surface, int width, int height);
215 public static final native void memmove(cairo_path_t dest, int /*long*/ src, int /*long*/ size);
216 public static final native void memmove(cairo_path_data_t dest, int /*long*/ src, int /*long*/ size);
217 public static final native void memmove(double[] dest, int /*long*/ src, int /*long*/ size);
218
219 }
220
Popular Tags