[cairo-commit] cairo-java/src/java/org/freedesktop/cairo
Antialias.java, 1.2, 1.3 CairoException.java, 1.1,
1.2 CairoObject.java, 1.3, 1.4 Content.java, 1.2,
1.3 Context.java, 1.11, 1.12 Extend.java, 1.4,
1.5 FillRule.java, 1.4, 1.5 Filter.java, 1.4,
1.5 FontExtents.java, 1.5, 1.6 FontFace.java, 1.5,
1.6 FontOptions.java, 1.3, 1.4 FontSlant.java, 1.3,
1.4 FontWeight.java, 1.3, 1.4 Format.java, 1.3, 1.4 Glyph.java,
1.7, 1.8 Gradient.java, 1.3, 1.4 HintMetrics.java, 1.2,
1.3 HintStyle.java, 1.2, 1.3 ImageSurface.java, 1.11,
1.12 LineCap.java, 1.3, 1.4 LineJoin.java, 1.3,
1.4 LinearGradient.java, 1.1, 1.2 Matrix.java, 1.11,
1.12 Operator.java, 1.5, 1.6 PDFSurface.java, 1.6,
1.7 Path.java, 1.2, 1.3 PathElement.java, 1.2,
1.3 PathElementType.java, 1.2, 1.3 PathIterator.java, 1.1,
1.2 Pattern.java, 1.9, 1.10 Point.java, 1.2,
1.3 RadialGradient.java, 1.1, 1.2 Rectangle.java, 1.1,
1.2 ScaledFont.java, 1.5, 1.6 Status.java, 1.12,
1.13 SubpixelOrder.java, 1.2, 1.3 Surface.java, 1.17,
1.18 SurfacePattern.java, 1.2, 1.3 TextExtents.java, 1.6, 1.7
Andrew Frederick Cowie
commit at pdx.freedesktop.org
Sun Feb 12 00:43:04 PST 2006
Committed by: afcowie
Update of /cvs/cairo/cairo-java/src/java/org/freedesktop/cairo
In directory gabe:/tmp/cvs-serv18060/src/java/org/freedesktop/cairo
Modified Files:
Antialias.java CairoException.java CairoObject.java
Content.java Context.java Extend.java FillRule.java
Filter.java FontExtents.java FontFace.java FontOptions.java
FontSlant.java FontWeight.java Format.java Glyph.java
Gradient.java HintMetrics.java HintStyle.java
ImageSurface.java LineCap.java LineJoin.java
LinearGradient.java Matrix.java Operator.java PDFSurface.java
Path.java PathElement.java PathElementType.java
PathIterator.java Pattern.java Point.java RadialGradient.java
Rectangle.java ScaledFont.java Status.java SubpixelOrder.java
Surface.java SurfacePattern.java TextExtents.java
Log Message:
Apply Eclipse's "Java Default" style code formatting to all Java source files.
Index: Antialias.java
===================================================================
RCS file: /cvs/cairo/cairo-java/src/java/org/freedesktop/cairo/Antialias.java,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -d -r1.2 -r1.3
--- Antialias.java 13 Sep 2005 03:14:10 -0000 1.2
+++ Antialias.java 12 Feb 2006 08:43:01 -0000 1.3
@@ -12,60 +12,63 @@
import org.gnu.glib.Enum;
/**
- * Specifies the type of antialiasing to do when rendering text.
+ * Specifies the type of antialiasing to do when rendering text.
*/
-public class Antialias extends Enum {
+public class Antialias extends Enum
+{
- static final private int _DEFAULT = 0;
- /**
- * Use the default antialiasing for
- * the font subsystem and target device
- */
- static final public Antialias DEFAULT = new Antialias (_DEFAULT);
- static final private int _NONE = 1;
- /**
- * Do no antialiasing of fonts; use bilevel text.
- */
- static final public Antialias NONE = new Antialias (_NONE);
- static final private int _GRAY = 2;
- /**
- * Perform single-color antialiasing (using
- * shades of gray for black text on a white background, for example).
- */
- static final public Antialias GRAY = new Antialias (_GRAY);
- static final private int _SUBPIXEL = 3;
- /**
- * Perform antialiasing by taking
- * advantage of the order of subpixel elements on devices
- * such as LCD panels
- */
- static final public Antialias SUBPIXEL = new Antialias (_SUBPIXEL);
- static final private Antialias[] theInterned = new Antialias[] {
- DEFAULT, NONE, GRAY, SUBPIXEL
- };
- static private java.util.Hashtable theInternedExtras;
- static final private Antialias theSacrificialOne = new Antialias (0);
- static public Antialias intern (int value) {
- if (value < theInterned.length) {
- return theInterned[value];
- }
- theSacrificialOne.value_ = value;
- if (theInternedExtras == null) {
- theInternedExtras = new java.util.Hashtable();
- }
- Antialias already = (Antialias) theInternedExtras.get(theSacrificialOne);
- if (already == null) {
- already = new Antialias(value);
- theInternedExtras.put(already, already);
- }
- return already;
- }
+ static final private int _DEFAULT = 0;
+ /**
+ * Use the default antialiasing for the font subsystem and target device
+ */
+ static final public Antialias DEFAULT = new Antialias(_DEFAULT);
+ static final private int _NONE = 1;
+ /**
+ * Do no antialiasing of fonts; use bilevel text.
+ */
+ static final public Antialias NONE = new Antialias(_NONE);
+ static final private int _GRAY = 2;
+ /**
+ * Perform single-color antialiasing (using shades of gray for black text on
+ * a white background, for example).
+ */
+ static final public Antialias GRAY = new Antialias(_GRAY);
+ static final private int _SUBPIXEL = 3;
+ /**
+ * Perform antialiasing by taking advantage of the order of subpixel
+ * elements on devices such as LCD panels
+ */
+ static final public Antialias SUBPIXEL = new Antialias(_SUBPIXEL);
+ static final private Antialias[] theInterned = new Antialias[] {
+ DEFAULT,
+ NONE,
+ GRAY,
+ SUBPIXEL
+ };
+ static private java.util.Hashtable theInternedExtras;
+ static final private Antialias theSacrificialOne = new Antialias(0);
- private Antialias(int value) {
- value_ = value;
- }
+ static public Antialias intern(int value) {
+ if (value < theInterned.length) {
+ return theInterned[value];
+ }
+ theSacrificialOne.value_ = value;
+ if (theInternedExtras == null) {
+ theInternedExtras = new java.util.Hashtable();
+ }
+ Antialias already = (Antialias) theInternedExtras.get(theSacrificialOne);
+ if (already == null) {
+ already = new Antialias(value);
+ theInternedExtras.put(already, already);
+ }
+ return already;
+ }
- public boolean test (Antialias other) {
- return (value_ & other.value_) == other.value_;
- }
+ private Antialias(int value) {
+ value_ = value;
+ }
+
+ public boolean test(Antialias other) {
+ return (value_ & other.value_) == other.value_;
+ }
}
Index: CairoException.java
===================================================================
RCS file: /cvs/cairo/cairo-java/src/java/org/freedesktop/cairo/CairoException.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -d -r1.1 -r1.2
--- CairoException.java 23 Feb 2005 18:17:52 -0000 1.1
+++ CairoException.java 12 Feb 2006 08:43:01 -0000 1.2
@@ -8,6 +8,7 @@
*/
package org.freedesktop.cairo;
-public class CairoException extends Exception {
+public class CairoException extends Exception
+{
}
Index: CairoObject.java
===================================================================
RCS file: /cvs/cairo/cairo-java/src/java/org/freedesktop/cairo/CairoObject.java,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -d -r1.3 -r1.4
--- CairoObject.java 13 Sep 2005 03:14:10 -0000 1.3
+++ CairoObject.java 12 Feb 2006 08:43:01 -0000 1.4
@@ -1,11 +1,11 @@
/*
* Java-Gnome Bindings Library
-*
-* Copyright 1998-2005 the Java-Gnome Team, all rights reserved.
-*
-* The Java-Gnome bindings library is free software distributed under
-* the terms of the GNU Library General Public License version 2.
-*/
+ *
+ * Copyright 1998-2005 the Java-Gnome Team, all rights reserved.
+ *
+ * The Java-Gnome bindings library is free software distributed under
+ * the terms of the GNU Library General Public License version 2.
+ */
package org.freedesktop.cairo;
@@ -14,15 +14,16 @@
/**
*/
-class CairoObject extends Struct {
+class CairoObject extends Struct
+{
CairoObject(Handle hndl) {
super(hndl);
}
- // static init code
- static {
- System.loadLibrary("cairojni-" + org.freedesktop.cairo.Config.CAIRO_API_VERSION);
- }
-
+ // static init code
+ static {
+ System.loadLibrary("cairojni-" + org.freedesktop.cairo.Config.CAIRO_API_VERSION);
+ }
+
}
Index: Content.java
===================================================================
RCS file: /cvs/cairo/cairo-java/src/java/org/freedesktop/cairo/Content.java,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -d -r1.2 -r1.3
--- Content.java 13 Sep 2005 03:14:10 -0000 1.2
+++ Content.java 12 Feb 2006 08:43:01 -0000 1.3
@@ -11,42 +11,46 @@
import org.gnu.glib.Enum;
-public class Content extends Enum {
+public class Content extends Enum
+{
- static final private int _COLOR = 0x1000;
- static final public Content COLOR = new Content (_COLOR);
- static final private int _ALPHA = 0x2000;
- static final public Content ALPHA = new Content (_ALPHA);
- static final private int _COLOR_ALPHA = 0x3000;
- static final public Content COLOR_ALPHA = new Content (_COLOR_ALPHA);
+ static final private int _COLOR = 0x1000;
+ static final public Content COLOR = new Content(_COLOR);
+ static final private int _ALPHA = 0x2000;
+ static final public Content ALPHA = new Content(_ALPHA);
+ static final private int _COLOR_ALPHA = 0x3000;
+ static final public Content COLOR_ALPHA = new Content(_COLOR_ALPHA);
- static final private Content[] theInterned = new Content[] {
- COLOR, ALPHA, COLOR_ALPHA
- };
- static private java.util.Hashtable theInternedExtras;
- static final private Content theSacrificialOne = new Content (0);
- static public Content intern (int value) {
- if (value < theInterned.length) {
- return theInterned[value];
- }
- theSacrificialOne.value_ = value;
- if (theInternedExtras == null) {
- theInternedExtras = new java.util.Hashtable();
- }
- Content already = (Content) theInternedExtras.get(theSacrificialOne);
- if (already == null) {
- already = new Content(value);
- theInternedExtras.put(already, already);
- }
- return already;
- }
+ static final private Content[] theInterned = new Content[] {
+ COLOR,
+ ALPHA,
+ COLOR_ALPHA
+ };
+ static private java.util.Hashtable theInternedExtras;
+ static final private Content theSacrificialOne = new Content(0);
- private Content(int value) {
- value_ = value;
- }
+ static public Content intern(int value) {
+ if (value < theInterned.length) {
+ return theInterned[value];
+ }
+ theSacrificialOne.value_ = value;
+ if (theInternedExtras == null) {
+ theInternedExtras = new java.util.Hashtable();
+ }
+ Content already = (Content) theInternedExtras.get(theSacrificialOne);
+ if (already == null) {
+ already = new Content(value);
+ theInternedExtras.put(already, already);
+ }
+ return already;
+ }
- public boolean test (Content other) {
- return (value_ & other.value_) == other.value_;
- }
+ private Content(int value) {
+ value_ = value;
+ }
+
+ public boolean test(Content other) {
+ return (value_ & other.value_) == other.value_;
+ }
}
Index: Context.java
===================================================================
RCS file: /cvs/cairo/cairo-java/src/java/org/freedesktop/cairo/Context.java,v
retrieving revision 1.11
retrieving revision 1.12
diff -u -d -r1.11 -r1.12
--- Context.java 2 Dec 2005 10:36:58 -0000 1.11
+++ Context.java 12 Feb 2006 08:43:01 -0000 1.12
@@ -11,76 +11,77 @@
import org.gnu.glib.Struct;
import org.gnu.glib.Handle;
-public class Context extends CairoObject {
-
+public class Context extends CairoObject
+{
+
/**
- * Creates a new Context with all graphics state parameters set to
- * default values and with target as a target surface. The target
[...1758 lines suppressed...]
+ native static final private int cairo_get_antialias(Handle obj);
+
+ native static final private void cairo_set_font_options(Handle obj, Handle fo);
+
+ native static final private Handle cairo_get_font_options(Handle obj);
+
+ // TODO: add the following
+ // cairo_path_t *
+ // cairo_copy_path (cairo_t *cr);
+ //
+ // cairo_path_t *
+ // cairo_copy_path_flat (cairo_t *cr);
+ //
+ // void
+ // cairo_append_path (cairo_t *cr,
+ // cairo_path_t *path);
+ //
+ // void
+ // cairo_path_destroy (cairo_path_t *path);
}
Index: Extend.java
===================================================================
RCS file: /cvs/cairo/cairo-java/src/java/org/freedesktop/cairo/Extend.java,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -d -r1.4 -r1.5
--- Extend.java 28 Oct 2005 23:04:46 -0000 1.4
+++ Extend.java 12 Feb 2006 08:43:01 -0000 1.5
@@ -12,56 +12,60 @@
/**
*/
-public class Extend extends Enum {
+public class Extend extends Enum
+{
- static final private int _NONE = 0;
- /**
- * pixels outside of the source pattern are fully transparent
- */
- static final public Extend NONE = new Extend (_NONE);
- static final private int _REPEAT = 1;
- /**
- * the pattern is tiled by repeating
- */
- static final public Extend REPEAT = new Extend (_REPEAT);
- static final private int _REFLECT = 2;
- /**
- * the pattern is tiled by reflecting at the edges
- */
- static final public Extend REFLECT = new Extend (_REFLECT);
- static final private int _PAD = 3;
- /**
- * pixels outside of the pattern copy the closest pixel
- * from the source
- */
- static final public Extend PAD = new Extend(_PAD);
-
- static final private Extend[] theInterned = new Extend[] {
- NONE, REPEAT, REFLECT, PAD
- };
- static private java.util.Hashtable theInternedExtras;
- static final private Extend theSacrificialOne = new Extend (0);
- static public Extend intern (int value) {
- if (value < theInterned.length) {
- return theInterned[value];
- }
- theSacrificialOne.value_ = value;
- if (theInternedExtras == null) {
- theInternedExtras = new java.util.Hashtable();
- }
- Extend already = (Extend) theInternedExtras.get(theSacrificialOne);
- if (already == null) {
- already = new Extend(value);
- theInternedExtras.put(already, already);
- }
- return already;
- }
+ static final private int _NONE = 0;
+ /**
+ * pixels outside of the source pattern are fully transparent
+ */
+ static final public Extend NONE = new Extend(_NONE);
+ static final private int _REPEAT = 1;
+ /**
+ * the pattern is tiled by repeating
+ */
+ static final public Extend REPEAT = new Extend(_REPEAT);
+ static final private int _REFLECT = 2;
+ /**
+ * the pattern is tiled by reflecting at the edges
+ */
+ static final public Extend REFLECT = new Extend(_REFLECT);
+ static final private int _PAD = 3;
+ /**
+ * pixels outside of the pattern copy the closest pixel from the source
+ */
+ static final public Extend PAD = new Extend(_PAD);
- private Extend(int value) {
- value_ = value;
- }
+ static final private Extend[] theInterned = new Extend[] {
+ NONE,
+ REPEAT,
+ REFLECT,
+ PAD
+ };
+ static private java.util.Hashtable theInternedExtras;
+ static final private Extend theSacrificialOne = new Extend(0);
- public boolean test (Extend other) {
- return (value_ & other.value_) == other.value_;
- }
+ static public Extend intern(int value) {
+ if (value < theInterned.length) {
+ return theInterned[value];
+ }
+ theSacrificialOne.value_ = value;
+ if (theInternedExtras == null) {
+ theInternedExtras = new java.util.Hashtable();
+ }
+ Extend already = (Extend) theInternedExtras.get(theSacrificialOne);
+ if (already == null) {
+ already = new Extend(value);
+ theInternedExtras.put(already, already);
+ }
+ return already;
+ }
+
+ private Extend(int value) {
+ value_ = value;
+ }
+
+ public boolean test(Extend other) {
+ return (value_ & other.value_) == other.value_;
+ }
}
Index: FillRule.java
===================================================================
RCS file: /cvs/cairo/cairo-java/src/java/org/freedesktop/cairo/FillRule.java,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -d -r1.4 -r1.5
--- FillRule.java 13 Sep 2005 03:14:10 -0000 1.4
+++ FillRule.java 12 Feb 2006 08:43:01 -0000 1.5
@@ -10,38 +10,41 @@
import org.gnu.glib.Enum;
-public class FillRule extends Enum {
+public class FillRule extends Enum
+{
- static final private int _WINDING = 0;
- static final public FillRule WINDING = new FillRule (_WINDING);
- static final private int _EVEN_ODD = 1;
- static final public FillRule EVEN_ODD = new FillRule (_EVEN_ODD);
- static final private FillRule[] theInterned = new FillRule[] {
- WINDING, EVEN_ODD
- };
- static private java.util.Hashtable theInternedExtras;
- static final private FillRule theSacrificialOne = new FillRule (0);
- static public FillRule intern (int value) {
- if (value < theInterned.length) {
- return theInterned[value];
- }
- theSacrificialOne.value_ = value;
- if (theInternedExtras == null) {
- theInternedExtras = new java.util.Hashtable();
- }
- FillRule already = (FillRule) theInternedExtras.get(theSacrificialOne);
- if (already == null) {
- already = new FillRule(value);
- theInternedExtras.put(already, already);
- }
- return already;
- }
+ static final private int _WINDING = 0;
+ static final public FillRule WINDING = new FillRule(_WINDING);
+ static final private int _EVEN_ODD = 1;
+ static final public FillRule EVEN_ODD = new FillRule(_EVEN_ODD);
+ static final private FillRule[] theInterned = new FillRule[] {
+ WINDING,
+ EVEN_ODD
+ };
+ static private java.util.Hashtable theInternedExtras;
+ static final private FillRule theSacrificialOne = new FillRule(0);
- private FillRule(int value) {
- value_ = value;
- }
+ static public FillRule intern(int value) {
+ if (value < theInterned.length) {
+ return theInterned[value];
+ }
+ theSacrificialOne.value_ = value;
+ if (theInternedExtras == null) {
+ theInternedExtras = new java.util.Hashtable();
+ }
+ FillRule already = (FillRule) theInternedExtras.get(theSacrificialOne);
+ if (already == null) {
+ already = new FillRule(value);
+ theInternedExtras.put(already, already);
+ }
+ return already;
+ }
- public boolean test (FillRule other) {
- return (value_ & other.value_) == other.value_;
- }
+ private FillRule(int value) {
+ value_ = value;
+ }
+
+ public boolean test(FillRule other) {
+ return (value_ & other.value_) == other.value_;
+ }
}
Index: Filter.java
===================================================================
RCS file: /cvs/cairo/cairo-java/src/java/org/freedesktop/cairo/Filter.java,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -d -r1.4 -r1.5
--- Filter.java 13 Sep 2005 03:14:10 -0000 1.4
+++ Filter.java 12 Feb 2006 08:43:01 -0000 1.5
@@ -12,45 +12,52 @@
/**
*/
-public class Filter extends Enum {
- static final private int _FAST = 0;
- static final public Filter FAST = new Filter (_FAST);
- static final private int _GOOD = 1;
- static final public Filter GOOD = new Filter (_GOOD);
- static final private int _BEST = 2;
- static final public Filter BEST = new Filter (_BEST);
- static final private int _NEAREST = 3;
- static final public Filter NEAREST = new Filter (_NEAREST);
- static final private int _BILINEAR = 4;
- static final public Filter BILINEAR = new Filter (_BILINEAR);
- static final private int _GAUSSIAN = 5;
- static final public Filter GAUSSIAN = new Filter (_GAUSSIAN);
- static final private Filter[] theInterned = new Filter[] {
- FAST, GOOD, BEST, NEAREST, BILINEAR, GAUSSIAN
- };
- static private java.util.Hashtable theInternedExtras;
- static final private Filter theSacrificialOne = new Filter (0);
- static public Filter intern (int value) {
- if (value < theInterned.length) {
- return theInterned[value];
- }
- theSacrificialOne.value_ = value;
- if (theInternedExtras == null) {
- theInternedExtras = new java.util.Hashtable();
- }
- Filter already = (Filter) theInternedExtras.get(theSacrificialOne);
- if (already == null) {
- already = new Filter(value);
- theInternedExtras.put(already, already);
- }
- return already;
- }
+public class Filter extends Enum
+{
+ static final private int _FAST = 0;
+ static final public Filter FAST = new Filter(_FAST);
+ static final private int _GOOD = 1;
+ static final public Filter GOOD = new Filter(_GOOD);
+ static final private int _BEST = 2;
+ static final public Filter BEST = new Filter(_BEST);
+ static final private int _NEAREST = 3;
+ static final public Filter NEAREST = new Filter(_NEAREST);
+ static final private int _BILINEAR = 4;
+ static final public Filter BILINEAR = new Filter(_BILINEAR);
+ static final private int _GAUSSIAN = 5;
+ static final public Filter GAUSSIAN = new Filter(_GAUSSIAN);
+ static final private Filter[] theInterned = new Filter[] {
+ FAST,
+ GOOD,
+ BEST,
+ NEAREST,
+ BILINEAR,
+ GAUSSIAN
+ };
+ static private java.util.Hashtable theInternedExtras;
+ static final private Filter theSacrificialOne = new Filter(0);
- private Filter(int value) {
- value_ = value;
- }
+ static public Filter intern(int value) {
+ if (value < theInterned.length) {
+ return theInterned[value];
+ }
+ theSacrificialOne.value_ = value;
+ if (theInternedExtras == null) {
+ theInternedExtras = new java.util.Hashtable();
+ }
+ Filter already = (Filter) theInternedExtras.get(theSacrificialOne);
+ if (already == null) {
+ already = new Filter(value);
+ theInternedExtras.put(already, already);
+ }
+ return already;
+ }
- public boolean test (Filter other) {
- return (value_ & other.value_) == other.value_;
- }
+ private Filter(int value) {
+ value_ = value;
+ }
+
+ public boolean test(Filter other) {
+ return (value_ & other.value_) == other.value_;
+ }
}
Index: FontExtents.java
===================================================================
RCS file: /cvs/cairo/cairo-java/src/java/org/freedesktop/cairo/FontExtents.java,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -d -r1.5 -r1.6
--- FontExtents.java 13 Sep 2005 03:14:10 -0000 1.5
+++ FontExtents.java 12 Feb 2006 08:43:01 -0000 1.6
@@ -1,55 +1,59 @@
/*
* Java-Gnome Bindings Library
-*
-* Copyright 1998-2005 the Java-Gnome Team, all rights reserved.
-*
-* The Java-Gnome bindings library is free software distributed under
-* the terms of the GNU Library General Public License version 2.
-*/
+ *
+ * Copyright 1998-2005 the Java-Gnome Team, all rights reserved.
+ *
+ * The Java-Gnome bindings library is free software distributed under
+ * the terms of the GNU Library General Public License version 2.
+ */
package org.freedesktop.cairo;
import org.gnu.glib.Handle;
-public class FontExtents extends CairoObject {
-
+public class FontExtents extends CairoObject
+{
+
FontExtents(Handle hndl) {
super(hndl);
}
-
+
protected void finalize() throws Throwable {
free(getHandle());
super.finalize();
}
-
-
public double getAscent() {
return get_ascent(getHandle());
}
-
+
public double getDescent() {
return get_descent(getHandle());
}
-
+
public double getHeight() {
return get_height(getHandle());
}
-
+
public double getMaxXAdvance() {
return get_max_x_advance(getHandle());
}
-
+
public double getMaxYAdvance() {
return get_max_y_advance(getHandle());
}
-
+
/*
* Native calls
*/
- native static final private void free(Handle obj);
+ native static final private void free(Handle obj);
+
native static final private double get_ascent(Handle obj);
+
native static final private double get_descent(Handle obj);
+
native static final private double get_height(Handle obj);
+
native static final private double get_max_x_advance(Handle obj);
+
native static final private double get_max_y_advance(Handle obj);
}
Index: FontFace.java
===================================================================
RCS file: /cvs/cairo/cairo-java/src/java/org/freedesktop/cairo/FontFace.java,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -d -r1.5 -r1.6
--- FontFace.java 13 Sep 2005 03:14:10 -0000 1.5
+++ FontFace.java 12 Feb 2006 08:43:01 -0000 1.6
@@ -1,34 +1,35 @@
/*
* Java-Gnome Bindings Library
-*
-* Copyright 1998-2005 the Java-Gnome Team, all rights reserved.
-*
-* The Java-Gnome bindings library is free software distributed under
-* the terms of the GNU Library General Public License version 2.
-*/
+ *
+ * Copyright 1998-2005 the Java-Gnome Team, all rights reserved.
+ *
+ * The Java-Gnome bindings library is free software distributed under
+ * the terms of the GNU Library General Public License version 2.
+ */
package org.freedesktop.cairo;
import org.gnu.glib.Handle;
/**
- * A FontFace specifies all aspects of a font other than the size
- * or font matrix (a font matrix is used to distort a font by
- * sheering it or scaling it unequally in the two directions).
+ * A FontFace specifies all aspects of a font other than the size or font matrix
+ * (a font matrix is used to distort a font by sheering it or scaling it
+ * unequally in the two directions).
*/
-public class FontFace extends CairoObject {
+public class FontFace extends CairoObject
+{
FontFace(Handle hndl) {
super(hndl);
}
-
- protected void finalize() throws Throwable {
- cairo_font_face_destroy(getHandle());
- super.finalize();
- }
- /*
- * Native calls
- */
+ protected void finalize() throws Throwable {
+ cairo_font_face_destroy(getHandle());
+ super.finalize();
+ }
+
+ /*
+ * Native calls
+ */
native static final private void cairo_font_face_destroy(Handle obj);
}
Index: FontOptions.java
===================================================================
RCS file: /cvs/cairo/cairo-java/src/java/org/freedesktop/cairo/FontOptions.java,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -d -r1.3 -r1.4
--- FontOptions.java 13 Sep 2005 03:14:10 -0000 1.3
+++ FontOptions.java 12 Feb 2006 08:43:01 -0000 1.4
@@ -2,77 +2,89 @@
import org.gnu.glib.Handle;
+public class FontOptions extends CairoObject
+{
-public class FontOptions extends CairoObject {
-
- public FontOptions() {
- super(cairo_font_options_create());
- }
-
- FontOptions(Handle handle) {
- super(handle);
- }
-
- public void setAntialias(Antialias antialias) {
- cairo_font_options_set_antialias(getHandle(), antialias.getValue());
- }
-
- public Antialias getAntialias() {
- return Antialias.intern(cairo_font_options_get_antialias(getHandle()));
- }
-
- public void setSubpixelOrder(SubpixelOrder subpixelOrder) {
- cairo_font_options_set_subpixel_order(getHandle(), subpixelOrder.getValue());
- }
-
- public SubpixelOrder getSubpixelOrder() {
- return SubpixelOrder.intern(cairo_font_options_get_subpixel_order(getHandle()));
- }
-
- public void setHintStyle(HintStyle hintStyle) {
- cairo_font_options_set_hint_style(getHandle(), hintStyle.getValue());
- }
-
- public HintStyle getHintStyle() {
- return HintStyle.intern(cairo_font_options_get_hint_style(getHandle()));
- }
-
- public void setHintMetrics(HintMetrics hintMetrics) {
- cairo_font_options_set_hint_metrics(getHandle(), hintMetrics.getValue());
- }
-
- public HintMetrics getHintMetrics() {
- return HintMetrics.intern(cairo_font_options_get_hint_metrics(getHandle()));
- }
-
- public void merge(FontOptions other) {
- cairo_font_options_merge(getHandle(), other.getHandle());
- }
-
- public boolean equal(FontOptions other) {
- return cairo_font_options_equal(getHandle(), other.getHandle());
- }
-
- public long hash() {
- return cairo_font_options_hash(getHandle());
- }
-
- protected void finalize() throws Throwable {
- cairo_font_options_destroy(getHandle());
- super.finalize();
- }
+ public FontOptions() {
+ super(cairo_font_options_create());
+ }
- native static final private Handle cairo_font_options_create();
- native static final private void cairo_font_options_set_antialias(Handle obj, int antialias);
- native static final private int cairo_font_options_get_antialias(Handle obj);
- native static final private void cairo_font_options_set_subpixel_order(Handle obj, int order);
- native static final private int cairo_font_options_get_subpixel_order(Handle obj);
- native static final private void cairo_font_options_set_hint_style(Handle obj, int style);
- native static final private int cairo_font_options_get_hint_style(Handle obj);
- native static final private void cairo_font_options_set_hint_metrics(Handle obj, int metrics);
- native static final private int cairo_font_options_get_hint_metrics(Handle obj);
- native static final private void cairo_font_options_destroy(Handle obj);
- native static final private void cairo_font_options_merge(Handle obj, Handle other);
- native static final private boolean cairo_font_options_equal(Handle obj, Handle other);
- native static final private long cairo_font_options_hash(Handle obj);
+ FontOptions(Handle handle) {
+ super(handle);
+ }
+
+ public void setAntialias(Antialias antialias) {
+ cairo_font_options_set_antialias(getHandle(), antialias.getValue());
+ }
+
+ public Antialias getAntialias() {
+ return Antialias.intern(cairo_font_options_get_antialias(getHandle()));
+ }
+
+ public void setSubpixelOrder(SubpixelOrder subpixelOrder) {
+ cairo_font_options_set_subpixel_order(getHandle(), subpixelOrder.getValue());
+ }
+
+ public SubpixelOrder getSubpixelOrder() {
+ return SubpixelOrder.intern(cairo_font_options_get_subpixel_order(getHandle()));
+ }
+
+ public void setHintStyle(HintStyle hintStyle) {
+ cairo_font_options_set_hint_style(getHandle(), hintStyle.getValue());
+ }
+
+ public HintStyle getHintStyle() {
+ return HintStyle.intern(cairo_font_options_get_hint_style(getHandle()));
+ }
+
+ public void setHintMetrics(HintMetrics hintMetrics) {
+ cairo_font_options_set_hint_metrics(getHandle(), hintMetrics.getValue());
+ }
+
+ public HintMetrics getHintMetrics() {
+ return HintMetrics.intern(cairo_font_options_get_hint_metrics(getHandle()));
+ }
+
+ public void merge(FontOptions other) {
+ cairo_font_options_merge(getHandle(), other.getHandle());
+ }
+
+ public boolean equal(FontOptions other) {
+ return cairo_font_options_equal(getHandle(), other.getHandle());
+ }
+
+ public long hash() {
+ return cairo_font_options_hash(getHandle());
+ }
+
+ protected void finalize() throws Throwable {
+ cairo_font_options_destroy(getHandle());
+ super.finalize();
+ }
+
+ native static final private Handle cairo_font_options_create();
+
+ native static final private void cairo_font_options_set_antialias(Handle obj, int antialias);
+
+ native static final private int cairo_font_options_get_antialias(Handle obj);
+
+ native static final private void cairo_font_options_set_subpixel_order(Handle obj, int order);
+
+ native static final private int cairo_font_options_get_subpixel_order(Handle obj);
+
+ native static final private void cairo_font_options_set_hint_style(Handle obj, int style);
+
+ native static final private int cairo_font_options_get_hint_style(Handle obj);
+
+ native static final private void cairo_font_options_set_hint_metrics(Handle obj, int metrics);
+
+ native static final private int cairo_font_options_get_hint_metrics(Handle obj);
+
+ native static final private void cairo_font_options_destroy(Handle obj);
+
+ native static final private void cairo_font_options_merge(Handle obj, Handle other);
+
+ native static final private boolean cairo_font_options_equal(Handle obj, Handle other);
+
+ native static final private long cairo_font_options_hash(Handle obj);
}
Index: FontSlant.java
===================================================================
RCS file: /cvs/cairo/cairo-java/src/java/org/freedesktop/cairo/FontSlant.java,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -d -r1.3 -r1.4
--- FontSlant.java 13 Sep 2005 03:14:10 -0000 1.3
+++ FontSlant.java 12 Feb 2006 08:43:01 -0000 1.4
@@ -1,48 +1,52 @@
/*
* Java-Gnome Bindings Library
-*
-* Copyright 1998-2005 the Java-Gnome Team, all rights reserved.
-*
-* The Java-Gnome bindings library is free software distributed under
-* the terms of the GNU Library General Public License version 2.
-*/
+ *
+ * Copyright 1998-2005 the Java-Gnome Team, all rights reserved.
+ *
+ * The Java-Gnome bindings library is free software distributed under
+ * the terms of the GNU Library General Public License version 2.
+ */
package org.freedesktop.cairo;
import org.gnu.glib.Enum;
-public class FontSlant extends Enum {
- static final private int _NORMAL = 0;
- static final public FontSlant NORMAL = new FontSlant (_NORMAL);
- static final private int _ITALIC = 1;
- static final public FontSlant ITALIC = new FontSlant (_ITALIC);
- static final private int _OBLIQUE = 2;
- static final public FontSlant OBLIQUE = new FontSlant (_OBLIQUE);
- static final private FontSlant[] theInterned = new FontSlant[] {
- NORMAL, ITALIC, OBLIQUE
- };
- static private java.util.Hashtable theInternedExtras;
- static final private FontSlant theSacrificialOne = new FontSlant (0);
- static public FontSlant intern (int value) {
- if (value < theInterned.length) {
- return theInterned[value];
- }
- theSacrificialOne.value_ = value;
- if (theInternedExtras == null) {
- theInternedExtras = new java.util.Hashtable();
- }
- FontSlant already = (FontSlant) theInternedExtras.get(theSacrificialOne);
- if (already == null) {
- already = new FontSlant(value);
- theInternedExtras.put(already, already);
- }
- return already;
- }
+public class FontSlant extends Enum
+{
+ static final private int _NORMAL = 0;
+ static final public FontSlant NORMAL = new FontSlant(_NORMAL);
+ static final private int _ITALIC = 1;
+ static final public FontSlant ITALIC = new FontSlant(_ITALIC);
+ static final private int _OBLIQUE = 2;
+ static final public FontSlant OBLIQUE = new FontSlant(_OBLIQUE);
+ static final private FontSlant[] theInterned = new FontSlant[] {
+ NORMAL,
+ ITALIC,
+ OBLIQUE
+ };
+ static private java.util.Hashtable theInternedExtras;
+ static final private FontSlant theSacrificialOne = new FontSlant(0);
- private FontSlant(int value) {
- value_ = value;
- }
+ static public FontSlant intern(int value) {
+ if (value < theInterned.length) {
+ return theInterned[value];
+ }
+ theSacrificialOne.value_ = value;
+ if (theInternedExtras == null) {
+ theInternedExtras = new java.util.Hashtable();
+ }
+ FontSlant already = (FontSlant) theInternedExtras.get(theSacrificialOne);
+ if (already == null) {
+ already = new FontSlant(value);
+ theInternedExtras.put(already, already);
+ }
+ return already;
+ }
- public boolean test (FontSlant other) {
- return (value_ & other.value_) == other.value_;
- }
+ private FontSlant(int value) {
+ value_ = value;
+ }
+
+ public boolean test(FontSlant other) {
+ return (value_ & other.value_) == other.value_;
+ }
}
Index: FontWeight.java
===================================================================
RCS file: /cvs/cairo/cairo-java/src/java/org/freedesktop/cairo/FontWeight.java,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -d -r1.3 -r1.4
--- FontWeight.java 13 Sep 2005 03:14:10 -0000 1.3
+++ FontWeight.java 12 Feb 2006 08:43:01 -0000 1.4
@@ -1,47 +1,50 @@
/*
* Java-Gnome Bindings Library
-*
-* Copyright 1998-2005 the Java-Gnome Team, all rights reserved.
-*
-* The Java-Gnome bindings library is free software distributed under
-* the terms of the GNU Library General Public License version 2.
-*/
+ *
+ * Copyright 1998-2005 the Java-Gnome Team, all rights reserved.
+ *
+ * The Java-Gnome bindings library is free software distributed under
+ * the terms of the GNU Library General Public License version 2.
+ */
package org.freedesktop.cairo;
import org.gnu.glib.Enum;
-public class FontWeight extends Enum {
- static final private int _NORMAL = 0;
- static final public FontWeight NORMAL = new FontWeight (_NORMAL);
- static final private int _BOLD = 1;
- static final public FontWeight BOLD = new FontWeight (_BOLD);
- static final private FontWeight[] theInterned = new FontWeight[] {
- NORMAL, BOLD
- };
- static private java.util.Hashtable theInternedExtras;
- static final private FontWeight theSacrificialOne = new FontWeight (0);
- static public FontWeight intern (int value) {
- if (value < theInterned.length) {
- return theInterned[value];
- }
- theSacrificialOne.value_ = value;
- if (theInternedExtras == null) {
- theInternedExtras = new java.util.Hashtable();
- }
- FontWeight already = (FontWeight) theInternedExtras.get(theSacrificialOne);
- if (already == null) {
- already = new FontWeight(value);
- theInternedExtras.put(already, already);
- }
- return already;
- }
+public class FontWeight extends Enum
+{
+ static final private int _NORMAL = 0;
+ static final public FontWeight NORMAL = new FontWeight(_NORMAL);
+ static final private int _BOLD = 1;
+ static final public FontWeight BOLD = new FontWeight(_BOLD);
+ static final private FontWeight[] theInterned = new FontWeight[] {
+ NORMAL,
+ BOLD
+ };
+ static private java.util.Hashtable theInternedExtras;
+ static final private FontWeight theSacrificialOne = new FontWeight(0);
- private FontWeight(int value) {
- value_ = value;
- }
+ static public FontWeight intern(int value) {
+ if (value < theInterned.length) {
+ return theInterned[value];
+ }
+ theSacrificialOne.value_ = value;
+ if (theInternedExtras == null) {
+ theInternedExtras = new java.util.Hashtable();
+ }
+ FontWeight already = (FontWeight) theInternedExtras.get(theSacrificialOne);
+ if (already == null) {
+ already = new FontWeight(value);
+ theInternedExtras.put(already, already);
+ }
+ return already;
+ }
- public boolean test (FontWeight other) {
- return (value_ & other.value_) == other.value_;
- }
+ private FontWeight(int value) {
+ value_ = value;
+ }
+
+ public boolean test(FontWeight other) {
+ return (value_ & other.value_) == other.value_;
+ }
}
Index: Format.java
===================================================================
RCS file: /cvs/cairo/cairo-java/src/java/org/freedesktop/cairo/Format.java,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -d -r1.3 -r1.4
--- Format.java 13 Sep 2005 03:14:10 -0000 1.3
+++ Format.java 12 Feb 2006 08:43:01 -0000 1.4
@@ -10,42 +10,47 @@
import org.gnu.glib.Enum;
-public class Format extends Enum {
+public class Format extends Enum
+{
- static final private int _ARGB32 = 0;
- static final public Format ARGB32 = new Format (_ARGB32);
- static final private int _RGB24 = 1;
- static final public Format RGB24 = new Format (_RGB24);
- static final private int _A8 = 2;
- static final public Format A8 = new Format (_A8);
- static final private int _A1 = 3;
- static final public Format A1 = new Format (_A1);
- static final private Format[] theInterned = new Format[] {
- ARGB32, RGB24, A8, A1
- };
- static private java.util.Hashtable theInternedExtras;
- static final private Format theSacrificialOne = new Format (0);
- static public Format intern (int value) {
- if (value < theInterned.length) {
- return theInterned[value];
- }
- theSacrificialOne.value_ = value;
- if (theInternedExtras == null) {
- theInternedExtras = new java.util.Hashtable();
- }
- Format already = (Format) theInternedExtras.get(theSacrificialOne);
- if (already == null) {
- already = new Format(value);
- theInternedExtras.put(already, already);
- }
- return already;
- }
+ static final private int _ARGB32 = 0;
+ static final public Format ARGB32 = new Format(_ARGB32);
+ static final private int _RGB24 = 1;
+ static final public Format RGB24 = new Format(_RGB24);
+ static final private int _A8 = 2;
+ static final public Format A8 = new Format(_A8);
+ static final private int _A1 = 3;
+ static final public Format A1 = new Format(_A1);
+ static final private Format[] theInterned = new Format[] {
+ ARGB32,
+ RGB24,
+ A8,
+ A1
+ };
+ static private java.util.Hashtable theInternedExtras;
+ static final private Format theSacrificialOne = new Format(0);
- private Format(int value) {
- value_ = value;
- }
+ static public Format intern(int value) {
+ if (value < theInterned.length) {
+ return theInterned[value];
+ }
+ theSacrificialOne.value_ = value;
+ if (theInternedExtras == null) {
+ theInternedExtras = new java.util.Hashtable();
+ }
+ Format already = (Format) theInternedExtras.get(theSacrificialOne);
+ if (already == null) {
+ already = new Format(value);
+ theInternedExtras.put(already, already);
+ }
+ return already;
+ }
- public boolean test (Format other) {
- return (value_ & other.value_) == other.value_;
- }
+ private Format(int value) {
+ value_ = value;
+ }
+
+ public boolean test(Format other) {
+ return (value_ & other.value_) == other.value_;
+ }
}
Index: Glyph.java
===================================================================
RCS file: /cvs/cairo/cairo-java/src/java/org/freedesktop/cairo/Glyph.java,v
retrieving revision 1.7
retrieving revision 1.8
diff -u -d -r1.7 -r1.8
--- Glyph.java 13 Sep 2005 03:14:10 -0000 1.7
+++ Glyph.java 12 Feb 2006 08:43:01 -0000 1.8
@@ -1,33 +1,32 @@
/*
* Java-Gnome Bindings Library
-*
-* Copyright 1998-2005 the Java-Gnome Team, all rights reserved.
-*
-* The Java-Gnome bindings library is free software distributed under
-* the terms of the GNU Library General Public License version 2.
-*/
+ *
+ * Copyright 1998-2005 the Java-Gnome Team, all rights reserved.
+ *
+ * The Java-Gnome bindings library is free software distributed under
+ * the terms of the GNU Library General Public License version 2.
+ */
package org.freedesktop.cairo;
import org.gnu.glib.Handle;
/**
- * A Glyph holds information about a single glyph when drawing
- * or measuring text. A font is (in simple terms) a collection
- * of shapes used to draw text. A glyph is one of these shapes.
- * There can be multiple glyphs for a single character (alternates
- * to be used in different contexts, for example), or a glyph
- * can be a <firstterm>ligature</firstterm> of multiple characters.
- * Cairo doesn't expose any way of converting input text into
- * glyphs, so in order to use the Cairo interfaces that take arrays
- * of glyphs, you must directly access the appropriate underlying
- * font system.
+ * A Glyph holds information about a single glyph when drawing or measuring
+ * text. A font is (in simple terms) a collection of shapes used to draw text. A
+ * glyph is one of these shapes. There can be multiple glyphs for a single
+ * character (alternates to be used in different contexts, for example), or a
+ * glyph can be a <firstterm>ligature</firstterm> of multiple characters. Cairo
+ * doesn't expose any way of converting input text into glyphs, so in order to
+ * use the Cairo interfaces that take arrays of glyphs, you must directly access
+ * the appropriate underlying font system.
*/
-public class Glyph extends CairoObject {
+public class Glyph extends CairoObject
+{
public Glyph() {
super(alloc());
}
-
+
public Glyph(long index, double x, double y) {
super(alloc(index, x, y));
}
@@ -35,50 +34,58 @@
Glyph(Handle hndl) {
super(hndl);
}
-
- protected void finalize() throws Throwable {
+
+ protected void finalize() throws Throwable {
free(getHandle());
super.finalize();
}
public long getIndex() {
- return get_index(getHandle());
- }
-
+ return get_index(getHandle());
+ }
+
public void setIndex(long index) {
set_index(getHandle(), index);
}
-
- public double getX() {
- return get_x(getHandle());
- }
-
+
+ public double getX() {
+ return get_x(getHandle());
+ }
+
public void setX(double x) {
set_x(getHandle(), x);
}
-
- public double getY() {
- return get_y(getHandle());
- }
-
+
+ public double getY() {
+ return get_y(getHandle());
+ }
+
public void setY(double y) {
set_y(getHandle(), y);
}
-
- public Point getPoint() {
- return new Point(get_x(getHandle()), get_y(getHandle()));
- }
- /*
- * native calls
- */
- native static final private Handle alloc();
- native static final private Handle alloc(long index, double x, double y);
- native static final private void free(Handle obj);
- native static final private long get_index(Handle obj);
- native static final private double get_x(Handle obj);
- native static final private double get_y(Handle obj);
- native static final private void set_index(Handle obj, long index);
- native static final private void set_x(Handle obj, double x);
- native static final private void set_y(Handle obj, double y);
+ public Point getPoint() {
+ return new Point(get_x(getHandle()), get_y(getHandle()));
+ }
+
+ /*
+ * native calls
+ */
+ native static final private Handle alloc();
+
+ native static final private Handle alloc(long index, double x, double y);
+
+ native static final private void free(Handle obj);
+
+ native static final private long get_index(Handle obj);
+
+ native static final private double get_x(Handle obj);
+
+ native static final private double get_y(Handle obj);
+
+ native static final private void set_index(Handle obj, long index);
+
+ native static final private void set_x(Handle obj, double x);
+
+ native static final private void set_y(Handle obj, double y);
}
Index: Gradient.java
===================================================================
RCS file: /cvs/cairo/cairo-java/src/java/org/freedesktop/cairo/Gradient.java,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -d -r1.3 -r1.4
--- Gradient.java 13 Sep 2005 03:14:10 -0000 1.3
+++ Gradient.java 12 Feb 2006 08:43:01 -0000 1.4
@@ -10,36 +10,45 @@
import org.gnu.glib.Handle;
-public class Gradient extends Pattern {
-
- Gradient(Handle hndl) {
- super(hndl);
- }
+public class Gradient extends Pattern
+{
+
+ Gradient(Handle hndl) {
+ super(hndl);
+ }
+
+ /**
+ * Adds a new color stop to the pattern.
+ *
+ * @param offset
+ * The offset length
+ * @param red
+ * The value to use for red
+ * @param green
+ * The value to use for green
+ * @param blue
+ * The value to use for blue
+ */
+ public void addColorStop(double offset, double red, double green, double blue) {
+ cairo_pattern_add_color_stop_rgb(getHandle(), offset, red, green, blue);
+ }
+
+ /**
+ * Adds a new color stop to the pattern.
+ *
+ * @param offset
+ * The offset length
+ * @param red
+ * The value to use for red
+ * @param green
+ * The value to use for green
+ * @param blue
+ * The value to use for blue
+ * @param alpha
+ * alpha for the color
+ */
+ public void addColorStop(double offset, double red, double green, double blue, double alpha) {
+ cairo_pattern_add_color_stop_rgba(getHandle(), offset, red, green, blue, alpha);
+ }
- /**
- * Adds a new color stop to the pattern.
- * @param offset The offset length
- * @param red The value to use for red
- * @param green The value to use for green
- * @param blue The value to use for blue
- */
- public void addColorStop(double offset, double red, double green, double blue) {
- cairo_pattern_add_color_stop_rgb(getHandle(), offset, red,
- green, blue);
- }
-
- /**
- * Adds a new color stop to the pattern.
- * @param offset The offset length
- * @param red The value to use for red
- * @param green The value to use for green
- * @param blue The value to use for blue
- * @param alpha alpha for the color
- */
- public void addColorStop(double offset, double red, double green, double blue, double alpha) {
- cairo_pattern_add_color_stop_rgba(getHandle(), offset, red,
- green, blue, alpha);
- }
-
-
}
Index: HintMetrics.java
===================================================================
RCS file: /cvs/cairo/cairo-java/src/java/org/freedesktop/cairo/HintMetrics.java,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -d -r1.2 -r1.3
--- HintMetrics.java 13 Sep 2005 03:14:10 -0000 1.2
+++ HintMetrics.java 12 Feb 2006 08:43:01 -0000 1.3
@@ -12,58 +12,60 @@
import org.gnu.glib.Enum;
/**
- * Specifies whether to hint font metrics; hinting font metrics
- * means quantizing them so that they are integer values in
- * device space. Doing this improves the consistency of
- * letter and line spacing, however it also means that text
- * will be laid out differently at different zoom factors.
+ * Specifies whether to hint font metrics; hinting font metrics means quantizing
+ * them so that they are integer values in device space. Doing this improves the
+ * consistency of letter and line spacing, however it also means that text will
+ * be laid out differently at different zoom factors.
*/
-public class HintMetrics extends Enum {
+public class HintMetrics extends Enum
+{
- static final private int _DEFAULT = 0;
- /**
- * Hint metrics in the default
- * manner for the font backend and target device
- */
- static final public HintMetrics DEFAULT = new HintMetrics (_DEFAULT);
- static final private int _OFF = 1;
- /**
- * Do not hint font metrics
- */
- static final public HintMetrics OFF = new HintMetrics (_OFF);
- static final private int _ON = 2;
- /**
- * Hint font metrics
- */
- static final public HintMetrics ON = new HintMetrics (_ON);
+ static final private int _DEFAULT = 0;
+ /**
+ * Hint metrics in the default manner for the font backend and target device
+ */
+ static final public HintMetrics DEFAULT = new HintMetrics(_DEFAULT);
+ static final private int _OFF = 1;
+ /**
+ * Do not hint font metrics
+ */
+ static final public HintMetrics OFF = new HintMetrics(_OFF);
+ static final private int _ON = 2;
+ /**
+ * Hint font metrics
+ */
+ static final public HintMetrics ON = new HintMetrics(_ON);
- static final private HintMetrics[] theInterned = new HintMetrics[] {
- DEFAULT, OFF, ON
- };
- static private java.util.Hashtable theInternedExtras;
- static final private HintMetrics theSacrificialOne = new HintMetrics (0);
- static public HintMetrics intern (int value) {
- if (value < theInterned.length) {
- return theInterned[value];
- }
- theSacrificialOne.value_ = value;
- if (theInternedExtras == null) {
- theInternedExtras = new java.util.Hashtable();
- }
- HintMetrics already = (HintMetrics) theInternedExtras.get(theSacrificialOne);
- if (already == null) {
- already = new HintMetrics(value);
- theInternedExtras.put(already, already);
- }
- return already;
- }
+ static final private HintMetrics[] theInterned = new HintMetrics[] {
+ DEFAULT,
+ OFF,
+ ON
+ };
+ static private java.util.Hashtable theInternedExtras;
+ static final private HintMetrics theSacrificialOne = new HintMetrics(0);
- private HintMetrics(int value) {
- value_ = value;
- }
+ static public HintMetrics intern(int value) {
+ if (value < theInterned.length) {
+ return theInterned[value];
+ }
+ theSacrificialOne.value_ = value;
+ if (theInternedExtras == null) {
+ theInternedExtras = new java.util.Hashtable();
+ }
+ HintMetrics already = (HintMetrics) theInternedExtras.get(theSacrificialOne);
+ if (already == null) {
+ already = new HintMetrics(value);
+ theInternedExtras.put(already, already);
+ }
+ return already;
+ }
- public boolean test (HintMetrics other) {
- return (value_ & other.value_) == other.value_;
- }
+ private HintMetrics(int value) {
+ value_ = value;
+ }
+
+ public boolean test(HintMetrics other) {
+ return (value_ & other.value_) == other.value_;
+ }
}
Index: HintStyle.java
===================================================================
RCS file: /cvs/cairo/cairo-java/src/java/org/freedesktop/cairo/HintStyle.java,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -d -r1.2 -r1.3
--- HintStyle.java 13 Sep 2005 03:14:10 -0000 1.2
+++ HintStyle.java 12 Feb 2006 08:43:01 -0000 1.3
@@ -12,72 +12,74 @@
import org.gnu.glib.Enum;
/**
- * Specifies the type of hinting to do on font outlines. Hinting
- * is the process of fitting outlines to the pixel grid in order
- * to improve the appearance of the result. Since hinting outlines
- * involves distorting them, it also reduces the faithfulness
- * to the original outline shapes. Not all of the outline hinting
- * styles are supported by all font backends.
+ * Specifies the type of hinting to do on font outlines. Hinting is the process
+ * of fitting outlines to the pixel grid in order to improve the appearance of
+ * the result. Since hinting outlines involves distorting them, it also reduces
+ * the faithfulness to the original outline shapes. Not all of the outline
+ * hinting styles are supported by all font backends.
*/
-public class HintStyle extends Enum {
+public class HintStyle extends Enum
+{
- static final private int _DEFAULT = 0;
- /**
- * Use the default hint style for
- * for font backend and target device
- */
- static final public HintStyle DEFAULT = new HintStyle (_DEFAULT);
- static final private int _NONE = 1;
- /**
- * Do not hint outlines
- */
- static final public HintStyle NONE = new HintStyle (_NONE);
- static final private int _SLIGHT = 2;
- /**
- * Hint outlines slightly to improve
- * contrast while retaining good fidelity to the original
- * shapes.
- */
- static final public HintStyle SLIGHT = new HintStyle (_SLIGHT);
- static final private int _MEDIUM = 3;
- /**
- * Hint outlines with medium strength
- * giving a compromise between fidelity to the original shapes
- * and contrast
- */
- static final public HintStyle MEDIUM = new HintStyle (_MEDIUM);
- static final private int _FULL = 4;
- /**
- * Hint outlines to maximize contrast
- */
- static final public HintStyle FULL = new HintStyle (_FULL);
- static final private HintStyle[] theInterned = new HintStyle[] {
- DEFAULT, NONE, SLIGHT, MEDIUM, FULL
- };
- static private java.util.Hashtable theInternedExtras;
- static final private HintStyle theSacrificialOne = new HintStyle (0);
- static public HintStyle intern (int value) {
- if (value < theInterned.length) {
- return theInterned[value];
- }
- theSacrificialOne.value_ = value;
- if (theInternedExtras == null) {
- theInternedExtras = new java.util.Hashtable();
- }
- HintStyle already = (HintStyle) theInternedExtras.get(theSacrificialOne);
- if (already == null) {
- already = new HintStyle(value);
- theInternedExtras.put(already, already);
- }
- return already;
- }
+ static final private int _DEFAULT = 0;
+ /**
+ * Use the default hint style for for font backend and target device
+ */
+ static final public HintStyle DEFAULT = new HintStyle(_DEFAULT);
+ static final private int _NONE = 1;
+ /**
+ * Do not hint outlines
+ */
+ static final public HintStyle NONE = new HintStyle(_NONE);
+ static final private int _SLIGHT = 2;
+ /**
+ * Hint outlines slightly to improve contrast while retaining good fidelity
+ * to the original shapes.
+ */
+ static final public HintStyle SLIGHT = new HintStyle(_SLIGHT);
+ static final private int _MEDIUM = 3;
+ /**
+ * Hint outlines with medium strength giving a compromise between fidelity
+ * to the original shapes and contrast
+ */
+ static final public HintStyle MEDIUM = new HintStyle(_MEDIUM);
+ static final private int _FULL = 4;
+ /**
+ * Hint outlines to maximize contrast
+ */
+ static final public HintStyle FULL = new HintStyle(_FULL);
+ static final private HintStyle[] theInterned = new HintStyle[] {
+ DEFAULT,
+ NONE,
+ SLIGHT,
+ MEDIUM,
+ FULL
+ };
+ static private java.util.Hashtable theInternedExtras;
+ static final private HintStyle theSacrificialOne = new HintStyle(0);
- private HintStyle(int value) {
- value_ = value;
- }
+ static public HintStyle intern(int value) {
+ if (value < theInterned.length) {
+ return theInterned[value];
+ }
+ theSacrificialOne.value_ = value;
+ if (theInternedExtras == null) {
+ theInternedExtras = new java.util.Hashtable();
+ }
+ HintStyle already = (HintStyle) theInternedExtras.get(theSacrificialOne);
+ if (already == null) {
+ already = new HintStyle(value);
+ theInternedExtras.put(already, already);
+ }
+ return already;
+ }
- public boolean test (HintStyle other) {
- return (value_ & other.value_) == other.value_;
- }
+ private HintStyle(int value) {
+ value_ = value;
+ }
+
+ public boolean test(HintStyle other) {
+ return (value_ & other.value_) == other.value_;
+ }
}
Index: ImageSurface.java
===================================================================
RCS file: /cvs/cairo/cairo-java/src/java/org/freedesktop/cairo/ImageSurface.java,v
retrieving revision 1.11
retrieving revision 1.12
diff -u -d -r1.11 -r1.12
--- ImageSurface.java 13 Sep 2005 03:14:10 -0000 1.11
+++ ImageSurface.java 12 Feb 2006 08:43:01 -0000 1.12
@@ -1,11 +1,11 @@
/*
* Java-Gnome Bindings Library
-*
-* Copyright 1998-2005 the Java-Gnome Team, all rights reserved.
-*
-* The Java-Gnome bindings library is free software distributed under
-* the terms of the GNU Library General Public License version 2.
-*/
+ *
+ * Copyright 1998-2005 the Java-Gnome Team, all rights reserved.
+ *
+ * The Java-Gnome bindings library is free software distributed under
+ * the terms of the GNU Library General Public License version 2.
+ */
package org.freedesktop.cairo;
@@ -13,48 +13,54 @@
/**
*/
-public class ImageSurface extends Surface {
-
-
+public class ImageSurface extends Surface
+{
+
public ImageSurface(Format format, int width, int height) {
super(cairo_image_surface_create(format.getValue(), width, height));
}
-
+
public ImageSurface(char[] data, Format format, int width, int height, int stride) {
super(cairo_image_surface_create_for_data(data, format.getValue(), width, height, stride));
}
-
+
ImageSurface(Handle hndl) {
super(hndl);
}
-
- public int getWidth() {
- return cairo_image_surface_get_width(getHandle());
- }
-
- public int getHeight() {
- return cairo_image_surface_get_height(getHandle());
- }
-
- static public ImageSurface createFromPNG(String filename) {
- return new ImageSurface(cairo_image_surface_create_from_png(filename));
- }
-
+
+ public int getWidth() {
+ return cairo_image_surface_get_width(getHandle());
+ }
+
+ public int getHeight() {
+ return cairo_image_surface_get_height(getHandle());
+ }
+
+ static public ImageSurface createFromPNG(String filename) {
+ return new ImageSurface(cairo_image_surface_create_from_png(filename));
+ }
+
/*
* Native calls
*/
native static final private Handle cairo_image_surface_create(int format, int width, int height);
- native static final private Handle cairo_image_surface_create_for_data(char[] data, int format, int width, int height, int stride);
+
+ native static final private Handle cairo_image_surface_create_for_data(char[] data, int format, int width,
+ int height, int stride);
+
// TODO: JNI
native static final private int cairo_image_surface_get_width(Handle obj);
+
// TODO: JNI
native static final private int cairo_image_surface_get_height(Handle obj);
+
// TODO: JNI and exception handling
native static final private Handle cairo_image_surface_create_from_png(String filename);
// TODO:
-// native static final private Handle cairo_image_surface_create_from_png_stream(String func);
-// cairo_surface_t *
-// cairo_image_surface_create_from_png_stream (cairo_read_func_t read_func,
-// void *closure);
-
+ // native static final private Handle
+ // cairo_image_surface_create_from_png_stream(String func);
+ // cairo_surface_t *
+ // cairo_image_surface_create_from_png_stream (cairo_read_func_t read_func,
+ // void *closure);
+
}
Index: LineCap.java
===================================================================
RCS file: /cvs/cairo/cairo-java/src/java/org/freedesktop/cairo/LineCap.java,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -d -r1.3 -r1.4
--- LineCap.java 13 Sep 2005 03:14:10 -0000 1.3
+++ LineCap.java 12 Feb 2006 08:43:01 -0000 1.4
@@ -10,40 +10,44 @@
import org.gnu.glib.Enum;
-public class LineCap extends Enum {
+public class LineCap extends Enum
+{
- static final private int _BUTT = 0;
- static final public LineCap BUTT = new LineCap (_BUTT);
- static final private int _ROUND = 1;
- static final public LineCap ROUND = new LineCap (_ROUND);
- static final private int _SQUARE = 2;
- static final public LineCap SQUARE = new LineCap (_SQUARE);
- static final private LineCap[] theInterned = new LineCap[] {
- BUTT, ROUND, SQUARE
- };
- static private java.util.Hashtable theInternedExtras;
- static final private LineCap theSacrificialOne = new LineCap (0);
- static public LineCap intern (int value) {
- if (value < theInterned.length) {
- return theInterned[value];
- }
- theSacrificialOne.value_ = value;
- if (theInternedExtras == null) {
- theInternedExtras = new java.util.Hashtable();
- }
- LineCap already = (LineCap) theInternedExtras.get(theSacrificialOne);
- if (already == null) {
- already = new LineCap(value);
- theInternedExtras.put(already, already);
- }
- return already;
- }
+ static final private int _BUTT = 0;
+ static final public LineCap BUTT = new LineCap(_BUTT);
+ static final private int _ROUND = 1;
+ static final public LineCap ROUND = new LineCap(_ROUND);
+ static final private int _SQUARE = 2;
+ static final public LineCap SQUARE = new LineCap(_SQUARE);
+ static final private LineCap[] theInterned = new LineCap[] {
+ BUTT,
+ ROUND,
+ SQUARE
+ };
+ static private java.util.Hashtable theInternedExtras;
+ static final private LineCap theSacrificialOne = new LineCap(0);
- private LineCap(int value) {
- value_ = value;
- }
+ static public LineCap intern(int value) {
+ if (value < theInterned.length) {
+ return theInterned[value];
+ }
+ theSacrificialOne.value_ = value;
+ if (theInternedExtras == null) {
+ theInternedExtras = new java.util.Hashtable();
+ }
+ LineCap already = (LineCap) theInternedExtras.get(theSacrificialOne);
+ if (already == null) {
+ already = new LineCap(value);
+ theInternedExtras.put(already, already);
+ }
+ return already;
+ }
- public boolean test (LineCap other) {
- return (value_ & other.value_) == other.value_;
- }
+ private LineCap(int value) {
+ value_ = value;
+ }
+
+ public boolean test(LineCap other) {
+ return (value_ & other.value_) == other.value_;
+ }
}
Index: LineJoin.java
===================================================================
RCS file: /cvs/cairo/cairo-java/src/java/org/freedesktop/cairo/LineJoin.java,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -d -r1.3 -r1.4
--- LineJoin.java 13 Sep 2005 03:14:10 -0000 1.3
+++ LineJoin.java 12 Feb 2006 08:43:01 -0000 1.4
@@ -1,49 +1,53 @@
/*
* Java-Gnome Bindings Library
-*
-* Copyright 1998-2005 the Java-Gnome Team, all rights reserved.
-*
-* The Java-Gnome bindings library is free software distributed under
-* the terms of the GNU Library General Public License version 2.
-*/
+ *
+ * Copyright 1998-2005 the Java-Gnome Team, all rights reserved.
+ *
+ * The Java-Gnome bindings library is free software distributed under
+ * the terms of the GNU Library General Public License version 2.
+ */
package org.freedesktop.cairo;
import org.gnu.glib.Enum;
-public class LineJoin extends Enum {
+public class LineJoin extends Enum
+{
- static final private int _MITER = 0;
- static final public LineJoin MITER = new LineJoin (_MITER);
- static final private int _ROUND = 1;
- static final public LineJoin ROUND = new LineJoin (_ROUND);
- static final private int _BEVEL = 2;
- static final public LineJoin BEVEL = new LineJoin (_BEVEL);
- static final private LineJoin[] theInterned = new LineJoin[] {
- MITER, ROUND, BEVEL
- };
- static private java.util.Hashtable theInternedExtras;
- static final private LineJoin theSacrificialOne = new LineJoin (0);
- static public LineJoin intern (int value) {
- if (value < theInterned.length) {
- return theInterned[value];
- }
- theSacrificialOne.value_ = value;
- if (theInternedExtras == null) {
- theInternedExtras = new java.util.Hashtable();
- }
- LineJoin already = (LineJoin) theInternedExtras.get(theSacrificialOne);
- if (already == null) {
- already = new LineJoin(value);
- theInternedExtras.put(already, already);
- }
- return already;
- }
+ static final private int _MITER = 0;
+ static final public LineJoin MITER = new LineJoin(_MITER);
+ static final private int _ROUND = 1;
+ static final public LineJoin ROUND = new LineJoin(_ROUND);
+ static final private int _BEVEL = 2;
+ static final public LineJoin BEVEL = new LineJoin(_BEVEL);
+ static final private LineJoin[] theInterned = new LineJoin[] {
+ MITER,
+ ROUND,
+ BEVEL
+ };
+ static private java.util.Hashtable theInternedExtras;
+ static final private LineJoin theSacrificialOne = new LineJoin(0);
- private LineJoin(int value) {
- value_ = value;
- }
+ static public LineJoin intern(int value) {
+ if (value < theInterned.length) {
+ return theInterned[value];
+ }
+ theSacrificialOne.value_ = value;
+ if (theInternedExtras == null) {
+ theInternedExtras = new java.util.Hashtable();
+ }
+ LineJoin already = (LineJoin) theInternedExtras.get(theSacrificialOne);
+ if (already == null) {
+ already = new LineJoin(value);
+ theInternedExtras.put(already, already);
+ }
+ return already;
+ }
- public boolean test (LineJoin other) {
- return (value_ & other.value_) == other.value_;
- }
+ private LineJoin(int value) {
+ value_ = value;
+ }
+
+ public boolean test(LineJoin other) {
+ return (value_ & other.value_) == other.value_;
+ }
}
Index: LinearGradient.java
===================================================================
RCS file: /cvs/cairo/cairo-java/src/java/org/freedesktop/cairo/LinearGradient.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -d -r1.1 -r1.2
--- LinearGradient.java 9 May 2005 15:38:24 -0000 1.1
+++ LinearGradient.java 12 Feb 2006 08:43:01 -0000 1.2
@@ -8,10 +8,11 @@
*/
package org.freedesktop.cairo;
-public class LinearGradient extends Gradient {
+public class LinearGradient extends Gradient
+{
+
+ public LinearGradient(double x1, double y1, double x2, double y2) {
+ super(cairo_pattern_create_linear(x1, y1, x2, y2));
+ }
- public LinearGradient(double x1, double y1, double x2, double y2) {
- super(cairo_pattern_create_linear(x1, y1, x2, y2));
- }
-
}
Index: Matrix.java
===================================================================
RCS file: /cvs/cairo/cairo-java/src/java/org/freedesktop/cairo/Matrix.java,v
retrieving revision 1.11
retrieving revision 1.12
diff -u -d -r1.11 -r1.12
--- Matrix.java 28 Oct 2005 23:04:46 -0000 1.11
+++ Matrix.java 12 Feb 2006 08:43:01 -0000 1.12
@@ -14,66 +14,72 @@
/**
* TODO: error handling
*/
-public class Matrix extends CairoObject {
+public class Matrix extends CairoObject
+{
Matrix(Handle hndl) {
super(hndl);
}
-
- /**
- * Sets the matrix to be the affine transformation given by
- * xx, yx, xy, yy, x0, y0. The transformation is given
- * by:
- * <code>
- * x_new = xx * x + xy * y + x0;
- * y_new = yx * x + yy * y + y0;
- * </code>
- */
- public void init(double xx, double yx, double xy, double yy, double x0, double y0) {
- cairo_matrix_init(getHandle(), xx, yx, xy, yy, x0, y0);
- }
-
- /**
- * Modifies the matrix to be an identity transformation.
- */
- public void initIdentity() {
- cairo_matrix_init_identity(getHandle());
- }
-
- /**
- * Initializes the matrix to a transformation that translates by tx and
- * ty in the X and Y dimensions, respectively.
- *
- * @param tx amount to translate in the X direction.
- * @param ty amount to translate in the Y direction.
- */
- public void initTranslate(double tx, double ty) {
- cairo_matrix_init_translate(getHandle(), tx, ty);
- }
-
- /**
- * Initializes the matrix to a transformation that scales by sx and sy
- * in the X and Y dimensions, respectively.
- *
- * @param sx scale factor in the X direction.
- * @param sy scale factor in the Y direction.
- */
- public void initScale(double sx, double sy) {
- cairo_matrix_init_scale(getHandle(), sx, sy);
- }
-
- /**
- * Initialized the matrix to a transformation that rotates by @radians.
- *
- * @param radians angle of rotation, in radians. The direction of rotation
- * is defined such that positive angles rotate in the direction from
- * the positive X axis toward the positive Y axis. With the default
- * axis orientation of cairo, positive angles rotate in a clockwise
- * direction.
- */
- public void initRotate(double radians) {
- cairo_matrix_init_rotate(getHandle(), radians);
- }
+
+ /**
+ * Sets the matrix to be the affine transformation given by xx, yx, xy, yy,
+ * x0, y0. The transformation is given by: <code>
+ * x_new = xx * x + xy * y + x0;
+ * y_new = yx * x + yy * y + y0;
+ * </code>
+ */
+ public void init(double xx, double yx, double xy, double yy, double x0, double y0) {
+ cairo_matrix_init(getHandle(), xx, yx, xy, yy, x0, y0);
+ }
+
+ /**
+ * Modifies the matrix to be an identity transformation.
+ */
+ public void initIdentity() {
+ cairo_matrix_init_identity(getHandle());
+ }
+
+ /**
+ * Initializes the matrix to a transformation that translates by tx and ty
+ * in the X and Y dimensions, respectively.
+ *
+ * @param tx
+ * amount to translate in the X direction.
+ * @param ty
+ * amount to translate in the Y direction.
+ */
+ public void initTranslate(double tx, double ty) {
+ cairo_matrix_init_translate(getHandle(), tx, ty);
+ }
+
+ /**
+ * Initializes the matrix to a transformation that scales by sx and sy in
+ * the X and Y dimensions, respectively.
+ *
+ * @param sx
+ * scale factor in the X direction.
+ * @param sy
+ * scale factor in the Y direction.
+ */
+ public void initScale(double sx, double sy) {
+ cairo_matrix_init_scale(getHandle(), sx, sy);
+ }
+
+ /**
+ * Initialized the matrix to a transformation that rotates by
+ *
+ * @radians.
+ *
+ * @param radians
+ * angle of rotation, in radians. The direction of rotation is
+ * defined such that positive angles rotate in the direction from
+ * the positive X axis toward the positive Y axis. With the
+ * default axis orientation of cairo, positive angles rotate in a
+ * clockwise direction.
+ */
+ public void initRotate(double radians) {
+ cairo_matrix_init_rotate(getHandle(), radians);
+ }
/**
* Appends a transaltion transformation to this matrix.
@@ -135,8 +141,12 @@
* Transforms the given distance and returns transformed co-ordinates
*/
public Point transformDistance(Point distance) {
- double[] dx = new double[] { distance.getX() };
- double[] dy = new double[] { distance.getY() };
+ double[] dx = new double[] {
+ distance.getX()
+ };
+ double[] dy = new double[] {
+ distance.getY()
+ };
cairo_matrix_transform_distance(getHandle(), dx, dy);
return new Point(dx[0], dy[0]);
}
@@ -145,8 +155,12 @@
* Transforms the given point and returns transformed co-ordinates
*/
public Point transformPoint(Point point) {
- double[] dx = new double[] { point.getX() };
- double[] dy = new double[] { point.getY() };
+ double[] dx = new double[] {
+ point.getX()
+ };
+ double[] dy = new double[] {
+ point.getY()
+ };
cairo_matrix_transform_distance(getHandle(), dx, dy);
return new Point(dx[0], dy[0]);
}
@@ -154,7 +168,7 @@
public double getXX() {
return getXX(getHandle());
}
-
+
public void setXX(double xx) {
setXX(getHandle(), xx);
}
@@ -162,39 +176,39 @@
public double getYX() {
return getYX(getHandle());
}
-
+
public void setYX(double yx) {
setYX(getHandle(), yx);
}
-
+
public double getXY() {
return getXY(getHandle());
}
-
+
public void setXY(double xy) {
setXY(getHandle(), xy);
}
-
+
public double getYY() {
return getYY(getHandle());
}
-
+
public void setYY(double yy) {
setYY(getHandle(), yy);
}
-
+
public double getX0() {
return getX0(getHandle());
}
-
+
public void setX0(double x0) {
setX0(getHandle(), x0);
}
-
+
public double getY0() {
return getY0(getHandle());
}
-
+
public void setY0(double y0) {
setY0(getHandle(), y0);
}
@@ -203,38 +217,52 @@
* Native calls
*/
native static final private double getXX(Handle matrix);
+
native static final private double getYX(Handle matrix);
+
native static final private double getXY(Handle matrix);
+
native static final private double getYY(Handle matrix);
+
native static final private double getX0(Handle matrix);
+
native static final private double getY0(Handle matrix);
+
native static final private void setXX(Handle matrix, double xx);
+
native static final private void setYX(Handle matrix, double yx);
+
native static final private void setXY(Handle matrix, double xy);
+
native static final private void setYY(Handle matrix, double yy);
+
native static final private void setX0(Handle matrix, double x0);
+
native static final private void setY0(Handle matrix, double y0);
-
- native static final private void cairo_matrix_init(Handle matrix,
- double xx, double yx, double xy, double yy, double x0, double y0);
+
+ native static final private void cairo_matrix_init(Handle matrix, double xx, double yx, double xy, double yy,
+ double x0, double y0);
+
native static final private void cairo_matrix_init_identity(Handle matrix);
- native static final private void cairo_matrix_init_translate(Handle matrix,
- double tx, double ty);
- native static final private void cairo_matrix_init_scale(Handle matrix,
- double sx, double sy);
+
+ native static final private void cairo_matrix_init_translate(Handle matrix, double tx, double ty);
+
+ native static final private void cairo_matrix_init_scale(Handle matrix, double sx, double sy);
+
native static final private void cairo_matrix_init_rotate(Handle matrix, double radians);
- native static final private void cairo_matrix_translate(Handle matrix,
- double tx, double ty);
- native static final private void cairo_matrix_scale(Handle matrix,
- double sx, double sy);
- native static final private void cairo_matrix_rotate(Handle matrix,
- double radians);
+
+ native static final private void cairo_matrix_translate(Handle matrix, double tx, double ty);
+
+ native static final private void cairo_matrix_scale(Handle matrix, double sx, double sy);
+
+ native static final private void cairo_matrix_rotate(Handle matrix, double radians);
+
native static final private void cairo_matrix_invert(Handle matrix);
- native static final private void cairo_matrix_multiply(Handle result,
- Handle a, Handle b);
- native static final private void cairo_matrix_transform_distance(
- Handle handle, double[] dx, double[] dy);
- native static final private void cairo_matrix_transform_point(
- Handle handle, double[] x, double[] y);
+
+ native static final private void cairo_matrix_multiply(Handle result, Handle a, Handle b);
+
+ native static final private void cairo_matrix_transform_distance(Handle handle, double[] dx, double[] dy);
+
+ native static final private void cairo_matrix_transform_point(Handle handle, double[] x, double[] y);
}
Index: Operator.java
===================================================================
RCS file: /cvs/cairo/cairo-java/src/java/org/freedesktop/cairo/Operator.java,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -d -r1.5 -r1.6
--- Operator.java 13 Sep 2005 03:14:10 -0000 1.5
+++ Operator.java 12 Feb 2006 08:43:01 -0000 1.6
@@ -12,62 +12,76 @@
/**
*/
-public class Operator extends Enum {
- static final private int _CLEAR = 0;
- static final public Operator CLEAR = new Operator (_CLEAR);
- static final private int _SOURCE = 1;
- static final public Operator SOURCE = new Operator (_SOURCE);
- static final private int _OVER = 2;
- static final public Operator OVER = new Operator (_OVER);
- static final private int _IN = 3;
- static final public Operator IN = new Operator (_IN);
- static final private int _OUT = 4;
- static final public Operator OUT = new Operator (_OUT);
- static final private int _ATOP = 5;
- static final public Operator ATOP = new Operator (_ATOP);
- static final private int _DEST = 6;
- static final public Operator DEST = new Operator (_DEST);
- static final private int _DEST_OVER = 7;
- static final public Operator DEST_OVER = new Operator (_DEST_OVER);
- static final private int _DEST_IN = 8;
- static final public Operator DEST_IN = new Operator (_DEST_IN);
- static final private int _DEST_OUT = 9;
- static final public Operator DEST_OUT = new Operator (_DEST_OUT);
- static final private int _DEST_ATOP = 10;
- static final public Operator DEST_ATOP = new Operator (_DEST_ATOP);
- static final private int _XOR = 11;
- static final public Operator XOR = new Operator (_XOR);
- static final private int _ADD = 12;
- static final public Operator ADD = new Operator (_ADD);
- static final private int _SATURATE = 13;
- static final public Operator SATURATE = new Operator (_SATURATE);
- static final private Operator[] theInterned = new Operator[] {
- CLEAR, SOURCE, OVER, IN, OUT, ATOP, DEST, DEST_OVER, DEST_IN,
- DEST_OUT, DEST_ATOP, XOR, ADD, SATURATE
- };
- static private java.util.Hashtable theInternedExtras;
- static final private Operator theSacrificialOne = new Operator (0);
- static public Operator intern (int value) {
- if (value < theInterned.length) {
- return theInterned[value];
- }
- theSacrificialOne.value_ = value;
- if (theInternedExtras == null) {
- theInternedExtras = new java.util.Hashtable();
- }
- Operator already = (Operator) theInternedExtras.get(theSacrificialOne);
- if (already == null) {
- already = new Operator(value);
- theInternedExtras.put(already, already);
- }
- return already;
- }
+public class Operator extends Enum
+{
+ static final private int _CLEAR = 0;
+ static final public Operator CLEAR = new Operator(_CLEAR);
+ static final private int _SOURCE = 1;
+ static final public Operator SOURCE = new Operator(_SOURCE);
+ static final private int _OVER = 2;
+ static final public Operator OVER = new Operator(_OVER);
+ static final private int _IN = 3;
+ static final public Operator IN = new Operator(_IN);
+ static final private int _OUT = 4;
+ static final public Operator OUT = new Operator(_OUT);
+ static final private int _ATOP = 5;
+ static final public Operator ATOP = new Operator(_ATOP);
+ static final private int _DEST = 6;
+ static final public Operator DEST = new Operator(_DEST);
+ static final private int _DEST_OVER = 7;
+ static final public Operator DEST_OVER = new Operator(_DEST_OVER);
+ static final private int _DEST_IN = 8;
+ static final public Operator DEST_IN = new Operator(_DEST_IN);
+ static final private int _DEST_OUT = 9;
+ static final public Operator DEST_OUT = new Operator(_DEST_OUT);
+ static final private int _DEST_ATOP = 10;
+ static final public Operator DEST_ATOP = new Operator(_DEST_ATOP);
+ static final private int _XOR = 11;
+ static final public Operator XOR = new Operator(_XOR);
+ static final private int _ADD = 12;
+ static final public Operator ADD = new Operator(_ADD);
+ static final private int _SATURATE = 13;
+ static final public Operator SATURATE = new Operator(_SATURATE);
+ static final private Operator[] theInterned = new Operator[] {
+ CLEAR,
+ SOURCE,
+ OVER,
+ IN,
+ OUT,
+ ATOP,
+ DEST,
+ DEST_OVER,
+ DEST_IN,
+ DEST_OUT,
+ DEST_ATOP,
+ XOR,
+ ADD,
+ SATURATE
+ };
+ static private java.util.Hashtable theInternedExtras;
+ static final private Operator theSacrificialOne = new Operator(0);
- private Operator(int value) {
- value_ = value;
- }
+ static public Operator intern(int value) {
+ if (value < theInterned.length) {
+ return theInterned[value];
+ }
+ theSacrificialOne.value_ = value;
+ if (theInternedExtras == null) {
+ theInternedExtras = new java.util.Hashtable();
+ }
+ Operator already = (Operator) theInternedExtras.get(theSacrificialOne);
+ if (already == null) {
+ already = new Operator(value);
+ theInternedExtras.put(already, already);
+ }
+ return already;
+ }
- public boolean test (Operator other) {
- return (value_ & other.value_) == other.value_;
- }
+ private Operator(int value) {
+ value_ = value;
+ }
+
+ public boolean test(Operator other) {
+ return (value_ & other.value_) == other.value_;
+ }
}
Index: PDFSurface.java
===================================================================
RCS file: /cvs/cairo/cairo-java/src/java/org/freedesktop/cairo/PDFSurface.java,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -d -r1.6 -r1.7
--- PDFSurface.java 13 Sep 2005 03:14:10 -0000 1.6
+++ PDFSurface.java 12 Feb 2006 08:43:01 -0000 1.7
@@ -15,29 +15,27 @@
/**
*/
-public class PDFSurface extends Surface {
+public class PDFSurface extends Surface
+{
- public PDFSurface(String filename, double widthInches, double heightInches)
- throws IOException {
+ public PDFSurface(String filename, double widthInches, double heightInches) throws IOException {
super(initialize(filename, widthInches, heightInches));
}
-
+
public void setDPI(double xDPI, double yDPI) {
cairo_pdf_surface_set_dpi(getHandle(), xDPI, yDPI);
}
-
- private static Handle initialize(String filename, double widthInches, double heightInches)
- throws IOException {
+
+ private static Handle initialize(String filename, double widthInches, double heightInches) throws IOException {
File f = new File(filename);
-
+
if (f.isDirectory())
throw new IOException(filename + " is a directory");
-
+
if (f.exists()) {
if (!f.canWrite())
throw new IOException("cannot write to file: " + filename);
- }
- else {
+ } else {
String parent = f.getParent();
if (null == parent)
parent = System.getProperty("user.dir");
@@ -51,11 +49,12 @@
}
return cairo_pdf_surface_create(filename, widthInches, heightInches);
}
-
+
/*
* Native calls
*/
- native static final private Handle cairo_pdf_surface_create(String filename,
- double width_inches, double height_inches);
+ native static final private Handle cairo_pdf_surface_create(String filename, double width_inches,
+ double height_inches);
+
native static final private void cairo_pdf_surface_set_dpi(Handle handle, double x, double y);
}
Index: Path.java
===================================================================
RCS file: /cvs/cairo/cairo-java/src/java/org/freedesktop/cairo/Path.java,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -d -r1.2 -r1.3
--- Path.java 13 Sep 2005 03:14:10 -0000 1.2
+++ Path.java 12 Feb 2006 08:43:01 -0000 1.3
@@ -1,57 +1,62 @@
/*
* Java-Gnome Bindings Library
-*
-* Copyright 1998-2005 the Java-Gnome Team, all rights reserved.
-*
-* The Java-Gnome bindings library is free software distributed under
-* the terms of the GNU Library General Public License version 2.
-*/
+ *
+ * Copyright 1998-2005 the Java-Gnome Team, all rights reserved.
+ *
+ * The Java-Gnome bindings library is free software distributed under
+ * the terms of the GNU Library General Public License version 2.
+ */
package org.freedesktop.cairo;
import java.util.Iterator;
import org.gnu.glib.Handle;
-public class Path extends CairoObject {
-
- public Path(PathElement[] elements) {
- super(alloc());
- if (null != elements)
- for (int i = 0; i < elements.length; i++)
- add_data(getHandle(), elements[i].getHandle());
- }
-
- Path(Handle hndl) {
- super(hndl);
- }
-
- protected void finalize() throws Throwable {
- cairo_path_destroy(getHandle());
- super.finalize();
- }
+public class Path extends CairoObject
+{
- public Iterator iterator() {
- Handle[] hndls = get_all_data(getHandle());
- if (hndls == null)
- return new PathIterator(null);
- PathElement[] elements = new PathElement[hndls.length];
- for (int i = 0; i < hndls.length; i++)
- elements[i] = new PathElement(hndls[i]);
- return new PathIterator(elements);
- }
+ public Path(PathElement[] elements) {
+ super(alloc());
+ if (null != elements)
+ for (int i = 0; i < elements.length; i++)
+ add_data(getHandle(), elements[i].getHandle());
+ }
- public boolean add(PathElement pe) {
- add_data(getHandle(), pe.getHandle());
- return false;
- }
+ Path(Handle hndl) {
+ super(hndl);
+ }
- public PathElement get(int index) {
- return new PathElement(get_data(getHandle(), index));
- }
+ protected void finalize() throws Throwable {
+ cairo_path_destroy(getHandle());
+ super.finalize();
+ }
- native static final private Handle alloc();
- native static final private Handle get_data(Handle obj, int index);
- native static final private Handle[] get_all_data(Handle obj);
- native static final private void add_data(Handle obj, Handle data);
- native static final private void cairo_path_destroy(Handle obj);
+ public Iterator iterator() {
+ Handle[] hndls = get_all_data(getHandle());
+ if (hndls == null)
+ return new PathIterator(null);
+ PathElement[] elements = new PathElement[hndls.length];
+ for (int i = 0; i < hndls.length; i++)
+ elements[i] = new PathElement(hndls[i]);
+ return new PathIterator(elements);
+ }
+
+ public boolean add(PathElement pe) {
+ add_data(getHandle(), pe.getHandle());
+ return false;
+ }
+
+ public PathElement get(int index) {
+ return new PathElement(get_data(getHandle(), index));
+ }
+
+ native static final private Handle alloc();
+
+ native static final private Handle get_data(Handle obj, int index);
+
+ native static final private Handle[] get_all_data(Handle obj);
+
+ native static final private void add_data(Handle obj, Handle data);
+
+ native static final private void cairo_path_destroy(Handle obj);
}
Index: PathElement.java
===================================================================
RCS file: /cvs/cairo/cairo-java/src/java/org/freedesktop/cairo/PathElement.java,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -d -r1.2 -r1.3
--- PathElement.java 13 Sep 2005 03:14:10 -0000 1.2
+++ PathElement.java 12 Feb 2006 08:43:01 -0000 1.3
@@ -1,46 +1,48 @@
/*
* Java-Gnome Bindings Library
-*
-* Copyright 1998-2005 the Java-Gnome Team, all rights reserved.
-*
-* The Java-Gnome bindings library is free software distributed under
-* the terms of the GNU Library General Public License version 2.
-*/
+ *
+ * Copyright 1998-2005 the Java-Gnome Team, all rights reserved.
+ *
+ * The Java-Gnome bindings library is free software distributed under
+ * the terms of the GNU Library General Public License version 2.
+ */
package org.freedesktop.cairo;
import org.gnu.glib.Handle;
-public class PathElement extends CairoObject {
-
- private int length;
- private Point[] points;
- private PathElementType type;
-
- PathElement(Handle hndl) {
- super(hndl);
- length = get_length(getHandle());
- type = PathElementType.intern(get_type(getHandle()));
- if (length > 1) {
- points = new Point[length - 1];
- for (int i = 1; i < length; i++) {
- double[] coor = get_point(getHandle(), i - 1);
- points[i-1] = new Point(coor[0], coor[1]);
- }
- }
- }
-
- public PathElementType getType() {
- return type;
- }
-
- public Point getPoint(int index) {
- if (index > length)
- return null;
- return points[index];
- }
-
-
- native static final private int get_length(Handle obj);
- native static final private double[] get_point(Handle ojb, int index);
- native static final private int get_type(Handle obj);
+public class PathElement extends CairoObject
+{
+
+ private int length;
+ private Point[] points;
+ private PathElementType type;
+
+ PathElement(Handle hndl) {
+ super(hndl);
+ length = get_length(getHandle());
+ type = PathElementType.intern(get_type(getHandle()));
+ if (length > 1) {
+ points = new Point[length - 1];
+ for (int i = 1; i < length; i++) {
+ double[] coor = get_point(getHandle(), i - 1);
+ points[i - 1] = new Point(coor[0], coor[1]);
+ }
+ }
+ }
+
+ public PathElementType getType() {
+ return type;
+ }
+
+ public Point getPoint(int index) {
+ if (index > length)
+ return null;
+ return points[index];
+ }
+
+ native static final private int get_length(Handle obj);
+
+ native static final private double[] get_point(Handle ojb, int index);
+
+ native static final private int get_type(Handle obj);
}
Index: PathElementType.java
===================================================================
RCS file: /cvs/cairo/cairo-java/src/java/org/freedesktop/cairo/PathElementType.java,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -d -r1.2 -r1.3
--- PathElementType.java 13 Sep 2005 03:14:10 -0000 1.2
+++ PathElementType.java 12 Feb 2006 08:43:01 -0000 1.3
@@ -1,51 +1,56 @@
/*
* Java-Gnome Bindings Library
-*
-* Copyright 1998-2005 the Java-Gnome Team, all rights reserved.
-*
-* The Java-Gnome bindings library is free software distributed under
-* the terms of the GNU Library General Public License version 2.
-*/
+ *
+ * Copyright 1998-2005 the Java-Gnome Team, all rights reserved.
+ *
+ * The Java-Gnome bindings library is free software distributed under
+ * the terms of the GNU Library General Public License version 2.
+ */
package org.freedesktop.cairo;
import org.gnu.glib.Enum;
-class PathElementType extends Enum {
+class PathElementType extends Enum
+{
- static final private int _MOVE_TO = 0;
- static final public PathElementType MOVE_TO = new PathElementType (_MOVE_TO);
- static final private int _LINE_TO = 1;
- static final public PathElementType LINE_TO = new PathElementType (_LINE_TO);
- static final private int _CURVE_TO = 2;
- static final public PathElementType CURVE_TO = new PathElementType (_CURVE_TO);
- static final private int _CLOSE_PATH = 2;
- static final public PathElementType CLOSE_PATH = new PathElementType (_CLOSE_PATH);
- static final private PathElementType[] theInterned = new PathElementType[] {
- MOVE_TO, LINE_TO, CURVE_TO, CLOSE_PATH
- };
- static private java.util.Hashtable theInternedExtras;
- static final private PathElementType theSacrificialOne = new PathElementType (0);
- static public PathElementType intern (int value) {
- if (value < theInterned.length) {
- return theInterned[value];
- }
- theSacrificialOne.value_ = value;
- if (theInternedExtras == null) {
- theInternedExtras = new java.util.Hashtable();
- }
- PathElementType already = (PathElementType) theInternedExtras.get(theSacrificialOne);
- if (already == null) {
- already = new PathElementType(value);
- theInternedExtras.put(already, already);
- }
- return already;
- }
+ static final private int _MOVE_TO = 0;
+ static final public PathElementType MOVE_TO = new PathElementType(_MOVE_TO);
+ static final private int _LINE_TO = 1;
+ static final public PathElementType LINE_TO = new PathElementType(_LINE_TO);
+ static final private int _CURVE_TO = 2;
+ static final public PathElementType CURVE_TO = new PathElementType(_CURVE_TO);
+ static final private int _CLOSE_PATH = 2;
+ static final public PathElementType CLOSE_PATH = new PathElementType(_CLOSE_PATH);
+ static final private PathElementType[] theInterned = new PathElementType[] {
+ MOVE_TO,
+ LINE_TO,
+ CURVE_TO,
+ CLOSE_PATH
+ };
+ static private java.util.Hashtable theInternedExtras;
+ static final private PathElementType theSacrificialOne = new PathElementType(0);
- private PathElementType(int value) {
- value_ = value;
- }
+ static public PathElementType intern(int value) {
+ if (value < theInterned.length) {
+ return theInterned[value];
+ }
+ theSacrificialOne.value_ = value;
+ if (theInternedExtras == null) {
+ theInternedExtras = new java.util.Hashtable();
+ }
+ PathElementType already = (PathElementType) theInternedExtras.get(theSacrificialOne);
+ if (already == null) {
+ already = new PathElementType(value);
+ theInternedExtras.put(already, already);
+ }
+ return already;
+ }
- public boolean test (PathElementType other) {
- return (value_ & other.value_) == other.value_;
- }
+ private PathElementType(int value) {
+ value_ = value;
+ }
+
+ public boolean test(PathElementType other) {
+ return (value_ & other.value_) == other.value_;
+ }
}
Index: PathIterator.java
===================================================================
RCS file: /cvs/cairo/cairo-java/src/java/org/freedesktop/cairo/PathIterator.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -d -r1.1 -r1.2
--- PathIterator.java 11 May 2005 16:12:29 -0000 1.1
+++ PathIterator.java 12 Feb 2006 08:43:01 -0000 1.2
@@ -1,37 +1,38 @@
/*
* Java-Gnome Bindings Library
-*
-* Copyright 1998-2005 the Java-Gnome Team, all rights reserved.
-*
-* The Java-Gnome bindings library is free software distributed under
-* the terms of the GNU Library General Public License version 2.
-*/
+ *
+ * Copyright 1998-2005 the Java-Gnome Team, all rights reserved.
+ *
+ * The Java-Gnome bindings library is free software distributed under
+ * the terms of the GNU Library General Public License version 2.
+ */
package org.freedesktop.cairo;
import java.util.Iterator;
-class PathIterator implements Iterator {
-
- private PathElement[] elements;
- private int currentElement;
-
- PathIterator(PathElement[] elements) {
- this.elements = elements;
- currentElement = 0;
- }
+class PathIterator implements Iterator
+{
- public boolean hasNext() {
- return currentElement <= elements.length - 1;
- }
+ private PathElement[] elements;
+ private int currentElement;
- public Object next() {
- if (hasNext())
- return elements[currentElement];
- return null;
- }
+ PathIterator(PathElement[] elements) {
+ this.elements = elements;
+ currentElement = 0;
+ }
- public void remove() {
- throw new UnsupportedOperationException("Not supported");
- }
+ public boolean hasNext() {
+ return currentElement <= elements.length - 1;
+ }
+
+ public Object next() {
+ if (hasNext())
+ return elements[currentElement];
+ return null;
+ }
+
+ public void remove() {
+ throw new UnsupportedOperationException("Not supported");
+ }
}
Index: Pattern.java
===================================================================
RCS file: /cvs/cairo/cairo-java/src/java/org/freedesktop/cairo/Pattern.java,v
retrieving revision 1.9
retrieving revision 1.10
diff -u -d -r1.9 -r1.10
--- Pattern.java 13 Sep 2005 03:14:10 -0000 1.9
+++ Pattern.java 12 Feb 2006 08:43:01 -0000 1.10
@@ -14,102 +14,102 @@
/**
* TODO: error handling
*/
-public class Pattern extends CairoObject {
+public class Pattern extends CairoObject
+{
- /**
- * Create a new cairo_pattern_t corresponding to a opaque color. The
- * color components are floating point numbers in the range 0 to 1.
- * If the values passed in are outside that range, they will be
- * clamped.
- * @param red
- * @param green
- * @param blue
- */
- public Pattern(double red, double green, double blue) {
- super(cairo_pattern_create_rgb(red, green, blue));
- }
-
- /**
- * Create a new cairo_pattern_t corresponding to a translucent color.
- * The color components are floating point numbers in the range 0 to
- * 1. If the values passed in are outside that range, they will be
- * clamped.
- * @param red
- * @param green
- * @param blue
- * @param alpha
- */
- public Pattern(double red, double green, double blue, double alpha) {
- super(cairo_pattern_create_rgba(red, green, blue, alpha));
- }
-
- Pattern(Handle hndl) {
- super(hndl);
- }
+ /**
+ * Create a new cairo_pattern_t corresponding to a opaque color. The color
+ * components are floating point numbers in the range 0 to 1. If the values
+ * passed in are outside that range, they will be clamped.
+ *
+ * @param red
+ * @param green
+ * @param blue
+ */
+ public Pattern(double red, double green, double blue) {
+ super(cairo_pattern_create_rgb(red, green, blue));
+ }
- protected void finalize() throws Throwable {
- cairo_pattern_destroy(getHandle());
- super.finalize();
- }
+ /**
+ * Create a new cairo_pattern_t corresponding to a translucent color. The
+ * color components are floating point numbers in the range 0 to 1. If the
+ * values passed in are outside that range, they will be clamped.
+ *
+ * @param red
+ * @param green
+ * @param blue
+ * @param alpha
+ */
+ public Pattern(double red, double green, double blue, double alpha) {
+ super(cairo_pattern_create_rgba(red, green, blue, alpha));
+ }
- /**
- * Sets the transformation matrix for this pattern.
- *
- * @param matrix
- * The transformation matrix.
- */
- public void setMatrix(Matrix matrix) {
- cairo_pattern_set_matrix(getHandle(), matrix.getHandle());
- }
+ Pattern(Handle hndl) {
+ super(hndl);
+ }
- /**
- * Returns the current transform matrix of this pattern. Note that this
- * method returns a new matrix object and you must dispose it.
- *
- * @return The transformation matrix for the pattern.
- */
- public Matrix getMatrix() {
- Handle hndl = Struct.getNullHandle();
- cairo_pattern_get_matrix(getHandle(), hndl);
- return new Matrix(hndl);
- }
+ protected void finalize() throws Throwable {
+ cairo_pattern_destroy(getHandle());
+ super.finalize();
+ }
- /*
- * Native calls
- */
- native static final private void cairo_pattern_destroy(Handle pat);
- native static final private void cairo_pattern_set_matrix(Handle pat,
- Handle matrix);
- native static final private void cairo_pattern_get_matrix(Handle pat,
- Handle matrix);
- native static final private Handle cairo_pattern_create_rgb(double red,
- double green, double blue);
- native static final private Handle cairo_pattern_create_rgba(double red,
- double green, double blue, double alpha);
+ /**
+ * Sets the transformation matrix for this pattern.
+ *
+ * @param matrix
+ * The transformation matrix.
+ */
+ public void setMatrix(Matrix matrix) {
+ cairo_pattern_set_matrix(getHandle(), matrix.getHandle());
+ }
- // Used by SurfacePattern
- native static final protected Handle cairo_pattern_create_for_surface(
- Handle surface);
- native static final protected void cairo_pattern_set_extend(Handle pat,
- int extend);
- native static final protected int cairo_pattern_get_extend(Handle pat);
- native static final protected void cairo_pattern_set_filter(Handle pat,
- int filter);
- native static final protected int cairo_pattern_get_filter(Handle pat);
+ /**
+ * Returns the current transform matrix of this pattern. Note that this
+ * method returns a new matrix object and you must dispose it.
+ *
+ * @return The transformation matrix for the pattern.
+ */
+ public Matrix getMatrix() {
+ Handle hndl = Struct.getNullHandle();
+ cairo_pattern_get_matrix(getHandle(), hndl);
+ return new Matrix(hndl);
+ }
- // Used by Gradient
- native static final protected void cairo_pattern_add_color_stop_rgb(
- Handle pat, double offset, double red, double green, double blue);
- native static final protected void cairo_pattern_add_color_stop_rgba(
- Handle pat, double offset, double red, double green, double blue,
- double alpha);
+ /*
+ * Native calls
+ */
+ native static final private void cairo_pattern_destroy(Handle pat);
- // Used by LinearGradient
- native static final protected Handle cairo_pattern_create_linear(double x0,
- double y0, double x1, double y1);
+ native static final private void cairo_pattern_set_matrix(Handle pat, Handle matrix);
- // used by RadialGradient
- native static final protected Handle cairo_pattern_create_radial(
- double cx0, double yx0, double radius0, double cx1, double cy1,
- double radius1);
+ native static final private void cairo_pattern_get_matrix(Handle pat, Handle matrix);
+
+ native static final private Handle cairo_pattern_create_rgb(double red, double green, double blue);
+
+ native static final private Handle cairo_pattern_create_rgba(double red, double green, double blue, double alpha);
+
+ // Used by SurfacePattern
+ native static final protected Handle cairo_pattern_create_for_surface(Handle surface);
+
+ native static final protected void cairo_pattern_set_extend(Handle pat, int extend);
+
+ native static final protected int cairo_pattern_get_extend(Handle pat);
+
+ native static final protected void cairo_pattern_set_filter(Handle pat, int filter);
+
+ native static final protected int cairo_pattern_get_filter(Handle pat);
+
+ // Used by Gradient
+ native static final protected void cairo_pattern_add_color_stop_rgb(Handle pat, double offset, double red,
+ double green, double blue);
+
+ native static final protected void cairo_pattern_add_color_stop_rgba(Handle pat, double offset, double red,
+ double green, double blue, double alpha);
+
+ // Used by LinearGradient
+ native static final protected Handle cairo_pattern_create_linear(double x0, double y0, double x1, double y1);
+
+ // used by RadialGradient
+ native static final protected Handle cairo_pattern_create_radial(double cx0, double yx0, double radius0,
+ double cx1, double cy1, double radius1);
}
Index: Point.java
===================================================================
RCS file: /cvs/cairo/cairo-java/src/java/org/freedesktop/cairo/Point.java,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -d -r1.2 -r1.3
--- Point.java 14 Mar 2005 20:15:22 -0000 1.2
+++ Point.java 12 Feb 2006 08:43:01 -0000 1.3
@@ -8,33 +8,34 @@
*/
package org.freedesktop.cairo;
-public class Point {
- private double x;
- private double y;
-
- public Point() {
- x = -1;
- y = -1;
- }
-
- public Point(double x, double y) {
- this.x = x;
- this.y = y;
- }
-
- public double getX() {
- return x;
- }
-
- public void setX(double x) {
- this.x = x;
- }
-
- public double getY() {
- return y;
- }
-
- public void setY(double y) {
- this.y = y;
- }
+public class Point
+{
+ private double x;
+ private double y;
+
+ public Point() {
+ x = -1;
+ y = -1;
+ }
+
+ public Point(double x, double y) {
+ this.x = x;
+ this.y = y;
+ }
+
+ public double getX() {
+ return x;
+ }
+
+ public void setX(double x) {
+ this.x = x;
+ }
+
+ public double getY() {
+ return y;
+ }
+
+ public void setY(double y) {
+ this.y = y;
+ }
}
Index: RadialGradient.java
===================================================================
RCS file: /cvs/cairo/cairo-java/src/java/org/freedesktop/cairo/RadialGradient.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -d -r1.1 -r1.2
--- RadialGradient.java 9 May 2005 15:38:24 -0000 1.1
+++ RadialGradient.java 12 Feb 2006 08:43:01 -0000 1.2
@@ -8,10 +8,11 @@
*/
package org.freedesktop.cairo;
-public class RadialGradient extends Gradient {
+public class RadialGradient extends Gradient
+{
+
+ public RadialGradient(double x1, double y1, double radius1, double x2, double y2, double radius2) {
+ super(cairo_pattern_create_radial(x1, y1, radius1, x1, y2, radius2));
+ }
- public RadialGradient(double x1, double y1, double radius1, double x2, double y2, double radius2) {
- super(cairo_pattern_create_radial(x1, y1, radius1, x1, y2, radius2));
- }
-
}
Index: Rectangle.java
===================================================================
RCS file: /cvs/cairo/cairo-java/src/java/org/freedesktop/cairo/Rectangle.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -d -r1.1 -r1.2
--- Rectangle.java 9 May 2005 14:47:03 -0000 1.1
+++ Rectangle.java 12 Feb 2006 08:43:01 -0000 1.2
@@ -8,49 +8,57 @@
*/
package org.freedesktop.cairo;
-public class Rectangle {
-
- double x1;
- double y1;
- double x2;
- double y2;
-
- public Rectangle(double x1, double y1, double x2, double y2) {
- this.x1 = x1;
- this.y1 = y1;
- this.x2 = x2;
- this.y2 = y2;
- }
-
- public Rectangle(Point upperLeft, Point lowerRight) {
- this.x1 = upperLeft.getX();
- this.y1 = upperLeft.getY();
- this.x2 = lowerRight.getX();
- this.y2 = lowerRight.getY();
- }
-
- public double getX1() {
- return x1;
- }
- public void setX1(double x1) {
- this.x1 = x1;
- }
- public double getX2() {
- return x2;
- }
- public void setX2(double x2) {
- this.x2 = x2;
- }
- public double getY1() {
- return y1;
- }
- public void setY1(double y1) {
- this.y1 = y1;
- }
- public double getY2() {
- return y2;
- }
- public void setY2(double y2) {
- this.y2 = y2;
- }
+public class Rectangle
+{
+
+ double x1;
+ double y1;
+ double x2;
+ double y2;
+
+ public Rectangle(double x1, double y1, double x2, double y2) {
+ this.x1 = x1;
+ this.y1 = y1;
+ this.x2 = x2;
+ this.y2 = y2;
+ }
+
+ public Rectangle(Point upperLeft, Point lowerRight) {
+ this.x1 = upperLeft.getX();
+ this.y1 = upperLeft.getY();
+ this.x2 = lowerRight.getX();
+ this.y2 = lowerRight.getY();
+ }
+
+ public double getX1() {
+ return x1;
+ }
+
+ public void setX1(double x1) {
+ this.x1 = x1;
+ }
+
+ public double getX2() {
+ return x2;
+ }
+
+ public void setX2(double x2) {
+ this.x2 = x2;
+ }
+
+ public double getY1() {
+ return y1;
+ }
+
+ public void setY1(double y1) {
+ this.y1 = y1;
+ }
+
+ public double getY2() {
+ return y2;
+ }
+
+ public void setY2(double y2) {
+ this.y2 = y2;
+ }
}
Index: ScaledFont.java
===================================================================
RCS file: /cvs/cairo/cairo-java/src/java/org/freedesktop/cairo/ScaledFont.java,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -d -r1.5 -r1.6
--- ScaledFont.java 28 Oct 2005 23:04:46 -0000 1.5
+++ ScaledFont.java 12 Feb 2006 08:43:01 -0000 1.6
@@ -1,72 +1,80 @@
/*
* Java-Gnome Bindings Library
-*
-* Copyright 1998-2005 the Java-Gnome Team, all rights reserved.
-*
-* The Java-Gnome bindings library is free software distributed under
-* the terms of the GNU Library General Public License version 2.
-*/
+ *
+ * Copyright 1998-2005 the Java-Gnome Team, all rights reserved.
+ *
+ * The Java-Gnome bindings library is free software distributed under
+ * the terms of the GNU Library General Public License version 2.
+ */
package org.freedesktop.cairo;
import org.gnu.glib.Handle;
-public class ScaledFont extends CairoObject {
+public class ScaledFont extends CairoObject
+{
/**
* Create a new ScaledFont
- * @param fontFace The FontFace
- * @param matrix font space to user space transformation matrix for the
- * font. In the simplest case of a N point font, this matrix is just a
- * scale by N, but it can also be used to shear the font or stretch it
- * unequally along the two axes.
- * @param ctm user to device transformation matrix with which the font will
- * be used.
+ *
+ * @param fontFace
+ * The FontFace
+ * @param matrix
+ * font space to user space transformation matrix for the font.
+ * In the simplest case of a N point font, this matrix is just a
+ * scale by N, but it can also be used to shear the font or
+ * stretch it unequally along the two axes.
+ * @param ctm
+ * user to device transformation matrix with which the font will
+ * be used.
*/
public ScaledFont(FontFace fontFace, Matrix matrix, Matrix ctm, FontOptions options) {
super(cairo_scaled_font_create(fontFace.getHandle(), matrix.getHandle(), ctm.getHandle(), options.getHandle()));
}
-
- protected void finalize() throws Throwable {
- cairo_scaled_font_destroy(getHandle());
- super.finalize();
- }
- ScaledFont(Handle hndl) {
+ protected void finalize() throws Throwable {
+ cairo_scaled_font_destroy(getHandle());
+ super.finalize();
+ }
+
+ ScaledFont(Handle hndl) {
super(hndl);
}
-
+
public FontExtents getFontExtents() {
Handle hndl = getNullHandle();
cairo_scaled_font_extents(getHandle(), hndl);
return new FontExtents(hndl);
}
-
- /**
- * Gets the overall metrics for an array of glyphs. The X and Y offsets
- * in glyphs are taken from an origin of 0,0.
- *
- * @param glyhps an array of glyph IDs with X and Y offsets
- * @return a TextExtent which contains the extents
- */
- public TextExtents getGlyphExtents(Glyph[] glyhps) {
- if (null == glyhps)
- return null;
- Handle[] g = new Handle[glyhps.length];
- for (int i = 0; i < glyhps.length; i++) {
- g[i] = glyhps[i].getHandle();
- }
- Handle hndl = getNullHandle();
- cairo_scaled_font_glyph_extents(getHandle(), g, hndl);
- return new TextExtents(hndl);
- }
-
+
+ /**
+ * Gets the overall metrics for an array of glyphs. The X and Y offsets in
+ * glyphs are taken from an origin of 0,0.
+ *
+ * @param glyhps
+ * an array of glyph IDs with X and Y offsets
+ * @return a TextExtent which contains the extents
+ */
+ public TextExtents getGlyphExtents(Glyph[] glyhps) {
+ if (null == glyhps)
+ return null;
+ Handle[] g = new Handle[glyhps.length];
+ for (int i = 0; i < glyhps.length; i++) {
+ g[i] = glyhps[i].getHandle();
+ }
+ Handle hndl = getNullHandle();
+ cairo_scaled_font_glyph_extents(getHandle(), g, hndl);
+ return new TextExtents(hndl);
+ }
+
native static final private Handle cairo_scaled_font_create(Handle face, Handle matrix, Handle ctm, Handle options);
+
native static final private void cairo_scaled_font_extents(Handle obj, Handle extents);
-
- native static final private void cairo_scaled_font_glyph_extents(Handle obj, Handle[] glyphs, Handle extents);
-
- // TODO: lifecycle
- native static final private void cairo_scaled_font_reference(Handle obj);
- native static final private void cairo_scaled_font_destroy(Handle obj);
+
+ native static final private void cairo_scaled_font_glyph_extents(Handle obj, Handle[] glyphs, Handle extents);
+
+ // TODO: lifecycle
+ native static final private void cairo_scaled_font_reference(Handle obj);
+
+ native static final private void cairo_scaled_font_destroy(Handle obj);
}
Index: Status.java
===================================================================
RCS file: /cvs/cairo/cairo-java/src/java/org/freedesktop/cairo/Status.java,v
retrieving revision 1.12
retrieving revision 1.13
diff -u -d -r1.12 -r1.13
--- Status.java 13 Sep 2005 03:14:10 -0000 1.12
+++ Status.java 12 Feb 2006 08:43:01 -0000 1.13
@@ -11,83 +11,101 @@
import org.gnu.glib.Enum;
-public class Status extends Enum {
- static final private int _SUCCESS = 0;
- static final public Status SUCCESS = new Status (_SUCCESS);
- static final private int _NO_MEMORY = 1;
- static final public Status NO_MEMORY = new Status (_NO_MEMORY);
- static final private int _INVALID_RESTORE = 2;
- static final public Status INVALID_RESTORE = new Status (_INVALID_RESTORE);
- static final private int _INVALID_POP_GROUP = 3;
- static final public Status INVALID_POP_GROUP = new Status (_INVALID_POP_GROUP);
- static final private int _NO_CURRENT_POINT = 4;
- static final public Status NO_CURRENT_POINT = new Status (_NO_CURRENT_POINT);
- static final private int _INVALID_MATRIX = 5;
- static final public Status INVALID_MATRIX = new Status (_INVALID_MATRIX);
- static final private int _INVALID_STATUS = 6;
- static final public Status INVALID_STATUS = new Status (_INVALID_STATUS);
- static final private int _NULL_POINTER = 7;
- static final public Status NULL_POINTER = new Status (_NULL_POINTER);
- static final private int _INVALID_STRING = 8;
- static final public Status INVALID_STRING = new Status (_INVALID_STRING);
- static final private int _INVALID_PATH_DATA = 9;
- static final public Status INVALID_PATH_DATA = new Status (_INVALID_PATH_DATA);
- static final private int _READ_ERROR = 10;
- static final public Status READ_ERROR = new Status (_READ_ERROR);
- static final private int _WRITE_ERROR = 11;
- static final public Status WRITE_ERROR = new Status (_WRITE_ERROR);
- static final private int _SURFACE_FINISHED = 12;
- static final public Status SURFACE_FINISHED = new Status (_SURFACE_FINISHED);
- static final private int _SURFACE_TYPE_MISMATCH = 13;
- static final public Status SURFACE_TYPE_MISMATCH = new Status (_SURFACE_TYPE_MISMATCH);
- static final private int _PATTERN_TYPE_MISMATCH = 13;
- static final public Status PATTERN_TYPE_MISMATCH = new Status (_PATTERN_TYPE_MISMATCH);
- static final private int _INVALID_CONTENT = 14;
- static final public Status INVALID_CONTENT = new Status (_INVALID_CONTENT);
- static final private int _INVALID_FORMAT = 13;
- static final public Status INVALID_FORMAT = new Status (_INVALID_FORMAT);
- static final private int _INVALID_VISUAL = 13;
- static final public Status INVALID_VISUAL = new Status (_INVALID_VISUAL);
- static final private int _FILE_NOT_FOUND = 13;
- static final public Status FILE_NOT_FOUND = new Status (_FILE_NOT_FOUND);
- static final private int _INVALID_DASH = 14;
- static final public Status INVALID_DASH = new Status (_INVALID_DASH);
+public class Status extends Enum
+{
+ static final private int _SUCCESS = 0;
+ static final public Status SUCCESS = new Status(_SUCCESS);
+ static final private int _NO_MEMORY = 1;
+ static final public Status NO_MEMORY = new Status(_NO_MEMORY);
+ static final private int _INVALID_RESTORE = 2;
+ static final public Status INVALID_RESTORE = new Status(_INVALID_RESTORE);
+ static final private int _INVALID_POP_GROUP = 3;
+ static final public Status INVALID_POP_GROUP = new Status(_INVALID_POP_GROUP);
+ static final private int _NO_CURRENT_POINT = 4;
+ static final public Status NO_CURRENT_POINT = new Status(_NO_CURRENT_POINT);
+ static final private int _INVALID_MATRIX = 5;
+ static final public Status INVALID_MATRIX = new Status(_INVALID_MATRIX);
+ static final private int _INVALID_STATUS = 6;
+ static final public Status INVALID_STATUS = new Status(_INVALID_STATUS);
+ static final private int _NULL_POINTER = 7;
+ static final public Status NULL_POINTER = new Status(_NULL_POINTER);
+ static final private int _INVALID_STRING = 8;
+ static final public Status INVALID_STRING = new Status(_INVALID_STRING);
+ static final private int _INVALID_PATH_DATA = 9;
+ static final public Status INVALID_PATH_DATA = new Status(_INVALID_PATH_DATA);
+ static final private int _READ_ERROR = 10;
+ static final public Status READ_ERROR = new Status(_READ_ERROR);
+ static final private int _WRITE_ERROR = 11;
+ static final public Status WRITE_ERROR = new Status(_WRITE_ERROR);
+ static final private int _SURFACE_FINISHED = 12;
+ static final public Status SURFACE_FINISHED = new Status(_SURFACE_FINISHED);
+ static final private int _SURFACE_TYPE_MISMATCH = 13;
+ static final public Status SURFACE_TYPE_MISMATCH = new Status(_SURFACE_TYPE_MISMATCH);
+ static final private int _PATTERN_TYPE_MISMATCH = 13;
+ static final public Status PATTERN_TYPE_MISMATCH = new Status(_PATTERN_TYPE_MISMATCH);
+ static final private int _INVALID_CONTENT = 14;
+ static final public Status INVALID_CONTENT = new Status(_INVALID_CONTENT);
+ static final private int _INVALID_FORMAT = 13;
+ static final public Status INVALID_FORMAT = new Status(_INVALID_FORMAT);
+ static final private int _INVALID_VISUAL = 13;
+ static final public Status INVALID_VISUAL = new Status(_INVALID_VISUAL);
+ static final private int _FILE_NOT_FOUND = 13;
+ static final public Status FILE_NOT_FOUND = new Status(_FILE_NOT_FOUND);
+ static final private int _INVALID_DASH = 14;
+ static final public Status INVALID_DASH = new Status(_INVALID_DASH);
- static final private Status[] theInterned = new Status[] {
- SUCCESS, NO_MEMORY, INVALID_RESTORE, INVALID_POP_GROUP, NO_CURRENT_POINT,
- INVALID_MATRIX, INVALID_STATUS, NULL_POINTER, INVALID_STRING, INVALID_PATH_DATA,
- READ_ERROR, WRITE_ERROR, SURFACE_FINISHED, SURFACE_TYPE_MISMATCH, PATTERN_TYPE_MISMATCH,
- INVALID_CONTENT, INVALID_FORMAT, INVALID_VISUAL, FILE_NOT_FOUND, INVALID_DASH
- };
- static private java.util.Hashtable theInternedExtras;
- static final private Status theSacrificialOne = new Status (0);
- static public Status intern (int value) {
- if (value < theInterned.length) {
- return theInterned[value];
- }
- theSacrificialOne.value_ = value;
- if (theInternedExtras == null) {
- theInternedExtras = new java.util.Hashtable();
- }
- Status already = (Status) theInternedExtras.get(theSacrificialOne);
- if (already == null) {
- already = new Status(value);
- theInternedExtras.put(already, already);
- }
- return already;
- }
+ static final private Status[] theInterned = new Status[] {
+ SUCCESS,
+ NO_MEMORY,
+ INVALID_RESTORE,
+ INVALID_POP_GROUP,
+ NO_CURRENT_POINT,
+ INVALID_MATRIX,
+ INVALID_STATUS,
+ NULL_POINTER,
+ INVALID_STRING,
+ INVALID_PATH_DATA,
+ READ_ERROR,
+ WRITE_ERROR,
+ SURFACE_FINISHED,
+ SURFACE_TYPE_MISMATCH,
+ PATTERN_TYPE_MISMATCH,
+ INVALID_CONTENT,
+ INVALID_FORMAT,
+ INVALID_VISUAL,
+ FILE_NOT_FOUND,
+ INVALID_DASH
+ };
+ static private java.util.Hashtable theInternedExtras;
+ static final private Status theSacrificialOne = new Status(0);
- private Status(int value) {
- value_ = value;
- }
+ static public Status intern(int value) {
+ if (value < theInterned.length) {
+ return theInterned[value];
+ }
+ theSacrificialOne.value_ = value;
+ if (theInternedExtras == null) {
+ theInternedExtras = new java.util.Hashtable();
+ }
+ Status already = (Status) theInternedExtras.get(theSacrificialOne);
+ if (already == null) {
+ already = new Status(value);
+ theInternedExtras.put(already, already);
+ }
+ return already;
+ }
- public boolean test (Status other) {
- return (value_ & other.value_) == other.value_;
- }
-
- public String toString() {
- return cairo_status_to_string(value_);
- }
-
- native static final private String cairo_status_to_string(int status);
+ private Status(int value) {
+ value_ = value;
+ }
+
+ public boolean test(Status other) {
+ return (value_ & other.value_) == other.value_;
+ }
+
+ public String toString() {
+ return cairo_status_to_string(value_);
+ }
+
+ native static final private String cairo_status_to_string(int status);
}
Index: SubpixelOrder.java
===================================================================
RCS file: /cvs/cairo/cairo-java/src/java/org/freedesktop/cairo/SubpixelOrder.java,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -d -r1.2 -r1.3
--- SubpixelOrder.java 13 Sep 2005 03:14:10 -0000 1.2
+++ SubpixelOrder.java 12 Feb 2006 08:43:01 -0000 1.3
@@ -12,68 +12,68 @@
import org.gnu.glib.Enum;
/**
- * The subpixel order specifies the order of color elements within
- * each pixel on the display device when rendering with an
- * antialiasing mode of SUBPIXEL.
+ * The subpixel order specifies the order of color elements within each pixel on
+ * the display device when rendering with an antialiasing mode of SUBPIXEL.
*/
-public class SubpixelOrder extends Enum {
+public class SubpixelOrder extends Enum
+{
- static final private int _DEFAULT = 0;
- /**
- * Use the default subpixel order for
- * for the target device
- */
- static final public SubpixelOrder DEFAULT = new SubpixelOrder (_DEFAULT);
- static final private int _RGB = 1;
- /**
- * Subpixel elements are arranged horizontally
- * with red at the left
- */
- static final public SubpixelOrder RGB = new SubpixelOrder (_RGB);
- static final private int _BGR = 2;
- /**
- * Subpixel elements are arranged horizontally
- * with blue at the left
- */
- static final public SubpixelOrder BGR = new SubpixelOrder (_BGR);
- static final private int _VRGB = 3;
- /**
- * Subpixel elements are arranged vertically
- * with red at the top
- */
- static final public SubpixelOrder VRGB = new SubpixelOrder (_VRGB);
- static final private int _VBGR = 4;
- /**
- * Subpixel elements are arranged vertically
- * with blue at the top
- */
- static final public SubpixelOrder VBGR = new SubpixelOrder (_VBGR);
- static final private SubpixelOrder[] theInterned = new SubpixelOrder[] {
- DEFAULT, RGB, BGR, VRGB, VBGR
- };
- static private java.util.Hashtable theInternedExtras;
- static final private SubpixelOrder theSacrificialOne = new SubpixelOrder (0);
- static public SubpixelOrder intern (int value) {
- if (value < theInterned.length) {
- return theInterned[value];
- }
- theSacrificialOne.value_ = value;
- if (theInternedExtras == null) {
- theInternedExtras = new java.util.Hashtable();
- }
- SubpixelOrder already = (SubpixelOrder) theInternedExtras.get(theSacrificialOne);
- if (already == null) {
- already = new SubpixelOrder(value);
- theInternedExtras.put(already, already);
- }
- return already;
- }
+ static final private int _DEFAULT = 0;
+ /**
+ * Use the default subpixel order for for the target device
+ */
+ static final public SubpixelOrder DEFAULT = new SubpixelOrder(_DEFAULT);
+ static final private int _RGB = 1;
+ /**
+ * Subpixel elements are arranged horizontally with red at the left
+ */
+ static final public SubpixelOrder RGB = new SubpixelOrder(_RGB);
+ static final private int _BGR = 2;
+ /**
+ * Subpixel elements are arranged horizontally with blue at the left
+ */
+ static final public SubpixelOrder BGR = new SubpixelOrder(_BGR);
+ static final private int _VRGB = 3;
+ /**
+ * Subpixel elements are arranged vertically with red at the top
+ */
+ static final public SubpixelOrder VRGB = new SubpixelOrder(_VRGB);
+ static final private int _VBGR = 4;
+ /**
+ * Subpixel elements are arranged vertically with blue at the top
+ */
+ static final public SubpixelOrder VBGR = new SubpixelOrder(_VBGR);
+ static final private SubpixelOrder[] theInterned = new SubpixelOrder[] {
+ DEFAULT,
+ RGB,
+ BGR,
+ VRGB,
+ VBGR
+ };
+ static private java.util.Hashtable theInternedExtras;
+ static final private SubpixelOrder theSacrificialOne = new SubpixelOrder(0);
- private SubpixelOrder(int value) {
- value_ = value;
- }
+ static public SubpixelOrder intern(int value) {
+ if (value < theInterned.length) {
+ return theInterned[value];
+ }
+ theSacrificialOne.value_ = value;
+ if (theInternedExtras == null) {
+ theInternedExtras = new java.util.Hashtable();
+ }
+ SubpixelOrder already = (SubpixelOrder) theInternedExtras.get(theSacrificialOne);
+ if (already == null) {
+ already = new SubpixelOrder(value);
+ theInternedExtras.put(already, already);
+ }
+ return already;
+ }
- public boolean test (SubpixelOrder other) {
- return (value_ & other.value_) == other.value_;
- }
+ private SubpixelOrder(int value) {
+ value_ = value;
+ }
+
+ public boolean test(SubpixelOrder other) {
+ return (value_ & other.value_) == other.value_;
+ }
}
Index: Surface.java
===================================================================
RCS file: /cvs/cairo/cairo-java/src/java/org/freedesktop/cairo/Surface.java,v
retrieving revision 1.17
retrieving revision 1.18
diff -u -d -r1.17 -r1.18
--- Surface.java 13 Sep 2005 03:14:10 -0000 1.17
+++ Surface.java 12 Feb 2006 08:43:01 -0000 1.18
@@ -13,71 +13,78 @@
import org.gnu.glib.Handle;
/**
- * The Surface class represents an Cairo drawing surface. A Cairo object
- * is used to draw on the drawing surface.
+ * The Surface class represents an Cairo drawing surface. A Cairo object is used
+ * to draw on the drawing surface.
*/
-public class Surface extends CairoObject {
-
- Surface(Handle hndl) {
- super(hndl);
- }
-
- protected void finalize() throws Throwable {
- cairo_surface_destroy(getHandle());
- super.finalize();
- }
-
- public Surface createSimilar(Content content, int width, int height) {
- return new Surface(cairo_surface_create_similar(getHandle(),
- content.getValue(), width, height));
- }
-
- public void finish() {
- cairo_surface_finish(getHandle());
- }
-
- public void setDeviceOffset(double xOffset, double yOffset) {
- cairo_surface_set_device_offset(getHandle(), xOffset, yOffset);
- }
-
- public void writeToPNG(String filename) {
- cairo_surface_write_to_png(getHandle(), filename);
- }
-
- public void writeToPNG(OutputStream ostream) {
- cairo_surface_write_to_png_stream(getHandle(), ostream);
- }
-
- public FontOptions getFontOptions() {
- return new FontOptions(cairo_surface_get_font_options(getHandle()));
- }
-
- public void flush() {
- cairo_surface_flush(getHandle());
- }
-
- public void markDirty() {
- cairo_surface_mark_dirty(getHandle());
- }
-
- public void markDirty(int x, int y, int width, int height) {
- cairo_surface_mark_dirty_rectangle(getHandle(), x, y, width, height);
- }
-
- /*
- * Native calls
- */
- native static final private Handle cairo_surface_create_similar(Handle other, int format, int width, int height);
- native static final private void cairo_surface_destroy(Handle obj);
- native static final private int cairo_surface_finish(Handle obj);
-
+public class Surface extends CairoObject
+{
+
+ Surface(Handle hndl) {
+ super(hndl);
+ }
+
+ protected void finalize() throws Throwable {
+ cairo_surface_destroy(getHandle());
+ super.finalize();
+ }
+
+ public Surface createSimilar(Content content, int width, int height) {
+ return new Surface(cairo_surface_create_similar(getHandle(), content.getValue(), width, height));
+ }
+
+ public void finish() {
+ cairo_surface_finish(getHandle());
+ }
+
+ public void setDeviceOffset(double xOffset, double yOffset) {
+ cairo_surface_set_device_offset(getHandle(), xOffset, yOffset);
+ }
+
+ public void writeToPNG(String filename) {
+ cairo_surface_write_to_png(getHandle(), filename);
+ }
+
+ public void writeToPNG(OutputStream ostream) {
+ cairo_surface_write_to_png_stream(getHandle(), ostream);
+ }
+
+ public FontOptions getFontOptions() {
+ return new FontOptions(cairo_surface_get_font_options(getHandle()));
+ }
+
+ public void flush() {
+ cairo_surface_flush(getHandle());
+ }
+
+ public void markDirty() {
+ cairo_surface_mark_dirty(getHandle());
+ }
+
+ public void markDirty(int x, int y, int width, int height) {
+ cairo_surface_mark_dirty_rectangle(getHandle(), x, y, width, height);
+ }
+
+ /*
+ * Native calls
+ */
+ native static final private Handle cairo_surface_create_similar(Handle other, int format, int width, int height);
+
+ native static final private void cairo_surface_destroy(Handle obj);
+
+ native static final private int cairo_surface_finish(Handle obj);
+
native static final private int cairo_surface_write_to_png(Handle obj, String filename);
+
native static final private int cairo_surface_write_to_png_stream(Handle obj, OutputStream ostream);
- native static final private void cairo_surface_set_device_offset(Handle obj, double xOff, double yOff);
-
- native static final private Handle cairo_surface_get_font_options(Handle obj);
- native static final private void cairo_surface_flush(Handle obj);
- native static final private void cairo_surface_mark_dirty(Handle obj);
- native static final private void cairo_surface_mark_dirty_rectangle(Handle obj, int x, int y, int width, int height);
-
+
+ native static final private void cairo_surface_set_device_offset(Handle obj, double xOff, double yOff);
+
+ native static final private Handle cairo_surface_get_font_options(Handle obj);
+
+ native static final private void cairo_surface_flush(Handle obj);
+
+ native static final private void cairo_surface_mark_dirty(Handle obj);
+
+ native static final private void cairo_surface_mark_dirty_rectangle(Handle obj, int x, int y, int width, int height);
+
}
Index: SurfacePattern.java
===================================================================
RCS file: /cvs/cairo/cairo-java/src/java/org/freedesktop/cairo/SurfacePattern.java,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -d -r1.2 -r1.3
--- SurfacePattern.java 26 Jun 2005 23:15:49 -0000 1.2
+++ SurfacePattern.java 12 Feb 2006 08:43:01 -0000 1.3
@@ -8,42 +8,48 @@
*/
package org.freedesktop.cairo;
-public class SurfacePattern extends Pattern {
+public class SurfacePattern extends Pattern
+{
+
+ public SurfacePattern(Surface surface) {
+ super(cairo_pattern_create_for_surface(surface.getHandle()));
+ }
+
+ /**
+ * Sets the extend option for the pattern.
+ *
+ * @param extend
+ * The Extend to use.
+ */
+ public void setExtend(Extend extend) {
+ cairo_pattern_set_extend(getHandle(), extend.getValue());
+ }
+
+ /**
+ * Returns the current extend option for the pattern.
+ *
+ * @return The current extend option
+ */
+ public Extend getExtend() {
+ return Extend.intern(cairo_pattern_get_extend(getHandle()));
+ }
+
+ /**
+ * Sets the filter option for the pattern.
+ *
+ * @param filter
+ */
+ public void setFilter(Filter filter) {
+ cairo_pattern_set_filter(getHandle(), filter.getValue());
+ }
+
+ /**
+ * Returns the current filter option for the pattern.
+ *
+ * @return The current filter option (One of the Cairo.FILTER_xxx options).
+ */
+ public Filter getFilter() {
+ return Filter.intern(cairo_pattern_get_filter(getHandle()));
+ }
- public SurfacePattern(Surface surface) {
- super(cairo_pattern_create_for_surface(surface.getHandle()));
- }
-
- /**
- * Sets the extend option for the pattern.
- * @param extend The Extend to use.
- */
- public void setExtend(Extend extend) {
- cairo_pattern_set_extend(getHandle(), extend.getValue());
- }
-
- /**
- * Returns the current extend option for the pattern.
- * @return The current extend option
- */
- public Extend getExtend() {
- return Extend.intern(cairo_pattern_get_extend(getHandle()));
- }
-
- /**
- * Sets the filter option for the pattern.
- * @param filter
- */
- public void setFilter(Filter filter) {
- cairo_pattern_set_filter(getHandle(), filter.getValue());
- }
-
- /**
- * Returns the current filter option for the pattern.
- * @return The current filter option (One of the Cairo.FILTER_xxx options).
- */
- public Filter getFilter() {
- return Filter.intern(cairo_pattern_get_filter(getHandle()));
- }
-
}
Index: TextExtents.java
===================================================================
RCS file: /cvs/cairo/cairo-java/src/java/org/freedesktop/cairo/TextExtents.java,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -d -r1.6 -r1.7
--- TextExtents.java 13 Sep 2005 03:14:10 -0000 1.6
+++ TextExtents.java 12 Feb 2006 08:43:01 -0000 1.7
@@ -1,57 +1,56 @@
/*
* Java-Gnome Bindings Library
-*
-* Copyright 1998-2005 the Java-Gnome Team, all rights reserved.
-*
-* The Java-Gnome bindings library is free software distributed under
-* the terms of the GNU Library General Public License version 2.
-*/
+ *
+ * Copyright 1998-2005 the Java-Gnome Team, all rights reserved.
+ *
+ * The Java-Gnome bindings library is free software distributed under
+ * the terms of the GNU Library General Public License version 2.
+ */
package org.freedesktop.cairo;
import org.gnu.glib.Handle;
/**
- * The TextExtents stores the extents of a single glyph or a
- * string of glyphs in user-space coordinates. Because text
- * extents are in user-space coordinates, they don't scale along with
- * the current transformation matrix.
+ * The TextExtents stores the extents of a single glyph or a string of glyphs in
+ * user-space coordinates. Because text extents are in user-space coordinates,
+ * they don't scale along with the current transformation matrix.
*/
-public class TextExtents extends CairoObject {
+public class TextExtents extends CairoObject
+{
TextExtents(Handle hndl) {
super(hndl);
}
-
+
public double getXBearing() {
return get_x_bearing(getHandle());
}
-
- public double getYBearing(){
+
+ public double getYBearing() {
return get_y_bearning(getHandle());
}
-
+
public double getWidth() {
return get_width(getHandle());
}
-
+
public double getHeight() {
return get_height(getHandle());
}
-
+
public double getXAdvance() {
return get_x_advance(getHandle());
}
-
+
public double getYAdvance() {
return get_y_advance(getHandle());
}
-
+
protected void finalize() throws Throwable {
try {
free(getHandle());
- }
- finally {
+ } finally {
super.finalize();
}
}
@@ -60,10 +59,16 @@
* Native calls
*/
native static final private double get_x_bearing(Handle obj);
+
native static final private double get_y_bearning(Handle obj);
+
native static final private double get_width(Handle obj);
+
native static final private double get_height(Handle obj);
+
native static final private double get_x_advance(Handle obj);
+
native static final private double get_y_advance(Handle obj);
+
native static final private void free(Handle obj);
}
More information about the cairo-commit
mailing list