Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
Diffstat (limited to 'bundles/org.eclipse.swt')
-rw-r--r--bundles/org.eclipse.swt/.classpath_gtk2
-rwxr-xr-xbundles/org.eclipse.swt/.classpath_motif2
-rwxr-xr-xbundles/org.eclipse.swt/.classpath_photon47
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT PI/cairo/library/cairo.c1483
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT PI/cairo/library/cairo.h21
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT PI/cairo/library/cairo_custom.c43
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT PI/cairo/library/cairo_stats.c167
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT PI/cairo/library/cairo_stats.h149
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT PI/cairo/library/cairo_structs.c57
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT PI/cairo/library/cairo_structs.h25
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT PI/cairo/org/eclipse/swt/internal/cairo/Cairo.java201
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT PI/cairo/org/eclipse/swt/internal/cairo/cairo_font_extents_t.java22
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT PI/gtk/library/make_linux.mak25
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT/cairo/org/eclipse/swt/graphics/Path.java130
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT/cairo/org/eclipse/swt/graphics/Transform.java144
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT/emulated/graphics/org/eclipse/swt/graphics/Path.java98
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT/emulated/graphics/org/eclipse/swt/graphics/Transform.java112
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/graphics/Device.java8
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/graphics/GC.java530
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/graphics/GCData.java3
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/graphics/Image.java6
-rwxr-xr-xbundles/org.eclipse.swt/Eclipse SWT/motif/org/eclipse/swt/graphics/Device.java8
-rwxr-xr-xbundles/org.eclipse.swt/Eclipse SWT/motif/org/eclipse/swt/graphics/GC.java514
-rwxr-xr-xbundles/org.eclipse.swt/Eclipse SWT/motif/org/eclipse/swt/graphics/GCData.java3
-rwxr-xr-xbundles/org.eclipse.swt/Eclipse SWT/motif/org/eclipse/swt/graphics/Image.java6
-rwxr-xr-xbundles/org.eclipse.swt/Eclipse SWT/photon/org/eclipse/swt/graphics/GC.java41
26 files changed, 3770 insertions, 77 deletions
diff --git a/bundles/org.eclipse.swt/.classpath_gtk b/bundles/org.eclipse.swt/.classpath_gtk
index b97872990d..ec9e471be4 100644
--- a/bundles/org.eclipse.swt/.classpath_gtk
+++ b/bundles/org.eclipse.swt/.classpath_gtk
@@ -2,11 +2,13 @@
<classpath>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
<classpathentry kind="src" path="Eclipse SWT/gtk"/>
+ <classpathentry kind="src" path="Eclipse SWT/cairo"/>
<classpathentry kind="src" path="Eclipse SWT/emulated/bidi"/>
<classpathentry kind="src" path="Eclipse SWT/emulated/coolbar"/>
<classpathentry kind="src" path="Eclipse SWT/common"/>
<classpathentry kind="src" path="Eclipse SWT/common_j2se"/>
<classpathentry kind="src" path="Eclipse SWT PI/gtk"/>
+ <classpathentry kind="src" path="Eclipse SWT PI/cairo"/>
<classpathentry kind="src" path="Eclipse SWT PI/common"/>
<classpathentry kind="src" path="Eclipse SWT PI/common_j2se"/>
<classpathentry kind="src" path="Eclipse SWT Accessibility/gtk"/>
diff --git a/bundles/org.eclipse.swt/.classpath_motif b/bundles/org.eclipse.swt/.classpath_motif
index 4333070e3d..db1b0e8635 100755
--- a/bundles/org.eclipse.swt/.classpath_motif
+++ b/bundles/org.eclipse.swt/.classpath_motif
@@ -2,6 +2,7 @@
<classpath>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
<classpathentry kind="src" path="Eclipse SWT/motif"/>
+ <classpathentry kind="src" path="Eclipse SWT/cairo"/>
<classpathentry kind="src" path="Eclipse SWT/emulated/bidi"/>
<classpathentry kind="src" path="Eclipse SWT/emulated/coolbar"/>
<classpathentry kind="src" path="Eclipse SWT/emulated/tabfolder"/>
@@ -11,6 +12,7 @@
<classpathentry kind="src" path="Eclipse SWT/common_j2se"/>
<classpathentry kind="src" path="Eclipse SWT PI/motif"/>
<classpathentry kind="src" path="Eclipse SWT PI/motif_gtk"/>
+ <classpathentry kind="src" path="Eclipse SWT PI/cairo"/>
<classpathentry kind="src" path="Eclipse SWT PI/common"/>
<classpathentry kind="src" path="Eclipse SWT PI/common_j2se"/>
<classpathentry kind="src" path="Eclipse SWT Accessibility/emulated"/>
diff --git a/bundles/org.eclipse.swt/.classpath_photon b/bundles/org.eclipse.swt/.classpath_photon
index 1bf7ec5406..07687b940d 100755
--- a/bundles/org.eclipse.swt/.classpath_photon
+++ b/bundles/org.eclipse.swt/.classpath_photon
@@ -1,26 +1,27 @@
<?xml version="1.0" encoding="UTF-8"?>
<classpath>
- <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
- <classpathentry kind="src" path="Eclipse SWT/photon"/>
- <classpathentry kind="src" path="Eclipse SWT/emulated/bidi"/>
- <classpathentry kind="src" path="Eclipse SWT/emulated/coolbar"/>
- <classpathentry kind="src" path="Eclipse SWT/emulated/tray"/>
- <classpathentry kind="src" path="Eclipse SWT/emulated/treetable"/>
- <classpathentry kind="src" path="Eclipse SWT/emulated/textlayout"/>
- <classpathentry kind="src" path="Eclipse SWT/common"/>
- <classpathentry kind="src" path="Eclipse SWT/common_j2se"/>
- <classpathentry kind="src" path="Eclipse SWT PI/photon"/>
- <classpathentry kind="src" path="Eclipse SWT PI/common_j2se"/>
- <classpathentry kind="src" path="Eclipse SWT Accessibility/emulated"/>
- <classpathentry kind="src" path="Eclipse SWT Accessibility/common"/>
- <classpathentry kind="src" path="Eclipse SWT Drag and Drop/photon"/>
- <classpathentry kind="src" path="Eclipse SWT Drag and Drop/common"/>
- <classpathentry kind="src" path="Eclipse SWT Printing/photon"/>
- <classpathentry kind="src" path="Eclipse SWT Printing/common"/>
- <classpathentry kind="src" path="Eclipse SWT Program/photon"/>
- <classpathentry kind="src" path="Eclipse SWT Program/common"/>
- <classpathentry kind="src" path="Eclipse SWT Custom Widgets/common"/>
- <classpathentry kind="src" path="Eclipse SWT Browser/common"/>
- <classpathentry kind="src" path="Eclipse SWT Browser/photon"/>
- <classpathentry kind="output" path="bin"/>
+ <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
+ <classpathentry kind="src" path="Eclipse SWT/photon"/>
+ <classpathentry kind="src" path="Eclipse SWT/emulated/graphics"/>
+ <classpathentry kind="src" path="Eclipse SWT/emulated/bidi"/>
+ <classpathentry kind="src" path="Eclipse SWT/emulated/coolbar"/>
+ <classpathentry kind="src" path="Eclipse SWT/emulated/tray"/>
+ <classpathentry kind="src" path="Eclipse SWT/emulated/treetable"/>
+ <classpathentry kind="src" path="Eclipse SWT/emulated/textlayout"/>
+ <classpathentry kind="src" path="Eclipse SWT/common"/>
+ <classpathentry kind="src" path="Eclipse SWT/common_j2se"/>
+ <classpathentry kind="src" path="Eclipse SWT PI/photon"/>
+ <classpathentry kind="src" path="Eclipse SWT PI/common_j2se"/>
+ <classpathentry kind="src" path="Eclipse SWT Accessibility/emulated"/>
+ <classpathentry kind="src" path="Eclipse SWT Accessibility/common"/>
+ <classpathentry kind="src" path="Eclipse SWT Drag and Drop/photon"/>
+ <classpathentry kind="src" path="Eclipse SWT Drag and Drop/common"/>
+ <classpathentry kind="src" path="Eclipse SWT Printing/photon"/>
+ <classpathentry kind="src" path="Eclipse SWT Printing/common"/>
+ <classpathentry kind="src" path="Eclipse SWT Program/photon"/>
+ <classpathentry kind="src" path="Eclipse SWT Program/common"/>
+ <classpathentry kind="src" path="Eclipse SWT Custom Widgets/common"/>
+ <classpathentry kind="src" path="Eclipse SWT Browser/common"/>
+ <classpathentry kind="src" path="Eclipse SWT Browser/photon"/>
+ <classpathentry kind="output" path="bin"/>
</classpath>
diff --git a/bundles/org.eclipse.swt/Eclipse SWT PI/cairo/library/cairo.c b/bundles/org.eclipse.swt/Eclipse SWT PI/cairo/library/cairo.c
new file mode 100644
index 0000000000..fd86cc5d70
--- /dev/null
+++ b/bundles/org.eclipse.swt/Eclipse SWT PI/cairo/library/cairo.c
@@ -0,0 +1,1483 @@
+/*******************************************************************************
+* Copyright (c) 2000, 2004 IBM Corporation and others.
+* All rights reserved. This program and the accompanying materials
+* are made available under the terms of the Common Public License v1.0
+* which accompanies this distribution, and is available at
+* http://www.eclipse.org/legal/cpl-v10.html
+*
+* Contributors:
+* IBM Corporation - initial API and implementation
+*******************************************************************************/
+
+#include "swt.h"
+#include "cairo_structs.h"
+#include "cairo_stats.h"
+
+#define Cairo_NATIVE(func) Java_org_eclipse_swt_internal_cairo_Cairo_##func
+
+#ifndef NO_cairo_1arc
+JNIEXPORT void JNICALL Cairo_NATIVE(cairo_1arc)
+ (JNIEnv *env, jclass that, jint arg0, jdouble arg1, jdouble arg2, jdouble arg3, jdouble arg4, jdouble arg5)
+{
+ Cairo_NATIVE_ENTER(env, that, cairo_1arc_FUNC);
+ cairo_arc((cairo_t *)arg0, arg1, arg2, arg3, arg4, arg5);
+ Cairo_NATIVE_EXIT(env, that, cairo_1arc_FUNC);
+}
+#endif
+
+#ifndef NO_cairo_1arc_1negative
+JNIEXPORT void JNICALL Cairo_NATIVE(cairo_1arc_1negative)
+ (JNIEnv *env, jclass that, jint arg0, jdouble arg1, jdouble arg2, jdouble arg3, jdouble arg4, jdouble arg5)
+{
+ Cairo_NATIVE_ENTER(env, that, cairo_1arc_1negative_FUNC);
+ cairo_arc_negative((cairo_t *)arg0, arg1, arg2, arg3, arg4, arg5);
+ Cairo_NATIVE_EXIT(env, that, cairo_1arc_1negative_FUNC);
+}
+#endif
+
+#ifndef NO_cairo_1clip
+JNIEXPORT void JNICALL Cairo_NATIVE(cairo_1clip)
+ (JNIEnv *env, jclass that, jint arg0)
+{
+ Cairo_NATIVE_ENTER(env, that, cairo_1clip_FUNC);
+ cairo_clip((cairo_t *)arg0);
+ Cairo_NATIVE_EXIT(env, that, cairo_1clip_FUNC);
+}
+#endif
+
+#ifndef NO_cairo_1close_1path
+JNIEXPORT void JNICALL Cairo_NATIVE(cairo_1close_1path)
+ (JNIEnv *env, jclass that, jint arg0)
+{
+ Cairo_NATIVE_ENTER(env, that, cairo_1close_1path_FUNC);
+ cairo_close_path((cairo_t *)arg0);
+ Cairo_NATIVE_EXIT(env, that, cairo_1close_1path_FUNC);
+}
+#endif
+
+#ifndef NO_cairo_1concat_1matrix
+JNIEXPORT void JNICALL Cairo_NATIVE(cairo_1concat_1matrix)
+ (JNIEnv *env, jclass that, jint arg0, jint arg1)
+{
+ Cairo_NATIVE_ENTER(env, that, cairo_1concat_1matrix_FUNC);
+ cairo_concat_matrix((cairo_t *)arg0, (cairo_matrix_t *)arg1);
+ Cairo_NATIVE_EXIT(env, that, cairo_1concat_1matrix_FUNC);
+}
+#endif
+
+#ifndef NO_cairo_1copy
+JNIEXPORT void JNICALL Cairo_NATIVE(cairo_1copy)
+ (JNIEnv *env, jclass that, jint arg0, jint arg1)
+{
+ Cairo_NATIVE_ENTER(env, that, cairo_1copy_FUNC);
+ cairo_copy((cairo_t *)arg0, (cairo_t *)arg1);
+ Cairo_NATIVE_EXIT(env, that, cairo_1copy_FUNC);
+}
+#endif
+
+#ifndef NO_cairo_1copy_1page
+JNIEXPORT void JNICALL Cairo_NATIVE(cairo_1copy_1page)
+ (JNIEnv *env, jclass that, jint arg0)
+{
+ Cairo_NATIVE_ENTER(env, that, cairo_1copy_1page_FUNC);
+ cairo_copy_page((cairo_t *)arg0);
+ Cairo_NATIVE_EXIT(env, that, cairo_1copy_1page_FUNC);
+}
+#endif
+
+#ifndef NO_cairo_1create
+JNIEXPORT jint JNICALL Cairo_NATIVE(cairo_1create)
+ (JNIEnv *env, jclass that)
+{
+ jint rc = 0;
+ Cairo_NATIVE_ENTER(env, that, cairo_1create_FUNC);
+ rc = (jint)cairo_create();
+ Cairo_NATIVE_EXIT(env, that, cairo_1create_FUNC);
+ return rc;
+}
+#endif
+
+#ifndef NO_cairo_1current_1alpha
+JNIEXPORT jdouble JNICALL Cairo_NATIVE(cairo_1current_1alpha)
+ (JNIEnv *env, jclass that, jint arg0)
+{
+ jdouble rc = 0;
+ Cairo_NATIVE_ENTER(env, that, cairo_1current_1alpha_FUNC);
+ rc = (jdouble)cairo_current_alpha((cairo_t *)arg0);
+ Cairo_NATIVE_EXIT(env, that, cairo_1current_1alpha_FUNC);
+ return rc;
+}
+#endif
+
+#ifndef NO_cairo_1current_1fill_1rule
+JNIEXPORT jint JNICALL Cairo_NATIVE(cairo_1current_1fill_1rule)
+ (JNIEnv *env, jclass that, jint arg0)
+{
+ jint rc = 0;
+ Cairo_NATIVE_ENTER(env, that, cairo_1current_1fill_1rule_FUNC);
+ rc = (jint)cairo_current_fill_rule((cairo_t *)arg0);
+ Cairo_NATIVE_EXIT(env, that, cairo_1current_1fill_1rule_FUNC);
+ return rc;
+}
+#endif
+
+#ifndef NO_cairo_1current_1font
+JNIEXPORT jint JNICALL Cairo_NATIVE(cairo_1current_1font)
+ (JNIEnv *env, jclass that, jint arg0)
+{
+ jint rc = 0;
+ Cairo_NATIVE_ENTER(env, that, cairo_1current_1font_FUNC);
+ rc = (jint)cairo_current_font((cairo_t *)arg0);
+ Cairo_NATIVE_EXIT(env, that, cairo_1current_1font_FUNC);
+ return rc;
+}
+#endif
+
+#ifndef NO_cairo_1current_1font_1extents
+JNIEXPORT void JNICALL Cairo_NATIVE(cairo_1current_1font_1extents)
+ (JNIEnv *env, jclass that, jint arg0, jobject arg1)
+{
+ cairo_font_extents_t _arg1, *lparg1=NULL;
+ Cairo_NATIVE_ENTER(env, that, cairo_1current_1font_1extents_FUNC);
+ if (arg1) if ((lparg1 = getcairo_font_extents_tFields(env, arg1, &_arg1)) == NULL) goto fail;
+ cairo_current_font_extents((cairo_t *)arg0, (cairo_font_extents_t *)lparg1);
+fail:
+ if (arg1 && lparg1) setcairo_font_extents_tFields(env, arg1, lparg1);
+ Cairo_NATIVE_EXIT(env, that, cairo_1current_1font_1extents_FUNC);
+}
+#endif
+
+#ifndef NO_cairo_1current_1line_1cap
+JNIEXPORT jint JNICALL Cairo_NATIVE(cairo_1current_1line_1cap)
+ (JNIEnv *env, jclass that, jint arg0)
+{
+ jint rc = 0;
+ Cairo_NATIVE_ENTER(env, that, cairo_1current_1line_1cap_FUNC);
+ rc = (jint)cairo_current_line_cap((cairo_t *)arg0);
+ Cairo_NATIVE_EXIT(env, that, cairo_1current_1line_1cap_FUNC);
+ return rc;
+}
+#endif
+
+#ifndef NO_cairo_1current_1line_1join
+JNIEXPORT jint JNICALL Cairo_NATIVE(cairo_1current_1line_1join)
+ (JNIEnv *env, jclass that, jint arg0)
+{
+ jint rc = 0;
+ Cairo_NATIVE_ENTER(env, that, cairo_1current_1line_1join_FUNC);
+ rc = (jint)cairo_current_line_join((cairo_t *)arg0);
+ Cairo_NATIVE_EXIT(env, that, cairo_1current_1line_1join_FUNC);
+ return rc;
+}
+#endif
+
+#ifndef NO_cairo_1current_1line_1width
+JNIEXPORT jdouble JNICALL Cairo_NATIVE(cairo_1current_1line_1width)
+ (JNIEnv *env, jclass that, jint arg0)
+{
+ jdouble rc = 0;
+ Cairo_NATIVE_ENTER(env, that, cairo_1current_1line_1width_FUNC);
+ rc = (jdouble)cairo_current_line_width((cairo_t *)arg0);
+ Cairo_NATIVE_EXIT(env, that, cairo_1current_1line_1width_FUNC);
+ return rc;
+}
+#endif
+
+#ifndef NO_cairo_1current_1matrix
+JNIEXPORT void JNICALL Cairo_NATIVE(cairo_1current_1matrix)
+ (JNIEnv *env, jclass that, jint arg0, jint arg1)
+{
+ Cairo_NATIVE_ENTER(env, that, cairo_1current_1matrix_FUNC);
+ cairo_current_matrix((cairo_t *)arg0, (cairo_matrix_t *)arg1);
+ Cairo_NATIVE_EXIT(env, that, cairo_1current_1matrix_FUNC);
+}
+#endif
+
+#ifndef NO_cairo_1current_1miter_1limit
+JNIEXPORT jdouble JNICALL Cairo_NATIVE(cairo_1current_1miter_1limit)
+ (JNIEnv *env, jclass that, jint arg0)
+{
+ jdouble rc = 0;
+ Cairo_NATIVE_ENTER(env, that, cairo_1current_1miter_1limit_FUNC);
+ rc = (jdouble)cairo_current_miter_limit((cairo_t *)arg0);
+ Cairo_NATIVE_EXIT(env, that, cairo_1current_1miter_1limit_FUNC);
+ return rc;
+}
+#endif
+
+#ifndef NO_cairo_1current_1operator
+JNIEXPORT jint JNICALL Cairo_NATIVE(cairo_1current_1operator)
+ (JNIEnv *env, jclass that, jint arg0)
+{
+ jint rc = 0;
+ Cairo_NATIVE_ENTER(env, that, cairo_1current_1operator_FUNC);
+ rc = (jint)cairo_current_operator((cairo_t *)arg0);
+ Cairo_NATIVE_EXIT(env, that, cairo_1current_1operator_FUNC);
+ return rc;
+}
+#endif
+
+#ifndef NO_cairo_1current_1path
+JNIEXPORT void JNICALL Cairo_NATIVE(cairo_1current_1path)
+ (JNIEnv *env, jclass that, jint arg0, jint arg1, jint arg2, jint arg3, jint arg4, jint arg5)
+{
+ Cairo_NATIVE_ENTER(env, that, cairo_1current_1path_FUNC);
+ cairo_current_path((cairo_t *)arg0, (cairo_move_to_func_t *)arg1, (cairo_line_to_func_t *)arg2, (cairo_curve_to_func_t *)arg3, (cairo_close_path_func_t *)arg4, (void *)arg5);
+ Cairo_NATIVE_EXIT(env, that, cairo_1current_1path_FUNC);
+}
+#endif
+
+#ifndef NO_cairo_1current_1path_1flat
+JNIEXPORT void JNICALL Cairo_NATIVE(cairo_1current_1path_1flat)
+ (JNIEnv *env, jclass that, jint arg0, jint arg1, jint arg2, jint arg3, jint arg4)
+{
+ Cairo_NATIVE_ENTER(env, that, cairo_1current_1path_1flat_FUNC);
+ cairo_current_path_flat((cairo_t *)arg0, (cairo_move_to_func_t *)arg1, (cairo_line_to_func_t *)arg2, (cairo_close_path_func_t *)arg3, (void *)arg4);
+ Cairo_NATIVE_EXIT(env, that, cairo_1current_1path_1flat_FUNC);
+}
+#endif
+
+#ifndef NO_cairo_1current_1pattern
+JNIEXPORT jint JNICALL Cairo_NATIVE(cairo_1current_1pattern)
+ (JNIEnv *env, jclass that, jint arg0)
+{
+ jint rc = 0;
+ Cairo_NATIVE_ENTER(env, that, cairo_1current_1pattern_FUNC);
+ rc = (jint)cairo_current_pattern((cairo_t *)arg0);
+ Cairo_NATIVE_EXIT(env, that, cairo_1current_1pattern_FUNC);
+ return rc;
+}
+#endif
+
+#ifndef NO_cairo_1current_1point
+JNIEXPORT void JNICALL Cairo_NATIVE(cairo_1current_1point)
+ (JNIEnv *env, jclass that, jint arg0, jdoubleArray arg1, jdoubleArray arg2)
+{
+ jdouble *lparg1=NULL;
+ jdouble *lparg2=NULL;
+ Cairo_NATIVE_ENTER(env, that, cairo_1current_1point_FUNC);
+ if (arg1) if ((lparg1 = (*env)->GetDoubleArrayElements(env, arg1, NULL)) == NULL) goto fail;
+ if (arg2) if ((lparg2 = (*env)->GetDoubleArrayElements(env, arg2, NULL)) == NULL) goto fail;
+ cairo_current_point((cairo_t *)arg0, lparg1, lparg2);
+fail:
+ if (arg2 && lparg2) (*env)->ReleaseDoubleArrayElements(env, arg2, lparg2, 0);
+ if (arg1 && lparg1) (*env)->ReleaseDoubleArrayElements(env, arg1, lparg1, 0);
+ Cairo_NATIVE_EXIT(env, that, cairo_1current_1point_FUNC);
+}
+#endif
+
+#ifndef NO_cairo_1current_1rgb_1color
+JNIEXPORT void JNICALL Cairo_NATIVE(cairo_1current_1rgb_1color)
+ (JNIEnv *env, jclass that, jint arg0, jdoubleArray arg1, jdoubleArray arg2, jdoubleArray arg3)
+{
+ jdouble *lparg1=NULL;
+ jdouble *lparg2=NULL;
+ jdouble *lparg3=NULL;
+ Cairo_NATIVE_ENTER(env, that, cairo_1current_1rgb_1color_FUNC);
+ if (arg1) if ((lparg1 = (*env)->GetDoubleArrayElements(env, arg1, NULL)) == NULL) goto fail;
+ if (arg2) if ((lparg2 = (*env)->GetDoubleArrayElements(env, arg2, NULL)) == NULL) goto fail;
+ if (arg3) if ((lparg3 = (*env)->GetDoubleArrayElements(env, arg3, NULL)) == NULL) goto fail;
+ cairo_current_rgb_color((cairo_t *)arg0, lparg1, lparg2, lparg3);
+fail:
+ if (arg3 && lparg3) (*env)->ReleaseDoubleArrayElements(env, arg3, lparg3, 0);
+ if (arg2 && lparg2) (*env)->ReleaseDoubleArrayElements(env, arg2, lparg2, 0);
+ if (arg1 && lparg1) (*env)->ReleaseDoubleArrayElements(env, arg1, lparg1, 0);
+ Cairo_NATIVE_EXIT(env, that, cairo_1current_1rgb_1color_FUNC);
+}
+#endif
+
+#ifndef NO_cairo_1current_1target_1surface
+JNIEXPORT jint JNICALL Cairo_NATIVE(cairo_1current_1target_1surface)
+ (JNIEnv *env, jclass that, jint arg0)
+{
+ jint rc = 0;
+ Cairo_NATIVE_ENTER(env, that, cairo_1current_1target_1surface_FUNC);
+ rc = (jint)cairo_current_target_surface((cairo_t *)arg0);
+ Cairo_NATIVE_EXIT(env, that, cairo_1current_1target_1surface_FUNC);
+ return rc;
+}
+#endif
+
+#ifndef NO_cairo_1current_1tolerance
+JNIEXPORT jdouble JNICALL Cairo_NATIVE(cairo_1current_1tolerance)
+ (JNIEnv *env, jclass that, jint arg0)
+{
+ jdouble rc = 0;
+ Cairo_NATIVE_ENTER(env, that, cairo_1current_1tolerance_FUNC);
+ rc = (jdouble)cairo_current_tolerance((cairo_t *)arg0);
+ Cairo_NATIVE_EXIT(env, that, cairo_1current_1tolerance_FUNC);
+ return rc;
+}
+#endif
+
+#ifndef NO_cairo_1curve_1to
+JNIEXPORT void JNICALL Cairo_NATIVE(cairo_1curve_1to)
+ (JNIEnv *env, jclass that, jint arg0, jdouble arg1, jdouble arg2, jdouble arg3, jdouble arg4, jdouble arg5, jdouble arg6)
+{
+ Cairo_NATIVE_ENTER(env, that, cairo_1curve_1to_FUNC);
+ cairo_curve_to((cairo_t *)arg0, arg1, arg2, arg3, arg4, arg5, arg6);
+ Cairo_NATIVE_EXIT(env, that, cairo_1curve_1to_FUNC);
+}
+#endif
+
+#ifndef NO_cairo_1default_1matrix
+JNIEXPORT void JNICALL Cairo_NATIVE(cairo_1default_1matrix)
+ (JNIEnv *env, jclass that, jint arg0)
+{
+ Cairo_NATIVE_ENTER(env, that, cairo_1default_1matrix_FUNC);
+ cairo_default_matrix((cairo_t *)arg0);
+ Cairo_NATIVE_EXIT(env, that, cairo_1default_1matrix_FUNC);
+}
+#endif
+
+#ifndef NO_cairo_1destroy
+JNIEXPORT void JNICALL Cairo_NATIVE(cairo_1destroy)
+ (JNIEnv *env, jclass that, jint arg0)
+{
+ Cairo_NATIVE_ENTER(env, that, cairo_1destroy_FUNC);
+ cairo_destroy((cairo_t *)arg0);
+ Cairo_NATIVE_EXIT(env, that, cairo_1destroy_FUNC);
+}
+#endif
+
+#ifndef NO_cairo_1fill
+JNIEXPORT void JNICALL Cairo_NATIVE(cairo_1fill)
+ (JNIEnv *env, jclass that, jint arg0)
+{
+ Cairo_NATIVE_ENTER(env, that, cairo_1fill_FUNC);
+ cairo_fill((cairo_t *)arg0);
+ Cairo_NATIVE_EXIT(env, that, cairo_1fill_FUNC);
+}
+#endif
+
+#ifndef NO_cairo_1fill_1extents
+JNIEXPORT void JNICALL Cairo_NATIVE(cairo_1fill_1extents)
+ (JNIEnv *env, jclass that, jint arg0, jdoubleArray arg1, jdoubleArray arg2, jdoubleArray arg3, jdoubleArray arg4)
+{
+ jdouble *lparg1=NULL;
+ jdouble *lparg2=NULL;
+ jdouble *lparg3=NULL;
+ jdouble *lparg4=NULL;
+ Cairo_NATIVE_ENTER(env, that, cairo_1fill_1extents_FUNC);
+ if (arg1) if ((lparg1 = (*env)->GetDoubleArrayElements(env, arg1, NULL)) == NULL) goto fail;
+ if (arg2) if ((lparg2 = (*env)->GetDoubleArrayElements(env, arg2, NULL)) == NULL) goto fail;
+ if (arg3) if ((lparg3 = (*env)->GetDoubleArrayElements(env, arg3, NULL)) == NULL) goto fail;
+ if (arg4) if ((lparg4 = (*env)->GetDoubleArrayElements(env, arg4, NULL)) == NULL) goto fail;
+ cairo_fill_extents((cairo_t *)arg0, lparg1, lparg2, lparg3, lparg4);
+fail:
+ if (arg4 && lparg4) (*env)->ReleaseDoubleArrayElements(env, arg4, lparg4, 0);
+ if (arg3 && lparg3) (*env)->ReleaseDoubleArrayElements(env, arg3, lparg3, 0);
+ if (arg2 && lparg2) (*env)->ReleaseDoubleArrayElements(env, arg2, lparg2, 0);
+ if (arg1 && lparg1) (*env)->ReleaseDoubleArrayElements(env, arg1, lparg1, 0);
+ Cairo_NATIVE_EXIT(env, that, cairo_1fill_1extents_FUNC);
+}
+#endif
+
+#ifndef NO_cairo_1font_1current_1transform
+JNIEXPORT void JNICALL Cairo_NATIVE(cairo_1font_1current_1transform)
+ (JNIEnv *env, jclass that, jint arg0, jint arg1)
+{
+ Cairo_NATIVE_ENTER(env, that, cairo_1font_1current_1transform_FUNC);
+ cairo_font_current_transform((cairo_font_t *)arg0, (cairo_matrix_t *)arg1);
+ Cairo_NATIVE_EXIT(env, that, cairo_1font_1current_1transform_FUNC);
+}
+#endif
+
+#ifndef NO_cairo_1font_1destroy
+JNIEXPORT void JNICALL Cairo_NATIVE(cairo_1font_1destroy)
+ (JNIEnv *env, jclass that, jint arg0)
+{
+ Cairo_NATIVE_ENTER(env, that, cairo_1font_1destroy_FUNC);
+ cairo_font_destroy((cairo_font_t *)arg0);
+ Cairo_NATIVE_EXIT(env, that, cairo_1font_1destroy_FUNC);
+}
+#endif
+
+#ifndef NO_cairo_1font_1extents_1t_1sizeof
+JNIEXPORT jint JNICALL Cairo_NATIVE(cairo_1font_1extents_1t_1sizeof)
+ (JNIEnv *env, jclass that)
+{
+ jint rc = 0;
+ Cairo_NATIVE_ENTER(env, that, cairo_1font_1extents_1t_1sizeof_FUNC);
+ rc = (jint)cairo_font_extents_t_sizeof();
+ Cairo_NATIVE_EXIT(env, that, cairo_1font_1extents_1t_1sizeof_FUNC);
+ return rc;
+}
+#endif
+
+#ifndef NO_cairo_1font_1reference
+JNIEXPORT void JNICALL Cairo_NATIVE(cairo_1font_1reference)
+ (JNIEnv *env, jclass that, jint arg0)
+{
+ Cairo_NATIVE_ENTER(env, that, cairo_1font_1reference_FUNC);
+ cairo_font_reference((cairo_font_t *)arg0);
+ Cairo_NATIVE_EXIT(env, that, cairo_1font_1reference_FUNC);
+}
+#endif
+
+#ifndef NO_cairo_1font_1set_1transform
+JNIEXPORT void JNICALL Cairo_NATIVE(cairo_1font_1set_1transform)
+ (JNIEnv *env, jclass that, jint arg0, jint arg1)
+{
+ Cairo_NATIVE_ENTER(env, that, cairo_1font_1set_1transform_FUNC);
+ cairo_font_set_transform((cairo_font_t *)arg0, (cairo_matrix_t *)arg1);
+ Cairo_NATIVE_EXIT(env, that, cairo_1font_1set_1transform_FUNC);
+}
+#endif
+
+#ifndef NO_cairo_1glyph_1extents
+JNIEXPORT void JNICALL Cairo_NATIVE(cairo_1glyph_1extents)
+ (JNIEnv *env, jclass that, jint arg0, jint arg1, jint arg2, jint arg3)
+{
+ Cairo_NATIVE_ENTER(env, that, cairo_1glyph_1extents_FUNC);
+ cairo_glyph_extents((cairo_t *)arg0, (cairo_glyph_t *)arg1, arg2, (cairo_text_extents_t *)arg3);
+ Cairo_NATIVE_EXIT(env, that, cairo_1glyph_1extents_FUNC);
+}
+#endif
+
+#ifndef NO_cairo_1glyph_1path
+JNIEXPORT void JNICALL Cairo_NATIVE(cairo_1glyph_1path)
+ (JNIEnv *env, jclass that, jint arg0, jint arg1, jint arg2)
+{
+ Cairo_NATIVE_ENTER(env, that, cairo_1glyph_1path_FUNC);
+ cairo_glyph_path((cairo_t *)arg0, (cairo_glyph_t *)arg1, arg2);
+ Cairo_NATIVE_EXIT(env, that, cairo_1glyph_1path_FUNC);
+}
+#endif
+
+#ifndef NO_cairo_1identity_1matrix
+JNIEXPORT void JNICALL Cairo_NATIVE(cairo_1identity_1matrix)
+ (JNIEnv *env, jclass that, jint arg0)
+{
+ Cairo_NATIVE_ENTER(env, that, cairo_1identity_1matrix_FUNC);
+ cairo_identity_matrix((cairo_t *)arg0);
+ Cairo_NATIVE_EXIT(env, that, cairo_1identity_1matrix_FUNC);
+}
+#endif
+
+#ifndef NO_cairo_1image_1surface_1create
+JNIEXPORT jint JNICALL Cairo_NATIVE(cairo_1image_1surface_1create)
+ (JNIEnv *env, jclass that, jint arg0, jint arg1, jint arg2)
+{
+ jint rc = 0;
+ Cairo_NATIVE_ENTER(env, that, cairo_1image_1surface_1create_FUNC);
+ rc = (jint)cairo_image_surface_create(arg0, arg1, arg2);
+ Cairo_NATIVE_EXIT(env, that, cairo_1image_1surface_1create_FUNC);
+ return rc;
+}
+#endif
+
+#ifndef NO_cairo_1image_1surface_1create_1for_1data
+JNIEXPORT jint JNICALL Cairo_NATIVE(cairo_1image_1surface_1create_1for_1data)
+ (JNIEnv *env, jclass that, jint arg0, jint arg1, jint arg2, jint arg3, jint arg4)
+{
+ jint rc = 0;
+ Cairo_NATIVE_ENTER(env, that, cairo_1image_1surface_1create_1for_1data_FUNC);
+ rc = (jint)cairo_image_surface_create_for_data((char *)arg0, arg1, arg2, arg3, arg4);
+ Cairo_NATIVE_EXIT(env, that, cairo_1image_1surface_1create_1for_1data_FUNC);
+ return rc;
+}
+#endif
+
+#ifndef NO_cairo_1in_1fill
+JNIEXPORT jint JNICALL Cairo_NATIVE(cairo_1in_1fill)
+ (JNIEnv *env, jclass that, jint arg0, jdouble arg1, jdouble arg2)
+{
+ jint rc = 0;
+ Cairo_NATIVE_ENTER(env, that, cairo_1in_1fill_FUNC);
+ rc = (jint)cairo_in_fill((cairo_t *)arg0, arg1, arg2);
+ Cairo_NATIVE_EXIT(env, that, cairo_1in_1fill_FUNC);
+ return rc;
+}
+#endif
+
+#ifndef NO_cairo_1in_1stroke
+JNIEXPORT jint JNICALL Cairo_NATIVE(cairo_1in_1stroke)
+ (JNIEnv *env, jclass that, jint arg0, jdouble arg1, jdouble arg2)
+{
+ jint rc = 0;
+ Cairo_NATIVE_ENTER(env, that, cairo_1in_1stroke_FUNC);
+ rc = (jint)cairo_in_stroke((cairo_t *)arg0, arg1, arg2);
+ Cairo_NATIVE_EXIT(env, that, cairo_1in_1stroke_FUNC);
+ return rc;
+}
+#endif
+
+#ifndef NO_cairo_1init_1clip
+JNIEXPORT void JNICALL Cairo_NATIVE(cairo_1init_1clip)
+ (JNIEnv *env, jclass that, jint arg0)
+{
+ Cairo_NATIVE_ENTER(env, that, cairo_1init_1clip_FUNC);
+ cairo_init_clip((cairo_t *)arg0);
+ Cairo_NATIVE_EXIT(env, that, cairo_1init_1clip_FUNC);
+}
+#endif
+
+#ifndef NO_cairo_1inverse_1transform_1distance
+JNIEXPORT void JNICALL Cairo_NATIVE(cairo_1inverse_1transform_1distance)
+ (JNIEnv *env, jclass that, jint arg0, jdoubleArray arg1, jdoubleArray arg2)
+{
+ jdouble *lparg1=NULL;
+ jdouble *lparg2=NULL;
+ Cairo_NATIVE_ENTER(env, that, cairo_1inverse_1transform_1distance_FUNC);
+ if (arg1) if ((lparg1 = (*env)->GetDoubleArrayElements(env, arg1, NULL)) == NULL) goto fail;
+ if (arg2) if ((lparg2 = (*env)->GetDoubleArrayElements(env, arg2, NULL)) == NULL) goto fail;
+ cairo_inverse_transform_distance((cairo_t *)arg0, lparg1, lparg2);
+fail:
+ if (arg2 && lparg2) (*env)->ReleaseDoubleArrayElements(env, arg2, lparg2, 0);
+ if (arg1 && lparg1) (*env)->ReleaseDoubleArrayElements(env, arg1, lparg1, 0);
+ Cairo_NATIVE_EXIT(env, that, cairo_1inverse_1transform_1distance_FUNC);
+}
+#endif
+
+#ifndef NO_cairo_1inverse_1transform_1point
+JNIEXPORT void JNICALL Cairo_NATIVE(cairo_1inverse_1transform_1point)
+ (JNIEnv *env, jclass that, jint arg0, jdoubleArray arg1, jdoubleArray arg2)
+{
+ jdouble *lparg1=NULL;
+ jdouble *lparg2=NULL;
+ Cairo_NATIVE_ENTER(env, that, cairo_1inverse_1transform_1point_FUNC);
+ if (arg1) if ((lparg1 = (*env)->GetDoubleArrayElements(env, arg1, NULL)) == NULL) goto fail;
+ if (arg2) if ((lparg2 = (*env)->GetDoubleArrayElements(env, arg2, NULL)) == NULL) goto fail;
+ cairo_inverse_transform_point((cairo_t *)arg0, lparg1, lparg2);
+fail:
+ if (arg2 && lparg2) (*env)->ReleaseDoubleArrayElements(env, arg2, lparg2, 0);
+ if (arg1 && lparg1) (*env)->ReleaseDoubleArrayElements(env, arg1, lparg1, 0);
+ Cairo_NATIVE_EXIT(env, that, cairo_1inverse_1transform_1point_FUNC);
+}
+#endif
+
+#ifndef NO_cairo_1line_1to
+JNIEXPORT void JNICALL Cairo_NATIVE(cairo_1line_1to)
+ (JNIEnv *env, jclass that, jint arg0, jdouble arg1, jdouble arg2)
+{
+ Cairo_NATIVE_ENTER(env, that, cairo_1line_1to_FUNC);
+ cairo_line_to((cairo_t *)arg0, arg1, arg2);
+ Cairo_NATIVE_EXIT(env, that, cairo_1line_1to_FUNC);
+}
+#endif
+
+#ifndef NO_cairo_1matrix_1copy
+JNIEXPORT jint JNICALL Cairo_NATIVE(cairo_1matrix_1copy)
+ (JNIEnv *env, jclass that, jint arg0, jint arg1)
+{
+ jint rc = 0;
+ Cairo_NATIVE_ENTER(env, that, cairo_1matrix_1copy_FUNC);
+ rc = (jint)cairo_matrix_copy((cairo_matrix_t *)arg0, (cairo_matrix_t *)arg1);
+ Cairo_NATIVE_EXIT(env, that, cairo_1matrix_1copy_FUNC);
+ return rc;
+}
+#endif
+
+#ifndef NO_cairo_1matrix_1create
+JNIEXPORT jint JNICALL Cairo_NATIVE(cairo_1matrix_1create)
+ (JNIEnv *env, jclass that)
+{
+ jint rc = 0;
+ Cairo_NATIVE_ENTER(env, that, cairo_1matrix_1create_FUNC);
+ rc = (jint)cairo_matrix_create();
+ Cairo_NATIVE_EXIT(env, that, cairo_1matrix_1create_FUNC);
+ return rc;
+}
+#endif
+
+#ifndef NO_cairo_1matrix_1destroy
+JNIEXPORT void JNICALL Cairo_NATIVE(cairo_1matrix_1destroy)
+ (JNIEnv *env, jclass that, jint arg0)
+{
+ Cairo_NATIVE_ENTER(env, that, cairo_1matrix_1destroy_FUNC);
+ cairo_matrix_destroy((cairo_matrix_t *)arg0);
+ Cairo_NATIVE_EXIT(env, that, cairo_1matrix_1destroy_FUNC);
+}
+#endif
+
+#ifndef NO_cairo_1matrix_1get_1affine
+JNIEXPORT jint JNICALL Cairo_NATIVE(cairo_1matrix_1get_1affine)
+ (JNIEnv *env, jclass that, jint arg0, jdoubleArray arg1, jdoubleArray arg2, jdoubleArray arg3, jdoubleArray arg4, jdoubleArray arg5, jdoubleArray arg6)
+{
+ jdouble *lparg1=NULL;
+ jdouble *lparg2=NULL;
+ jdouble *lparg3=NULL;
+ jdouble *lparg4=NULL;
+ jdouble *lparg5=NULL;
+ jdouble *lparg6=NULL;
+ jint rc = 0;
+ Cairo_NATIVE_ENTER(env, that, cairo_1matrix_1get_1affine_FUNC);
+ if (arg1) if ((lparg1 = (*env)->GetDoubleArrayElements(env, arg1, NULL)) == NULL) goto fail;
+ if (arg2) if ((lparg2 = (*env)->GetDoubleArrayElements(env, arg2, NULL)) == NULL) goto fail;
+ if (arg3) if ((lparg3 = (*env)->GetDoubleArrayElements(env, arg3, NULL)) == NULL) goto fail;
+ if (arg4) if ((lparg4 = (*env)->GetDoubleArrayElements(env, arg4, NULL)) == NULL) goto fail;
+ if (arg5) if ((lparg5 = (*env)->GetDoubleArrayElements(env, arg5, NULL)) == NULL) goto fail;
+ if (arg6) if ((lparg6 = (*env)->GetDoubleArrayElements(env, arg6, NULL)) == NULL) goto fail;
+ rc = (jint)cairo_matrix_get_affine((cairo_matrix_t *)arg0, lparg1, lparg2, lparg3, lparg4, lparg5, lparg6);
+fail:
+ if (arg6 && lparg6) (*env)->ReleaseDoubleArrayElements(env, arg6, lparg6, 0);
+ if (arg5 && lparg5) (*env)->ReleaseDoubleArrayElements(env, arg5, lparg5, 0);
+ if (arg4 && lparg4) (*env)->ReleaseDoubleArrayElements(env, arg4, lparg4, 0);
+ if (arg3 && lparg3) (*env)->ReleaseDoubleArrayElements(env, arg3, lparg3, 0);
+ if (arg2 && lparg2) (*env)->ReleaseDoubleArrayElements(env, arg2, lparg2, 0);
+ if (arg1 && lparg1) (*env)->ReleaseDoubleArrayElements(env, arg1, lparg1, 0);
+ Cairo_NATIVE_EXIT(env, that, cairo_1matrix_1get_1affine_FUNC);
+ return rc;
+}
+#endif
+
+#ifndef NO_cairo_1matrix_1invert
+JNIEXPORT jint JNICALL Cairo_NATIVE(cairo_1matrix_1invert)
+ (JNIEnv *env, jclass that, jint arg0)
+{
+ jint rc = 0;
+ Cairo_NATIVE_ENTER(env, that, cairo_1matrix_1invert_FUNC);
+ rc = (jint)cairo_matrix_invert((cairo_matrix_t *)arg0);
+ Cairo_NATIVE_EXIT(env, that, cairo_1matrix_1invert_FUNC);
+ return rc;
+}
+#endif
+
+#ifndef NO_cairo_1matrix_1multiply
+JNIEXPORT jint JNICALL Cairo_NATIVE(cairo_1matrix_1multiply)
+ (JNIEnv *env, jclass that, jint arg0, jint arg1, jint arg2)
+{
+ jint rc = 0;
+ Cairo_NATIVE_ENTER(env, that, cairo_1matrix_1multiply_FUNC);
+ rc = (jint)cairo_matrix_multiply((cairo_matrix_t *)arg0, (cairo_matrix_t *)arg1, (cairo_matrix_t *)arg2);
+ Cairo_NATIVE_EXIT(env, that, cairo_1matrix_1multiply_FUNC);
+ return rc;
+}
+#endif
+
+#ifndef NO_cairo_1matrix_1rotate
+JNIEXPORT jint JNICALL Cairo_NATIVE(cairo_1matrix_1rotate)
+ (JNIEnv *env, jclass that, jint arg0, jdouble arg1)
+{
+ jint rc = 0;
+ Cairo_NATIVE_ENTER(env, that, cairo_1matrix_1rotate_FUNC);
+ rc = (jint)cairo_matrix_rotate((cairo_matrix_t *)arg0, arg1);
+ Cairo_NATIVE_EXIT(env, that, cairo_1matrix_1rotate_FUNC);
+ return rc;
+}
+#endif
+
+#ifndef NO_cairo_1matrix_1scale
+JNIEXPORT jint JNICALL Cairo_NATIVE(cairo_1matrix_1scale)
+ (JNIEnv *env, jclass that, jint arg0, jdouble arg1, jdouble arg2)
+{
+ jint rc = 0;
+ Cairo_NATIVE_ENTER(env, that, cairo_1matrix_1scale_FUNC);
+ rc = (jint)cairo_matrix_scale((cairo_matrix_t *)arg0, arg1, arg2);
+ Cairo_NATIVE_EXIT(env, that, cairo_1matrix_1scale_FUNC);
+ return rc;
+}
+#endif
+
+#ifndef NO_cairo_1matrix_1set_1affine
+JNIEXPORT jint JNICALL Cairo_NATIVE(cairo_1matrix_1set_1affine)
+ (JNIEnv *env, jclass that, jint arg0, jdouble arg1, jdouble arg2, jdouble arg3, jdouble arg4, jdouble arg5, jdouble arg6)
+{
+ jint rc = 0;
+ Cairo_NATIVE_ENTER(env, that, cairo_1matrix_1set_1affine_FUNC);
+ rc = (jint)cairo_matrix_set_affine((cairo_matrix_t *)arg0, arg1, arg2, arg3, arg4, arg5, arg6);
+ Cairo_NATIVE_EXIT(env, that, cairo_1matrix_1set_1affine_FUNC);
+ return rc;
+}
+#endif
+
+#ifndef NO_cairo_1matrix_1set_1identity
+JNIEXPORT jint JNICALL Cairo_NATIVE(cairo_1matrix_1set_1identity)
+ (JNIEnv *env, jclass that, jint arg0)
+{
+ jint rc = 0;
+ Cairo_NATIVE_ENTER(env, that, cairo_1matrix_1set_1identity_FUNC);
+ rc = (jint)cairo_matrix_set_identity((cairo_matrix_t *)arg0);
+ Cairo_NATIVE_EXIT(env, that, cairo_1matrix_1set_1identity_FUNC);
+ return rc;
+}
+#endif
+
+#ifndef NO_cairo_1matrix_1transform_1distance
+JNIEXPORT jint JNICALL Cairo_NATIVE(cairo_1matrix_1transform_1distance)
+ (JNIEnv *env, jclass that, jint arg0, jdoubleArray arg1, jdoubleArray arg2)
+{
+ jdouble *lparg1=NULL;
+ jdouble *lparg2=NULL;
+ jint rc = 0;
+ Cairo_NATIVE_ENTER(env, that, cairo_1matrix_1transform_1distance_FUNC);
+ if (arg1) if ((lparg1 = (*env)->GetDoubleArrayElements(env, arg1, NULL)) == NULL) goto fail;
+ if (arg2) if ((lparg2 = (*env)->GetDoubleArrayElements(env, arg2, NULL)) == NULL) goto fail;
+ rc = (jint)cairo_matrix_transform_distance((cairo_matrix_t *)arg0, lparg1, lparg2);
+fail:
+ if (arg2 && lparg2) (*env)->ReleaseDoubleArrayElements(env, arg2, lparg2, 0);
+ if (arg1 && lparg1) (*env)->ReleaseDoubleArrayElements(env, arg1, lparg1, 0);
+ Cairo_NATIVE_EXIT(env, that, cairo_1matrix_1transform_1distance_FUNC);
+ return rc;
+}
+#endif
+
+#ifndef NO_cairo_1matrix_1transform_1point
+JNIEXPORT jint JNICALL Cairo_NATIVE(cairo_1matrix_1transform_1point)
+ (JNIEnv *env, jclass that, jint arg0, jdoubleArray arg1, jdoubleArray arg2)
+{
+ jdouble *lparg1=NULL;
+ jdouble *lparg2=NULL;
+ jint rc = 0;
+ Cairo_NATIVE_ENTER(env, that, cairo_1matrix_1transform_1point_FUNC);
+ if (arg1) if ((lparg1 = (*env)->GetDoubleArrayElements(env, arg1, NULL)) == NULL) goto fail;
+ if (arg2) if ((lparg2 = (*env)->GetDoubleArrayElements(env, arg2, NULL)) == NULL) goto fail;
+ rc = (jint)cairo_matrix_transform_point((cairo_matrix_t *)arg0, lparg1, lparg2);
+fail:
+ if (arg2 && lparg2) (*env)->ReleaseDoubleArrayElements(env, arg2, lparg2, 0);
+ if (arg1 && lparg1) (*env)->ReleaseDoubleArrayElements(env, arg1, lparg1, 0);
+ Cairo_NATIVE_EXIT(env, that, cairo_1matrix_1transform_1point_FUNC);
+ return rc;
+}
+#endif
+
+#ifndef NO_cairo_1matrix_1translate
+JNIEXPORT jint JNICALL Cairo_NATIVE(cairo_1matrix_1translate)
+ (JNIEnv *env, jclass that, jint arg0, jdouble arg1, jdouble arg2)
+{
+ jint rc = 0;
+ Cairo_NATIVE_ENTER(env, that, cairo_1matrix_1translate_FUNC);
+ rc = (jint)cairo_matrix_translate((cairo_matrix_t *)arg0, arg1, arg2);
+ Cairo_NATIVE_EXIT(env, that, cairo_1matrix_1translate_FUNC);
+ return rc;
+}
+#endif
+
+#ifndef NO_cairo_1move_1to
+JNIEXPORT void JNICALL Cairo_NATIVE(cairo_1move_1to)
+ (JNIEnv *env, jclass that, jint arg0, jdouble arg1, jdouble arg2)
+{
+ Cairo_NATIVE_ENTER(env, that, cairo_1move_1to_FUNC);
+ cairo_move_to((cairo_t *)arg0, arg1, arg2);
+ Cairo_NATIVE_EXIT(env, that, cairo_1move_1to_FUNC);
+}
+#endif
+
+#ifndef NO_cairo_1new_1path
+JNIEXPORT void JNICALL Cairo_NATIVE(cairo_1new_1path)
+ (JNIEnv *env, jclass that, jint arg0)
+{
+ Cairo_NATIVE_ENTER(env, that, cairo_1new_1path_FUNC);
+ cairo_new_path((cairo_t *)arg0);
+ Cairo_NATIVE_EXIT(env, that, cairo_1new_1path_FUNC);
+}
+#endif
+
+#ifndef NO_cairo_1pattern_1add_1color_1stop
+JNIEXPORT jint JNICALL Cairo_NATIVE(cairo_1pattern_1add_1color_1stop)
+ (JNIEnv *env, jclass that, jint arg0, jdouble arg1, jdouble arg2, jdouble arg3, jdouble arg4, jdouble arg5)
+{
+ jint rc = 0;
+ Cairo_NATIVE_ENTER(env, that, cairo_1pattern_1add_1color_1stop_FUNC);
+ rc = (jint)cairo_pattern_add_color_stop((cairo_pattern_t *)arg0, arg1, arg2, arg3, arg4, arg5);
+ Cairo_NATIVE_EXIT(env, that, cairo_1pattern_1add_1color_1stop_FUNC);
+ return rc;
+}
+#endif
+
+#ifndef NO_cairo_1pattern_1create_1for_1surface
+JNIEXPORT jint JNICALL Cairo_NATIVE(cairo_1pattern_1create_1for_1surface)
+ (JNIEnv *env, jclass that, jint arg0)
+{
+ jint rc = 0;
+ Cairo_NATIVE_ENTER(env, that, cairo_1pattern_1create_1for_1surface_FUNC);
+ rc = (jint)cairo_pattern_create_for_surface((cairo_surface_t *)arg0);
+ Cairo_NATIVE_EXIT(env, that, cairo_1pattern_1create_1for_1surface_FUNC);
+ return rc;
+}
+#endif
+
+#ifndef NO_cairo_1pattern_1create_1linear
+JNIEXPORT jint JNICALL Cairo_NATIVE(cairo_1pattern_1create_1linear)
+ (JNIEnv *env, jclass that, jdouble arg0, jdouble arg1, jdouble arg2, jdouble arg3)
+{
+ jint rc = 0;
+ Cairo_NATIVE_ENTER(env, that, cairo_1pattern_1create_1linear_FUNC);
+ rc = (jint)cairo_pattern_create_linear(arg0, arg1, arg2, arg3);
+ Cairo_NATIVE_EXIT(env, that, cairo_1pattern_1create_1linear_FUNC);
+ return rc;
+}
+#endif
+
+#ifndef NO_cairo_1pattern_1create_1radial
+JNIEXPORT jint JNICALL Cairo_NATIVE(cairo_1pattern_1create_1radial)
+ (JNIEnv *env, jclass that, jdouble arg0, jdouble arg1, jdouble arg2, jdouble arg3, jdouble arg4, jdouble arg5)
+{
+ jint rc = 0;
+ Cairo_NATIVE_ENTER(env, that, cairo_1pattern_1create_1radial_FUNC);
+ rc = (jint)cairo_pattern_create_radial(arg0, arg1, arg2, arg3, arg4, arg5);
+ Cairo_NATIVE_EXIT(env, that, cairo_1pattern_1create_1radial_FUNC);
+ return rc;
+}
+#endif
+
+#ifndef NO_cairo_1pattern_1destroy
+JNIEXPORT void JNICALL Cairo_NATIVE(cairo_1pattern_1destroy)
+ (JNIEnv *env, jclass that, jint arg0)
+{
+ Cairo_NATIVE_ENTER(env, that, cairo_1pattern_1destroy_FUNC);
+ cairo_pattern_destroy((cairo_pattern_t *)arg0);
+ Cairo_NATIVE_EXIT(env, that, cairo_1pattern_1destroy_FUNC);
+}
+#endif
+
+#ifndef NO_cairo_1pattern_1get_1extend
+JNIEXPORT jint JNICALL Cairo_NATIVE(cairo_1pattern_1get_1extend)
+ (JNIEnv *env, jclass that, jint arg0)
+{
+ jint rc = 0;
+ Cairo_NATIVE_ENTER(env, that, cairo_1pattern_1get_1extend_FUNC);
+ rc = (jint)cairo_pattern_get_extend((cairo_pattern_t *)arg0);
+ Cairo_NATIVE_EXIT(env, that, cairo_1pattern_1get_1extend_FUNC);
+ return rc;
+}
+#endif
+
+#ifndef NO_cairo_1pattern_1get_1filter
+JNIEXPORT jint JNICALL Cairo_NATIVE(cairo_1pattern_1get_1filter)
+ (JNIEnv *env, jclass that, jint arg0)
+{
+ jint rc = 0;
+ Cairo_NATIVE_ENTER(env, that, cairo_1pattern_1get_1filter_FUNC);
+ rc = (jint)cairo_pattern_get_filter((cairo_pattern_t *)arg0);
+ Cairo_NATIVE_EXIT(env, that, cairo_1pattern_1get_1filter_FUNC);
+ return rc;
+}
+#endif
+
+#ifndef NO_cairo_1pattern_1get_1matrix
+JNIEXPORT jint JNICALL Cairo_NATIVE(cairo_1pattern_1get_1matrix)
+ (JNIEnv *env, jclass that, jint arg0, jint arg1)
+{
+ jint rc = 0;
+ Cairo_NATIVE_ENTER(env, that, cairo_1pattern_1get_1matrix_FUNC);
+ rc = (jint)cairo_pattern_get_matrix((cairo_pattern_t *)arg0, (cairo_matrix_t *)arg1);
+ Cairo_NATIVE_EXIT(env, that, cairo_1pattern_1get_1matrix_FUNC);
+ return rc;
+}
+#endif
+
+#ifndef NO_cairo_1pattern_1reference
+JNIEXPORT void JNICALL Cairo_NATIVE(cairo_1pattern_1reference)
+ (JNIEnv *env, jclass that, jint arg0)
+{
+ Cairo_NATIVE_ENTER(env, that, cairo_1pattern_1reference_FUNC);
+ cairo_pattern_reference((cairo_pattern_t *)arg0);
+ Cairo_NATIVE_EXIT(env, that, cairo_1pattern_1reference_FUNC);
+}
+#endif
+
+#ifndef NO_cairo_1pattern_1set_1extend
+JNIEXPORT jint JNICALL Cairo_NATIVE(cairo_1pattern_1set_1extend)
+ (JNIEnv *env, jclass that, jint arg0, jint arg1)
+{
+ jint rc = 0;
+ Cairo_NATIVE_ENTER(env, that, cairo_1pattern_1set_1extend_FUNC);
+ rc = (jint)cairo_pattern_set_extend((cairo_pattern_t *)arg0, arg1);
+ Cairo_NATIVE_EXIT(env, that, cairo_1pattern_1set_1extend_FUNC);
+ return rc;
+}
+#endif
+
+#ifndef NO_cairo_1pattern_1set_1filter
+JNIEXPORT jint JNICALL Cairo_NATIVE(cairo_1pattern_1set_1filter)
+ (JNIEnv *env, jclass that, jint arg0, jint arg1)
+{
+ jint rc = 0;
+ Cairo_NATIVE_ENTER(env, that, cairo_1pattern_1set_1filter_FUNC);
+ rc = (jint)cairo_pattern_set_filter((cairo_pattern_t *)arg0, arg1);
+ Cairo_NATIVE_EXIT(env, that, cairo_1pattern_1set_1filter_FUNC);
+ return rc;
+}
+#endif
+
+#ifndef NO_cairo_1pattern_1set_1matrix
+JNIEXPORT jint JNICALL Cairo_NATIVE(cairo_1pattern_1set_1matrix)
+ (JNIEnv *env, jclass that, jint arg0, jint arg1)
+{
+ jint rc = 0;
+ Cairo_NATIVE_ENTER(env, that, cairo_1pattern_1set_1matrix_FUNC);
+ rc = (jint)cairo_pattern_set_matrix((cairo_pattern_t *)arg0, (cairo_matrix_t *)arg1);
+ Cairo_NATIVE_EXIT(env, that, cairo_1pattern_1set_1matrix_FUNC);
+ return rc;
+}
+#endif
+
+#ifndef NO_cairo_1rectangle
+JNIEXPORT void JNICALL Cairo_NATIVE(cairo_1rectangle)
+ (JNIEnv *env, jclass that, jint arg0, jdouble arg1, jdouble arg2, jdouble arg3, jdouble arg4)
+{
+ Cairo_NATIVE_ENTER(env, that, cairo_1rectangle_FUNC);
+ cairo_rectangle((cairo_t *)arg0, arg1, arg2, arg3, arg4);
+ Cairo_NATIVE_EXIT(env, that, cairo_1rectangle_FUNC);
+}
+#endif
+
+#ifndef NO_cairo_1reference
+JNIEXPORT void JNICALL Cairo_NATIVE(cairo_1reference)
+ (JNIEnv *env, jclass that, jint arg0)
+{
+ Cairo_NATIVE_ENTER(env, that, cairo_1reference_FUNC);
+ cairo_reference((cairo_t *)arg0);
+ Cairo_NATIVE_EXIT(env, that, cairo_1reference_FUNC);
+}
+#endif
+
+#ifndef NO_cairo_1rel_1curve_1to
+JNIEXPORT void JNICALL Cairo_NATIVE(cairo_1rel_1curve_1to)
+ (JNIEnv *env, jclass that, jint arg0, jdouble arg1, jdouble arg2, jdouble arg3, jdouble arg4, jdouble arg5, jdouble arg6)
+{
+ Cairo_NATIVE_ENTER(env, that, cairo_1rel_1curve_1to_FUNC);
+ cairo_rel_curve_to((cairo_t *)arg0, arg1, arg2, arg3, arg4, arg5, arg6);
+ Cairo_NATIVE_EXIT(env, that, cairo_1rel_1curve_1to_FUNC);
+}
+#endif
+
+#ifndef NO_cairo_1rel_1line_1to
+JNIEXPORT void JNICALL Cairo_NATIVE(cairo_1rel_1line_1to)
+ (JNIEnv *env, jclass that, jint arg0, jdouble arg1, jdouble arg2)
+{
+ Cairo_NATIVE_ENTER(env, that, cairo_1rel_1line_1to_FUNC);
+ cairo_rel_line_to((cairo_t *)arg0, arg1, arg2);
+ Cairo_NATIVE_EXIT(env, that, cairo_1rel_1line_1to_FUNC);
+}
+#endif
+
+#ifndef NO_cairo_1rel_1move_1to
+JNIEXPORT void JNICALL Cairo_NATIVE(cairo_1rel_1move_1to)
+ (JNIEnv *env, jclass that, jint arg0, jdouble arg1, jdouble arg2)
+{
+ Cairo_NATIVE_ENTER(env, that, cairo_1rel_1move_1to_FUNC);
+ cairo_rel_move_to((cairo_t *)arg0, arg1, arg2);
+ Cairo_NATIVE_EXIT(env, that, cairo_1rel_1move_1to_FUNC);
+}
+#endif
+
+#ifndef NO_cairo_1restore
+JNIEXPORT void JNICALL Cairo_NATIVE(cairo_1restore)
+ (JNIEnv *env, jclass that, jint arg0)
+{
+ Cairo_NATIVE_ENTER(env, that, cairo_1restore_FUNC);
+ cairo_restore((cairo_t *)arg0);
+ Cairo_NATIVE_EXIT(env, that, cairo_1restore_FUNC);
+}
+#endif
+
+#ifndef NO_cairo_1rotate
+JNIEXPORT void JNICALL Cairo_NATIVE(cairo_1rotate)
+ (JNIEnv *env, jclass that, jint arg0, jdouble arg1)
+{
+ Cairo_NATIVE_ENTER(env, that, cairo_1rotate_FUNC);
+ cairo_rotate((cairo_t *)arg0, arg1);
+ Cairo_NATIVE_EXIT(env, that, cairo_1rotate_FUNC);
+}
+#endif
+
+#ifndef NO_cairo_1save
+JNIEXPORT void JNICALL Cairo_NATIVE(cairo_1save)
+ (JNIEnv *env, jclass that, jint arg0)
+{
+ Cairo_NATIVE_ENTER(env, that, cairo_1save_FUNC);
+ cairo_save((cairo_t *)arg0);
+ Cairo_NATIVE_EXIT(env, that, cairo_1save_FUNC);
+}
+#endif
+
+#ifndef NO_cairo_1scale
+JNIEXPORT void JNICALL Cairo_NATIVE(cairo_1scale)
+ (JNIEnv *env, jclass that, jint arg0, jdouble arg1, jdouble arg2)
+{
+ Cairo_NATIVE_ENTER(env, that, cairo_1scale_FUNC);
+ cairo_scale((cairo_t *)arg0, arg1, arg2);
+ Cairo_NATIVE_EXIT(env, that, cairo_1scale_FUNC);
+}
+#endif
+
+#ifndef NO_cairo_1scale_1font
+JNIEXPORT void JNICALL Cairo_NATIVE(cairo_1scale_1font)
+ (JNIEnv *env, jclass that, jint arg0, jdouble arg1)
+{
+ Cairo_NATIVE_ENTER(env, that, cairo_1scale_1font_FUNC);
+ cairo_scale_font((cairo_t *)arg0, arg1);
+ Cairo_NATIVE_EXIT(env, that, cairo_1scale_1font_FUNC);
+}
+#endif
+
+#ifndef NO_cairo_1select_1font
+JNIEXPORT void JNICALL Cairo_NATIVE(cairo_1select_1font)
+ (JNIEnv *env, jclass that, jint arg0, jbyteArray arg1, jint arg2, jint arg3)
+{
+ jbyte *lparg1=NULL;
+ Cairo_NATIVE_ENTER(env, that, cairo_1select_1font_FUNC);
+ if (arg1) if ((lparg1 = (*env)->GetByteArrayElements(env, arg1, NULL)) == NULL) goto fail;
+ cairo_select_font((cairo_t *)arg0, lparg1, arg2, arg3);
+fail:
+ if (arg1 && lparg1) (*env)->ReleaseByteArrayElements(env, arg1, lparg1, 0);
+ Cairo_NATIVE_EXIT(env, that, cairo_1select_1font_FUNC);
+}
+#endif
+
+#ifndef NO_cairo_1set_1alpha
+JNIEXPORT void JNICALL Cairo_NATIVE(cairo_1set_1alpha)
+ (JNIEnv *env, jclass that, jint arg0, jdouble arg1)
+{
+ Cairo_NATIVE_ENTER(env, that, cairo_1set_1alpha_FUNC);
+ cairo_set_alpha((cairo_t *)arg0, arg1);
+ Cairo_NATIVE_EXIT(env, that, cairo_1set_1alpha_FUNC);
+}
+#endif
+
+#ifndef NO_cairo_1set_1dash
+JNIEXPORT void JNICALL Cairo_NATIVE(cairo_1set_1dash)
+ (JNIEnv *env, jclass that, jint arg0, jdoubleArray arg1, jint arg2, jdouble arg3)
+{
+ jdouble *lparg1=NULL;
+ Cairo_NATIVE_ENTER(env, that, cairo_1set_1dash_FUNC);
+ if (arg1) if ((lparg1 = (*env)->GetDoubleArrayElements(env, arg1, NULL)) == NULL) goto fail;
+ cairo_set_dash((cairo_t *)arg0, lparg1, arg2, arg3);
+fail:
+ if (arg1 && lparg1) (*env)->ReleaseDoubleArrayElements(env, arg1, lparg1, 0);
+ Cairo_NATIVE_EXIT(env, that, cairo_1set_1dash_FUNC);
+}
+#endif
+
+#ifndef NO_cairo_1set_1fill_1rule
+JNIEXPORT void JNICALL Cairo_NATIVE(cairo_1set_1fill_1rule)
+ (JNIEnv *env, jclass that, jint arg0, jint arg1)
+{
+ Cairo_NATIVE_ENTER(env, that, cairo_1set_1fill_1rule_FUNC);
+ cairo_set_fill_rule((cairo_t *)arg0, arg1);
+ Cairo_NATIVE_EXIT(env, that, cairo_1set_1fill_1rule_FUNC);
+}
+#endif
+
+#ifndef NO_cairo_1set_1font
+JNIEXPORT void JNICALL Cairo_NATIVE(cairo_1set_1font)
+ (JNIEnv *env, jclass that, jint arg0, jint arg1)
+{
+ Cairo_NATIVE_ENTER(env, that, cairo_1set_1font_FUNC);
+ cairo_set_font((cairo_t *)arg0, (cairo_font_t *)arg1);
+ Cairo_NATIVE_EXIT(env, that, cairo_1set_1font_FUNC);
+}
+#endif
+
+#ifndef NO_cairo_1set_1line_1cap
+JNIEXPORT void JNICALL Cairo_NATIVE(cairo_1set_1line_1cap)
+ (JNIEnv *env, jclass that, jint arg0, jint arg1)
+{
+ Cairo_NATIVE_ENTER(env, that, cairo_1set_1line_1cap_FUNC);
+ cairo_set_line_cap((cairo_t *)arg0, arg1);
+ Cairo_NATIVE_EXIT(env, that, cairo_1set_1line_1cap_FUNC);
+}
+#endif
+
+#ifndef NO_cairo_1set_1line_1join
+JNIEXPORT void JNICALL Cairo_NATIVE(cairo_1set_1line_1join)
+ (JNIEnv *env, jclass that, jint arg0, jint arg1)
+{
+ Cairo_NATIVE_ENTER(env, that, cairo_1set_1line_1join_FUNC);
+ cairo_set_line_join((cairo_t *)arg0, arg1);
+ Cairo_NATIVE_EXIT(env, that, cairo_1set_1line_1join_FUNC);
+}
+#endif
+
+#ifndef NO_cairo_1set_1line_1width
+JNIEXPORT void JNICALL Cairo_NATIVE(cairo_1set_1line_1width)
+ (JNIEnv *env, jclass that, jint arg0, jdouble arg1)
+{
+ Cairo_NATIVE_ENTER(env, that, cairo_1set_1line_1width_FUNC);
+ cairo_set_line_width((cairo_t *)arg0, arg1);
+ Cairo_NATIVE_EXIT(env, that, cairo_1set_1line_1width_FUNC);
+}
+#endif
+
+#ifndef NO_cairo_1set_1matrix
+JNIEXPORT void JNICALL Cairo_NATIVE(cairo_1set_1matrix)
+ (JNIEnv *env, jclass that, jint arg0, jint arg1)
+{
+ Cairo_NATIVE_ENTER(env, that, cairo_1set_1matrix_FUNC);
+ cairo_set_matrix((cairo_t *)arg0, (cairo_matrix_t *)arg1);
+ Cairo_NATIVE_EXIT(env, that, cairo_1set_1matrix_FUNC);
+}
+#endif
+
+#ifndef NO_cairo_1set_1miter_1limit
+JNIEXPORT void JNICALL Cairo_NATIVE(cairo_1set_1miter_1limit)
+ (JNIEnv *env, jclass that, jint arg0, jdouble arg1)
+{
+ Cairo_NATIVE_ENTER(env, that, cairo_1set_1miter_1limit_FUNC);
+ cairo_set_miter_limit((cairo_t *)arg0, arg1);
+ Cairo_NATIVE_EXIT(env, that, cairo_1set_1miter_1limit_FUNC);
+}
+#endif
+
+#ifndef NO_cairo_1set_1operator
+JNIEXPORT void JNICALL Cairo_NATIVE(cairo_1set_1operator)
+ (JNIEnv *env, jclass that, jint arg0, jint arg1)
+{
+ Cairo_NATIVE_ENTER(env, that, cairo_1set_1operator_FUNC);
+ cairo_set_operator((cairo_t *)arg0, arg1);
+ Cairo_NATIVE_EXIT(env, that, cairo_1set_1operator_FUNC);
+}
+#endif
+
+#ifndef NO_cairo_1set_1pattern
+JNIEXPORT void JNICALL Cairo_NATIVE(cairo_1set_1pattern)
+ (JNIEnv *env, jclass that, jint arg0, jint arg1)
+{
+ Cairo_NATIVE_ENTER(env, that, cairo_1set_1pattern_FUNC);
+ cairo_set_pattern((cairo_t *)arg0, (cairo_pattern_t *)arg1);
+ Cairo_NATIVE_EXIT(env, that, cairo_1set_1pattern_FUNC);
+}
+#endif
+
+#ifndef NO_cairo_1set_1rgb_1color
+JNIEXPORT void JNICALL Cairo_NATIVE(cairo_1set_1rgb_1color)
+ (JNIEnv *env, jclass that, jint arg0, jdouble arg1, jdouble arg2, jdouble arg3)
+{
+ Cairo_NATIVE_ENTER(env, that, cairo_1set_1rgb_1color_FUNC);
+ cairo_set_rgb_color((cairo_t *)arg0, arg1, arg2, arg3);
+ Cairo_NATIVE_EXIT(env, that, cairo_1set_1rgb_1color_FUNC);
+}
+#endif
+
+#ifndef NO_cairo_1set_1target_1drawable
+JNIEXPORT void JNICALL Cairo_NATIVE(cairo_1set_1target_1drawable)
+ (JNIEnv *env, jclass that, jint arg0, jint arg1, jint arg2)
+{
+ Cairo_NATIVE_ENTER(env, that, cairo_1set_1target_1drawable_FUNC);
+ cairo_set_target_drawable((cairo_t *)arg0, (Display *)arg1, (Drawable)arg2);
+ Cairo_NATIVE_EXIT(env, that, cairo_1set_1target_1drawable_FUNC);
+}
+#endif
+
+#ifndef NO_cairo_1set_1target_1image
+JNIEXPORT void JNICALL Cairo_NATIVE(cairo_1set_1target_1image)
+ (JNIEnv *env, jclass that, jint arg0, jint arg1, jint arg2, jint arg3, jint arg4, jint arg5)
+{
+ Cairo_NATIVE_ENTER(env, that, cairo_1set_1target_1image_FUNC);
+ cairo_set_target_image((cairo_t *)arg0, (char *)arg1, arg2, arg3, arg4, arg5);
+ Cairo_NATIVE_EXIT(env, that, cairo_1set_1target_1image_FUNC);
+}
+#endif
+
+#ifndef NO_cairo_1set_1target_1surface
+JNIEXPORT void JNICALL Cairo_NATIVE(cairo_1set_1target_1surface)
+ (JNIEnv *env, jclass that, jint arg0, jint arg1)
+{
+ Cairo_NATIVE_ENTER(env, that, cairo_1set_1target_1surface_FUNC);
+ cairo_set_target_surface((cairo_t *)arg0, (cairo_surface_t *)arg1);
+ Cairo_NATIVE_EXIT(env, that, cairo_1set_1target_1surface_FUNC);
+}
+#endif
+
+#ifndef NO_cairo_1set_1tolerance
+JNIEXPORT void JNICALL Cairo_NATIVE(cairo_1set_1tolerance)
+ (JNIEnv *env, jclass that, jint arg0, jdouble arg1)
+{
+ Cairo_NATIVE_ENTER(env, that, cairo_1set_1tolerance_FUNC);
+ cairo_set_tolerance((cairo_t *)arg0, arg1);
+ Cairo_NATIVE_EXIT(env, that, cairo_1set_1tolerance_FUNC);
+}
+#endif
+
+#ifndef NO_cairo_1show_1glyphs
+JNIEXPORT void JNICALL Cairo_NATIVE(cairo_1show_1glyphs)
+ (JNIEnv *env, jclass that, jint arg0, jint arg1, jint arg2)
+{
+ Cairo_NATIVE_ENTER(env, that, cairo_1show_1glyphs_FUNC);
+ cairo_show_glyphs((cairo_t *)arg0, (cairo_glyph_t *)arg1, arg2);
+ Cairo_NATIVE_EXIT(env, that, cairo_1show_1glyphs_FUNC);
+}
+#endif
+
+#ifndef NO_cairo_1show_1page
+JNIEXPORT void JNICALL Cairo_NATIVE(cairo_1show_1page)
+ (JNIEnv *env, jclass that, jint arg0)
+{
+ Cairo_NATIVE_ENTER(env, that, cairo_1show_1page_FUNC);
+ cairo_show_page((cairo_t *)arg0);
+ Cairo_NATIVE_EXIT(env, that, cairo_1show_1page_FUNC);
+}
+#endif
+
+#ifndef NO_cairo_1show_1surface
+JNIEXPORT void JNICALL Cairo_NATIVE(cairo_1show_1surface)
+ (JNIEnv *env, jclass that, jint arg0, jint arg1, jint arg2, jint arg3)
+{
+ Cairo_NATIVE_ENTER(env, that, cairo_1show_1surface_FUNC);
+ cairo_show_surface((cairo_t *)arg0, (cairo_surface_t *)arg1, arg2, arg3);
+ Cairo_NATIVE_EXIT(env, that, cairo_1show_1surface_FUNC);
+}
+#endif
+
+#ifndef NO_cairo_1show_1text
+JNIEXPORT void JNICALL Cairo_NATIVE(cairo_1show_1text)
+ (JNIEnv *env, jclass that, jint arg0, jbyteArray arg1)
+{
+ jbyte *lparg1=NULL;
+ Cairo_NATIVE_ENTER(env, that, cairo_1show_1text_FUNC);
+ if (arg1) if ((lparg1 = (*env)->GetByteArrayElements(env, arg1, NULL)) == NULL) goto fail;
+ cairo_show_text((cairo_t *)arg0, lparg1);
+fail:
+ if (arg1 && lparg1) (*env)->ReleaseByteArrayElements(env, arg1, lparg1, 0);
+ Cairo_NATIVE_EXIT(env, that, cairo_1show_1text_FUNC);
+}
+#endif
+
+#ifndef NO_cairo_1status
+JNIEXPORT jint JNICALL Cairo_NATIVE(cairo_1status)
+ (JNIEnv *env, jclass that, jint arg0)
+{
+ jint rc = 0;
+ Cairo_NATIVE_ENTER(env, that, cairo_1status_FUNC);
+ rc = (jint)cairo_status((cairo_t *)arg0);
+ Cairo_NATIVE_EXIT(env, that, cairo_1status_FUNC);
+ return rc;
+}
+#endif
+
+#ifndef NO_cairo_1status_1string
+JNIEXPORT jint JNICALL Cairo_NATIVE(cairo_1status_1string)
+ (JNIEnv *env, jclass that, jint arg0)
+{
+ jint rc = 0;
+ Cairo_NATIVE_ENTER(env, that, cairo_1status_1string_FUNC);
+ rc = (jint)cairo_status_string((cairo_t *)arg0);
+ Cairo_NATIVE_EXIT(env, that, cairo_1status_1string_FUNC);
+ return rc;
+}
+#endif
+
+#ifndef NO_cairo_1stroke
+JNIEXPORT void JNICALL Cairo_NATIVE(cairo_1stroke)
+ (JNIEnv *env, jclass that, jint arg0)
+{
+ Cairo_NATIVE_ENTER(env, that, cairo_1stroke_FUNC);
+ cairo_stroke((cairo_t *)arg0);
+ Cairo_NATIVE_EXIT(env, that, cairo_1stroke_FUNC);
+}
+#endif
+
+#ifndef NO_cairo_1stroke_1extents
+JNIEXPORT void JNICALL Cairo_NATIVE(cairo_1stroke_1extents)
+ (JNIEnv *env, jclass that, jint arg0, jdoubleArray arg1, jdoubleArray arg2, jdoubleArray arg3, jdoubleArray arg4)
+{
+ jdouble *lparg1=NULL;
+ jdouble *lparg2=NULL;
+ jdouble *lparg3=NULL;
+ jdouble *lparg4=NULL;
+ Cairo_NATIVE_ENTER(env, that, cairo_1stroke_1extents_FUNC);
+ if (arg1) if ((lparg1 = (*env)->GetDoubleArrayElements(env, arg1, NULL)) == NULL) goto fail;
+ if (arg2) if ((lparg2 = (*env)->GetDoubleArrayElements(env, arg2, NULL)) == NULL) goto fail;
+ if (arg3) if ((lparg3 = (*env)->GetDoubleArrayElements(env, arg3, NULL)) == NULL) goto fail;
+ if (arg4) if ((lparg4 = (*env)->GetDoubleArrayElements(env, arg4, NULL)) == NULL) goto fail;
+ cairo_stroke_extents((cairo_t *)arg0, lparg1, lparg2, lparg3, lparg4);
+fail:
+ if (arg4 && lparg4) (*env)->ReleaseDoubleArrayElements(env, arg4, lparg4, 0);
+ if (arg3 && lparg3) (*env)->ReleaseDoubleArrayElements(env, arg3, lparg3, 0);
+ if (arg2 && lparg2) (*env)->ReleaseDoubleArrayElements(env, arg2, lparg2, 0);
+ if (arg1 && lparg1) (*env)->ReleaseDoubleArrayElements(env, arg1, lparg1, 0);
+ Cairo_NATIVE_EXIT(env, that, cairo_1stroke_1extents_FUNC);
+}
+#endif
+
+#ifndef NO_cairo_1surface_1create_1for_1image
+JNIEXPORT jint JNICALL Cairo_NATIVE(cairo_1surface_1create_1for_1image)
+ (JNIEnv *env, jclass that, jint arg0, jint arg1, jint arg2, jint arg3, jint arg4)
+{
+ jint rc = 0;
+ Cairo_NATIVE_ENTER(env, that, cairo_1surface_1create_1for_1image_FUNC);
+ rc = (jint)cairo_surface_create_for_image((char *)arg0, arg1, arg2, arg3, arg4);
+ Cairo_NATIVE_EXIT(env, that, cairo_1surface_1create_1for_1image_FUNC);
+ return rc;
+}
+#endif
+
+#ifndef NO_cairo_1surface_1create_1similar
+JNIEXPORT jint JNICALL Cairo_NATIVE(cairo_1surface_1create_1similar)
+ (JNIEnv *env, jclass that, jint arg0, jint arg1, jint arg2, jint arg3)
+{
+ jint rc = 0;
+ Cairo_NATIVE_ENTER(env, that, cairo_1surface_1create_1similar_FUNC);
+ rc = (jint)cairo_surface_create_similar((cairo_surface_t *)arg0, arg1, arg2, arg3);
+ Cairo_NATIVE_EXIT(env, that, cairo_1surface_1create_1similar_FUNC);
+ return rc;
+}
+#endif
+
+#ifndef NO_cairo_1surface_1destroy
+JNIEXPORT void JNICALL Cairo_NATIVE(cairo_1surface_1destroy)
+ (JNIEnv *env, jclass that, jint arg0)
+{
+ Cairo_NATIVE_ENTER(env, that, cairo_1surface_1destroy_FUNC);
+ cairo_surface_destroy((cairo_surface_t *)arg0);
+ Cairo_NATIVE_EXIT(env, that, cairo_1surface_1destroy_FUNC);
+}
+#endif
+
+#ifndef NO_cairo_1surface_1get_1filter
+JNIEXPORT jint JNICALL Cairo_NATIVE(cairo_1surface_1get_1filter)
+ (JNIEnv *env, jclass that, jint arg0)
+{
+ jint rc = 0;
+ Cairo_NATIVE_ENTER(env, that, cairo_1surface_1get_1filter_FUNC);
+ rc = (jint)cairo_surface_get_filter((cairo_surface_t *)arg0);
+ Cairo_NATIVE_EXIT(env, that, cairo_1surface_1get_1filter_FUNC);
+ return rc;
+}
+#endif
+
+#ifndef NO_cairo_1surface_1get_1matrix
+JNIEXPORT jint JNICALL Cairo_NATIVE(cairo_1surface_1get_1matrix)
+ (JNIEnv *env, jclass that, jint arg0, jint arg1)
+{
+ jint rc = 0;
+ Cairo_NATIVE_ENTER(env, that, cairo_1surface_1get_1matrix_FUNC);
+ rc = (jint)cairo_surface_get_matrix((cairo_surface_t *)arg0, (cairo_matrix_t *)arg1);
+ Cairo_NATIVE_EXIT(env, that, cairo_1surface_1get_1matrix_FUNC);
+ return rc;
+}
+#endif
+
+#ifndef NO_cairo_1surface_1reference
+JNIEXPORT void JNICALL Cairo_NATIVE(cairo_1surface_1reference)
+ (JNIEnv *env, jclass that, jint arg0)
+{
+ Cairo_NATIVE_ENTER(env, that, cairo_1surface_1reference_FUNC);
+ cairo_surface_reference((cairo_surface_t *)arg0);
+ Cairo_NATIVE_EXIT(env, that, cairo_1surface_1reference_FUNC);
+}
+#endif
+
+#ifndef NO_cairo_1surface_1set_1filter
+JNIEXPORT jint JNICALL Cairo_NATIVE(cairo_1surface_1set_1filter)
+ (JNIEnv *env, jclass that, jint arg0, jint arg1)
+{
+ jint rc = 0;
+ Cairo_NATIVE_ENTER(env, that, cairo_1surface_1set_1filter_FUNC);
+ rc = (jint)cairo_surface_set_filter((cairo_surface_t *)arg0, arg1);
+ Cairo_NATIVE_EXIT(env, that, cairo_1surface_1set_1filter_FUNC);
+ return rc;
+}
+#endif
+
+#ifndef NO_cairo_1surface_1set_1matrix
+JNIEXPORT jint JNICALL Cairo_NATIVE(cairo_1surface_1set_1matrix)
+ (JNIEnv *env, jclass that, jint arg0, jint arg1)
+{
+ jint rc = 0;
+ Cairo_NATIVE_ENTER(env, that, cairo_1surface_1set_1matrix_FUNC);
+ rc = (jint)cairo_surface_set_matrix((cairo_surface_t *)arg0, (cairo_matrix_t *)arg1);
+ Cairo_NATIVE_EXIT(env, that, cairo_1surface_1set_1matrix_FUNC);
+ return rc;
+}
+#endif
+
+#ifndef NO_cairo_1surface_1set_1repeat
+JNIEXPORT jint JNICALL Cairo_NATIVE(cairo_1surface_1set_1repeat)
+ (JNIEnv *env, jclass that, jint arg0, jint arg1)
+{
+ jint rc = 0;
+ Cairo_NATIVE_ENTER(env, that, cairo_1surface_1set_1repeat_FUNC);
+ rc = (jint)cairo_surface_set_repeat((cairo_surface_t *)arg0, arg1);
+ Cairo_NATIVE_EXIT(env, that, cairo_1surface_1set_1repeat_FUNC);
+ return rc;
+}
+#endif
+
+#ifndef NO_cairo_1text_1extents
+JNIEXPORT void JNICALL Cairo_NATIVE(cairo_1text_1extents)
+ (JNIEnv *env, jclass that, jint arg0, jbyteArray arg1, jint arg2)
+{
+ jbyte *lparg1=NULL;
+ Cairo_NATIVE_ENTER(env, that, cairo_1text_1extents_FUNC);
+ if (arg1) if ((lparg1 = (*env)->GetByteArrayElements(env, arg1, NULL)) == NULL) goto fail;
+ cairo_text_extents((cairo_t *)arg0, lparg1, (cairo_text_extents_t *)arg2);
+fail:
+ if (arg1 && lparg1) (*env)->ReleaseByteArrayElements(env, arg1, lparg1, 0);
+ Cairo_NATIVE_EXIT(env, that, cairo_1text_1extents_FUNC);
+}
+#endif
+
+#ifndef NO_cairo_1text_1path
+JNIEXPORT void JNICALL Cairo_NATIVE(cairo_1text_1path)
+ (JNIEnv *env, jclass that, jint arg0, jbyteArray arg1)
+{
+ jbyte *lparg1=NULL;
+ Cairo_NATIVE_ENTER(env, that, cairo_1text_1path_FUNC);
+ if (arg1) if ((lparg1 = (*env)->GetByteArrayElements(env, arg1, NULL)) == NULL) goto fail;
+ cairo_text_path((cairo_t *)arg0, lparg1);
+fail:
+ if (arg1 && lparg1) (*env)->ReleaseByteArrayElements(env, arg1, lparg1, 0);
+ Cairo_NATIVE_EXIT(env, that, cairo_1text_1path_FUNC);
+}
+#endif
+
+#ifndef NO_cairo_1transform_1distance
+JNIEXPORT void JNICALL Cairo_NATIVE(cairo_1transform_1distance)
+ (JNIEnv *env, jclass that, jint arg0, jdoubleArray arg1, jdoubleArray arg2)
+{
+ jdouble *lparg1=NULL;
+ jdouble *lparg2=NULL;
+ Cairo_NATIVE_ENTER(env, that, cairo_1transform_1distance_FUNC);
+ if (arg1) if ((lparg1 = (*env)->GetDoubleArrayElements(env, arg1, NULL)) == NULL) goto fail;
+ if (arg2) if ((lparg2 = (*env)->GetDoubleArrayElements(env, arg2, NULL)) == NULL) goto fail;
+ cairo_transform_distance((cairo_t *)arg0, lparg1, lparg2);
+fail:
+ if (arg2 && lparg2) (*env)->ReleaseDoubleArrayElements(env, arg2, lparg2, 0);
+ if (arg1 && lparg1) (*env)->ReleaseDoubleArrayElements(env, arg1, lparg1, 0);
+ Cairo_NATIVE_EXIT(env, that, cairo_1transform_1distance_FUNC);
+}
+#endif
+
+#ifndef NO_cairo_1transform_1font
+JNIEXPORT void JNICALL Cairo_NATIVE(cairo_1transform_1font)
+ (JNIEnv *env, jclass that, jint arg0, jint arg1)
+{
+ Cairo_NATIVE_ENTER(env, that, cairo_1transform_1font_FUNC);
+ cairo_transform_font((cairo_t *)arg0, (cairo_matrix_t *)arg1);
+ Cairo_NATIVE_EXIT(env, that, cairo_1transform_1font_FUNC);
+}
+#endif
+
+#ifndef NO_cairo_1transform_1point
+JNIEXPORT void JNICALL Cairo_NATIVE(cairo_1transform_1point)
+ (JNIEnv *env, jclass that, jint arg0, jdoubleArray arg1, jdoubleArray arg2)
+{
+ jdouble *lparg1=NULL;
+ jdouble *lparg2=NULL;
+ Cairo_NATIVE_ENTER(env, that, cairo_1transform_1point_FUNC);
+ if (arg1) if ((lparg1 = (*env)->GetDoubleArrayElements(env, arg1, NULL)) == NULL) goto fail;
+ if (arg2) if ((lparg2 = (*env)->GetDoubleArrayElements(env, arg2, NULL)) == NULL) goto fail;
+ cairo_transform_point((cairo_t *)arg0, lparg1, lparg2);
+fail:
+ if (arg2 && lparg2) (*env)->ReleaseDoubleArrayElements(env, arg2, lparg2, 0);
+ if (arg1 && lparg1) (*env)->ReleaseDoubleArrayElements(env, arg1, lparg1, 0);
+ Cairo_NATIVE_EXIT(env, that, cairo_1transform_1point_FUNC);
+}
+#endif
+
+#ifndef NO_cairo_1translate
+JNIEXPORT void JNICALL Cairo_NATIVE(cairo_1translate)
+ (JNIEnv *env, jclass that, jint arg0, jdouble arg1, jdouble arg2)
+{
+ Cairo_NATIVE_ENTER(env, that, cairo_1translate_FUNC);
+ cairo_translate((cairo_t *)arg0, arg1, arg2);
+ Cairo_NATIVE_EXIT(env, that, cairo_1translate_FUNC);
+}
+#endif
+
+#ifndef NO_cairo_1xlib_1surface_1create
+JNIEXPORT jint JNICALL Cairo_NATIVE(cairo_1xlib_1surface_1create)
+ (JNIEnv *env, jclass that, jint arg0, jint arg1, jint arg2, jint arg3, jint arg4)
+{
+ jint rc = 0;
+ Cairo_NATIVE_ENTER(env, that, cairo_1xlib_1surface_1create_FUNC);
+ rc = (jint)cairo_xlib_surface_create((Display *)arg0, (Drawable)arg1, (Visual *)arg2, arg3, (Colormap)arg4);
+ Cairo_NATIVE_EXIT(env, that, cairo_1xlib_1surface_1create_FUNC);
+ return rc;
+}
+#endif
+
diff --git a/bundles/org.eclipse.swt/Eclipse SWT PI/cairo/library/cairo.h b/bundles/org.eclipse.swt/Eclipse SWT PI/cairo/library/cairo.h
new file mode 100644
index 0000000000..147ec7a9c3
--- /dev/null
+++ b/bundles/org.eclipse.swt/Eclipse SWT PI/cairo/library/cairo.h
@@ -0,0 +1,21 @@
+/*******************************************************************************
+ * Copyright (c) 2000, 2004 IBM Corporation and others. 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.
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+
+#ifndef INC_cairo_H
+#define INC_cairo_H
+
+#include <cairo.h>
+
+#endif /* INC_cairo_H */
diff --git a/bundles/org.eclipse.swt/Eclipse SWT PI/cairo/library/cairo_custom.c b/bundles/org.eclipse.swt/Eclipse SWT PI/cairo/library/cairo_custom.c
new file mode 100644
index 0000000000..13c38122f0
--- /dev/null
+++ b/bundles/org.eclipse.swt/Eclipse SWT PI/cairo/library/cairo_custom.c
@@ -0,0 +1,43 @@
+/*******************************************************************************
+* Copyright (c) 2000, 2004 IBM Corporation and others.
+* All rights reserved. This program and the accompanying materials
+* are made available under the terms of the Common Public License v1.0
+* which accompanies this distribution, and is available at
+* http://www.eclipse.org/legal/cpl-v10.html
+*
+* Contributors:
+* IBM Corporation - initial API and implementation
+*******************************************************************************/
+
+#include "swt.h"
+#include "cairo_structs.h"
+#include "cairo_stats.h"
+
+#define Cairo_NATIVE(func) Java_org_eclipse_swt_internal_cairo_Cairo_##func
+
+#ifndef NO_cairo_1add_1path
+void moveTo(cairo_t *cairo, double x, double y) {
+ cairo_move_to(cairo, x, y);
+}
+
+void lineTo(cairo_t *cairo, double x, double y) {
+ cairo_line_to(cairo, x, y);
+}
+
+void curveTo(cairo_t *cairo, double x1, double y1, double x2, double y2, double x3, double y3) {
+ cairo_curve_to(cairo, x1, y1, x2, y2, x3, y3);
+}
+
+void closePath(cairo_t *cairo) {
+ cairo_close_path(cairo);
+}
+
+JNIEXPORT void JNICALL Cairo_NATIVE(cairo_1add_1path)
+ (JNIEnv *env, jclass that, SWT_PTR arg0, SWT_PTR arg1)
+{
+ Cairo_NATIVE_ENTER(env, that, cairo_1add_1path_FUNC);
+ cairo_new_path((cairo_t *)arg0);
+ cairo_current_path((cairo_t *)arg1, (cairo_move_to_func_t *)moveTo, (cairo_line_to_func_t *)lineTo, (cairo_curve_to_func_t *)curveTo, (cairo_close_path_func_t *)closePath, (void *)arg0);
+ Cairo_NATIVE_EXIT(env, that, cairo_1add_1path_FUNC);
+}
+#endif
diff --git a/bundles/org.eclipse.swt/Eclipse SWT PI/cairo/library/cairo_stats.c b/bundles/org.eclipse.swt/Eclipse SWT PI/cairo/library/cairo_stats.c
new file mode 100644
index 0000000000..ed3547e25e
--- /dev/null
+++ b/bundles/org.eclipse.swt/Eclipse SWT PI/cairo/library/cairo_stats.c
@@ -0,0 +1,167 @@
+/*******************************************************************************
+* Copyright (c) 2000, 2004 IBM Corporation and others.
+* All rights reserved. This program and the accompanying materials
+* are made available under the terms of the Common Public License v1.0
+* which accompanies this distribution, and is available at
+* http://www.eclipse.org/legal/cpl-v10.html
+*
+* Contributors:
+* IBM Corporation - initial API and implementation
+*******************************************************************************/
+
+#include "swt.h"
+#include "cairo_stats.h"
+
+#ifdef NATIVE_STATS
+
+int Cairo_nativeFunctionCount = 125;
+int Cairo_nativeFunctionCallCount[125];
+char * Cairo_nativeFunctionNames[] = {
+ "cairo_1add_1path",
+ "cairo_1arc",
+ "cairo_1arc_1negative",
+ "cairo_1clip",
+ "cairo_1close_1path",
+ "cairo_1concat_1matrix",
+ "cairo_1copy",
+ "cairo_1copy_1page",
+ "cairo_1create",
+ "cairo_1current_1alpha",
+ "cairo_1current_1fill_1rule",
+ "cairo_1current_1font",
+ "cairo_1current_1font_1extents",
+ "cairo_1current_1line_1cap",
+ "cairo_1current_1line_1join",
+ "cairo_1current_1line_1width",
+ "cairo_1current_1matrix",
+ "cairo_1current_1miter_1limit",
+ "cairo_1current_1operator",
+ "cairo_1current_1path",
+ "cairo_1current_1path_1flat",
+ "cairo_1current_1pattern",
+ "cairo_1current_1point",
+ "cairo_1current_1rgb_1color",
+ "cairo_1current_1target_1surface",
+ "cairo_1current_1tolerance",
+ "cairo_1curve_1to",
+ "cairo_1default_1matrix",
+ "cairo_1destroy",
+ "cairo_1fill",
+ "cairo_1fill_1extents",
+ "cairo_1font_1current_1transform",
+ "cairo_1font_1destroy",
+ "cairo_1font_1extents_1t_1sizeof",
+ "cairo_1font_1reference",
+ "cairo_1font_1set_1transform",
+ "cairo_1glyph_1extents",
+ "cairo_1glyph_1path",
+ "cairo_1identity_1matrix",
+ "cairo_1image_1surface_1create",
+ "cairo_1image_1surface_1create_1for_1data",
+ "cairo_1in_1fill",
+ "cairo_1in_1stroke",
+ "cairo_1init_1clip",
+ "cairo_1inverse_1transform_1distance",
+ "cairo_1inverse_1transform_1point",
+ "cairo_1line_1to",
+ "cairo_1matrix_1copy",
+ "cairo_1matrix_1create",
+ "cairo_1matrix_1destroy",
+ "cairo_1matrix_1get_1affine",
+ "cairo_1matrix_1invert",
+ "cairo_1matrix_1multiply",
+ "cairo_1matrix_1rotate",
+ "cairo_1matrix_1scale",
+ "cairo_1matrix_1set_1affine",
+ "cairo_1matrix_1set_1identity",
+ "cairo_1matrix_1transform_1distance",
+ "cairo_1matrix_1transform_1point",
+ "cairo_1matrix_1translate",
+ "cairo_1move_1to",
+ "cairo_1new_1path",
+ "cairo_1pattern_1add_1color_1stop",
+ "cairo_1pattern_1create_1for_1surface",
+ "cairo_1pattern_1create_1linear",
+ "cairo_1pattern_1create_1radial",
+ "cairo_1pattern_1destroy",
+ "cairo_1pattern_1get_1extend",
+ "cairo_1pattern_1get_1filter",
+ "cairo_1pattern_1get_1matrix",
+ "cairo_1pattern_1reference",
+ "cairo_1pattern_1set_1extend",
+ "cairo_1pattern_1set_1filter",
+ "cairo_1pattern_1set_1matrix",
+ "cairo_1rectangle",
+ "cairo_1reference",
+ "cairo_1rel_1curve_1to",
+ "cairo_1rel_1line_1to",
+ "cairo_1rel_1move_1to",
+ "cairo_1restore",
+ "cairo_1rotate",
+ "cairo_1save",
+ "cairo_1scale",
+ "cairo_1scale_1font",
+ "cairo_1select_1font",
+ "cairo_1set_1alpha",
+ "cairo_1set_1dash",
+ "cairo_1set_1fill_1rule",
+ "cairo_1set_1font",
+ "cairo_1set_1line_1cap",
+ "cairo_1set_1line_1join",
+ "cairo_1set_1line_1width",
+ "cairo_1set_1matrix",
+ "cairo_1set_1miter_1limit",
+ "cairo_1set_1operator",
+ "cairo_1set_1pattern",
+ "cairo_1set_1rgb_1color",
+ "cairo_1set_1target_1drawable",
+ "cairo_1set_1target_1image",
+ "cairo_1set_1target_1surface",
+ "cairo_1set_1tolerance",
+ "cairo_1show_1glyphs",
+ "cairo_1show_1page",
+ "cairo_1show_1surface",
+ "cairo_1show_1text",
+ "cairo_1status",
+ "cairo_1status_1string",
+ "cairo_1stroke",
+ "cairo_1stroke_1extents",
+ "cairo_1surface_1create_1for_1image",
+ "cairo_1surface_1create_1similar",
+ "cairo_1surface_1destroy",
+ "cairo_1surface_1get_1filter",
+ "cairo_1surface_1get_1matrix",
+ "cairo_1surface_1reference",
+ "cairo_1surface_1set_1filter",
+ "cairo_1surface_1set_1matrix",
+ "cairo_1surface_1set_1repeat",
+ "cairo_1text_1extents",
+ "cairo_1text_1path",
+ "cairo_1transform_1distance",
+ "cairo_1transform_1font",
+ "cairo_1transform_1point",
+ "cairo_1translate",
+ "cairo_1xlib_1surface_1create",
+};
+
+#define STATS_NATIVE(func) Java_org_eclipse_swt_tools_internal_NativeStats_##func
+
+JNIEXPORT jint JNICALL STATS_NATIVE(Cairo_1GetFunctionCount)
+ (JNIEnv *env, jclass that)
+{
+ return Cairo_nativeFunctionCount;
+}
+
+JNIEXPORT jstring JNICALL STATS_NATIVE(Cairo_1GetFunctionName)
+ (JNIEnv *env, jclass that, jint index)
+{
+ return (*env)->NewStringUTF(env, Cairo_nativeFunctionNames[index]);
+}
+
+JNIEXPORT jint JNICALL STATS_NATIVE(Cairo_1GetFunctionCallCount)
+ (JNIEnv *env, jclass that, jint index)
+{
+ return Cairo_nativeFunctionCallCount[index];
+}
+
+#endif
diff --git a/bundles/org.eclipse.swt/Eclipse SWT PI/cairo/library/cairo_stats.h b/bundles/org.eclipse.swt/Eclipse SWT PI/cairo/library/cairo_stats.h
new file mode 100644
index 0000000000..9085d01a0d
--- /dev/null
+++ b/bundles/org.eclipse.swt/Eclipse SWT PI/cairo/library/cairo_stats.h
@@ -0,0 +1,149 @@
+/*******************************************************************************
+* Copyright (c) 2000, 2004 IBM Corporation and others.
+* All rights reserved. This program and the accompanying materials
+* are made available under the terms of the Common Public License v1.0
+* which accompanies this distribution, and is available at
+* http://www.eclipse.org/legal/cpl-v10.html
+*
+* Contributors:
+* IBM Corporation - initial API and implementation
+*******************************************************************************/
+
+#ifdef NATIVE_STATS
+extern int Cairo_nativeFunctionCount;
+extern int Cairo_nativeFunctionCallCount[];
+extern char* Cairo_nativeFunctionNames[];
+#define Cairo_NATIVE_ENTER(env, that, func) Cairo_nativeFunctionCallCount[func]++;
+#define Cairo_NATIVE_EXIT(env, that, func)
+#else
+#define Cairo_NATIVE_ENTER(env, that, func)
+#define Cairo_NATIVE_EXIT(env, that, func)
+#endif
+
+typedef enum {
+ cairo_1add_1path_FUNC,
+ cairo_1arc_FUNC,
+ cairo_1arc_1negative_FUNC,
+ cairo_1clip_FUNC,
+ cairo_1close_1path_FUNC,
+ cairo_1concat_1matrix_FUNC,
+ cairo_1copy_FUNC,
+ cairo_1copy_1page_FUNC,
+ cairo_1create_FUNC,
+ cairo_1current_1alpha_FUNC,
+ cairo_1current_1fill_1rule_FUNC,
+ cairo_1current_1font_FUNC,
+ cairo_1current_1font_1extents_FUNC,
+ cairo_1current_1line_1cap_FUNC,
+ cairo_1current_1line_1join_FUNC,
+ cairo_1current_1line_1width_FUNC,
+ cairo_1current_1matrix_FUNC,
+ cairo_1current_1miter_1limit_FUNC,
+ cairo_1current_1operator_FUNC,
+ cairo_1current_1path_FUNC,
+ cairo_1current_1path_1flat_FUNC,
+ cairo_1current_1pattern_FUNC,
+ cairo_1current_1point_FUNC,
+ cairo_1current_1rgb_1color_FUNC,
+ cairo_1current_1target_1surface_FUNC,
+ cairo_1current_1tolerance_FUNC,
+ cairo_1curve_1to_FUNC,
+ cairo_1default_1matrix_FUNC,
+ cairo_1destroy_FUNC,
+ cairo_1fill_FUNC,
+ cairo_1fill_1extents_FUNC,
+ cairo_1font_1current_1transform_FUNC,
+ cairo_1font_1destroy_FUNC,
+ cairo_1font_1extents_1t_1sizeof_FUNC,
+ cairo_1font_1reference_FUNC,
+ cairo_1font_1set_1transform_FUNC,
+ cairo_1glyph_1extents_FUNC,
+ cairo_1glyph_1path_FUNC,
+ cairo_1identity_1matrix_FUNC,
+ cairo_1image_1surface_1create_FUNC,
+ cairo_1image_1surface_1create_1for_1data_FUNC,
+ cairo_1in_1fill_FUNC,
+ cairo_1in_1stroke_FUNC,
+ cairo_1init_1clip_FUNC,
+ cairo_1inverse_1transform_1distance_FUNC,
+ cairo_1inverse_1transform_1point_FUNC,
+ cairo_1line_1to_FUNC,
+ cairo_1matrix_1copy_FUNC,
+ cairo_1matrix_1create_FUNC,
+ cairo_1matrix_1destroy_FUNC,
+ cairo_1matrix_1get_1affine_FUNC,
+ cairo_1matrix_1invert_FUNC,
+ cairo_1matrix_1multiply_FUNC,
+ cairo_1matrix_1rotate_FUNC,
+ cairo_1matrix_1scale_FUNC,
+ cairo_1matrix_1set_1affine_FUNC,
+ cairo_1matrix_1set_1identity_FUNC,
+ cairo_1matrix_1transform_1distance_FUNC,
+ cairo_1matrix_1transform_1point_FUNC,
+ cairo_1matrix_1translate_FUNC,
+ cairo_1move_1to_FUNC,
+ cairo_1new_1path_FUNC,
+ cairo_1pattern_1add_1color_1stop_FUNC,
+ cairo_1pattern_1create_1for_1surface_FUNC,
+ cairo_1pattern_1create_1linear_FUNC,
+ cairo_1pattern_1create_1radial_FUNC,
+ cairo_1pattern_1destroy_FUNC,
+ cairo_1pattern_1get_1extend_FUNC,
+ cairo_1pattern_1get_1filter_FUNC,
+ cairo_1pattern_1get_1matrix_FUNC,
+ cairo_1pattern_1reference_FUNC,
+ cairo_1pattern_1set_1extend_FUNC,
+ cairo_1pattern_1set_1filter_FUNC,
+ cairo_1pattern_1set_1matrix_FUNC,
+ cairo_1rectangle_FUNC,
+ cairo_1reference_FUNC,
+ cairo_1rel_1curve_1to_FUNC,
+ cairo_1rel_1line_1to_FUNC,
+ cairo_1rel_1move_1to_FUNC,
+ cairo_1restore_FUNC,
+ cairo_1rotate_FUNC,
+ cairo_1save_FUNC,
+ cairo_1scale_FUNC,
+ cairo_1scale_1font_FUNC,
+ cairo_1select_1font_FUNC,
+ cairo_1set_1alpha_FUNC,
+ cairo_1set_1dash_FUNC,
+ cairo_1set_1fill_1rule_FUNC,
+ cairo_1set_1font_FUNC,
+ cairo_1set_1line_1cap_FUNC,
+ cairo_1set_1line_1join_FUNC,
+ cairo_1set_1line_1width_FUNC,
+ cairo_1set_1matrix_FUNC,
+ cairo_1set_1miter_1limit_FUNC,
+ cairo_1set_1operator_FUNC,
+ cairo_1set_1pattern_FUNC,
+ cairo_1set_1rgb_1color_FUNC,
+ cairo_1set_1target_1drawable_FUNC,
+ cairo_1set_1target_1image_FUNC,
+ cairo_1set_1target_1surface_FUNC,
+ cairo_1set_1tolerance_FUNC,
+ cairo_1show_1glyphs_FUNC,
+ cairo_1show_1page_FUNC,
+ cairo_1show_1surface_FUNC,
+ cairo_1show_1text_FUNC,
+ cairo_1status_FUNC,
+ cairo_1status_1string_FUNC,
+ cairo_1stroke_FUNC,
+ cairo_1stroke_1extents_FUNC,
+ cairo_1surface_1create_1for_1image_FUNC,
+ cairo_1surface_1create_1similar_FUNC,
+ cairo_1surface_1destroy_FUNC,
+ cairo_1surface_1get_1filter_FUNC,
+ cairo_1surface_1get_1matrix_FUNC,
+ cairo_1surface_1reference_FUNC,
+ cairo_1surface_1set_1filter_FUNC,
+ cairo_1surface_1set_1matrix_FUNC,
+ cairo_1surface_1set_1repeat_FUNC,
+ cairo_1text_1extents_FUNC,
+ cairo_1text_1path_FUNC,
+ cairo_1transform_1distance_FUNC,
+ cairo_1transform_1font_FUNC,
+ cairo_1transform_1point_FUNC,
+ cairo_1translate_FUNC,
+ cairo_1xlib_1surface_1create_FUNC,
+} Cairo_FUNCS;
diff --git a/bundles/org.eclipse.swt/Eclipse SWT PI/cairo/library/cairo_structs.c b/bundles/org.eclipse.swt/Eclipse SWT PI/cairo/library/cairo_structs.c
new file mode 100644
index 0000000000..19e1c70065
--- /dev/null
+++ b/bundles/org.eclipse.swt/Eclipse SWT PI/cairo/library/cairo_structs.c
@@ -0,0 +1,57 @@
+/*******************************************************************************
+* Copyright (c) 2000, 2004 IBM Corporation and others.
+* All rights reserved. This program and the accompanying materials
+* are made available under the terms of the Common Public License v1.0
+* which accompanies this distribution, and is available at
+* http://www.eclipse.org/legal/cpl-v10.html
+*
+* Contributors:
+* IBM Corporation - initial API and implementation
+*******************************************************************************/
+
+#include "swt.h"
+#include "cairo_structs.h"
+
+#ifndef NO_cairo_font_extents_t
+typedef struct cairo_font_extents_t_FID_CACHE {
+ int cached;
+ jclass clazz;
+ jfieldID ascent, descent, height, max_x_advance, max_y_advance;
+} cairo_font_extents_t_FID_CACHE;
+
+cairo_font_extents_t_FID_CACHE cairo_font_extents_tFc;
+
+void cachecairo_font_extents_tFields(JNIEnv *env, jobject lpObject)
+{
+ if (cairo_font_extents_tFc.cached) return;
+ cairo_font_extents_tFc.clazz = (*env)->GetObjectClass(env, lpObject);
+ cairo_font_extents_tFc.ascent = (*env)->GetFieldID(env, cairo_font_extents_tFc.clazz, "ascent", "F");
+ cairo_font_extents_tFc.descent = (*env)->GetFieldID(env, cairo_font_extents_tFc.clazz, "descent", "F");
+ cairo_font_extents_tFc.height = (*env)->GetFieldID(env, cairo_font_extents_tFc.clazz, "height", "F");
+ cairo_font_extents_tFc.max_x_advance = (*env)->GetFieldID(env, cairo_font_extents_tFc.clazz, "max_x_advance", "F");
+ cairo_font_extents_tFc.max_y_advance = (*env)->GetFieldID(env, cairo_font_extents_tFc.clazz, "max_y_advance", "F");
+ cairo_font_extents_tFc.cached = 1;
+}
+
+cairo_font_extents_t *getcairo_font_extents_tFields(JNIEnv *env, jobject lpObject, cairo_font_extents_t *lpStruct)
+{
+ if (!cairo_font_extents_tFc.cached) cachecairo_font_extents_tFields(env, lpObject);
+ lpStruct->ascent = (*env)->GetFloatField(env, lpObject, cairo_font_extents_tFc.ascent);
+ lpStruct->descent = (*env)->GetFloatField(env, lpObject, cairo_font_extents_tFc.descent);
+ lpStruct->height = (*env)->GetFloatField(env, lpObject, cairo_font_extents_tFc.height);
+ lpStruct->max_x_advance = (*env)->GetFloatField(env, lpObject, cairo_font_extents_tFc.max_x_advance);
+ lpStruct->max_y_advance = (*env)->GetFloatField(env, lpObject, cairo_font_extents_tFc.max_y_advance);
+ return lpStruct;
+}
+
+void setcairo_font_extents_tFields(JNIEnv *env, jobject lpObject, cairo_font_extents_t *lpStruct)
+{
+ if (!cairo_font_extents_tFc.cached) cachecairo_font_extents_tFields(env, lpObject);
+ (*env)->SetFloatField(env, lpObject, cairo_font_extents_tFc.ascent, (jfloat)lpStruct->ascent);
+ (*env)->SetFloatField(env, lpObject, cairo_font_extents_tFc.descent, (jfloat)lpStruct->descent);
+ (*env)->SetFloatField(env, lpObject, cairo_font_extents_tFc.height, (jfloat)lpStruct->height);
+ (*env)->SetFloatField(env, lpObject, cairo_font_extents_tFc.max_x_advance, (jfloat)lpStruct->max_x_advance);
+ (*env)->SetFloatField(env, lpObject, cairo_font_extents_tFc.max_y_advance, (jfloat)lpStruct->max_y_advance);
+}
+#endif
+
diff --git a/bundles/org.eclipse.swt/Eclipse SWT PI/cairo/library/cairo_structs.h b/bundles/org.eclipse.swt/Eclipse SWT PI/cairo/library/cairo_structs.h
new file mode 100644
index 0000000000..2506387340
--- /dev/null
+++ b/bundles/org.eclipse.swt/Eclipse SWT PI/cairo/library/cairo_structs.h
@@ -0,0 +1,25 @@
+/*******************************************************************************
+* Copyright (c) 2000, 2004 IBM Corporation and others.
+* All rights reserved. This program and the accompanying materials
+* are made available under the terms of the Common Public License v1.0
+* which accompanies this distribution, and is available at
+* http://www.eclipse.org/legal/cpl-v10.html
+*
+* Contributors:
+* IBM Corporation - initial API and implementation
+*******************************************************************************/
+
+#include "cairo.h"
+
+#ifndef NO_cairo_font_extents_t
+void cachecairo_font_extents_tFields(JNIEnv *env, jobject lpObject);
+cairo_font_extents_t *getcairo_font_extents_tFields(JNIEnv *env, jobject lpObject, cairo_font_extents_t *lpStruct);
+void setcairo_font_extents_tFields(JNIEnv *env, jobject lpObject, cairo_font_extents_t *lpStruct);
+#define cairo_font_extents_t_sizeof() sizeof(cairo_font_extents_t)
+#else
+#define cachecairo_font_extents_tFields(a,b)
+#define getcairo_font_extents_tFields(a,b,c) NULL
+#define setcairo_font_extents_tFields(a,b,c)
+#define cairo_font_extents_t_sizeof() 0
+#endif
+
diff --git a/bundles/org.eclipse.swt/Eclipse SWT PI/cairo/org/eclipse/swt/internal/cairo/Cairo.java b/bundles/org.eclipse.swt/Eclipse SWT PI/cairo/org/eclipse/swt/internal/cairo/Cairo.java
new file mode 100644
index 0000000000..018e05203e
--- /dev/null
+++ b/bundles/org.eclipse.swt/Eclipse SWT PI/cairo/org/eclipse/swt/internal/cairo/Cairo.java
@@ -0,0 +1,201 @@
+/*******************************************************************************
+ * Copyright (c) 2000, 2004 IBM Corporation and others. 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.
+ *******************************************************************************/
+package org.eclipse.swt.internal.cairo;
+
+import org.eclipse.swt.internal.Library;
+
+public class Cairo {
+ static {
+ Library.loadLibrary("swt-cairo");
+ }
+
+ /** Constants */
+ public static final int CAIRO_FORMAT_ARGB32 = 0;
+ public static final int CAIRO_FORMAT_RGB24 = 1;
+ public static final int CAIRO_FORMAT_A8 = 2;
+ public static final int CAIRO_FORMAT_A1 = 3;
+ public static final int CAIRO_OPERATOR_CLEAR = 0;
+ public static final int CAIRO_OPERATOR_SRC = 1;
+ public static final int CAIRO_OPERATOR_DST = 2;
+ public static final int CAIRO_OPERATOR_OVER = 3;
+ public static final int CAIRO_OPERATOR_OVER_REVERSE = 4;
+ public static final int CAIRO_OPERATOR_IN = 5;
+ public static final int CAIRO_OPERATOR_IN_REVERSE = 6;
+ public static final int CAIRO_OPERATOR_OUT = 7;
+ public static final int CAIRO_OPERATOR_OUT_REVERSE = 8;
+ public static final int CAIRO_OPERATOR_ATOP = 9;
+ public static final int CAIRO_OPERATOR_ATOP_REVERSE = 10;
+ public static final int CAIRO_OPERATOR_XOR = 11;
+ public static final int CAIRO_OPERATOR_ADD = 12;
+ public static final int CAIRO_OPERATOR_SATURATE = 13;
+ public static final int CAIRO_FILL_RULE_WINDING = 0;
+ public static final int CAIRO_FILL_RULE_EVEN_ODD = 1;
+ public static final int CAIRO_LINE_CAP_BUTT = 0;
+ public static final int CAIRO_LINE_CAP_ROUND = 1;
+ public static final int CAIRO_LINE_CAP_SQUARE = 2;
+ public static final int CAIRO_LINE_JOIN_MITER = 0;
+ public static final int CAIRO_LINE_JOIN_ROUND = 1;
+ public static final int CAIRO_LINE_JOIN_BEVEL = 2;
+ public static final int CAIRO_FONT_SLANT_NORMAL = 0;
+ public static final int CAIRO_FONT_SLANT_ITALIC = 1;
+ public static final int CAIRO_FONT_SLANT_OBLIQUE = 2;
+ public static final int CAIRO_FONT_WEIGHT_NORMAL = 0;
+ public static final int CAIRO_FONT_WEIGHT_BOLD = 1;
+ public static final int CAIRO_STATUS_SUCCESS = 0;
+ public static final int CAIRO_STATUS_NO_MEMORY = 1;
+ public static final int CAIRO_STATUS_INVALID_RESTORE = 2;
+ public static final int CAIRO_STATUS_INVALID_POP_GROUP = 3;
+ public static final int CAIRO_STATUS_NO_CURRENT_POINT = 4;
+ public static final int CAIRO_STATUS_INVALID_MATRIX = 5;
+ public static final int CAIRO_STATUS_NO_TARGET_SURFACE = 6;
+ public static final int CAIRO_STATUS_NULL_POINTER =7;
+ public static final int CAIRO_FILTER_FAST = 0;
+ public static final int CAIRO_FILTER_GOOD = 1;
+ public static final int CAIRO_FILTER_BEST = 2;
+ public static final int CAIRO_FILTER_NEAREST = 3;
+ public static final int CAIRO_FILTER_BILINEAR = 4;
+ public static final int CAIRO_FILTER_GAUSSIAN = 5;
+ public static final int CAIRO_EXTEND_NONE = 0;
+ public static final int CAIRO_EXTEND_REPEAT = 1;
+ public static final int CAIRO_EXTEND_REFLECT = 2;
+
+/** 64*/
+public static final synchronized native int cairo_font_extents_t_sizeof ();
+
+/** Natives */
+public static final synchronized native void cairo_add_path (int /*long*/ cr1, int /*long*/ cr2);
+public static final synchronized native int /*long*/ cairo_create ();
+public static final synchronized native void cairo_reference (int /*long*/ cr);
+public static final synchronized native void cairo_destroy (int /*long*/ cr);
+public static final synchronized native void cairo_save (int /*long*/ cr);
+public static final synchronized native void cairo_restore (int /*long*/ cr);
+public static final synchronized native void cairo_copy (int /*long*/ dest, int /*long*/ src);
+public static final synchronized native void cairo_set_target_surface (int /*long*/ cr, int /*long*/ surface);
+public static final synchronized native void cairo_set_target_image (int /*long*/ cr, int /*long*/ data, int format, int width, int height, int stride);
+public static final synchronized native void cairo_set_target_drawable (int /*long*/ cr, int /*long*/ dpy, int /*long*/ drawable);
+public static final synchronized native void cairo_set_operator (int /*long*/ cr, int op);
+public static final synchronized native void cairo_set_rgb_color (int /*long*/ cr, double red, double green, double blue);
+public static final synchronized native void cairo_set_pattern (int /*long*/ cr, int /*long*/ pattern);
+public static final synchronized native void cairo_set_alpha (int /*long*/ cr, double alpha);
+public static final synchronized native void cairo_set_tolerance (int /*long*/ cr, double tolerance);
+public static final synchronized native void cairo_set_fill_rule (int /*long*/ cr, int fill_rule);
+public static final synchronized native void cairo_set_line_width (int /*long*/ cr, double width);
+public static final synchronized native void cairo_set_line_cap (int /*long*/ cr, int line_cap);
+public static final synchronized native void cairo_set_line_join (int /*long*/ cr, int line_join);
+public static final synchronized native void cairo_set_dash (int /*long*/ cr, double[] dashes, int ndash, double offset);
+public static final synchronized native void cairo_set_miter_limit (int /*long*/ cr, double limit);
+public static final synchronized native void cairo_translate (int /*long*/ cr, double tx, double ty);
+public static final synchronized native void cairo_scale (int /*long*/ cr, double sx, double sy);
+public static final synchronized native void cairo_rotate (int /*long*/ cr, double angle);
+public static final synchronized native void cairo_concat_matrix (int /*long*/ cr, int /*long*/ matrix);
+public static final synchronized native void cairo_set_matrix (int /*long*/ cr, int /*long*/ matrix);
+public static final synchronized native void cairo_default_matrix (int /*long*/ cr);
+public static final synchronized native void cairo_identity_matrix (int /*long*/ cr);
+public static final synchronized native void cairo_transform_point (int /*long*/ cr, double[] x, double[] y);
+public static final synchronized native void cairo_transform_distance (int /*long*/ cr, double[] dx, double[] dy);
+public static final synchronized native void cairo_inverse_transform_point (int /*long*/ cr, double[] x, double[] y);
+public static final synchronized native void cairo_inverse_transform_distance (int /*long*/ cr, double[] dx, double[] dy);
+public static final synchronized native void cairo_new_path (int /*long*/ cr);
+public static final synchronized native void cairo_move_to (int /*long*/ cr, double x, double y);
+public static final synchronized native void cairo_line_to (int /*long*/ cr, double x, double y);
+public static final synchronized native void cairo_curve_to (int /*long*/ cr, double x1, double y1, double x2, double y2, double x3, double y3);
+public static final synchronized native void cairo_arc (int /*long*/ cr, double xc, double yc, double radius, double angle1, double angle2);
+public static final synchronized native void cairo_arc_negative (int /*long*/ cr, double xc, double yc, double radius, double angle1, double angle2);
+//public static final synchronized native void cairo_arc_to (int /*long*/ cr, double x1, double y1, double x2, double y2, double radius);
+public static final synchronized native void cairo_rel_move_to (int /*long*/ cr, double dx, double dy);
+public static final synchronized native void cairo_rel_line_to (int /*long*/ cr, double dx, double dy);
+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);
+public static final synchronized native void cairo_rectangle (int /*long*/ cr, double x, double y, double width, double height);
+public static final synchronized native void cairo_close_path (int /*long*/ cr);
+public static final synchronized native void cairo_stroke (int /*long*/ cr);
+public static final synchronized native void cairo_fill (int /*long*/ cr);
+public static final synchronized native void cairo_copy_page (int /*long*/ cr);
+public static final synchronized native void cairo_show_page (int /*long*/ cr);
+public static final synchronized native int cairo_in_stroke (int /*long*/ cr, double x, double y);
+public static final synchronized native int cairo_in_fill (int /*long*/ cr, double x, double y);
+public static final synchronized native void cairo_stroke_extents (int /*long*/ cr, double[] x1, double[] y1, double[] x2, double[] y2);
+public static final synchronized native void cairo_fill_extents (int /*long*/ cr, double[] x1, double[] y1, double[] x2, double[] y2);
+public static final synchronized native void cairo_init_clip (int /*long*/ cr);
+public static final synchronized native void cairo_clip (int /*long*/ cr);
+public static final synchronized native void cairo_select_font (int /*long*/ cr, byte[] family, int slant, int weight);
+public static final synchronized native void cairo_scale_font (int /*long*/ cr, double scale);
+public static final synchronized native void cairo_transform_font (int /*long*/ cr, int /*long*/ matrix);
+public static final synchronized native void cairo_show_text (int /*long*/ ct, byte[] utf8);
+public static final synchronized native void cairo_show_glyphs (int /*long*/ ct, int /*long*/ glyphs, int num_glyphs);
+public static final synchronized native int /*long*/ cairo_current_font (int /*long*/ ct);
+public static final synchronized native void cairo_current_font_extents (int /*long*/ ct, cairo_font_extents_t extents);
+public static final synchronized native void cairo_set_font (int /*long*/ ct, int /*long*/ font);
+public static final synchronized native void cairo_text_extents (int /*long*/ ct, byte[] utf8, int /*long*/ extents);
+public static final synchronized native void cairo_glyph_extents (int /*long*/ ct, int /*long*/ glyphs, int num_glyphs, int /*long*/ extents);
+public static final synchronized native void cairo_text_path (int /*long*/ ct, byte[] utf8);
+public static final synchronized native void cairo_glyph_path (int /*long*/ ct, int /*long*/ glyphs, int num_glyphs);
+public static final synchronized native void cairo_font_reference (int /*long*/ font);
+public static final synchronized native void cairo_font_destroy (int /*long*/ font);
+public static final synchronized native void cairo_font_set_transform (int /*long*/ font, int /*long*/ matrix);
+public static final synchronized native void cairo_font_current_transform (int /*long*/ font, int /*long*/ matrix);
+public static final synchronized native void cairo_show_surface (int /*long*/ cr, int /*long*/ surface, int width, int height);
+public static final synchronized native int /*long*/ cairo_current_operator (int /*long*/ cr);
+public static final synchronized native void cairo_current_rgb_color (int /*long*/ cr, double[] red, double[] green, double[] blue);
+public static final synchronized native int /*long*/ cairo_current_pattern (int /*long*/ cr);
+public static final synchronized native double cairo_current_alpha (int /*long*/ cr);
+public static final synchronized native double cairo_current_tolerance (int /*long*/ cr);
+public static final synchronized native void cairo_current_point (int /*long*/ cr, double[] x, double[] y);
+public static final synchronized native int cairo_current_fill_rule (int /*long*/ cr);
+public static final synchronized native double cairo_current_line_width (int /*long*/ cr);
+public static final synchronized native int cairo_current_line_cap (int /*long*/ cr);
+public static final synchronized native int cairo_current_line_join (int /*long*/ cr);
+public static final synchronized native double cairo_current_miter_limit (int /*long*/ cr);
+public static final synchronized native void cairo_current_matrix (int /*long*/ cr, int /*long*/ matrix);
+public static final synchronized native int /*long*/ cairo_current_target_surface (int /*long*/ cr);
+public static final synchronized native void cairo_current_path (int /*long*/ cr, int /*long*/ move_to, int /*long*/ line_to, int /*long*/ curve_to, int /*long*/ close_path,int /*long*/ closure);
+public static final synchronized native void cairo_current_path_flat (int /*long*/ cr, int /*long*/ move_to, int /*long*/ line_to, int /*long*/ close_path, int /*long*/ closure);
+public static final synchronized native int cairo_status (int /*long*/ cr);
+public static final synchronized native int /*long*/ cairo_status_string (int /*long*/ cr);
+public static final synchronized native int /*long*/ cairo_surface_create_for_image (int /*long*/ data, int format, int width, int height, int stride);
+public static final synchronized native int /*long*/ cairo_surface_create_similar (int /*long*/ other, int format, int width, int height);
+public static final synchronized native void cairo_surface_reference (int /*long*/ surface);
+public static final synchronized native void cairo_surface_destroy (int /*long*/ surface);
+public static final synchronized native int cairo_surface_set_repeat (int /*long*/ surface, int repeat);
+public static final synchronized native int cairo_surface_set_matrix (int /*long*/ surface, int /*long*/ matrix);
+public static final synchronized native int cairo_surface_get_matrix (int /*long*/ surface, int /*long*/ matrix);
+public static final synchronized native int cairo_surface_set_filter (int /*long*/ surface, int filter);
+public static final synchronized native int cairo_surface_get_filter (int /*long*/ surface);
+public static final synchronized native int /*long*/ cairo_image_surface_create (int format, int width, int height);
+public static final synchronized native int /*long*/ cairo_image_surface_create_for_data (int /*long*/ data, int format, int width, int height, int stride);
+public static final synchronized native int /*long*/ cairo_pattern_create_for_surface (int /*long*/ surface);
+public static final synchronized native int /*long*/ cairo_pattern_create_linear (double x0, double y0, double x1, double y1);
+public static final synchronized native int /*long*/ cairo_pattern_create_radial (double cx0, double cy0, double radius0, double cx1, double cy1, double radius1);
+public static final synchronized native void cairo_pattern_reference (int /*long*/ pattern);
+public static final synchronized native void cairo_pattern_destroy (int /*long*/ pattern);
+public static final synchronized native int cairo_pattern_add_color_stop (int /*long*/ pattern, double offset, double red, double green, double blue, double alpha);
+public static final synchronized native int cairo_pattern_set_matrix (int /*long*/ pattern, int /*long*/ matrix);
+public static final synchronized native int cairo_pattern_get_matrix (int /*long*/ pattern, int /*long*/ matrix);
+public static final synchronized native int cairo_pattern_set_extend (int /*long*/ pattern, int extend);
+public static final synchronized native int cairo_pattern_get_extend (int /*long*/ pattern);
+public static final synchronized native int cairo_pattern_set_filter (int /*long*/ pattern, int filter);
+public static final synchronized native int cairo_pattern_get_filter (int /*long*/ pattern);
+public static final synchronized native int /*long*/ cairo_xlib_surface_create (int /*long*/ dpy, int /*long*/ drawable, int /*long*/ visual, int format, int /*long*/ colormap);
+public static final synchronized native int /*long*/ cairo_matrix_create ();
+public static final synchronized native void cairo_matrix_destroy (int /*long*/ matrix);
+public static final synchronized native int cairo_matrix_copy (int /*long*/ matrix, int /*long*/ other);
+public static final synchronized native int cairo_matrix_set_identity (int /*long*/ matrix);
+public static final synchronized native int cairo_matrix_set_affine (int /*long*/ cr, double a, double b, double c, double d, double tx, double ty);
+public static final synchronized native int cairo_matrix_get_affine (int /*long*/ matrix, double[] a, double[] b, double[] c, double[] d, double[] tx, double[] ty);
+public static final synchronized native int cairo_matrix_translate (int /*long*/ matrix, double tx, double ty);
+public static final synchronized native int cairo_matrix_scale (int /*long*/ matrix, double sx, double sy);
+public static final synchronized native int cairo_matrix_rotate (int /*long*/ matrix, double radians);
+public static final synchronized native int cairo_matrix_invert (int /*long*/ matrix);
+public static final synchronized native int cairo_matrix_multiply (int /*long*/ result, int /*long*/ a, int /*long*/ b);
+public static final synchronized native int cairo_matrix_transform_distance (int /*long*/ matrix, double[] dx, double[] dy);
+public static final synchronized native int cairo_matrix_transform_point (int /*long*/ matrix, double[] x, double[] y);
+
+}
diff --git a/bundles/org.eclipse.swt/Eclipse SWT PI/cairo/org/eclipse/swt/internal/cairo/cairo_font_extents_t.java b/bundles/org.eclipse.swt/Eclipse SWT PI/cairo/org/eclipse/swt/internal/cairo/cairo_font_extents_t.java
new file mode 100644
index 0000000000..79d955e5aa
--- /dev/null
+++ b/bundles/org.eclipse.swt/Eclipse SWT PI/cairo/org/eclipse/swt/internal/cairo/cairo_font_extents_t.java
@@ -0,0 +1,22 @@
+/*******************************************************************************
+ * Copyright (c) 2000, 2004 IBM Corporation and others. 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.
+ *******************************************************************************/
+package org.eclipse.swt.internal.cairo;
+
+
+public class cairo_font_extents_t {
+ public float ascent;
+ public float descent;
+ public float height;
+ public float max_x_advance;
+ public float max_y_advance;
+ public static final int sizeof = Cairo.cairo_font_extents_t_sizeof();
+}
diff --git a/bundles/org.eclipse.swt/Eclipse SWT PI/gtk/library/make_linux.mak b/bundles/org.eclipse.swt/Eclipse SWT PI/gtk/library/make_linux.mak
index fa73e369b6..24fcd3c3aa 100644
--- a/bundles/org.eclipse.swt/Eclipse SWT PI/gtk/library/make_linux.mak
+++ b/bundles/org.eclipse.swt/Eclipse SWT PI/gtk/library/make_linux.mak
@@ -20,6 +20,7 @@ WS_PREFIX = gtk
SWT_PREFIX = swt
AWT_PREFIX = swt-awt
SWTPI_PREFIX = swt-pi
+CAIRO_PREFIX = swt-cairo
ATK_PREFIX = swt-atk
KDE_PREFIX = swt-kde
GNOME_PREFIX = swt-gnome
@@ -27,11 +28,15 @@ MOZILLA_PREFIX = swt-mozilla
SWT_LIB = lib$(SWT_PREFIX)-$(WS_PREFIX)-$(SWT_VERSION).so
AWT_LIB = lib$(AWT_PREFIX)-$(WS_PREFIX)-$(SWT_VERSION).so
SWTPI_LIB = lib$(SWTPI_PREFIX)-$(WS_PREFIX)-$(SWT_VERSION).so
+CAIRO_LIB = lib$(CAIRO_PREFIX)-$(WS_PREFIX)-$(SWT_VERSION).so
ATK_LIB = lib$(ATK_PREFIX)-$(WS_PREFIX)-$(SWT_VERSION).so
GNOME_LIB = lib$(GNOME_PREFIX)-$(WS_PREFIX)-$(SWT_VERSION).so
KDE_LIB = lib$(KDE_PREFIX)-$(WS_PREFIX)-$(SWT_VERSION).so
MOZILLA_LIB = lib$(MOZILLA_PREFIX)-$(WS_PREFIX)-$(SWT_VERSION).so
+CAIROCFLAGS = -I/usr/local/include -I/usr/include/freetype2
+CAIROLIBS = -L/usr/local/lib -lcairo
+
# Do not use pkg-config to get libs because it includes unnecessary dependencies (i.e. pangoxft-1.0)
GTKCFLAGS = `pkg-config --cflags gtk+-2.0`
GTKLIBS = `pkg-config --libs-only-L gtk+-2.0 gthread-2.0` -lgtk-x11-2.0 -lgthread-2.0 -L$(XTEST_LIB_PATH) -lXtst
@@ -68,6 +73,7 @@ MOZILLALIBS = -shared -Wl,--version-script=mozilla_exports -Bsymbolic ${GECKO_LI
SWT_OBJECTS = swt.o callback.o
AWT_OBJECTS = swt_awt.o
SWTPI_OBJECTS = swt.o os.o os_structs.o os_custom.o os_stats.o
+CAIRO_OBJECTS = swt.o cairo.o cairo_structs.o cairo_stats.o cairo_custom.o
ATK_OBJECTS = swt.o atk.o atk_structs.o atk_custom.o atk_stats.o
GNOME_OBJECTS = swt.o gnome.o gnome_structs.o gnome_stats.o
KDE_OBJS = swt.o kde.o kde_stats.o
@@ -83,7 +89,7 @@ CFLAGS = -O -Wall \
LIBS = -shared -fpic
-all: make_swt make_atk make_gnome make_awt make_kde
+all: make_swt make_atk make_gnome make_awt make_kde make_cairo
#
# SWT libs
@@ -111,6 +117,23 @@ os_stats.o: os_stats.c os_structs.h os.h os_stats.h swt.h
$(CC) $(CFLAGS) $(GTKCFLAGS) -c os_stats.c
#
+# CAIRO libs
+#
+make_cairo: $(CAIRO_LIB)
+
+$(CAIRO_LIB): $(CAIRO_OBJECTS)
+ $(LD) $(LIBS) $(CAIROLIBS) -o $(CAIRO_LIB) $(CAIRO_OBJECTS)
+
+cairo.o: cairo.c cairo.h swt.h
+ $(CC) $(CFLAGS) $(CAIROCFLAGS) -c cairo.c
+cairo_custom.o: cairo_custom.c cairo_structs.h cairo.h swt.h
+ $(CC) $(CFLAGS) $(CAIROCFLAGS) -c cairo_custom.c
+cairo_structs.o: cairo_structs.c cairo_structs.h cairo.h swt.h
+ $(CC) $(CFLAGS) $(CAIROCFLAGS) -c cairo_structs.c
+cairo_stats.o: cairo_stats.c cairo_structs.h cairo.h cairo_stats.h swt.h
+ $(CC) $(CFLAGS) $(CAIROCFLAGS) -c cairo_stats.c
+
+#
# AWT lib
#
make_awt:$(AWT_LIB)
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/cairo/org/eclipse/swt/graphics/Path.java b/bundles/org.eclipse.swt/Eclipse SWT/cairo/org/eclipse/swt/graphics/Path.java
new file mode 100644
index 0000000000..398281bbfe
--- /dev/null
+++ b/bundles/org.eclipse.swt/Eclipse SWT/cairo/org/eclipse/swt/graphics/Path.java
@@ -0,0 +1,130 @@
+/*******************************************************************************
+ * Copyright (c) 2000, 2004 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Common Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/cpl-v10.html
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.swt.graphics;
+
+import org.eclipse.swt.*;
+import org.eclipse.swt.internal.*;
+import org.eclipse.swt.internal.cairo.*;
+
+public class Path {
+
+ /**
+ * the handle to the OS path resource
+ * (Warning: This field is platform dependent)
+ */
+ public int /*long*/ handle;
+
+ /**
+ * the device where this font was created
+ */
+ Device device;
+
+public Path (Device device) {
+ if (device == null) device = Device.getDevice();
+ if (device == null) SWT.error(SWT.ERROR_NULL_ARGUMENT);
+ this.device = device;
+ device.checkCairo();
+ handle = Cairo.cairo_create();
+ if (handle == 0) SWT.error(SWT.ERROR_NO_HANDLES);
+ if (device.tracking) device.new_Object(this);
+}
+
+public void addArc(float x, float y, float width, float height, float startAngle, float arcAngle) {
+ if (isDisposed()) SWT.error(SWT.ERROR_GRAPHIC_DISPOSED);
+ int /*long*/ matrix = Cairo.cairo_matrix_create();
+ Cairo.cairo_current_matrix(handle, matrix);
+ double lineWidth = Cairo.cairo_current_line_width(handle);
+ Cairo.cairo_translate(handle, x + width / 2f, y + height / 2f);
+ Cairo.cairo_scale(handle, width / 2f, height / 2f);
+ Cairo.cairo_set_line_width(handle, lineWidth / (width / 2f));
+ Cairo.cairo_arc_negative(handle, 0, 0, 1, -startAngle * (float)Compatibility.PI / 180, -(startAngle + arcAngle) * (float)Compatibility.PI / 180);
+ Cairo.cairo_set_line_width(handle, lineWidth);
+ Cairo.cairo_set_matrix(handle, matrix);
+ Cairo.cairo_destroy(matrix);
+}
+
+public void addPath(Path path) {
+ if (isDisposed()) SWT.error(SWT.ERROR_GRAPHIC_DISPOSED);
+ if (path.isDisposed()) SWT.error(SWT.ERROR_INVALID_ARGUMENT);
+ Cairo.cairo_add_path(handle, path.handle);
+}
+
+public void addRectangle(float x, float y, float width, float height) {
+ if (isDisposed()) SWT.error(SWT.ERROR_GRAPHIC_DISPOSED);
+ Cairo.cairo_rectangle(handle, x, y, width, height);
+}
+
+public void addString(String string, float x, float y, Font font) {
+ if (isDisposed()) SWT.error(SWT.ERROR_GRAPHIC_DISPOSED);
+ if (font == null) SWT.error(SWT.ERROR_NULL_ARGUMENT);
+ if (font.isDisposed()) SWT.error(SWT.ERROR_INVALID_ARGUMENT);
+ GC.setCairoFont(handle, font);
+ cairo_font_extents_t extents = new cairo_font_extents_t();
+ Cairo.cairo_current_font_extents(handle, extents);
+ double baseline = y + extents.ascent;
+ Cairo.cairo_move_to(handle, x, baseline);
+ byte[] buffer = Converter.wcsToMbcs(null, string, true);
+ Cairo.cairo_text_path(handle, buffer);
+}
+
+public void close() {
+ if (isDisposed()) SWT.error(SWT.ERROR_GRAPHIC_DISPOSED);
+ Cairo.cairo_close_path(handle);
+}
+
+public void curveTo(float cx1, float cy1, float cx2, float cy2, float x, float y) {
+ if (isDisposed()) SWT.error(SWT.ERROR_GRAPHIC_DISPOSED);
+ Cairo.cairo_curve_to(handle, cx1, cy1, cx2, cy2, x, y);
+}
+
+public void getCurrentPoint(float[] point) {
+ if (isDisposed()) SWT.error(SWT.ERROR_GRAPHIC_DISPOSED);
+ if (point == null) SWT.error(SWT.ERROR_NULL_ARGUMENT);
+ if (point.length < 2) SWT.error(SWT.ERROR_INVALID_ARGUMENT);
+ double[] x = new double[1], y = new double[1];
+ Cairo.cairo_current_point(handle, x, y);
+ point[0] = (float)x[0];
+ point[1] = (float)y[0];
+}
+
+public void lineTo(float x, float y) {
+ if (isDisposed()) SWT.error(SWT.ERROR_GRAPHIC_DISPOSED);
+ Cairo.cairo_line_to(handle, x, y);
+}
+
+public void moveTo(float x, float y) {
+ if (isDisposed()) SWT.error(SWT.ERROR_GRAPHIC_DISPOSED);
+ Cairo.cairo_move_to(handle, x, y);
+}
+
+public void quadTo(float cx, float cy, float x, float y) {
+ if (isDisposed()) SWT.error(SWT.ERROR_GRAPHIC_DISPOSED);
+ Cairo.cairo_curve_to(handle, cx, cy, cx, cy, x, y);
+}
+
+public void dispose() {
+ if (handle == 0) return;
+ Cairo.cairo_destroy(handle);
+ handle = 0;
+ if (device.tracking) device.dispose_Object(this);
+ device = null;
+}
+
+public boolean isDisposed() {
+ return handle == 0;
+}
+
+public String toString() {
+ if (isDisposed()) return "Path {*DISPOSED*}";
+ return "Path {" + handle + "}";
+}
+
+}
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/cairo/org/eclipse/swt/graphics/Transform.java b/bundles/org.eclipse.swt/Eclipse SWT/cairo/org/eclipse/swt/graphics/Transform.java
new file mode 100644
index 0000000000..04b1116a3f
--- /dev/null
+++ b/bundles/org.eclipse.swt/Eclipse SWT/cairo/org/eclipse/swt/graphics/Transform.java
@@ -0,0 +1,144 @@
+/*******************************************************************************
+ * Copyright (c) 2000, 2004 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Common Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/cpl-v10.html
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.swt.graphics;
+
+import org.eclipse.swt.*;
+import org.eclipse.swt.internal.*;
+import org.eclipse.swt.internal.cairo.*;
+
+public class Transform {
+ /**
+ * the handle to the OS transform resource
+ * (Warning: This field is platform dependent)
+ */
+ public int /*long*/ handle;
+
+ /**
+ * the device where this font was created
+ */
+ Device device;
+
+public Transform (Device device) {
+ this(device, 1, 0, 0, 1, 0, 0);
+}
+
+public Transform(Device device, float[] elements) {
+ this (device, checkTransform(elements)[0], elements[1], elements[2], elements[3], elements[4], elements[5]);
+}
+
+public Transform (Device device, float m11, float m12, float m21, float m22, float dx, float dy) {
+ if (device == null) device = Device.getDevice();
+ if (device == null) SWT.error(SWT.ERROR_NULL_ARGUMENT);
+ this.device = device;
+ device.checkCairo();
+ handle = Cairo.cairo_matrix_create();
+ if (handle == 0) SWT.error(SWT.ERROR_NO_HANDLES);
+ Cairo.cairo_matrix_set_affine(handle, m11, m12, m21, m22, dx, dy);
+ if (device.tracking) device.new_Object(this);
+}
+
+static float[] checkTransform(float[] elements) {
+ if (elements == null) SWT.error(SWT.ERROR_NULL_ARGUMENT);
+ if (elements.length < 6) SWT.error(SWT.ERROR_INVALID_ARGUMENT);
+ return elements;
+}
+
+public void dispose() {
+ if (handle == 0) return;
+ if (device.isDisposed()) return;
+ Cairo.cairo_matrix_destroy(handle);
+ handle = 0;
+ if (device.tracking) device.dispose_Object(this);
+ device = null;
+}
+
+public void getElements(float[] elements) {
+ if (isDisposed()) SWT.error(SWT.ERROR_GRAPHIC_DISPOSED);
+ if (elements == null) SWT.error(SWT.ERROR_NULL_ARGUMENT);
+ if (elements.length < 6) SWT.error(SWT.ERROR_INVALID_ARGUMENT);
+ double[] a = new double[1], b = new double[1], c = new double[1], d = new double[1];
+ double[] tx = new double[1], ty = new double[1];
+ Cairo.cairo_matrix_get_affine(handle, a, b, c, d, tx, ty);
+ elements[0] = (float)a[0];
+ elements[1] = (float)b[0];
+ elements[2] = (float)c[0];
+ elements[3] = (float)d[0];
+ elements[4] = (float)tx[0];
+ elements[5] = (float)ty[0];
+}
+
+public void invert() {
+ if (isDisposed()) SWT.error(SWT.ERROR_GRAPHIC_DISPOSED);
+ if (Cairo.cairo_matrix_invert(handle) != 0) {
+ SWT.error(SWT.ERROR_CANNOT_INVERT_MATRIX);
+ }
+}
+
+public boolean isDisposed() {
+ return handle == 0;
+}
+
+public boolean isIdentity() {
+ if (isDisposed()) SWT.error(SWT.ERROR_GRAPHIC_DISPOSED);
+ float[] m = new float[6];
+ getElements(m);
+ return m[0] == 1 && m[1] == 0 && m[2] == 0 && m[3] == 1 && m[4] == 0 && m[5] == 0;
+}
+
+public void multiply(Transform matrix) {
+ if (isDisposed()) SWT.error(SWT.ERROR_GRAPHIC_DISPOSED);
+ if (matrix == null) SWT.error(SWT.ERROR_NULL_ARGUMENT);
+ if (matrix.isDisposed()) SWT.error(SWT.ERROR_INVALID_ARGUMENT);
+ Cairo.cairo_matrix_multiply(handle, matrix.handle, handle);
+}
+
+public void rotate(float angle) {
+ if (isDisposed()) SWT.error(SWT.ERROR_GRAPHIC_DISPOSED);
+ Cairo.cairo_matrix_rotate(handle, angle * (float)Compatibility.PI / 180);
+}
+
+public void scale(float scaleX, float scaleY) {
+ if (isDisposed()) SWT.error(SWT.ERROR_GRAPHIC_DISPOSED);
+ Cairo.cairo_matrix_scale(handle, scaleX, scaleY);
+}
+
+public void setElements(float m11, float m12, float m21, float m22, float dx, float dy) {
+ if (isDisposed()) SWT.error(SWT.ERROR_GRAPHIC_DISPOSED);
+ Cairo.cairo_matrix_set_affine(handle, m11, m12, m21, m22, dx, dy);
+}
+
+public void transform(float[] pointArray) {
+ if (isDisposed()) SWT.error(SWT.ERROR_GRAPHIC_DISPOSED);
+ if (pointArray == null) SWT.error(SWT.ERROR_NULL_ARGUMENT);
+ double[] dx = new double[1], dy = new double[1];
+ int length = pointArray.length / 2;
+ for (int i = 0, j = 0; i < length; i++, j += 2) {
+ dx[0] = pointArray[j];
+ dy[0] = pointArray[j + 1];
+ Cairo.cairo_matrix_transform_point(handle, dx, dy);
+ pointArray[j] = (float)dx[0];
+ pointArray[j + 1] = (float)dy[0];
+ }
+}
+
+public void translate(float offsetX, float offsetY) {
+ if (isDisposed()) SWT.error(SWT.ERROR_GRAPHIC_DISPOSED);
+ Cairo.cairo_matrix_translate(handle, offsetX, offsetY);
+}
+
+public String toString() {
+ if (isDisposed()) return "Transform {*DISPOSED*}";
+ float[] elements = new float[6];
+ getElements(elements);
+ return "Transform {" + elements [0] + "," + elements [1] + "," +elements [2] + "," +elements [3] + "," +elements [4] + "," +elements [5] + "}";
+}
+
+}
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/emulated/graphics/org/eclipse/swt/graphics/Path.java b/bundles/org.eclipse.swt/Eclipse SWT/emulated/graphics/org/eclipse/swt/graphics/Path.java
new file mode 100644
index 0000000000..6c5621e617
--- /dev/null
+++ b/bundles/org.eclipse.swt/Eclipse SWT/emulated/graphics/org/eclipse/swt/graphics/Path.java
@@ -0,0 +1,98 @@
+/*******************************************************************************
+ * Copyright (c) 2000, 2004 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Common Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/cpl-v10.html
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.swt.graphics;
+
+import org.eclipse.swt.*;
+
+public class Path {
+
+ /**
+ * the handle to the OS path resource
+ * (Warning: This field is platform dependent)
+ */
+ public int handle;
+
+ /**
+ * the device where this font was created
+ */
+ Device device;
+
+public Path (Device device) {
+ if (device == null) device = Device.getDevice();
+ if (device == null) SWT.error(SWT.ERROR_NULL_ARGUMENT);
+ this.device = device;
+ SWT.error(SWT.ERROR_NO_GRAPHICS_LIBRARY);
+ if (handle == 0) SWT.error(SWT.ERROR_NO_HANDLES);
+ if (device.tracking) device.new_Object(this);
+}
+
+public void addArc(float x, float y, float width, float height, float startAngle, float arcAngle) {
+ if (isDisposed()) SWT.error(SWT.ERROR_GRAPHIC_DISPOSED);
+}
+
+public void addPath(Path path) {
+ if (isDisposed()) SWT.error(SWT.ERROR_GRAPHIC_DISPOSED);
+ if (path.isDisposed()) SWT.error(SWT.ERROR_INVALID_ARGUMENT);
+}
+
+public void addRectangle(float x, float y, float width, float height) {
+ if (isDisposed()) SWT.error(SWT.ERROR_GRAPHIC_DISPOSED);
+}
+
+public void addString(String string, float x, float y, Font font) {
+ if (isDisposed()) SWT.error(SWT.ERROR_GRAPHIC_DISPOSED);
+ if (font == null) SWT.error(SWT.ERROR_NULL_ARGUMENT);
+ if (font.isDisposed()) SWT.error(SWT.ERROR_INVALID_ARGUMENT);
+}
+
+public void close() {
+ if (isDisposed()) SWT.error(SWT.ERROR_GRAPHIC_DISPOSED);
+}
+
+public void curveTo(float cx1, float cy1, float cx2, float cy2, float x, float y) {
+ if (isDisposed()) SWT.error(SWT.ERROR_GRAPHIC_DISPOSED);
+}
+
+public void getCurrentPoint(float[] point) {
+ if (isDisposed()) SWT.error(SWT.ERROR_GRAPHIC_DISPOSED);
+ if (point == null) SWT.error(SWT.ERROR_NULL_ARGUMENT);
+ if (point.length < 2) SWT.error(SWT.ERROR_INVALID_ARGUMENT);
+}
+
+public void lineTo(float x, float y) {
+ if (isDisposed()) SWT.error(SWT.ERROR_GRAPHIC_DISPOSED);
+}
+
+public void moveTo(float x, float y) {
+ if (isDisposed()) SWT.error(SWT.ERROR_GRAPHIC_DISPOSED);
+}
+
+public void quadTo(float cx, float cy, float x, float y) {
+ if (isDisposed()) SWT.error(SWT.ERROR_GRAPHIC_DISPOSED);
+}
+
+public void dispose() {
+ if (handle == 0) return;
+ handle = 0;
+ if (device.tracking) device.dispose_Object(this);
+ device = null;
+}
+
+public boolean isDisposed() {
+ return handle == 0;
+}
+
+public String toString() {
+ if (isDisposed()) return "Path {*DISPOSED*}";
+ return "Path {" + handle + "}";
+}
+
+}
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/emulated/graphics/org/eclipse/swt/graphics/Transform.java b/bundles/org.eclipse.swt/Eclipse SWT/emulated/graphics/org/eclipse/swt/graphics/Transform.java
new file mode 100644
index 0000000000..49726e2d61
--- /dev/null
+++ b/bundles/org.eclipse.swt/Eclipse SWT/emulated/graphics/org/eclipse/swt/graphics/Transform.java
@@ -0,0 +1,112 @@
+/*******************************************************************************
+ * Copyright (c) 2000, 2004 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Common Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/cpl-v10.html
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.swt.graphics;
+
+import org.eclipse.swt.*;
+
+public class Transform {
+ /**
+ * the handle to the OS transform resource
+ * (Warning: This field is platform dependent)
+ */
+ public int handle;
+
+ /**
+ * the device where this font was created
+ */
+ Device device;
+
+public Transform (Device device) {
+ this(device, 1, 0, 0, 1, 0, 0);
+}
+
+public Transform(Device device, float[] elements) {
+ this (device, checkTransform(elements)[0], elements[1], elements[2], elements[3], elements[4], elements[5]);
+}
+
+public Transform (Device device, float m11, float m12, float m21, float m22, float dx, float dy) {
+ if (device == null) device = Device.getDevice();
+ if (device == null) SWT.error(SWT.ERROR_NULL_ARGUMENT);
+ SWT.error(SWT.ERROR_NO_GRAPHICS_LIBRARY);
+ if (handle == 0) SWT.error(SWT.ERROR_NO_HANDLES);
+ if (device.tracking) device.new_Object(this);
+}
+
+static float[] checkTransform(float[] elements) {
+ if (elements == null) SWT.error(SWT.ERROR_NULL_ARGUMENT);
+ if (elements.length < 6) SWT.error(SWT.ERROR_INVALID_ARGUMENT);
+ return elements;
+}
+
+public void dispose() {
+ if (handle == 0) return;
+ if (device.isDisposed()) return;
+ handle = 0;
+ if (device.tracking) device.dispose_Object(this);
+ device = null;
+}
+
+public void getElements(float[] elements) {
+ if (isDisposed()) SWT.error(SWT.ERROR_GRAPHIC_DISPOSED);
+ if (elements == null) SWT.error(SWT.ERROR_NULL_ARGUMENT);
+ if (elements.length < 6) SWT.error(SWT.ERROR_INVALID_ARGUMENT);
+}
+
+public void invert() {
+ if (isDisposed()) SWT.error(SWT.ERROR_GRAPHIC_DISPOSED);
+}
+
+public boolean isDisposed() {
+ return handle == 0;
+}
+
+public boolean isIdentity() {
+ if (isDisposed()) SWT.error(SWT.ERROR_GRAPHIC_DISPOSED);
+ float[] m = new float[6];
+ getElements(m);
+ return m[0] == 1 && m[1] == 0 && m[2] == 0 && m[3] == 1 && m[4] == 0 && m[5] == 0;
+}
+
+public void multiply(Transform matrix) {
+ if (isDisposed()) SWT.error(SWT.ERROR_GRAPHIC_DISPOSED);
+ if (matrix == null) SWT.error(SWT.ERROR_NULL_ARGUMENT);
+ if (matrix.isDisposed()) SWT.error(SWT.ERROR_INVALID_ARGUMENT);
+}
+
+public void rotate(float angle) {
+ if (isDisposed()) SWT.error(SWT.ERROR_GRAPHIC_DISPOSED);
+}
+
+public void scale(float scaleX, float scaleY) {
+ if (isDisposed()) SWT.error(SWT.ERROR_GRAPHIC_DISPOSED);
+}
+
+public void setElements(float m11, float m12, float m21, float m22, float dx, float dy) {
+ if (isDisposed()) SWT.error(SWT.ERROR_GRAPHIC_DISPOSED);
+}
+
+public void transform(float[] pointArray) {
+ if (isDisposed()) SWT.error(SWT.ERROR_GRAPHIC_DISPOSED);
+ if (pointArray == null) SWT.error(SWT.ERROR_NULL_ARGUMENT);
+}
+
+public void translate(float offsetX, float offsetY) {
+ if (isDisposed()) SWT.error(SWT.ERROR_GRAPHIC_DISPOSED);
+}
+
+public String toString() {
+ if (isDisposed()) return "Transform {*DISPOSED*}";
+ float[] elements = new float[6];
+ getElements(elements);
+ return "Transform {" + elements [0] + "," + elements [1] + "," +elements [2] + "," +elements [3] + "," +elements [4] + "," +elements [5] + "}";
+}
+
+}
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/graphics/Device.java b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/graphics/Device.java
index 1b6d502d3b..9166b17fb1 100644
--- a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/graphics/Device.java
+++ b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/graphics/Device.java
@@ -128,6 +128,14 @@ public Device(DeviceData data) {
systemFont = getSystemFont ();
}
+void checkCairo() {
+ try {
+ Class.forName("org.eclipse.swt.internal.cairo.Cairo");
+ } catch (Throwable t) {
+ SWT.error(SWT.ERROR_NO_GRAPHICS_LIBRARY, t);
+ }
+}
+
/**
* Throws an <code>SWTException</code> if the receiver can not
* be accessed by the caller. This may include both checks on
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/graphics/GC.java b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/graphics/GC.java
index 7bbde348f4..6a9062e45c 100644
--- a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/graphics/GC.java
+++ b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/graphics/GC.java
@@ -11,6 +11,7 @@
package org.eclipse.swt.graphics;
+import org.eclipse.swt.internal.cairo.*;
import org.eclipse.swt.internal.gtk.*;
import org.eclipse.swt.internal.*;
import org.eclipse.swt.*;
@@ -234,6 +235,14 @@ public void dispose() {
if (handle == 0) return;
if (data.device.isDisposed()) return;
+ int /*long*/ cairo = data.cairo;
+ if (cairo != 0) Cairo.cairo_destroy(cairo);
+ int /*long*/ matrix = data.matrix;
+ if (matrix != 0) Cairo.cairo_matrix_destroy(matrix);
+ int /*long*/ inverseMatrix = data.inverseMatrix;
+ if (inverseMatrix != 0) Cairo.cairo_matrix_destroy(inverseMatrix);
+ data.cairo = data.matrix = data.inverseMatrix = 0;
+
/* Free resources */
int /*long*/ clipRgn = data.clipRgn;
if (clipRgn != 0) OS.gdk_region_destroy(clipRgn);
@@ -302,6 +311,17 @@ public void drawArc(int x, int y, int width, int height, int startAngle, int arc
height = -height;
}
if (width == 0 || height == 0 || arcAngle == 0) return;
+ int /*long*/ cairo = data.cairo;
+ if (cairo != 0) {
+ Cairo.cairo_save(cairo);
+ Cairo.cairo_translate(cairo, x + width / 2f, y + height / 2f);
+ Cairo.cairo_scale(cairo, width / 2f, height / 2f);
+ Cairo.cairo_set_line_width(cairo, Cairo.cairo_current_line_width(cairo) / (width / 2f));
+ Cairo.cairo_arc_negative(cairo, 0, 0, 1, -startAngle * (float)Compatibility.PI / 180, -(startAngle + arcAngle) * (float)Compatibility.PI / 180);
+ Cairo.cairo_stroke(cairo);
+ Cairo.cairo_restore(cairo);
+ return;
+ }
OS.gdk_draw_arc(data.drawable, handle, 0, x, y, width, height, startAngle * 64, arcAngle * 64);
}
@@ -429,6 +449,34 @@ void drawImage(Image srcImage, int srcX, int srcY, int srcWidth, int srcHeight,
}
}
void drawImage(Image srcImage, int srcX, int srcY, int srcWidth, int srcHeight, int destX, int destY, int destWidth, int destHeight, boolean simple, int imgWidth, int imgHeight) {
+ int /*long*/ cairo = data.cairo;
+ if (cairo != 0) {
+ if (srcImage.surface == 0) {
+ int /*long*/ xDisplay = OS.GDK_DISPLAY();
+ int /*long*/ xDrawable = OS.GDK_PIXMAP_XID(srcImage.pixmap);
+ int /*long*/ xVisual = OS.gdk_x11_visual_get_xvisual(OS.gdk_visual_get_system());
+ int /*long*/ xColormap = OS.gdk_x11_colormap_get_xcolormap(OS.gdk_colormap_get_system());
+ srcImage.surface = Cairo.cairo_xlib_surface_create(xDisplay, xDrawable, xVisual, 0, xColormap);
+ }
+ Cairo.cairo_save(cairo);
+ //TODO - draw a piece of the image
+// if (srcX != 0 || srcY != 0) {
+// Cairo.cairo_rectangle(cairo, destX, destY, destWidth, destHeight);
+// Cairo.cairo_clip(cairo);
+// Cairo.cairo_new_path(cairo);
+// }
+ //TODO - need 0.5 to draw at 0,0 with no transformation ???
+ System.out.println("filter="+ Cairo.cairo_surface_get_filter(srcImage.surface));
+ Cairo.cairo_surface_set_filter(srcImage.surface, 5);
+ System.out.println("\tfilter="+ Cairo.cairo_surface_get_filter(srcImage.surface));
+ Cairo.cairo_translate(cairo, destX - srcX + 0.5, destY - srcY);
+ if (srcWidth != destWidth || srcHeight != destHeight) {
+ Cairo.cairo_scale(cairo, destWidth / (float)srcWidth, destHeight / (float)srcHeight);
+ }
+ Cairo.cairo_show_surface(cairo, srcImage.surface, imgWidth, imgHeight);
+ Cairo.cairo_restore(cairo);
+ return;
+ }
if (srcWidth == destWidth && srcHeight == destHeight) {
OS.gdk_draw_drawable(data.drawable, handle, srcImage.pixmap, srcX, srcY, destX, destY, destWidth, destHeight);
} else {
@@ -590,6 +638,13 @@ int /*long*/ scale(int /*long*/ src, int srcX, int srcY, int srcWidth, int srcHe
*/
public void drawLine(int x1, int y1, int x2, int y2) {
if (handle == 0) SWT.error(SWT.ERROR_GRAPHIC_DISPOSED);
+ int /*long*/ cairo = data.cairo;
+ if (cairo != 0) {
+ Cairo.cairo_move_to(cairo, x1, y1);
+ Cairo.cairo_line_to(cairo, x2, y2);
+ Cairo.cairo_stroke(cairo);
+ return;
+ }
OS.gdk_draw_line (data.drawable, handle, x1, y1, x2, y2);
}
@@ -624,9 +679,28 @@ public void drawOval(int x, int y, int width, int height) {
y = y + height;
height = -height;
}
+ int /*long*/ cairo = data.cairo;
+ if (cairo != 0) {
+ Cairo.cairo_save(cairo);
+ Cairo.cairo_translate(cairo, x + width / 2f, y + height / 2f);
+ Cairo.cairo_scale(cairo, width / 2f, height / 2f);
+ Cairo.cairo_set_line_width(cairo, Cairo.cairo_current_line_width(cairo) / (width / 2f));
+ Cairo.cairo_arc_negative(cairo, 0, 0, 1, 0, -2 * (float)Compatibility.PI);
+ Cairo.cairo_stroke(cairo);
+ Cairo.cairo_restore(cairo);
+ return;
+ }
OS.gdk_draw_arc(data.drawable, handle, 0, x, y, width, height, 0, 23040);
}
+public void drawPath(Path path) {
+ if (handle == 0) SWT.error(SWT.ERROR_GRAPHIC_DISPOSED);
+ if (path.handle == 0) SWT.error(SWT.ERROR_INVALID_ARGUMENT);
+ initCairo();
+ Cairo.cairo_add_path(data.cairo, path.handle);
+ Cairo.cairo_stroke(data.cairo);
+}
+
/**
* Draws a pixel, using the foreground color, at the specified
* point (<code>x</code>, <code>y</code>).
@@ -646,6 +720,12 @@ public void drawOval(int x, int y, int width, int height) {
*/
public void drawPoint (int x, int y) {
if (handle == 0) SWT.error(SWT.ERROR_GRAPHIC_DISPOSED);
+ int /*long*/ cairo = data.cairo;
+ if (cairo != 0) {
+ Cairo.cairo_rectangle(cairo, x, y, 1, 1);
+ Cairo.cairo_fill(cairo);
+ return;
+ }
OS.gdk_draw_point(data.drawable, handle, x, y);
}
@@ -669,6 +749,12 @@ public void drawPoint (int x, int y) {
public void drawPolygon(int[] pointArray) {
if (handle == 0) SWT.error(SWT.ERROR_GRAPHIC_DISPOSED);
if (pointArray == null) SWT.error(SWT.ERROR_NULL_ARGUMENT);
+ int /*long*/ cairo = data.cairo;
+ if (cairo != 0) {
+ drawPolyline(cairo, pointArray, true);
+ Cairo.cairo_stroke(cairo);
+ return;
+ }
OS.gdk_draw_polygon(data.drawable, handle, 0, pointArray, pointArray.length / 2);
}
@@ -692,9 +778,25 @@ public void drawPolygon(int[] pointArray) {
public void drawPolyline(int[] pointArray) {
if (handle == 0) SWT.error(SWT.ERROR_GRAPHIC_DISPOSED);
if (pointArray == null) SWT.error(SWT.ERROR_NULL_ARGUMENT);
+ int /*long*/ cairo = data.cairo;
+ if (cairo != 0) {
+ drawPolyline(cairo, pointArray, false);
+ Cairo.cairo_stroke(cairo);
+ return;
+ }
OS.gdk_draw_lines(data.drawable, handle, pointArray, pointArray.length / 2);
}
+void drawPolyline(int /*long*/ cairo, int[] pointArray, boolean close) {
+ int count = pointArray.length / 2;
+ if (count == 0) return;
+ Cairo.cairo_move_to(cairo, pointArray[0], pointArray[1]);
+ for (int i = 1, j=2; i < count; i++, j += 2) {
+ Cairo.cairo_line_to(cairo, pointArray[j], pointArray[j + 1]);
+ }
+ if (close) Cairo.cairo_close_path(cairo);
+}
+
/**
* Draws the outline of the rectangle specified by the arguments,
* using the receiver's foreground color. The left and right edges
@@ -720,6 +822,12 @@ public void drawRectangle(int x, int y, int width, int height) {
y = y + height;
height = -height;
}
+ int /*long*/ cairo = data.cairo;
+ if (cairo != 0) {
+ Cairo.cairo_rectangle(cairo, x, y, width, height);
+ Cairo.cairo_stroke(cairo);
+ return;
+ }
OS.gdk_draw_rectangle(data.drawable, handle, 0, x, y, width, height);
}
@@ -770,7 +878,6 @@ public void drawRoundRectangle(int x, int y, int width, int height, int arcWidth
int nh = height;
int naw = arcWidth;
int nah = arcHeight;
-
if (nw < 0) {
nw = 0 - nw;
nx = nx - nw;
@@ -779,14 +886,29 @@ public void drawRoundRectangle(int x, int y, int width, int height, int arcWidth
nh = 0 - nh;
ny = ny -nh;
}
- if (naw < 0)
- naw = 0 - naw;
- if (nah < 0)
- nah = 0 - nah;
-
+ if (naw < 0) naw = 0 - naw;
+ if (nah < 0) nah = 0 - nah;
+ int /*long*/ cairo = data.cairo;
+ if (cairo != 0) {
+ float naw2 = naw / 2f;
+ float nah2 = nah / 2f;
+ float fw = nw / naw2;
+ float fh = nh / nah2;
+ Cairo.cairo_save(cairo);
+ Cairo.cairo_translate(cairo, nx, ny);
+ Cairo.cairo_scale(cairo, naw2, nah2);
+ Cairo.cairo_move_to(cairo, fw - 1, 0);
+// Cairo.cairo_arc_to(cairo, 0, 0, 0, 1, 1);
+// Cairo.cairo_arc_to(cairo, 0, fh, 1, fh, 1);
+// Cairo.cairo_arc_to(cairo, fw, fh, fw, fh - 1, 1);
+// Cairo.cairo_arc_to(cairo, fw, 0, fw - 1, 0, 1);
+ Cairo.cairo_close_path(handle);
+ Cairo.cairo_stroke(cairo);
+ Cairo.cairo_restore(cairo);
+ return;
+ }
int naw2 = naw / 2;
int nah2 = nah / 2;
-
int /*long*/ drawable = data.drawable;
if (nw > naw) {
if (nh > nah) {
@@ -947,6 +1069,18 @@ public void drawText (String string, int x, int y, int flags) {
if (handle == 0) SWT.error(SWT.ERROR_GRAPHIC_DISPOSED);
if (string == null) SWT.error(SWT.ERROR_NULL_ARGUMENT);
if (string.length() == 0) return;
+ int /*long*/ cairo = data.cairo;
+ if (cairo != 0) {
+ //TODO - honor flags
+ cairo_font_extents_t extents = new cairo_font_extents_t();
+ Cairo.cairo_current_font_extents(cairo, extents);
+ double baseline = y + extents.ascent;
+ Cairo.cairo_move_to(cairo, x, baseline);
+ byte[] buffer = Converter.wcsToMbcs(null, string, true);
+ Cairo.cairo_text_path(cairo, buffer);
+ Cairo.cairo_fill(cairo);
+ return;
+ }
setString(string, flags);
GdkColor background = null;
GdkGCValues values = null;
@@ -1049,6 +1183,20 @@ public void fillArc(int x, int y, int width, int height, int startAngle, int arc
OS.gdk_gc_get_values(handle, values);
GdkColor color = new GdkColor();
color.pixel = values.background_pixel;
+ int /*long*/ cairo = data.cairo;
+ if (cairo != 0) {
+ int /*long*/ colormap = OS.gdk_colormap_get_system();
+ OS.gdk_colormap_query_color(colormap, color.pixel, color);
+ Cairo.cairo_save(cairo);
+ Cairo.cairo_set_rgb_color(cairo, (color.red & 0xFFFF) / (float)0xFFFF, (color.green & 0xFFFF) / (float)0xFFFF, (color.blue & 0xFFFF) / (float)0xFFFF);
+ Cairo.cairo_translate(cairo, x + width / 2f, y + height / 2f);
+ Cairo.cairo_scale(cairo, width / 2f, height / 2f);
+ Cairo.cairo_arc_negative(cairo, 0, 0, 1, -startAngle * (float)Compatibility.PI / 180, -(startAngle + arcAngle) * (float)Compatibility.PI / 180);
+ Cairo.cairo_line_to(cairo, 0, 0);
+ Cairo.cairo_fill(cairo);
+ Cairo.cairo_restore(cairo);
+ return;
+ }
OS.gdk_gc_set_foreground(handle, color);
OS.gdk_draw_arc(data.drawable, handle, 1, x, y, width, height, startAngle * 64, arcAngle * 64);
color.pixel = values.foreground_pixel;
@@ -1108,6 +1256,26 @@ public void fillGradientRectangle(int x, int y, int width, int height, boolean v
fillRectangle(x, y, width, height);
return;
}
+ int /*long*/ cairo = data.cairo;
+ if (cairo != 0) {
+ int /*long*/ pattern;
+ if (vertical) {
+ pattern = Cairo.cairo_pattern_create_linear (0.0, 0.0, 0.0, 1.0);
+ } else {
+ pattern = Cairo.cairo_pattern_create_linear (0.0, 0.0, 1.0, 0.0);
+ }
+ Cairo.cairo_pattern_add_color_stop (pattern, 0, fromRGB.red / 255f, fromRGB.green / 255f, fromRGB.blue / 255f, 1);
+ Cairo.cairo_pattern_add_color_stop (pattern, 1, toRGB.red / 255f, toRGB.green / 255f, toRGB.blue / 255f, 1);
+ Cairo.cairo_save(cairo);
+ Cairo.cairo_translate(cairo, x, y);
+ Cairo.cairo_scale(cairo, width, height);
+ Cairo.cairo_rectangle(cairo, 0, 0, 1, 1);
+ Cairo.cairo_set_pattern(cairo, pattern);
+ Cairo.cairo_fill(cairo);
+ Cairo.cairo_restore(cairo);
+ Cairo.cairo_pattern_destroy(pattern);
+ return;
+ }
ImageData.fillGradientRectangle(this, data.device,
x, y, width, height, vertical, fromRGB, toRGB,
8, 8, 8);
@@ -1143,12 +1311,43 @@ public void fillOval(int x, int y, int width, int height) {
OS.gdk_gc_get_values(handle, values);
GdkColor color = new GdkColor();
color.pixel = values.background_pixel;
+ int /*long*/ cairo = data.cairo;
+ if (cairo != 0) {
+ int /*long*/ colormap = OS.gdk_colormap_get_system();
+ OS.gdk_colormap_query_color(colormap, color.pixel, color);
+ Cairo.cairo_save(cairo);
+ Cairo.cairo_set_rgb_color(cairo, (color.red & 0xFFFF) / (float)0xFFFF, (color.green & 0xFFFF) / (float)0xFFFF, (color.blue & 0xFFFF) / (float)0xFFFF);
+ Cairo.cairo_translate(cairo, x + width / 2f, y + height / 2f);
+ Cairo.cairo_scale(cairo, width / 2f, height / 2f);
+ Cairo.cairo_arc_negative(cairo, 0, 0, 1, 0, 2 * (float)Compatibility.PI);
+ Cairo.cairo_fill(cairo);
+ Cairo.cairo_restore(cairo);
+ return;
+ }
OS.gdk_gc_set_foreground(handle, color);
OS.gdk_draw_arc(data.drawable, handle, 1, x, y, width, height, 0, 23040);
color.pixel = values.foreground_pixel;
OS.gdk_gc_set_foreground(handle, color);
}
+public void fillPath (Path path) {
+ if (handle == 0) SWT.error(SWT.ERROR_GRAPHIC_DISPOSED);
+ if (path.handle == 0) SWT.error(SWT.ERROR_INVALID_ARGUMENT);
+ initCairo();
+ GdkGCValues values = new GdkGCValues();
+ OS.gdk_gc_get_values(handle, values);
+ GdkColor color = new GdkColor();
+ color.pixel = values.background_pixel;
+ int /*long*/ cairo = data.cairo;
+ int /*long*/ colormap = OS.gdk_colormap_get_system();
+ OS.gdk_colormap_query_color(colormap, color.pixel, color);
+ Cairo.cairo_save(cairo);
+ Cairo.cairo_set_rgb_color(cairo, (color.red & 0xFFFF) / (float)0xFFFF, (color.green & 0xFFFF) / (float)0xFFFF, (color.blue & 0xFFFF) / (float)0xFFFF);
+ Cairo.cairo_add_path(cairo, path.handle);
+ Cairo.cairo_fill(cairo);
+ Cairo.cairo_restore(cairo);
+}
+
/**
* Fills the interior of the closed polygon which is defined by the
* specified array of integer coordinates, using the receiver's
@@ -1175,6 +1374,17 @@ public void fillPolygon(int[] pointArray) {
OS.gdk_gc_get_values(handle, values);
GdkColor color = new GdkColor();
color.pixel = values.background_pixel;
+ int /*long*/ cairo = data.cairo;
+ if (cairo != 0) {
+ int /*long*/ colormap = OS.gdk_colormap_get_system();
+ OS.gdk_colormap_query_color(colormap, color.pixel, color);
+ Cairo.cairo_save(cairo);
+ Cairo.cairo_set_rgb_color(cairo, (color.red & 0xFFFF) / (float)0xFFFF, (color.green & 0xFFFF) / (float)0xFFFF, (color.blue & 0xFFFF) / (float)0xFFFF);
+ drawPolyline(cairo, pointArray, true);
+ Cairo.cairo_fill(cairo);
+ Cairo.cairo_restore(cairo);
+ return;
+ }
OS.gdk_gc_set_foreground(handle, color);
OS.gdk_draw_polygon(data.drawable, handle, 1, pointArray, pointArray.length / 2);
color.pixel = values.foreground_pixel;
@@ -1210,6 +1420,17 @@ public void fillRectangle(int x, int y, int width, int height) {
OS.gdk_gc_get_values(handle, values);
GdkColor color = new GdkColor();
color.pixel = values.background_pixel;
+ int /*long*/ cairo = data.cairo;
+ if (cairo != 0) {
+ int /*long*/ colormap = OS.gdk_colormap_get_system();
+ OS.gdk_colormap_query_color(colormap, color.pixel, color);
+ Cairo.cairo_save(cairo);
+ Cairo.cairo_set_rgb_color(cairo, (color.red & 0xFFFF) / (float)0xFFFF, (color.green & 0xFFFF) / (float)0xFFFF, (color.blue & 0xFFFF) / (float)0xFFFF);
+ Cairo.cairo_rectangle(cairo, x, y, width, height);
+ Cairo.cairo_fill(cairo);
+ Cairo.cairo_restore(cairo);
+ return;
+ }
OS.gdk_gc_set_foreground(handle, color);
OS.gdk_draw_rectangle(data.drawable, handle, 1, x, y, width, height);
color.pixel = values.foreground_pixel;
@@ -1262,7 +1483,6 @@ public void fillRoundRectangle(int x, int y, int width, int height, int arcWidth
int nh = height;
int naw = arcWidth;
int nah = arcHeight;
-
if (nw < 0) {
nw = 0 - nw;
nx = nx - nw;
@@ -1271,20 +1491,37 @@ public void fillRoundRectangle(int x, int y, int width, int height, int arcWidth
nh = 0 - nh;
ny = ny -nh;
}
- if (naw < 0)
- naw = 0 - naw;
- if (nah < 0)
- nah = 0 - nah;
-
- int naw2 = naw / 2;
- int nah2 = nah / 2;
-
+ if (naw < 0) naw = 0 - naw;
+ if (nah < 0) nah = 0 - nah;
GdkGCValues values = new GdkGCValues();
OS.gdk_gc_get_values(handle, values);
GdkColor color = new GdkColor();
color.pixel = values.background_pixel;
+ int /*long*/ cairo = data.cairo;
+ if (cairo != 0) {
+ float naw2 = naw / 2f;
+ float nah2 = nah / 2f;
+ float fw = nw / naw2;
+ float fh = nh / nah2;
+ int /*long*/ colormap = OS.gdk_colormap_get_system();
+ OS.gdk_colormap_query_color(colormap, color.pixel, color);
+ Cairo.cairo_save(cairo);
+ Cairo.cairo_set_rgb_color(cairo, (color.red & 0xFFFF) / (float)0xFFFF, (color.green & 0xFFFF) / (float)0xFFFF, (color.blue & 0xFFFF) / (float)0xFFFF);
+ Cairo.cairo_translate(cairo, nx, ny);
+ Cairo.cairo_scale(cairo, naw2, nah2);
+ Cairo.cairo_move_to(cairo, fw - 1, 0);
+// Cairo.cairo_arc_to(cairo, 0, 0, 0, 1, 1);
+// Cairo.cairo_arc_to(cairo, 0, fh, 1, fh, 1);
+// Cairo.cairo_arc_to(cairo, fw, fh, fw, fh - 1, 1);
+// Cairo.cairo_arc_to(cairo, fw, 0, fw - 1, 0, 1);
+ Cairo.cairo_close_path(handle);
+ Cairo.cairo_stroke(cairo);
+ Cairo.cairo_restore(cairo);
+ return;
+ }
+ int naw2 = naw / 2;
+ int nah2 = nah / 2;
OS.gdk_gc_set_foreground(handle, color);
-
int /*long*/ drawable = data.drawable;
if (nw > naw) {
if (nh > nah) {
@@ -1309,7 +1546,6 @@ public void fillRoundRectangle(int x, int y, int width, int height, int arcWidth
OS.gdk_draw_arc(drawable, handle, 1, nx, ny, nw, nh, 0, 23040);
}
}
-
color.pixel = values.foreground_pixel;
OS.gdk_gc_set_foreground(handle, color);
}
@@ -1350,6 +1586,12 @@ public int getAdvanceWidth(char ch) {
return stringExtent(new String(new char[]{ch})).x;
}
+public int getAlpha() {
+ if (handle == 0) SWT.error(SWT.ERROR_GRAPHIC_DISPOSED);
+ initCairo();
+ return (int)(Cairo.cairo_current_alpha(data.cairo) * 255);
+}
+
/**
* Returns the background color.
*
@@ -1444,6 +1686,7 @@ public void getClipping(Region region) {
OS.gdk_region_union_with_rect(hRegion, rect);
} else {
OS.gdk_region_union(hRegion, clipRgn);
+ if (!isIdentity(data.matrix)) return;
}
if (data.damageRgn != 0) {
OS.gdk_region_intersect(hRegion, data.damageRgn);
@@ -1605,6 +1848,14 @@ public int getStyle () {
return data.style;
}
+public void getTransform(Transform transform) {
+ if (handle == 0) SWT.error(SWT.ERROR_GRAPHIC_DISPOSED);
+ if (transform == null) SWT.error(SWT.ERROR_NULL_ARGUMENT);
+ if (transform.isDisposed()) SWT.error(SWT.ERROR_INVALID_ARGUMENT);
+ initCairo();
+ Cairo.cairo_matrix_copy(transform.handle, data.matrix);
+}
+
/**
* Returns <code>true</code> if this GC is drawing in the mode
* where the resulting color in the destination is the
@@ -1677,6 +1928,65 @@ void init(Drawable drawable, GCData data, int /*long*/ gdkGC) {
handle = gdkGC;
}
+void initCairo() {
+ data.device.checkCairo();
+ int /*long*/ cairo = data.cairo;
+ if (cairo != 0) return;
+ data.cairo = cairo = Cairo.cairo_create();
+ if (cairo == 0) SWT.error(SWT.ERROR_NO_HANDLES);
+ data.matrix = Cairo.cairo_matrix_create();
+ if (data.matrix == 0) SWT.error(SWT.ERROR_NO_HANDLES);
+ data.inverseMatrix = Cairo.cairo_matrix_create();
+ if (data.inverseMatrix == 0) SWT.error(SWT.ERROR_NO_HANDLES);
+ int /*long*/ xDisplay = OS.GDK_DISPLAY();
+ int /*long*/ xDrawable = 0;
+ int translateX = 0, translateY = 0;
+ if (data.image != null) {
+ xDrawable = OS.GDK_PIXMAP_XID(data.drawable);
+ } else {
+ int[] x = new int[1], y = new int[1];
+ int /*long*/ [] real_drawable = new int /*long*/ [1];
+ OS.gdk_window_get_internal_paint_info(data.drawable, real_drawable, x, y);
+ xDrawable = OS.gdk_x11_drawable_get_xid(real_drawable[0]);
+ translateX = -x[0];
+ translateY = -y[0];
+ }
+ Cairo.cairo_set_target_drawable(cairo, xDisplay, xDrawable);
+ Cairo.cairo_translate(cairo, translateX, translateY);
+ Cairo.cairo_set_fill_rule(cairo, Cairo.CAIRO_FILL_RULE_EVEN_ODD);
+ GdkGCValues values = new GdkGCValues();
+ OS.gdk_gc_get_values(handle, values);
+ GdkColor color = new GdkColor();
+ color.pixel = values.foreground_pixel;
+ int /*long*/ colormap = OS.gdk_colormap_get_system();
+ OS.gdk_colormap_query_color(colormap, color.pixel, color);
+ Cairo.cairo_set_rgb_color(cairo, (color.red & 0xFFFF) / (float)0xFFFF, (color.green & 0xFFFF) / (float)0xFFFF, (color.blue & 0xFFFF) / (float)0xFFFF);
+ Cairo.cairo_set_line_width(cairo, Math.max(1, values.line_width));
+ int cap = Cairo.CAIRO_LINE_CAP_BUTT;
+ switch (values.cap_style) {
+ case OS.GDK_CAP_ROUND: cap = Cairo.CAIRO_LINE_CAP_ROUND; break;
+ case OS.GDK_CAP_BUTT: cap = Cairo.CAIRO_LINE_CAP_BUTT; break;
+ case OS.GDK_CAP_PROJECTING: cap = Cairo.CAIRO_LINE_CAP_SQUARE; break;
+ }
+ Cairo.cairo_set_line_cap(cairo, cap);
+ int join = Cairo.CAIRO_LINE_JOIN_MITER;
+ switch (values.join_style) {
+ case OS.GDK_JOIN_MITER: join = Cairo.CAIRO_LINE_JOIN_MITER; break;
+ case OS.GDK_JOIN_ROUND: join = Cairo.CAIRO_LINE_JOIN_ROUND; break;
+ case OS.GDK_JOIN_BEVEL: join = Cairo.CAIRO_LINE_JOIN_BEVEL; break;
+ }
+ Cairo.cairo_set_line_join(cairo, join);
+ if (data.dashes != null) {
+ double[] dashes = new double[data.dashes.length];
+ for (int i = 0; i < dashes.length; i++) {
+ dashes[i] = data.dashes[i];
+ }
+ Cairo.cairo_set_dash(cairo, dashes, dashes.length, 0);
+ }
+ setCairoFont(cairo, data.font);
+ setCairoClip(cairo, data.clipRgn);
+}
+
/**
* Returns <code>true</code> if the receiver has a clipping
* region set into it, and <code>false</code> otherwise.
@@ -1710,6 +2020,20 @@ public boolean isDisposed() {
return handle == 0;
}
+boolean isIdentity(int /*long*/ matrix) {
+ if (matrix == 0) return true;
+ double[] a = new double[1], b = new double[1], c = new double[1];
+ double[] d = new double[1], tx = new double[1], ty = new double[1];
+ Cairo.cairo_matrix_get_affine(matrix, a, b, c, d, tx, ty);
+ return a[0] == 1 && b[0] == 0 && c[0] == 0 && d[0] == 1 && tx[0] == 0 && ty[0] == 0;
+}
+
+public void setAlpha(int alpha) {
+ if (handle == 0) SWT.error(SWT.ERROR_GRAPHIC_DISPOSED);
+ initCairo();
+ Cairo.cairo_set_alpha(data.cairo, alpha / 255f);
+}
+
/**
* Sets the background color. The background color is used
* for fill operations and as the background color when text
@@ -1732,11 +2056,51 @@ public void setBackground(Color color) {
OS.gdk_gc_set_background(handle, color.handle);
}
+static void setCairoFont(int /*long*/ cairo, Font font) {
+ setCairoFont(cairo, font.handle);
+}
+
+static void setCairoFont(int /*long*/ cairo, int /*long*/ font) {
+ int /*long*/ family = OS.pango_font_description_get_family(font);
+ int length = OS.strlen(family);
+ byte[] buffer = new byte[length + 1];
+ OS.memmove(buffer, family, length);
+ //TODO - convert font height from pango to cairo
+ double height = OS.PANGO_PIXELS(OS.pango_font_description_get_size(font)) * 96 / 72;
+ int pangoStyle = OS.pango_font_description_get_style(font);
+ int pangoWeight = OS.pango_font_description_get_weight(font);
+ int slant = Cairo.CAIRO_FONT_SLANT_NORMAL;
+ if (pangoStyle == OS.PANGO_STYLE_ITALIC) slant = Cairo.CAIRO_FONT_SLANT_ITALIC;
+ if (pangoStyle == OS.PANGO_STYLE_OBLIQUE) slant = Cairo.CAIRO_FONT_SLANT_OBLIQUE;
+ int weight = Cairo.CAIRO_FONT_WEIGHT_NORMAL;
+ if (pangoWeight == OS.PANGO_WEIGHT_BOLD) weight = Cairo.CAIRO_FONT_WEIGHT_BOLD;
+ Cairo.cairo_select_font(cairo, buffer, slant, weight);
+ Cairo.cairo_scale_font(cairo, height);
+}
+
+static void setCairoClip(int /*long*/ cairo, int /*long*/ clipRgn) {
+ Cairo.cairo_init_clip(cairo);
+ if (clipRgn == 0) return;
+ int[] nRects = new int[1];
+ int /*long*/[] rects = new int /*long*/[1];
+ OS.gdk_region_get_rectangles(clipRgn, rects, nRects);
+ GdkRectangle rect = new GdkRectangle();
+ for (int i=0; i<nRects[0]; i++) {
+ OS.memmove(rect, rects[0] + (i * GdkRectangle.sizeof), GdkRectangle.sizeof);
+ Cairo.cairo_rectangle(cairo, rect.x, rect.y, rect.width, rect.height);
+ }
+ Cairo.cairo_clip(cairo);
+ Cairo.cairo_new_path(cairo);
+ if (rects[0] != 0) OS.g_free(rects[0]);
+}
+
void setClipping(int /*long*/ clipRgn) {
if (clipRgn == 0) {
if (data.clipRgn != 0) {
OS.gdk_region_destroy(data.clipRgn);
data.clipRgn = 0;
+ } else {
+ return;
}
int /*long*/ clipping = data.damageRgn != 0 ? data.damageRgn : 0;
OS.gdk_gc_set_clip_region(handle, clipping);
@@ -1753,6 +2117,10 @@ void setClipping(int /*long*/ clipRgn) {
OS.gdk_gc_set_clip_region(handle, clipping);
if (clipping != clipRgn) OS.gdk_region_destroy(clipping);
}
+ int /*long*/ cairo = data.cairo;
+ if (cairo != 0) {
+ setCairoClip(cairo, clipRgn);
+ }
}
/**
@@ -1790,6 +2158,19 @@ public void setClipping(int x, int y, int width, int height) {
OS.gdk_region_destroy(clipRgn);
}
+public void setClipping(Path path) {
+ if (handle == 0) SWT.error(SWT.ERROR_GRAPHIC_DISPOSED);
+ if (path != null && path.isDisposed()) SWT.error(SWT.ERROR_GRAPHIC_DISPOSED);
+ setClipping(0);
+ if (path != null) {
+ initCairo();
+ int /*long*/ cairo = data.cairo;
+ Cairo.cairo_add_path(cairo, path.handle);
+ Cairo.cairo_clip(cairo);
+ Cairo.cairo_new_path(cairo);
+ }
+}
+
/**
* Sets the area of the receiver which can be changed
* by drawing operations to the rectangular area specified
@@ -1816,6 +2197,9 @@ public void setClipping(Rectangle rect) {
*
* @param region the clipping region.
*
+ * * @exception IllegalArgumentException <ul>
+ * <li>ERROR_INVALID_ARGUMENT - if the region has been disposed</li>
+ * </ul>
* @exception SWTException <ul>
* <li>ERROR_GRAPHIC_DISPOSED - if the receiver has been disposed</li>
* </ul>
@@ -1848,6 +2232,10 @@ public void setFont(Font font) {
int /*long*/ fontHandle = data.font = font.handle;
OS.pango_layout_set_font_description(data.layout, fontHandle);
data.stringWidth = data.stringHeight = -1;
+ int /*long*/ cairo = data.cairo;
+ if (cairo != 0) {
+ setCairoFont(cairo, fontHandle);
+ }
}
/**
@@ -1869,20 +2257,28 @@ public void setForeground(Color color) {
if (color == null) SWT.error(SWT.ERROR_NULL_ARGUMENT);
if (color.isDisposed()) SWT.error(SWT.ERROR_INVALID_ARGUMENT);
OS.gdk_gc_set_foreground(handle, color.handle);
+ int /*long*/ cairo = data.cairo;
+ if (cairo != 0) {
+ GdkColor gdkColor = color.handle;
+ Cairo.cairo_set_rgb_color(cairo, (gdkColor.red & 0xFFFF) / (float)0xFFFF, (gdkColor.green & 0xFFFF) / (float)0xFFFF, (gdkColor.blue & 0xFFFF) / (float)0xFFFF);
+ }
}
public void setLineCap(int cap) {
if (handle == 0) SWT.error(SWT.ERROR_GRAPHIC_DISPOSED);
- int cap_style = 0;
+ int cap_style = 0, cairo_style = 0;
switch (cap) {
case SWT.CAP_ROUND:
cap_style = OS.GDK_CAP_ROUND;
+ cairo_style = Cairo.CAIRO_LINE_CAP_ROUND;
break;
case SWT.CAP_FLAT:
cap_style = OS.GDK_CAP_BUTT;
+ cairo_style = Cairo.CAIRO_LINE_CAP_BUTT;
break;
case SWT.CAP_SQUARE:
cap_style = OS.GDK_CAP_PROJECTING;
+ cairo_style = Cairo.CAIRO_LINE_CAP_SQUARE;
break;
default:
SWT.error(SWT.ERROR_INVALID_ARGUMENT);
@@ -1891,6 +2287,10 @@ public void setLineCap(int cap) {
OS.gdk_gc_get_values(handle, values);
int line_style = data.lineStyle == SWT.LINE_SOLID ? OS.GDK_LINE_SOLID : OS.GDK_LINE_ON_OFF_DASH;
OS.gdk_gc_set_line_attributes(handle, values.line_width, line_style, cap_style, values.join_style);
+ int /*long*/ cairo = data.cairo;
+ if (cairo != 0) {
+ Cairo.cairo_set_line_cap(cairo, cairo_style);
+ }
}
public void setLineDash(int[] dashes) {
@@ -1913,20 +2313,35 @@ public void setLineDash(int[] dashes) {
OS.gdk_gc_get_values(handle, values);
int line_style = data.lineStyle == SWT.LINE_SOLID ? OS.GDK_LINE_SOLID : OS.GDK_LINE_ON_OFF_DASH;
OS.gdk_gc_set_line_attributes(handle, values.line_width, line_style, values.cap_style, values.join_style);
+ int /*long*/ cairo = data.cairo;
+ if (cairo != 0) {
+ if (data.dashes != null) {
+ double[] cairoDashes = new double[data.dashes.length];
+ for (int i = 0; i < dashes.length; i++) {
+ cairoDashes[i] = data.dashes[i];
+ }
+ Cairo.cairo_set_dash(cairo, cairoDashes, cairoDashes.length, 0);
+ } else {
+ Cairo.cairo_set_dash(cairo, null, 0, 0);
+ }
+ }
}
public void setLineJoin(int join) {
if (handle == 0) SWT.error(SWT.ERROR_GRAPHIC_DISPOSED);
- int join_style = 0;
+ int join_style = 0, cairo_style = 0;
switch (join) {
case SWT.JOIN_MITER:
join_style = OS.GDK_JOIN_MITER;
+ cairo_style = Cairo.CAIRO_LINE_JOIN_MITER;
break;
case SWT.JOIN_ROUND:
join_style = OS.GDK_JOIN_ROUND;
+ cairo_style = Cairo.CAIRO_LINE_JOIN_ROUND;
break;
case SWT.JOIN_BEVEL:
join_style = OS.GDK_JOIN_BEVEL;
+ cairo_style = Cairo.CAIRO_LINE_JOIN_BEVEL;
break;
default:
SWT.error(SWT.ERROR_INVALID_ARGUMENT);
@@ -1935,6 +2350,10 @@ public void setLineJoin(int join) {
OS.gdk_gc_get_values(handle, values);
int line_style = data.lineStyle == SWT.LINE_SOLID ? OS.GDK_LINE_SOLID : OS.GDK_LINE_ON_OFF_DASH;
OS.gdk_gc_set_line_attributes(handle, values.line_width, line_style, values.cap_style, join_style);
+ int /*long*/ cairo = data.cairo;
+ if (cairo != 0) {
+ Cairo.cairo_set_line_join(cairo, cairo_style);
+ }
}
/**
@@ -1951,28 +2370,42 @@ public void setLineJoin(int join) {
*/
public void setLineStyle(int lineStyle) {
if (handle == 0) SWT.error(SWT.ERROR_GRAPHIC_DISPOSED);
+ int /*long*/ cairo = data.cairo;
int line_style = OS.GDK_LINE_ON_OFF_DASH;
switch (lineStyle) {
case SWT.LINE_SOLID:
line_style = OS.GDK_LINE_SOLID;
+ if (cairo != 0) Cairo.cairo_set_dash(cairo, null, 0, 0);
break;
case SWT.LINE_DASH:
OS.gdk_gc_set_dashes(handle, 0, new byte[] {18, 6}, 2);
+ if (cairo != 0) Cairo.cairo_set_dash(cairo, new double[] {18, 6}, 2, 0);
break;
case SWT.LINE_DOT:
OS.gdk_gc_set_dashes(handle, 0, new byte[] {3, 3}, 2);
+ if (cairo != 0) Cairo.cairo_set_dash(cairo, new double[] {3, 3}, 2, 0);
break;
case SWT.LINE_DASHDOT:
OS.gdk_gc_set_dashes(handle, 0, new byte[] {9, 6, 3, 6}, 4);
+ if (cairo != 0) Cairo.cairo_set_dash(cairo, new double[] {9, 6, 3, 6}, 4, 0);
break;
case SWT.LINE_DASHDOTDOT:
OS.gdk_gc_set_dashes(handle, 0, new byte[] {9, 3, 3, 3, 3, 3}, 6);
+ if (cairo != 0) Cairo.cairo_set_dash(cairo, new double[] {9, 3, 3, 3, 3, 3}, 6, 0);
case SWT.LINE_CUSTOM:
byte[] dash_list = data.dashes;
if (dash_list != null) {
OS.gdk_gc_set_dashes(handle, 0, dash_list, dash_list.length);
+ if (cairo != 0) {
+ double[] dashes = new double[data.dashes.length];
+ for (int i = 0; i < dashes.length; i++) {
+ dashes[i] = data.dashes[i];
+ }
+ Cairo.cairo_set_dash(cairo, dashes, dashes.length, 0);
+ }
} else {
line_style = OS.GDK_LINE_SOLID;
+ if (cairo != 0) Cairo.cairo_set_dash(cairo, null, 0, 0);
}
break;
default:
@@ -2002,6 +2435,10 @@ public void setLineWidth(int width) {
OS.gdk_gc_get_values(handle, values);
int line_style = data.lineStyle == SWT.LINE_SOLID ? OS.GDK_LINE_SOLID : OS.GDK_LINE_ON_OFF_DASH;
OS.gdk_gc_set_line_attributes(handle, width, line_style, values.cap_style, values.join_style);
+ int /*long*/ cairo = data.cairo;
+ if (cairo != 0) {
+ Cairo.cairo_set_line_width(cairo, width);
+ }
}
void setString(String string, int flags) {
@@ -2045,6 +2482,59 @@ void setString(String string, int flags) {
data.drawFlags = flags;
}
+public void setTransform(Transform transform) {
+ if (handle == 0) SWT.error(SWT.ERROR_GRAPHIC_DISPOSED);
+ if (transform == null) SWT.error(SWT.ERROR_NULL_ARGUMENT);
+ if (transform.isDisposed()) SWT.error(SWT.ERROR_INVALID_ARGUMENT);
+ initCairo();
+ int /*long*/ cairo = data.cairo;
+ Cairo.cairo_concat_matrix(cairo, data.inverseMatrix);
+ Cairo.cairo_concat_matrix(cairo, transform.handle);
+ Cairo.cairo_matrix_copy(data.matrix, transform.handle);
+ Cairo.cairo_matrix_copy(data.inverseMatrix, transform.handle);
+ Cairo.cairo_matrix_invert(data.inverseMatrix);
+ //TODO - round off problems
+ int /*long*/ clipRgn = data.clipRgn;
+ if (clipRgn != 0) {
+ int /*long*/ matrix = data.inverseMatrix;
+ int /*long*/ newRgn = OS.gdk_region_new();
+ int[] nRects = new int[1];
+ int /*long*/[] rects = new int /*long*/[1];
+ OS.gdk_region_get_rectangles(clipRgn, rects, nRects);
+ GdkRectangle rect = new GdkRectangle();
+ int[] pointArray = new int[8];
+ double[] x = new double[1], y = new double[1];
+ for (int i=0; i<nRects[0]; i++) {
+ OS.memmove(rect, rects[0] + (i * GdkRectangle.sizeof), GdkRectangle.sizeof);
+ x[0] = rect.x;
+ y[0] = rect.y;
+ Cairo.cairo_matrix_transform_point(matrix, x, y);
+ pointArray[0] = (int)Math.round(x[0]);
+ pointArray[1] = (int)Math.round(y[0]);
+ x[0] = rect.x + rect.width;
+ y[0] = rect.y;
+ Cairo.cairo_matrix_transform_point(matrix, x, y);
+ pointArray[2] = (int)Math.round(x[0]);
+ pointArray[3] = (int)Math.round(y[0]);
+ x[0] = rect.x + rect.width;
+ y[0] = rect.y + rect.height;
+ Cairo.cairo_matrix_transform_point(matrix, x, y);
+ pointArray[4] = (int)Math.round(x[0]);
+ pointArray[5] = (int)Math.round(y[0]);
+ x[0] = rect.x;
+ y[0] = rect.y + rect.height;
+ Cairo.cairo_matrix_transform_point(matrix, x, y);
+ pointArray[6] = (int)Math.round(x[0]);
+ pointArray[7] = (int)Math.round(y[0]);
+ int /*long*/ polyRgn = OS.gdk_region_polygon(pointArray, pointArray.length / 2, OS.GDK_EVEN_ODD_RULE);
+ OS.gdk_region_union(newRgn, polyRgn);
+ OS.gdk_region_destroy(polyRgn);
+ }
+ OS.gdk_region_destroy(clipRgn);
+ data.clipRgn = newRgn;
+ }
+}
+
/**
* If the argument is <code>true</code>, puts the receiver
* in a drawing mode where the resulting color in the destination
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/graphics/GCData.java b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/graphics/GCData.java
index 320d7fca34..7dd8743351 100644
--- a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/graphics/GCData.java
+++ b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/graphics/GCData.java
@@ -39,6 +39,9 @@ public final class GCData {
public byte[] dashes;
public boolean xorMode;
+ public int /*long*/ cairo;
+ public int /*long*/ matrix, inverseMatrix;
+
public String string;
public int stringWidth = -1;
public int stringHeight = -1;
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/graphics/Image.java b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/graphics/Image.java
index 1847a02220..9da6e5816f 100644
--- a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/graphics/Image.java
+++ b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/graphics/Image.java
@@ -11,6 +11,7 @@
package org.eclipse.swt.graphics;
+import org.eclipse.swt.internal.cairo.*;
import org.eclipse.swt.internal.gtk.*;
import org.eclipse.swt.*;
import java.io.*;
@@ -94,6 +95,8 @@ public final class Image implements Drawable {
*/
public int /*long*/ mask;
+ int /*long*/ surface;
+
/**
* The device where this image was created.
*/
@@ -558,7 +561,8 @@ public void dispose () {
if (memGC != null) memGC.dispose();
if (pixmap != 0) OS.g_object_unref(pixmap);
if (mask != 0) OS.g_object_unref(mask);
- pixmap = mask = 0;
+ if (surface != 0) Cairo.cairo_surface_destroy(surface);
+ surface = pixmap = mask = 0;
memGC = null;
if (device.tracking) device.dispose_Object(this);
device = null;
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/motif/org/eclipse/swt/graphics/Device.java b/bundles/org.eclipse.swt/Eclipse SWT/motif/org/eclipse/swt/graphics/Device.java
index d0d22d52ef..2c20828ec3 100755
--- a/bundles/org.eclipse.swt/Eclipse SWT/motif/org/eclipse/swt/graphics/Device.java
+++ b/bundles/org.eclipse.swt/Eclipse SWT/motif/org/eclipse/swt/graphics/Device.java
@@ -169,6 +169,14 @@ public Device(DeviceData data) {
systemFont = getSystemFont ();
}
+void checkCairo() {
+ try {
+ Class.forName("org.eclipse.swt.internal.cairo.Cairo");
+ } catch (Throwable t) {
+ SWT.error(SWT.ERROR_NO_GRAPHICS_LIBRARY, t);
+ }
+}
+
/**
* Throws an <code>SWTException</code> if the receiver can not
* be accessed by the caller. This may include both checks on
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/motif/org/eclipse/swt/graphics/GC.java b/bundles/org.eclipse.swt/Eclipse SWT/motif/org/eclipse/swt/graphics/GC.java
index 29ae7ff3f4..60872c3cfc 100755
--- a/bundles/org.eclipse.swt/Eclipse SWT/motif/org/eclipse/swt/graphics/GC.java
+++ b/bundles/org.eclipse.swt/Eclipse SWT/motif/org/eclipse/swt/graphics/GC.java
@@ -12,6 +12,7 @@ package org.eclipse.swt.graphics;
import org.eclipse.swt.internal.*;
+import org.eclipse.swt.internal.cairo.*;
import org.eclipse.swt.internal.motif.*;
import org.eclipse.swt.*;
@@ -206,7 +207,15 @@ public void copyArea(Image image, int x, int y) {
public void dispose () {
if (handle == 0) return;
if (data.device.isDisposed()) return;
-
+
+ int /*long*/ cairo = data.cairo;
+ if (cairo != 0) Cairo.cairo_destroy(cairo);
+ int /*long*/ matrix = data.matrix;
+ if (matrix != 0) Cairo.cairo_matrix_destroy(matrix);
+ int /*long*/ inverseMatrix = data.inverseMatrix;
+ if (inverseMatrix != 0) Cairo.cairo_matrix_destroy(inverseMatrix);
+ data.cairo = data.matrix = data.inverseMatrix = 0;
+
/* Free resources */
int clipRgn = data.clipRgn;
if (clipRgn != 0) OS.XDestroyRegion(clipRgn);
@@ -280,6 +289,17 @@ public void drawArc(int x, int y, int width, int height, int startAngle, int arc
height = -height;
}
if (width == 0 || height == 0 || arcAngle == 0) return;
+ int /*long*/ cairo = data.cairo;
+ if (cairo != 0) {
+ Cairo.cairo_save(cairo);
+ Cairo.cairo_translate(cairo, x + width / 2f, y + height / 2f);
+ Cairo.cairo_scale(cairo, width / 2f, height / 2f);
+ Cairo.cairo_set_line_width(cairo, Cairo.cairo_current_line_width(cairo) / (width / 2f));
+ Cairo.cairo_arc_negative(cairo, 0, 0, 1, -startAngle * (float)Compatibility.PI / 180, -(startAngle + arcAngle) * (float)Compatibility.PI / 180);
+ Cairo.cairo_stroke(cairo);
+ Cairo.cairo_restore(cairo);
+ return;
+ }
OS.XDrawArc(data.display, data.drawable, handle, x, y, width, height, startAngle * 64, arcAngle * 64);
}
/**
@@ -603,6 +623,30 @@ void drawImageMask(Image srcImage, int srcX, int srcY, int srcWidth, int srcHeig
if (srcImage.transparentPixel != -1 && srcImage.memGC != null) srcImage.destroyMask();
}
void drawImage(Image srcImage, int srcX, int srcY, int srcWidth, int srcHeight, int destX, int destY, int destWidth, int destHeight, boolean simple, int imgWidth, int imgHeight, int depth) {
+ int /*long*/ cairo = data.cairo;
+ if (cairo != 0) {
+ if (srcImage.surface == 0) {
+ int /*long*/ xDisplay = data.display;
+ int /*long*/ xDrawable = srcImage.pixmap;
+ int /*long*/ xVisual = OS.XDefaultVisual(xDisplay, OS.XDefaultScreen(xDisplay));
+ int /*long*/ xColormap = data.colormap;
+ srcImage.surface = Cairo.cairo_xlib_surface_create(xDisplay, xDrawable, xVisual, 0, xColormap);
+ }
+ Cairo.cairo_save(cairo);
+ //TODO - draw a piece of the image
+// if (srcX != 0 || srcY != 0) {
+// Cairo.cairo_rectangle(cairo, destX, destY, destWidth, destHeight);
+// Cairo.cairo_clip(cairo);
+// Cairo.cairo_new_path(cairo);
+// }
+ Cairo.cairo_translate(cairo, destX - srcX, destY - srcY);
+ if (srcWidth != destWidth || srcHeight != destHeight) {
+ Cairo.cairo_scale(cairo, destWidth / (float)srcWidth, destHeight / (float)srcHeight);
+ }
+ Cairo.cairo_show_surface(cairo, srcImage.surface, imgWidth, imgHeight);
+ Cairo.cairo_restore(cairo);
+ return;
+ }
int xDisplay = data.display;
int xDrawable = data.drawable;
/* Simple case: no stretching */
@@ -698,6 +742,13 @@ static int scalePixmap(int display, int pixmap, int srcX, int srcY, int srcWidth
*/
public void drawLine (int x1, int y1, int x2, int y2) {
if (handle == 0) SWT.error(SWT.ERROR_GRAPHIC_DISPOSED);
+ int /*long*/ cairo = data.cairo;
+ if (cairo != 0) {
+ Cairo.cairo_move_to(cairo, x1, y1);
+ Cairo.cairo_line_to(cairo, x2, y2);
+ Cairo.cairo_stroke(cairo);
+ return;
+ }
OS.XDrawLine (data.display, data.drawable, handle, x1, y1, x2, y2);
}
/**
@@ -731,8 +782,26 @@ public void drawOval(int x, int y, int width, int height) {
y = y + height;
height = -height;
}
+ int /*long*/ cairo = data.cairo;
+ if (cairo != 0) {
+ Cairo.cairo_save(cairo);
+ Cairo.cairo_translate(cairo, x + width / 2f, y + height / 2f);
+ Cairo.cairo_scale(cairo, width / 2f, height / 2f);
+ Cairo.cairo_set_line_width(cairo, Cairo.cairo_current_line_width(cairo) / (width / 2f));
+ Cairo.cairo_arc_negative(cairo, 0, 0, 1, 0, -2 * (float)Compatibility.PI);
+ Cairo.cairo_stroke(cairo);
+ Cairo.cairo_restore(cairo);
+ return;
+ }
OS.XDrawArc(data.display, data.drawable, handle, x, y, width, height, 0, 23040);
}
+public void drawPath(Path path) {
+ if (handle == 0) SWT.error(SWT.ERROR_GRAPHIC_DISPOSED);
+ if (path.handle == 0) SWT.error(SWT.ERROR_INVALID_ARGUMENT);
+ initCairo();
+ Cairo.cairo_add_path(data.cairo, path.handle);
+ Cairo.cairo_stroke(data.cairo);
+}
/**
* Draws a pixel, using the foreground color, at the specified
* point (<code>x</code>, <code>y</code>).
@@ -752,6 +821,12 @@ public void drawOval(int x, int y, int width, int height) {
*/
public void drawPoint (int x, int y) {
if (handle == 0) SWT.error(SWT.ERROR_GRAPHIC_DISPOSED);
+ int /*long*/ cairo = data.cairo;
+ if (cairo != 0) {
+ Cairo.cairo_rectangle(cairo, x, y, 1, 1);
+ Cairo.cairo_fill(cairo);
+ return;
+ }
OS.XDrawPoint(data.display, data.drawable, handle, x, y);
}
/**
@@ -774,6 +849,12 @@ public void drawPoint (int x, int y) {
public void drawPolygon(int[] pointArray) {
if (handle == 0) SWT.error(SWT.ERROR_GRAPHIC_DISPOSED);
if (pointArray == null) SWT.error(SWT.ERROR_NULL_ARGUMENT);
+ int /*long*/ cairo = data.cairo;
+ if (cairo != 0) {
+ drawPolyline(cairo, pointArray, true);
+ Cairo.cairo_stroke(cairo);
+ return;
+ }
// Motif does not have a native drawPolygon() call. Instead we ensure
// that the first and last points are the same and call drawPolyline().
@@ -833,12 +914,27 @@ public void drawPolygon(int[] pointArray) {
public void drawPolyline(int[] pointArray) {
if (handle == 0) SWT.error(SWT.ERROR_GRAPHIC_DISPOSED);
if (pointArray == null) SWT.error(SWT.ERROR_NULL_ARGUMENT);
+ int /*long*/ cairo = data.cairo;
+ if (cairo != 0) {
+ drawPolyline(cairo, pointArray, false);
+ Cairo.cairo_stroke(cairo);
+ return;
+ }
short[] xPoints = new short[pointArray.length];
for (int i = 0; i<pointArray.length;i++) {
xPoints[i] = (short) pointArray[i];
}
OS.XDrawLines(data.display,data.drawable,handle,xPoints,xPoints.length / 2, OS.CoordModeOrigin);
}
+void drawPolyline(int /*long*/ cairo, int[] pointArray, boolean close) {
+ int count = pointArray.length / 2;
+ if (count == 0) return;
+ Cairo.cairo_move_to(cairo, pointArray[0], pointArray[1]);
+ for (int i = 1, j=2; i < count; i++, j += 2) {
+ Cairo.cairo_line_to(cairo, pointArray[j], pointArray[j + 1]);
+ }
+ if (close) Cairo.cairo_close_path(cairo);
+}
/**
* Draws the outline of the rectangle specified by the arguments,
* using the receiver's foreground color. The left and right edges
@@ -864,6 +960,12 @@ public void drawRectangle (int x, int y, int width, int height) {
y = y + height;
height = -height;
}
+ int /*long*/ cairo = data.cairo;
+ if (cairo != 0) {
+ Cairo.cairo_rectangle(cairo, x, y, width, height);
+ Cairo.cairo_stroke(cairo);
+ return;
+ }
OS.XDrawRectangle (data.display, data.drawable, handle, x, y, width, height);
}
/**
@@ -907,17 +1009,12 @@ public void drawRectangle (Rectangle rect) {
*/
public void drawRoundRectangle (int x, int y, int width, int height, int arcWidth, int arcHeight) {
if (handle == 0) SWT.error(SWT.ERROR_GRAPHIC_DISPOSED);
-
- // X does not have a native for drawing round rectangles. Do the work in Java
- // and use drawLine() drawArc() calls.
-
int nx = x;
int ny = y;
int nw = width;
int nh = height;
int naw = arcWidth;
int nah = arcHeight;
-
if (nw < 0) {
nw = 0 - nw;
nx = nx - nw;
@@ -926,17 +1023,32 @@ public void drawRoundRectangle (int x, int y, int width, int height, int arcWidt
nh = 0 - nh;
ny = ny - nh;
}
- if (naw < 0)
- naw = 0 - naw;
- if (nah < 0)
- nah = 0 - nah;
-
+ if (naw < 0) naw = 0 - naw;
+ if (nah < 0) nah = 0 - nah;
+ int /*long*/ cairo = data.cairo;
+ if (cairo != 0) {
+ float naw2 = naw / 2f;
+ float nah2 = nah / 2f;
+ float fw = nw / naw2;
+ float fh = nh / nah2;
+ Cairo.cairo_new_path(cairo);
+ Cairo.cairo_save(cairo);
+ Cairo.cairo_translate(cairo, nx, ny);
+ Cairo.cairo_scale(cairo, naw2, nah2);
+ Cairo.cairo_move_to(cairo, fw - 1, 0);
+// Cairo.cairo_arc_to(cairo, 0, 0, 0, 1, 1);
+// Cairo.cairo_arc_to(cairo, 0, fh, 1, fh, 1);
+// Cairo.cairo_arc_to(cairo, fw, fh, fw, fh - 1, 1);
+// Cairo.cairo_arc_to(cairo, fw, 0, fw - 1, 0, 1);
+ Cairo.cairo_close_path(handle);
+ Cairo.cairo_stroke(cairo);
+ Cairo.cairo_restore(cairo);
+ return;
+ }
int naw2 = naw / 2;
int nah2 = nah / 2;
-
int xDisplay = data.display;
int xDrawable = data.drawable;
-
if (nw > naw) {
if (nh > nah) {
OS.XDrawArc(xDisplay, xDrawable, handle, nx, ny, naw, nah, 5760, 5760);
@@ -1009,6 +1121,18 @@ public void drawString (String string, int x, int y, boolean isTransparent) {
if (handle == 0) SWT.error(SWT.ERROR_GRAPHIC_DISPOSED);
if (string == null) SWT.error(SWT.ERROR_NULL_ARGUMENT);
if (string.length() == 0) return;
+ int /*long*/ cairo = data.cairo;
+ if (cairo != 0) {
+ //TODO - honor isTransparent
+ cairo_font_extents_t extents = new cairo_font_extents_t();
+ Cairo.cairo_current_font_extents(cairo, extents);
+ double baseline = y + extents.ascent;
+ Cairo.cairo_move_to(cairo, x, baseline);
+ byte[] buffer = Converter.wcsToMbcs(null, string, true);
+ Cairo.cairo_text_path(cairo, buffer);
+ Cairo.cairo_fill(cairo);
+ return;
+ }
setString(string);
if (isTransparent) {
OS.XmStringDraw (data.display, data.drawable, data.font.handle, data.xmString, handle, x, y, 0x7FFFFFFF, OS.XmALIGNMENT_BEGINNING, 0, null);
@@ -1152,6 +1276,18 @@ public void drawText (String string, int x, int y, int flags) {
if (handle == 0) SWT.error(SWT.ERROR_GRAPHIC_DISPOSED);
if (string == null) SWT.error(SWT.ERROR_NULL_ARGUMENT);
if (string.length() == 0) return;
+ int /*long*/ cairo = data.cairo;
+ if (cairo != 0) {
+ //TODO - honor flags
+ cairo_font_extents_t extents = new cairo_font_extents_t();
+ Cairo.cairo_current_font_extents(cairo, extents);
+ double baseline = y + extents.ascent;
+ Cairo.cairo_move_to(cairo, x, baseline);
+ byte[] buffer = Converter.wcsToMbcs(null, string, true);
+ Cairo.cairo_text_path(cairo, buffer);
+ Cairo.cairo_fill(cairo);
+ return;
+ }
setText(string, flags);
int xmMnemonic = data.xmMnemonic;
if (xmMnemonic != 0) {
@@ -1225,6 +1361,21 @@ public void fillArc(int x, int y, int width, int height, int startAngle, int arc
int xDisplay = data.display;
XGCValues values = new XGCValues ();
OS.XGetGCValues (xDisplay, handle, OS.GCForeground | OS.GCBackground, values);
+ int /*long*/ cairo = data.cairo;
+ if (cairo != 0) {
+ XColor color = new XColor();
+ color.pixel = values.background;
+ OS.XQueryColor(xDisplay, data.colormap, color);
+ Cairo.cairo_save(cairo);
+ Cairo.cairo_set_rgb_color(cairo, (color.red & 0xFFFF) / (float)0xFFFF, (color.green & 0xFFFF) / (float)0xFFFF, (color.blue & 0xFFFF) / (float)0xFFFF);
+ Cairo.cairo_translate(cairo, x + width / 2f, y + height / 2f);
+ Cairo.cairo_scale(cairo, width / 2f, height / 2f);
+ Cairo.cairo_arc_negative(cairo, 0, 0, 1, -startAngle * (float)Compatibility.PI / 180, -(startAngle + arcAngle) * (float)Compatibility.PI / 180);
+ Cairo.cairo_line_to(cairo, 0, 0);
+ Cairo.cairo_fill(cairo);
+ Cairo.cairo_restore(cairo);
+ return;
+ }
OS.XSetForeground (xDisplay, handle, values.background);
OS.XFillArc(xDisplay, data.drawable, handle, x, y, width, height, startAngle * 64, arcAngle * 64);
OS.XSetForeground (xDisplay, handle, values.foreground);
@@ -1300,7 +1451,26 @@ public void fillGradientRectangle(int x, int y, int width, int height, boolean v
xColor.pixel = toColor;
OS.XQueryColor(xDisplay, data.colormap, xColor);
final RGB toRGB = new RGB((xColor.red & 0xffff) >>> 8, (xColor.green & 0xffff) >>> 8, (xColor.blue & 0xffff) >>> 8);
-
+ int /*long*/ cairo = data.cairo;
+ if (cairo != 0) {
+ int /*long*/ pattern;
+ if (vertical) {
+ pattern = Cairo.cairo_pattern_create_linear (0.0, 0.0, 0.0, 1.0);
+ } else {
+ pattern = Cairo.cairo_pattern_create_linear (0.0, 0.0, 1.0, 0.0);
+ }
+ Cairo.cairo_pattern_add_color_stop (pattern, 0, fromRGB.red / 255f, fromRGB.green / 255f, fromRGB.blue / 255f, 1);
+ Cairo.cairo_pattern_add_color_stop (pattern, 1, toRGB.red / 255f, toRGB.green / 255f, toRGB.blue / 255f, 1);
+ Cairo.cairo_save(cairo);
+ Cairo.cairo_translate(cairo, x, y);
+ Cairo.cairo_scale(cairo, width, height);
+ Cairo.cairo_rectangle(cairo, 0, 0, 1, 1);
+ Cairo.cairo_set_pattern(cairo, pattern);
+ Cairo.cairo_fill(cairo);
+ Cairo.cairo_restore(cairo);
+ Cairo.cairo_pattern_destroy(pattern);
+ return;
+ }
final int redBits, greenBits, blueBits;
if (directColor) {
// RGB mapped display
@@ -1357,10 +1527,41 @@ public void fillOval (int x, int y, int width, int height) {
int display = data.display;
XGCValues values = new XGCValues ();
OS.XGetGCValues (display, handle, OS.GCForeground | OS.GCBackground, values);
+ int /*long*/ cairo = data.cairo;
+ if (cairo != 0) {
+ XColor color = new XColor();
+ color.pixel = values.background;
+ OS.XQueryColor(display, data.colormap, color);
+ Cairo.cairo_save(cairo);
+ Cairo.cairo_set_rgb_color(cairo, (color.red & 0xFFFF) / (float)0xFFFF, (color.green & 0xFFFF) / (float)0xFFFF, (color.blue & 0xFFFF) / (float)0xFFFF);
+ Cairo.cairo_translate(cairo, x + width / 2f, y + height / 2f);
+ Cairo.cairo_scale(cairo, width / 2f, height / 2f);
+ Cairo.cairo_arc_negative(cairo, 0, 0, 1, 0, 2 * (float)Compatibility.PI);
+ Cairo.cairo_fill(cairo);
+ Cairo.cairo_restore(cairo);
+ return;
+ }
OS.XSetForeground (display, handle, values.background);
OS.XFillArc (display, data.drawable, handle, x, y, width, height, 0, 23040);
OS.XSetForeground (display, handle, values.foreground);
}
+public void fillPath (Path path) {
+ if (handle == 0) SWT.error(SWT.ERROR_GRAPHIC_DISPOSED);
+ if (path.handle == 0) SWT.error(SWT.ERROR_INVALID_ARGUMENT);
+ initCairo();
+ int display = data.display;
+ XGCValues values = new XGCValues ();
+ OS.XGetGCValues (display, handle, OS.GCForeground | OS.GCBackground, values);
+ XColor color = new XColor();
+ color.pixel = values.background;
+ OS.XQueryColor(display, data.colormap, color);
+ int /*long*/ cairo = data.cairo;
+ Cairo.cairo_save(cairo);
+ Cairo.cairo_set_rgb_color(cairo, (color.red & 0xFFFF) / (float)0xFFFF, (color.green & 0xFFFF) / (float)0xFFFF, (color.blue & 0xFFFF) / (float)0xFFFF);
+ Cairo.cairo_add_path(cairo, path.handle);
+ Cairo.cairo_fill(cairo);
+ Cairo.cairo_restore(cairo);
+}
/**
* Fills the interior of the closed polygon which is defined by the
* specified array of integer coordinates, using the receiver's
@@ -1383,13 +1584,25 @@ public void fillOval (int x, int y, int width, int height) {
public void fillPolygon(int[] pointArray) {
if (handle == 0) SWT.error(SWT.ERROR_GRAPHIC_DISPOSED);
if (pointArray == null) SWT.error(SWT.ERROR_NULL_ARGUMENT);
+ int xDisplay = data.display;
+ XGCValues values = new XGCValues ();
+ OS.XGetGCValues (xDisplay, handle, OS.GCForeground | OS.GCBackground, values);
+ int /*long*/ cairo = data.cairo;
+ if (cairo != 0) {
+ XColor color = new XColor();
+ color.pixel = values.background;
+ OS.XQueryColor(xDisplay, data.colormap, color);
+ Cairo.cairo_save(cairo);
+ Cairo.cairo_set_rgb_color(cairo, (color.red & 0xFFFF) / (float)0xFFFF, (color.green & 0xFFFF) / (float)0xFFFF, (color.blue & 0xFFFF) / (float)0xFFFF);
+ drawPolyline(cairo, pointArray, true);
+ Cairo.cairo_fill(cairo);
+ Cairo.cairo_restore(cairo);
+ return;
+ }
short[] xPoints = new short[pointArray.length];
for (int i = 0; i<pointArray.length;i++) {
xPoints[i] = (short) pointArray[i];
}
- int xDisplay = data.display;
- XGCValues values = new XGCValues ();
- OS.XGetGCValues (xDisplay, handle, OS.GCForeground | OS.GCBackground, values);
OS.XSetForeground (xDisplay, handle, values.background);
OS.XFillPolygon(xDisplay, data.drawable, handle,xPoints, xPoints.length / 2, OS.Complex, OS.CoordModeOrigin);
OS.XSetForeground (xDisplay, handle, values.foreground);
@@ -1422,6 +1635,18 @@ public void fillRectangle (int x, int y, int width, int height) {
int xDisplay = data.display;
XGCValues values = new XGCValues ();
OS.XGetGCValues (xDisplay, handle, OS.GCForeground | OS.GCBackground, values);
+ int /*long*/ cairo = data.cairo;
+ if (cairo != 0) {
+ XColor color = new XColor();
+ color.pixel = values.background;
+ OS.XQueryColor(xDisplay, data.colormap, color);
+ Cairo.cairo_save(cairo);
+ Cairo.cairo_set_rgb_color(cairo, (color.red & 0xFFFF) / (float)0xFFFF, (color.green & 0xFFFF) / (float)0xFFFF, (color.blue & 0xFFFF) / (float)0xFFFF);
+ Cairo.cairo_rectangle(cairo, x, y, width, height);
+ Cairo.cairo_fill(cairo);
+ Cairo.cairo_restore(cairo);
+ return;
+ }
OS.XSetForeground (xDisplay, handle, values.background);
OS.XFillRectangle (xDisplay, data.drawable, handle, x, y, width, height);
OS.XSetForeground (xDisplay, handle, values.foreground);
@@ -1470,7 +1695,6 @@ public void fillRoundRectangle (int x, int y, int width, int height, int arcWidt
int nh = height;
int naw = arcWidth;
int nah = arcHeight;
-
if (nw < 0) {
nw = 0 - nw;
nx = nx - nw;
@@ -1479,20 +1703,38 @@ public void fillRoundRectangle (int x, int y, int width, int height, int arcWidt
nh = 0 - nh;
ny = ny -nh;
}
- if (naw < 0)
- naw = 0 - naw;
- if (nah < 0)
- nah = 0 - nah;
-
- int naw2 = naw / 2;
- int nah2 = nah / 2;
-
+ if (naw < 0) naw = 0 - naw;
+ if (nah < 0) nah = 0 - nah;
int xDisplay = data.display;
- int xDrawable = data.drawable;
XGCValues values = new XGCValues ();
OS.XGetGCValues(xDisplay, handle, OS.GCForeground | OS.GCBackground, values);
+ int /*long*/ cairo = data.cairo;
+ if (cairo != 0) {
+ float naw2 = naw / 2f;
+ float nah2 = nah / 2f;
+ float fw = nw / naw2;
+ float fh = nh / nah2;
+ XColor color = new XColor();
+ color.pixel = values.background;
+ OS.XQueryColor(xDisplay, data.colormap, color);
+ Cairo.cairo_save(cairo);
+ Cairo.cairo_set_rgb_color(cairo, (color.red & 0xFFFF) / (float)0xFFFF, (color.green & 0xFFFF) / (float)0xFFFF, (color.blue & 0xFFFF) / (float)0xFFFF);
+ Cairo.cairo_translate(cairo, nx, ny);
+ Cairo.cairo_scale(cairo, naw2, nah2);
+ Cairo.cairo_move_to(cairo, fw - 1, 0);
+// Cairo.cairo_arc_to(cairo, 0, 0, 0, 1, 1);
+// Cairo.cairo_arc_to(cairo, 0, fh, 1, fh, 1);
+// Cairo.cairo_arc_to(cairo, fw, fh, fw, fh - 1, 1);
+// Cairo.cairo_arc_to(cairo, fw, 0, fw - 1, 0, 1);
+ Cairo.cairo_close_path(handle);
+ Cairo.cairo_stroke(cairo);
+ Cairo.cairo_restore(cairo);
+ return;
+ }
+ int naw2 = naw / 2;
+ int nah2 = nah / 2;
+ int xDrawable = data.drawable;
OS.XSetForeground(xDisplay, handle, values.background);
-
if (nw > naw) {
if (nh > nah) {
OS.XFillArc(xDisplay, xDrawable, handle, nx, ny, naw, nah, 5760, 5760);
@@ -1679,6 +1921,11 @@ public int getAdvanceWidth(char ch) {
OS.XmFontListFreeFontContext(context);
return 0;
}
+public int getAlpha() {
+ if (handle == 0) SWT.error(SWT.ERROR_GRAPHIC_DISPOSED);
+ initCairo();
+ return (int)(Cairo.cairo_current_alpha(data.cairo) * 255);
+}
/**
* Returns the background color.
*
@@ -1921,6 +2168,7 @@ public void getClipping(Region region) {
OS.XUnionRectWithRegion(rect, hRegion, hRegion);
} else {
OS.XUnionRegion (hRegion, clipRgn, hRegion);
+ if (!isIdentity(data.matrix)) return;
}
if (data.damageRgn != 0) {
OS.XIntersectRegion(hRegion, data.damageRgn, hRegion);
@@ -2289,6 +2537,13 @@ public int getStyle () {
if (handle == 0) SWT.error(SWT.ERROR_GRAPHIC_DISPOSED);
return data.style;
}
+public void getTransform(Transform transform) {
+ if (handle == 0) SWT.error(SWT.ERROR_GRAPHIC_DISPOSED);
+ if (transform == null) SWT.error(SWT.ERROR_NULL_ARGUMENT);
+ if (transform.isDisposed()) SWT.error(SWT.ERROR_INVALID_ARGUMENT);
+ initCairo();
+ Cairo.cairo_matrix_copy(transform.handle, data.matrix);
+}
/**
* Returns <code>true</code> if this GC is drawing in the mode
* where the resulting color in the destination is the
@@ -2346,6 +2601,51 @@ void init(Drawable drawable, GCData data, int xGC) {
this.data = data;
handle = xGC;
}
+void initCairo() {
+ data.device.checkCairo();
+ int /*long*/ cairo = data.cairo;
+ if (cairo != 0) return;
+ data.cairo = cairo = Cairo.cairo_create();
+ if (cairo == 0) SWT.error(SWT.ERROR_NO_HANDLES);
+ data.matrix = Cairo.cairo_matrix_create();
+ if (data.matrix == 0) SWT.error(SWT.ERROR_NO_HANDLES);
+ data.inverseMatrix = Cairo.cairo_matrix_create();
+ if (data.inverseMatrix == 0) SWT.error(SWT.ERROR_NO_HANDLES);
+ int /*long*/ xDisplay = data.display;
+ int /*long*/ xDrawable = data.drawable;
+ Cairo.cairo_set_target_drawable(cairo, xDisplay, xDrawable);
+ Cairo.cairo_set_fill_rule(cairo, Cairo.CAIRO_FILL_RULE_EVEN_ODD);
+ XGCValues values = new XGCValues();
+ OS.XGetGCValues(xDisplay, handle, OS.GCBackground | OS.GCCapStyle | OS.GCForeground | OS.GCJoinStyle | OS.GCLineWidth, values);
+ XColor color = new XColor();
+ color.pixel = values.foreground;
+ OS.XQueryColor(xDisplay, data.colormap, color);
+ Cairo.cairo_set_rgb_color(cairo, (color.red & 0xFFFF) / (float)0xFFFF, (color.green & 0xFFFF) / (float)0xFFFF, (color.blue & 0xFFFF) / (float)0xFFFF);
+ Cairo.cairo_set_line_width(cairo, Math.max(1, values.line_width));
+ int cap = Cairo.CAIRO_LINE_CAP_BUTT;
+ switch (values.cap_style) {
+ case OS.CapRound: cap = Cairo.CAIRO_LINE_CAP_ROUND; break;
+ case OS.CapButt: cap = Cairo.CAIRO_LINE_CAP_BUTT; break;
+ case OS.CapProjecting: cap = Cairo.CAIRO_LINE_CAP_SQUARE; break;
+ }
+ Cairo.cairo_set_line_cap(cairo, cap);
+ int join = Cairo.CAIRO_LINE_JOIN_MITER;
+ switch (values.join_style) {
+ case OS.JoinMiter: join = Cairo.CAIRO_LINE_JOIN_MITER; break;
+ case OS.JoinRound: join = Cairo.CAIRO_LINE_JOIN_ROUND; break;
+ case OS.JoinBevel: join = Cairo.CAIRO_LINE_JOIN_BEVEL; break;
+ }
+ Cairo.cairo_set_line_join(cairo, join);
+ if (data.dashes != null) {
+ double[] dashes = new double[data.dashes.length];
+ for (int i = 0; i < dashes.length; i++) {
+ dashes[i] = data.dashes[i];
+ }
+ Cairo.cairo_set_dash(cairo, dashes, dashes.length, 0);
+ }
+ setCairoFont(cairo, data.font);
+ setCairoClip(cairo, data.clipRgn);
+}
/**
* Returns <code>true</code> if the receiver has a clipping
* region set into it, and <code>false</code> otherwise.
@@ -2377,6 +2677,18 @@ public boolean isClipped() {
public boolean isDisposed() {
return handle == 0;
}
+boolean isIdentity(int /*long*/ matrix) {
+ if (matrix == 0) return true;
+ double[] a = new double[1], b = new double[1], c = new double[1];
+ double[] d = new double[1], tx = new double[1], ty = new double[1];
+ Cairo.cairo_matrix_get_affine(matrix, a, b, c, d, tx, ty);
+ return a[0] == 1 && b[0] == 0 && c[0] == 0 && d[0] == 1 && tx[0] == 0 && ty[0] == 0;
+}
+public void setAlpha(int alpha) {
+ if (handle == 0) SWT.error(SWT.ERROR_GRAPHIC_DISPOSED);
+ initCairo();
+ Cairo.cairo_set_alpha(data.cairo, alpha / 255f);
+}
/**
* Invokes platform specific functionality to allocate a new graphics context.
* <p>
@@ -2439,6 +2751,29 @@ public void setBackground (Color color) {
if (color.isDisposed()) SWT.error(SWT.ERROR_INVALID_ARGUMENT);
OS.XSetBackground(data.display, handle, color.handle.pixel);
}
+static void setCairoFont(int /*long*/ cairo, Font font) {
+ //TODO - use X font instead of loading new one???
+ FontData[] fds = font.getFontData();
+ FontData fd = fds[0];
+ int style = fd.getStyle();
+ int slant = Cairo.CAIRO_FONT_SLANT_NORMAL;
+ if ((style & SWT.ITALIC) != 0) slant = Cairo.CAIRO_FONT_SLANT_ITALIC;
+ int weight = Cairo.CAIRO_FONT_WEIGHT_NORMAL;
+ if ((style & SWT.BOLD) != 0) weight = Cairo.CAIRO_FONT_WEIGHT_BOLD;
+ byte[] buffer = Converter.wcsToMbcs(null, fd.getName(), true);
+ Cairo.cairo_select_font(cairo, buffer, slant, weight);
+ Cairo.cairo_scale_font(cairo, fd.getHeight());
+}
+static void setCairoClip(int /*long*/ cairo, int /*long*/ clipRgn) {
+ Cairo.cairo_init_clip(cairo);
+ if (clipRgn == 0) return;
+ //TODO - get rectangles from region instead of clip box
+ XRectangle rect = new XRectangle();
+ OS.XClipBox(clipRgn, rect);
+ Cairo.cairo_rectangle(cairo, rect.x, rect.y, rect.width, rect.height);
+ Cairo.cairo_clip(cairo);
+ Cairo.cairo_new_path(cairo);
+}
void setClipping(int clipRgn) {
if (clipRgn == 0) {
if (data.clipRgn != 0) {
@@ -2463,6 +2798,10 @@ void setClipping(int clipRgn) {
OS.XSetRegion (data.display, handle, clipping);
if (clipping != clipRgn) OS.XDestroyRegion(clipping);
}
+ int /*long*/ cairo = data.cairo;
+ if (cairo != 0) {
+ setCairoClip(cairo, clipRgn);
+ }
}
/**
* Sets the area of the receiver which can be changed
@@ -2498,6 +2837,18 @@ public void setClipping (int x, int y, int width, int height) {
setClipping(clipRgn);
OS.XDestroyRegion(clipRgn);
}
+public void setClipping(Path path) {
+ if (handle == 0) SWT.error(SWT.ERROR_GRAPHIC_DISPOSED);
+ if (path != null && path.isDisposed()) SWT.error(SWT.ERROR_GRAPHIC_DISPOSED);
+ setClipping(0);
+ if (path != null) {
+ initCairo();
+ int /*long*/ cairo = data.cairo;
+ Cairo.cairo_add_path(cairo, path.handle);
+ Cairo.cairo_clip(cairo);
+ Cairo.cairo_new_path(cairo);
+ }
+}
/**
* Sets the area of the receiver which can be changed
* by drawing operations to the rectangular area specified
@@ -2555,6 +2906,10 @@ public void setFont (Font font) {
if (data.renderTable != 0) OS.XmRenderTableFree(data.renderTable);
data.renderTable = 0;
data.stringWidth = data.stringHeight = data.textWidth = data.textHeight = -1;
+ int /*long*/ cairo = data.cairo;
+ if (cairo != 0) {
+ setCairoFont(cairo, font);
+ }
}
/**
* Sets the foreground color. The foreground color is used
@@ -2575,19 +2930,27 @@ public void setForeground (Color color) {
if (color == null) SWT.error(SWT.ERROR_NULL_ARGUMENT);
if (color.isDisposed()) SWT.error(SWT.ERROR_INVALID_ARGUMENT);
OS.XSetForeground(data.display, handle, color.handle.pixel);
+ int /*long*/ cairo = data.cairo;
+ if (cairo != 0) {
+ XColor xColor = color.handle;
+ Cairo.cairo_set_rgb_color(cairo, (xColor.red & 0xFFFF) / (float)0xFFFF, (xColor.green & 0xFFFF) / (float)0xFFFF, (xColor.blue & 0xFFFF) / (float)0xFFFF);
+ }
}
public void setLineCap(int cap) {
if (handle == 0) SWT.error(SWT.ERROR_GRAPHIC_DISPOSED);
- int cap_style = 0;
+ int cap_style = 0, cairo_style = 0;
switch (cap) {
case SWT.CAP_ROUND:
cap_style = OS.CapRound;
+ cairo_style = Cairo.CAIRO_LINE_CAP_ROUND;
break;
case SWT.CAP_FLAT:
cap_style = OS.CapButt;
+ cairo_style = Cairo.CAIRO_LINE_CAP_BUTT;
break;
case SWT.CAP_SQUARE:
cap_style = OS.CapProjecting;
+ cairo_style = Cairo.CAIRO_LINE_CAP_SQUARE;
break;
default:
SWT.error(SWT.ERROR_INVALID_ARGUMENT);
@@ -2597,6 +2960,10 @@ public void setLineCap(int cap) {
OS.XGetGCValues(xDisplay, handle, OS.GCLineWidth | OS.GCJoinStyle, values);
int line_style = data.lineStyle == SWT.LINE_SOLID ? OS.LineSolid : OS.LineOnOffDash;
OS.XSetLineAttributes(xDisplay, handle, values.line_width, line_style, cap_style, values.join_style);
+ int /*long*/ cairo = data.cairo;
+ if (cairo != 0) {
+ Cairo.cairo_set_line_cap(cairo, cairo_style);
+ }
}
public void setLineDash(int[] dashes) {
if (handle == 0) SWT.error(SWT.ERROR_GRAPHIC_DISPOSED);
@@ -2619,19 +2986,34 @@ public void setLineDash(int[] dashes) {
OS.XGetGCValues(xDisplay, handle, OS.GCLineWidth | OS.GCCapStyle | OS.GCJoinStyle, values);
int line_style = data.lineStyle == SWT.LINE_SOLID ? OS.LineSolid : OS.LineOnOffDash;
OS.XSetLineAttributes(xDisplay, handle, values.line_width, line_style, values.cap_style, values.join_style);
+ int /*long*/ cairo = data.cairo;
+ if (cairo != 0) {
+ if (data.dashes != null) {
+ double[] cairoDashes = new double[data.dashes.length];
+ for (int i = 0; i < dashes.length; i++) {
+ cairoDashes[i] = data.dashes[i];
+ }
+ Cairo.cairo_set_dash(cairo, cairoDashes, cairoDashes.length, 0);
+ } else {
+ Cairo.cairo_set_dash(cairo, null, 0, 0);
+ }
+ }
}
public void setLineJoin(int join) {
if (handle == 0) SWT.error(SWT.ERROR_GRAPHIC_DISPOSED);
- int join_style = 0;
+ int join_style = 0, cairo_style = 0;
switch (join) {
case SWT.JOIN_MITER:
join_style = OS.JoinMiter;
+ cairo_style = Cairo.CAIRO_LINE_JOIN_MITER;
break;
case SWT.JOIN_ROUND:
join_style = OS.JoinRound;
+ cairo_style = Cairo.CAIRO_LINE_JOIN_ROUND;
break;
case SWT.JOIN_BEVEL:
join_style = OS.JoinBevel;
+ cairo_style = Cairo.CAIRO_LINE_JOIN_BEVEL;
break;
default:
SWT.error(SWT.ERROR_INVALID_ARGUMENT);
@@ -2641,6 +3023,10 @@ public void setLineJoin(int join) {
OS.XGetGCValues(xDisplay, handle, OS.GCLineWidth | OS.GCCapStyle, values);
int line_style = data.lineStyle == SWT.LINE_SOLID ? OS.LineSolid : OS.LineOnOffDash;
OS.XSetLineAttributes(xDisplay, handle, values.line_width, line_style, values.cap_style, join_style);
+ int /*long*/ cairo = data.cairo;
+ if (cairo != 0) {
+ Cairo.cairo_set_line_join(cairo, cairo_style);
+ }
}
/**
* Sets the receiver's line style to the argument, which must be one
@@ -2656,30 +3042,44 @@ public void setLineJoin(int join) {
*/
public void setLineStyle(int lineStyle) {
if (handle == 0) SWT.error(SWT.ERROR_GRAPHIC_DISPOSED);
+ int /*long*/ cairo = data.cairo;
int xDisplay = data.display;
int line_style = OS.LineOnOffDash;
switch (lineStyle) {
case SWT.LINE_SOLID:
line_style = OS.LineSolid;
+ if (cairo != 0) Cairo.cairo_set_dash(cairo, null, 0, 0);
break;
case SWT.LINE_DASH:
OS.XSetDashes(xDisplay, handle, 0, new byte[]{18, 6}, 2);
+ if (cairo != 0) Cairo.cairo_set_dash(cairo, new double[] {18, 6}, 2, 0);
break;
case SWT.LINE_DOT:
OS.XSetDashes(xDisplay, handle, 0, new byte[]{3, 3}, 2);
+ if (cairo != 0) Cairo.cairo_set_dash(cairo, new double[] {3, 3}, 2, 0);
break;
case SWT.LINE_DASHDOT:
OS.XSetDashes(xDisplay, handle, 0, new byte[]{9, 6, 3, 6}, 4);
+ if (cairo != 0) Cairo.cairo_set_dash(cairo, new double[] {9, 6, 3, 6}, 4, 0);
break;
case SWT.LINE_DASHDOTDOT:
OS.XSetDashes(xDisplay, handle, 0, new byte[]{9, 3, 3, 3, 3, 3}, 6);
+ if (cairo != 0) Cairo.cairo_set_dash(cairo, new double[] {9, 3, 3, 3, 3, 3}, 6, 0);
break;
case SWT.LINE_CUSTOM:
byte[] dash_list = data.dashes;
if (dash_list != null) {
OS.XSetDashes(xDisplay, handle, 0, dash_list, dash_list.length);
+ if (cairo != 0) {
+ double[] dashes = new double[data.dashes.length];
+ for (int i = 0; i < dashes.length; i++) {
+ dashes[i] = data.dashes[i];
+ }
+ Cairo.cairo_set_dash(cairo, dashes, dashes.length, 0);
+ }
} else {
line_style = OS.LineSolid;
+ if (cairo != 0) Cairo.cairo_set_dash(cairo, null, 0, 0);
}
break;
default:
@@ -2708,7 +3108,11 @@ public void setLineWidth(int width) {
XGCValues values = new XGCValues();
OS.XGetGCValues(xDisplay, handle, OS.GCLineWidth | OS.GCCapStyle | OS.GCJoinStyle, values);
int line_style = data.lineStyle == SWT.LINE_SOLID ? OS.LineSolid : OS.LineOnOffDash;
- OS.XSetLineAttributes(data.display, handle, width, line_style, values.cap_style, values.join_style);
+ OS.XSetLineAttributes(data.display, handle, width, line_style, values.cap_style, values.join_style);
+ int /*long*/ cairo = data.cairo;
+ if (cairo != 0) {
+ Cairo.cairo_set_line_width(cairo, width);
+ }
}
void setString(String string) {
if (string == data.string) return;
@@ -2747,6 +3151,54 @@ void setText(String string, int flags) {
data.textWidth = data.textHeight = -1;
data.drawFlags = flags;
}
+public void setTransform(Transform transform) {
+ if (handle == 0) SWT.error(SWT.ERROR_GRAPHIC_DISPOSED);
+ if (transform == null) SWT.error(SWT.ERROR_NULL_ARGUMENT);
+ if (transform.isDisposed()) SWT.error(SWT.ERROR_INVALID_ARGUMENT);
+ initCairo();
+ int /*long*/ cairo = data.cairo;
+ Cairo.cairo_concat_matrix(cairo, data.inverseMatrix);
+ Cairo.cairo_concat_matrix(cairo, transform.handle);
+ Cairo.cairo_matrix_copy(data.matrix, transform.handle);
+ Cairo.cairo_matrix_copy(data.inverseMatrix, transform.handle);
+ Cairo.cairo_matrix_invert(data.inverseMatrix);
+ //TODO - round off problems
+ int /*long*/ clipRgn = data.clipRgn;
+ if (clipRgn != 0) {
+ int /*long*/ matrix = data.inverseMatrix;
+ int /*long*/ newRgn = OS.XCreateRegion();
+ //TODO - get rectangles from region instead of clip box
+ XRectangle rect = new XRectangle();
+ OS.XClipBox(clipRgn, rect);
+ short[] pointArray = new short[8];
+ double[] x = new double[1], y = new double[1];
+ x[0] = rect.x;
+ y[0] = rect.y;
+ Cairo.cairo_matrix_transform_point(matrix, x, y);
+ pointArray[0] = (short)Math.round(x[0]);
+ pointArray[1] = (short)Math.round(y[0]);
+ x[0] = rect.x + rect.width;
+ y[0] = rect.y;
+ Cairo.cairo_matrix_transform_point(matrix, x, y);
+ pointArray[2] = (short)Math.round(x[0]);
+ pointArray[3] = (short)Math.round(y[0]);
+ x[0] = rect.x + rect.width;
+ y[0] = rect.y + rect.height;
+ Cairo.cairo_matrix_transform_point(matrix, x, y);
+ pointArray[4] = (short)Math.round(x[0]);
+ pointArray[5] = (short)Math.round(y[0]);
+ x[0] = rect.x;
+ y[0] = rect.y + rect.height;
+ Cairo.cairo_matrix_transform_point(matrix, x, y);
+ pointArray[6] = (short)Math.round(x[0]);
+ pointArray[7] = (short)Math.round(y[0]);
+ int /*long*/ polyRgn = OS.XPolygonRegion(pointArray, pointArray.length / 2, OS.EvenOddRule);
+ OS.XUnionRegion(handle, polyRgn, handle);
+ OS.XDestroyRegion(polyRgn);
+ OS.XDestroyRegion(clipRgn);
+ data.clipRgn = newRgn;
+ }
+}
/**
* If the argument is <code>true</code>, puts the receiver
* in a drawing mode where the resulting color in the destination
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/motif/org/eclipse/swt/graphics/GCData.java b/bundles/org.eclipse.swt/Eclipse SWT/motif/org/eclipse/swt/graphics/GCData.java
index 7bbdd1cdc4..b992ad414f 100755
--- a/bundles/org.eclipse.swt/Eclipse SWT/motif/org/eclipse/swt/graphics/GCData.java
+++ b/bundles/org.eclipse.swt/Eclipse SWT/motif/org/eclipse/swt/graphics/GCData.java
@@ -38,6 +38,9 @@ public final class GCData {
public byte[] dashes;
public int renderTable;
+ public int /*long*/ cairo;
+ public int /*long*/ matrix, inverseMatrix;
+
public String string;
public int stringWidth = -1;
public int stringHeight = -1;
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/motif/org/eclipse/swt/graphics/Image.java b/bundles/org.eclipse.swt/Eclipse SWT/motif/org/eclipse/swt/graphics/Image.java
index 56bc59df99..4610944cba 100755
--- a/bundles/org.eclipse.swt/Eclipse SWT/motif/org/eclipse/swt/graphics/Image.java
+++ b/bundles/org.eclipse.swt/Eclipse SWT/motif/org/eclipse/swt/graphics/Image.java
@@ -11,6 +11,7 @@
package org.eclipse.swt.graphics;
+import org.eclipse.swt.internal.cairo.*;
import org.eclipse.swt.internal.motif.*;
import org.eclipse.swt.*;
import java.io.*;
@@ -93,6 +94,8 @@ public final class Image implements Drawable {
*/
public int mask;
+ int /*long*/ surface;
+
/**
* The device where this image was created.
*/
@@ -672,8 +675,9 @@ public void dispose () {
int xDisplay = device.xDisplay;
if (pixmap != 0) OS.XFreePixmap (xDisplay, pixmap);
if (mask != 0) OS.XFreePixmap (xDisplay, mask);
+ if (surface != 0) Cairo.cairo_surface_destroy(surface);
+ surface = pixmap = mask = 0;
memGC = null;
- pixmap = mask = 0;
if (device.tracking) device.dispose_Object(this);
device = null;
}
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/photon/org/eclipse/swt/graphics/GC.java b/bundles/org.eclipse.swt/Eclipse SWT/photon/org/eclipse/swt/graphics/GC.java
index 5e78cda10b..2a156ad405 100755
--- a/bundles/org.eclipse.swt/Eclipse SWT/photon/org/eclipse/swt/graphics/GC.java
+++ b/bundles/org.eclipse.swt/Eclipse SWT/photon/org/eclipse/swt/graphics/GC.java
@@ -993,6 +993,11 @@ public void drawOval (int x, int y, int width, int height) {
}
}
+public void drawPath(Path path) {
+ if (handle == 0) SWT.error(SWT.ERROR_GRAPHIC_DISPOSED);
+ if (path.handle == 0) SWT.error(SWT.ERROR_INVALID_ARGUMENT);
+}
+
/**
* Draws a pixel, using the foreground color, at the specified
* point (<code>x</code>, <code>y</code>).
@@ -1663,6 +1668,11 @@ public void fillOval (int x, int y, int width, int height) {
}
}
+public void fillPath (Path path) {
+ if (handle == 0) SWT.error(SWT.ERROR_GRAPHIC_DISPOSED);
+ if (path.handle == 0) SWT.error(SWT.ERROR_INVALID_ARGUMENT);
+}
+
/**
* Fills the interior of the closed polygon which is defined by the
* specified array of integer coordinates, using the receiver's
@@ -1818,6 +1828,11 @@ public int getAdvanceWidth(char ch) {
return getCharWidth(ch);
}
+public int getAlpha() {
+ if (handle == 0) SWT.error(SWT.ERROR_GRAPHIC_DISPOSED);
+ return 0xFF;
+}
+
/**
* Returns the background color.
*
@@ -1925,6 +1940,7 @@ public Rectangle getClipping() {
public void getClipping (Region region) {
if (handle == 0) SWT.error(SWT.ERROR_GRAPHIC_DISPOSED);
if (region == null) SWT.error (SWT.ERROR_NULL_ARGUMENT);
+ if (region.isDisposed()) SWT.error(SWT.ERROR_INVALID_ARGUMENT);
int flags = OS.PtEnter(0);
try {
if (region.handle != 0 && region.handle != Region.EMPTY_REGION) {
@@ -2081,6 +2097,12 @@ public int getStyle () {
return data.style;
}
+public void getTransform(Transform transform) {
+ if (handle == 0) SWT.error(SWT.ERROR_GRAPHIC_DISPOSED);
+ if (transform == null) SWT.error(SWT.ERROR_NULL_ARGUMENT);
+ if (transform.isDisposed()) SWT.error(SWT.ERROR_INVALID_ARGUMENT);
+}
+
/**
* Returns <code>true</code> if this GC is drawing in the mode
* where the resulting color in the destination is the
@@ -2185,6 +2207,10 @@ public boolean isDisposed() {
return handle == 0;
}
+public void setAlpha(int alpha) {
+ if (handle == 0) SWT.error(SWT.ERROR_GRAPHIC_DISPOSED);
+}
+
/**
* Sets the background color. The background color is used
* for fill operations and as the background color when text
@@ -2248,6 +2274,11 @@ public void setClipping (int x, int y, int width, int height) {
dirtyBits |= DIRTY_CLIPPING;
}
+public void setClipping(Path path) {
+ if (handle == 0) SWT.error(SWT.ERROR_GRAPHIC_DISPOSED);
+ if (path != null && path.isDisposed()) SWT.error(SWT.ERROR_GRAPHIC_DISPOSED);
+}
+
/**
* Sets the area of the receiver which can be changed
* by drawing operations to the rectangular area specified
@@ -2279,12 +2310,16 @@ public void setClipping (Rectangle rect) {
*
* @param region the clipping region.
*
+ * * @exception IllegalArgumentException <ul>
+ * <li>ERROR_INVALID_ARGUMENT - if the region has been disposed</li>
+ * </ul>
* @exception SWTException <ul>
* <li>ERROR_GRAPHIC_DISPOSED - if the receiver has been disposed</li>
* </ul>
*/
public void setClipping (Region region) {
if (handle == 0) SWT.error(SWT.ERROR_GRAPHIC_DISPOSED);
+ if (region != null && region.isDisposed()) SWT.error(SWT.ERROR_INVALID_ARGUMENT);
int clipRects = data.clipRects;
int clipRectsCount = data.clipRectsCount;
if (clipRects != 0)
@@ -2608,6 +2643,12 @@ int getClipping(int widget, int topWidget, boolean clipChildren, boolean clipSib
return widget_tile;
}
+public void setTransform(Transform transform) {
+ if (handle == 0) SWT.error(SWT.ERROR_GRAPHIC_DISPOSED);
+ if (transform == null) SWT.error(SWT.ERROR_NULL_ARGUMENT);
+ if (transform.isDisposed()) SWT.error(SWT.ERROR_INVALID_ARGUMENT);
+}
+
/**
* If the argument is <code>true</code>, puts the receiver
* in a drawing mode where the resulting color in the destination

Back to the top