[cairo-commit] CairoJava/src/org/cairographics/cairo Cairo.java, 1.11, 1.12 CairoException.java, 1.6, 1.7 CairoFont.java, 1.5, 1.6 CairoPattern.java, 1.4, 1.5

Charles Tuckey commit at pdx.freedesktop.org
Sun Dec 5 19:44:55 PST 2004


Committed by: ctuckey

Update of /cvs/cairo/CairoJava/src/org/cairographics/cairo
In directory gabe:/tmp/cvs-serv12012/src/org/cairographics/cairo

Modified Files:
	Cairo.java CairoException.java CairoFont.java 
	CairoPattern.java 
Log Message:
Use getter methods to get enumerated type values found in cairo.h 
instead of hardcoding them in java classes.
Added new cairo_status_t elements:
    CAIRO_STATUS_NO_TARGET_SURFACE,
    CAIRO_STATUS_NULL_POINTER
to CairoException class.


Index: Cairo.java
===================================================================
RCS file: /cvs/cairo/CairoJava/src/org/cairographics/cairo/Cairo.java,v
retrieving revision 1.11
retrieving revision 1.12
diff -u -d -r1.11 -r1.12
--- Cairo.java	27 Oct 2004 03:45:37 -0000	1.11
+++ Cairo.java	6 Dec 2004 03:44:53 -0000	1.12
@@ -48,6 +48,7 @@
 package org.cairographics.cairo;
 
 import org.eclipse.swt.graphics.Color;
+
 import org.eclipse.swt.graphics.Image;
 
 /**
@@ -61,84 +62,84 @@
     /*
      * Cairo Format:
      */
-    public final static short FORMAT_ARGB32 = 0;
+    public final static short FORMAT_ARGB32 = getFORMAT_ARGB32();
 
-    public final static short FORMAT_RGB24 = 1;
+    public final static short FORMAT_RGB24 = getFORMAT_RGB24();
 
-    public final static short FORMAT_A8 = 2;
+    public final static short FORMAT_A8 = getFORMAT_A8();
 
-    public final static short FORMAT_A1 = 4;
+    public final static short FORMAT_A1 = getFORMAT_A1();
 
     /*
      * Cairo operators
      */
-    public final static short OPERATOR_CLEAR = 0;
+    public final static short OPERATOR_CLEAR = getOPERATOR_CLEAR();
 
-    public final static short OPERATOR_SRC = 1;
+    public final static short OPERATOR_SRC = getOPERATOR_SRC();
 
-    public final static short OPERATOR_DST = 2;
+    public final static short OPERATOR_DST = getOPERATOR_DST();
 
-    public final static short OPERATOR_OVER = 3;
+    public final static short OPERATOR_OVER = getOPERATOR_OVER();
 
-    public final static short OPERATOR_OVER_REVERSE = 4;
+    public final static short OPERATOR_OVER_REVERSE = getOPERATOR_OVER_REVERSE();
 
-    public final static short OPERATOR_IN = 5;
+    public final static short OPERATOR_IN = getOPERATOR_IN();
 
-    public final static short OPERATOR_IN_REVERSE = 6;
+    public final static short OPERATOR_IN_REVERSE = getOPERATOR_IN_REVERSE();
 
-    public final static short OPERATOR_OUT = 7;
+    public final static short OPERATOR_OUT = getOPERATOR_OUT();
 
-    public final static short OPERATOR_OUT_REVERSE = 8;
+    public final static short OPERATOR_OUT_REVERSE = getOPERATOR_OUT_REVERSE();
 
-    public final static short OPERATOR_ATOP = 9;
+    public final static short OPERATOR_ATOP = getOPERATOR_ATOP();
 
-    public final static short OPERATOR_ATOP_REVERSE = 10;
+    public final static short OPERATOR_ATOP_REVERSE = getOPERATOR_ATOP_REVERSE();
 
-    public final static short OPERATOR_XOR = 11;
+    public final static short OPERATOR_XOR = getOPERATOR_XOR();
 
-    public final static short OPERATOR_ADD = 12;
+    public final static short OPERATOR_ADD = getOPERATOR_ADD();
 
-    public final static short OPERATOR_SATURATE = 13;
+    public final static short OPERATOR_SATURATE = getOPERATOR_SATURATE();
 
     /*
      * Fill Rule constants
      */
-    public final static short FILLRULE_WINDING = 0;
+    public final static short FILLRULE_WINDING = getFILL_RULE_WINDING();
 
-    public final static short FILLRULE_EVENODD = 1;
+    public final static short FILLRULE_EVENODD = getFILL_RULE_EVEN_ODD();
 
     /*
      * Linecap rules: CairoLineCapButt, CairoLineCapRound, CairoLineCapSquare
      */
-    public final static short LINECAP_BUTT = 0;
+    public final static short LINECAP_BUTT = getLINE_CAP_BUTT();
 
-    public final static short LINECAP_ROUND = 1;
+    public final static short LINECAP_ROUND = getLINE_CAP_ROUND();
 
-    public final static short LINECAP_SQUARE = 2;
+    public final static short LINECAP_SQUARE = getLINE_CAP_SQUARE();
 
     /*
      * Line join styles
      */
-    public final static short LINEJOIN_MITER = 0;
+    public final static short LINEJOIN_MITER = getLINE_JOIN_MITER();
 
-    public final static short LINEJOIN_ROUND = 1;
+    public final static short LINEJOIN_ROUND = getLINE_JOIN_ROUND();
 
-    public final static short LINEJOIN_BEVEL = 2;
+    public final static short LINEJOIN_BEVEL = getLINE_JOIN_BEVEL();
 
     /*
      * Filter options
      */
-    public final static short FILTER_FAST = 0;
+    public final static short FILTER_FAST = getFILTER_FAST();
 
-    public final static short FILTER_GOOD = 1;
+    public final static short FILTER_GOOD = getFILTER_GOOD();
 
-    public final static short FILTER_BEST = 2;
+    public final static short FILTER_BEST = getFILTER_BEST();
 
-    public final static short FILTER_NEAREST = 3;
+    public final static short FILTER_NEAREST = getFILTER_NEAREST();
 
-    public final static short FILTER_BILINEAR = 4;
+    public final static short FILTER_BILINEAR = getFILTER_BILINEAR();
 
-    public final static short FILTER_GAUSSIAN = 5;
+    public final static short FILTER_GAUSSIAN = getFILTER_GAUSSIAN();
 
     /** native cairo state handle */
     long handle = 0;
@@ -152,7 +153,7 @@
         handle = cairo_create();
     }
 
-    /**
+	/**
      * Constructs a new cairo state that draws on an cairo surface.
      * 
      * @param surface
@@ -1253,6 +1254,68 @@
     native static void cairo_current_path(long cr, PathTracer tracer);
 
     native static void cairo_current_path_flat(long cr, FlatPathTracer tracer);
+    
+    private native static short getFORMAT_ARGB32();
 
-}
+	private native static short getFORMAT_RGB24();
+
+	private native static short getFORMAT_A8();
+
+	private native static short getFORMAT_A1();
+
+	private native static short getOPERATOR_CLEAR();
+
+	private native static short getOPERATOR_SRC();
+
+	private native static short getOPERATOR_DST();
+
+	private native static short getOPERATOR_OVER();
+
+	private native static short getOPERATOR_OVER_REVERSE();
+
+	private native static short getOPERATOR_IN();
+
+	private native static short getOPERATOR_IN_REVERSE();
+
+	private native static short getOPERATOR_OUT();
+
+	private native static short getOPERATOR_OUT_REVERSE();
+
+	private native static short getOPERATOR_ATOP();
+
+	private native static short getOPERATOR_ATOP_REVERSE();
+
+	private native static short getOPERATOR_XOR();
 
+	private native static short getOPERATOR_ADD();
+
+	private native static short getOPERATOR_SATURATE();
+
+	private native static short getFILL_RULE_WINDING();
+
+	private native static short getFILL_RULE_EVEN_ODD();
+
+    private native static short getLINE_CAP_BUTT();
+
+    private native static short getLINE_CAP_ROUND();
+
+    private native static short getLINE_CAP_SQUARE();
+
+    private native static short getLINE_JOIN_MITER();
+    
+    private native static short getLINE_JOIN_ROUND();
+    
+    private native static short getLINE_JOIN_BEVEL();
+    
+    private native static short getFILTER_FAST();
+    
+    private native static short getFILTER_GOOD();
+    
+    private native static short getFILTER_BEST();
+    
+    private native static short getFILTER_NEAREST();
+    
+    private native static short getFILTER_BILINEAR();
+    
+    private native static short getFILTER_GAUSSIAN();
+}

Index: CairoException.java
===================================================================
RCS file: /cvs/cairo/CairoJava/src/org/cairographics/cairo/CairoException.java,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -d -r1.6 -r1.7
--- CairoException.java	27 Oct 2004 03:45:37 -0000	1.6
+++ CairoException.java	6 Dec 2004 03:44:53 -0000	1.7
@@ -60,12 +60,14 @@
     /*
      * Cairo function call status constants
      */
-    public final static short STATUS_SUCCESS = 0;
-    public final static short STATUS_NO_MEMORY = 1;
-    public final static short STATUS_INVALID_RESTORE = 2;
-    public final static short STATUS_INVALID_POPGROUP = 3;
-    public final static short STATUS_NO_CURRENT_POINT = 4;
-    public final static short STATUS_INVALID_MATRIX = 5;
+    public final static short STATUS_SUCCESS = getSTATUS_SUCCESS();
+    public final static short STATUS_NO_MEMORY = getSTATUS_NO_MEMORY();
+    public final static short STATUS_INVALID_RESTORE = getSTATUS_INVALID_RESTORE();
+    public final static short STATUS_INVALID_POPGROUP = getSTATUS_INVALID_POPGROUP();
+    public final static short STATUS_NO_CURRENT_POINT = getSTATUS_NO_CURRENT_POINT();
+    public final static short STATUS_INVALID_MATRIX = getSTATUS_INVALID_MATRIX();
+    public final static short STATUS_NO_TARGET_SURFACE = getSTATUS_NO_TARGET_SURFACE();
+    public final static short STATUS_NULL_POINTER = getSTATUS_NULL_POINTER();
 
     /**
      * The cairo error code. Will be one of STATUS_xxxx codes.
@@ -95,4 +97,13 @@
      * Native method
      */
     native static String cairo_status_string (short cr);
+    
+    private native static short getSTATUS_SUCCESS();
+    private native static short getSTATUS_NO_MEMORY();
+    private native static short getSTATUS_INVALID_RESTORE();
+    private native static short getSTATUS_INVALID_POPGROUP();
+    private native static short getSTATUS_NO_CURRENT_POINT();
+    private native static short getSTATUS_INVALID_MATRIX();
+    private native static short getSTATUS_NO_TARGET_SURFACE();
+    private native static short getSTATUS_NULL_POINTER();
 }

Index: CairoFont.java
===================================================================
RCS file: /cvs/cairo/CairoJava/src/org/cairographics/cairo/CairoFont.java,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -d -r1.5 -r1.6
--- CairoFont.java	27 Oct 2004 03:45:37 -0000	1.5
+++ CairoFont.java	6 Dec 2004 03:44:53 -0000	1.6
@@ -61,15 +61,15 @@
     /*
      * Font weight options.
      */
-    public final static short WEIGHT_NORMAL = 0;
-    public final static short WEIGHT_BOLD = 1;
+    public final static short WEIGHT_NORMAL = getWEIGHT_NORMAL();
+    public final static short WEIGHT_BOLD = getWEIGHT_BOLD();
 
     /*
      * Font slant options
      */
-    public final static short SLANT_NORMAL = 0;
-    public final static short SLANT_ITALIC = 1;
-    public final static short SLANT_OBLIQUE = 2;
+    public final static short SLANT_NORMAL = getSLANT_NORMAL();
+    public final static short SLANT_ITALIC = getSLANT_ITALIC();
+    public final static short SLANT_OBLIQUE = getSLANT_OBLIQUE();
     
     /** Native font handle */
     long handle = 0;
@@ -133,4 +133,11 @@
     native static void cairo_font_destroy (long font);
     native static void cairo_font_set_transform (long font, long matrix); 
     native static void cairo_font_current_transform (long font, long matrix);
+
+    private native static short getWEIGHT_NORMAL();
+    private native static short getWEIGHT_BOLD();
+    private native static short getSLANT_NORMAL();
+    private native static short getSLANT_ITALIC();
+    private native static short getSLANT_OBLIQUE();
+
 }

Index: CairoPattern.java
===================================================================
RCS file: /cvs/cairo/CairoJava/src/org/cairographics/cairo/CairoPattern.java,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -d -r1.4 -r1.5
--- CairoPattern.java	27 Oct 2004 03:45:37 -0000	1.4
+++ CairoPattern.java	6 Dec 2004 03:44:53 -0000	1.5
@@ -54,11 +54,11 @@
     }
     
     /* Pattern extend constants */
-    public static final short EXTEND_NONE = 0;
+    public static final short EXTEND_NONE = getEXTEND_NONE();
 
-    public static final short EXTEND_REPEAT = 1;
+    public static final short EXTEND_REPEAT = getEXTEND_REPEAT();
 
-    public static final short EXTEND_REFLECT = 2;
+    public static final short EXTEND_REFLECT = getEXTEND_REFLECT();
 
     protected long handle = 0;
 
@@ -185,4 +185,9 @@
     native static short cairo_pattern_get_extend(long pattern);
     native static void cairo_pattern_set_filter(long pattern, short filter);
     native static short cairo_pattern_get_filter(long pattern);
+
+    private native static short getEXTEND_NONE();
+    private native static short getEXTEND_REPEAT();
+    private native static short getEXTEND_REFLECT();
+
 }




More information about the cairo-commit mailing list