[cairo-commit] cairo-java/src/java/org/freedesktop/cairo
Extend.java, 1.3, 1.4 Matrix.java, 1.10, 1.11 ScaledFont.java,
1.4, 1.5
Jeffrey Morgan
commit at pdx.freedesktop.org
Fri Oct 28 16:04:48 PDT 2005
Committed by: kuzman
Update of /cvs/cairo/cairo-java/src/java/org/freedesktop/cairo
In directory gabe:/tmp/cvs-serv11401/src/java/org/freedesktop/cairo
Modified Files:
Extend.java Matrix.java ScaledFont.java
Log Message:
Added missing public API.
Index: Extend.java
===================================================================
RCS file: /cvs/cairo/cairo-java/src/java/org/freedesktop/cairo/Extend.java,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -d -r1.3 -r1.4
--- Extend.java 13 Sep 2005 03:14:10 -0000 1.3
+++ Extend.java 28 Oct 2005 23:04:46 -0000 1.4
@@ -15,13 +15,29 @@
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
+ NONE, REPEAT, REFLECT, PAD
};
static private java.util.Hashtable theInternedExtras;
static final private Extend theSacrificialOne = new Extend (0);
Index: Matrix.java
===================================================================
RCS file: /cvs/cairo/cairo-java/src/java/org/freedesktop/cairo/Matrix.java,v
retrieving revision 1.10
retrieving revision 1.11
diff -u -d -r1.10 -r1.11
--- Matrix.java 13 Sep 2005 03:14:10 -0000 1.10
+++ Matrix.java 28 Oct 2005 23:04:46 -0000 1.11
@@ -19,6 +19,61 @@
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);
+ }
/**
* Appends a transaltion transformation to this matrix.
@@ -160,18 +215,13 @@
native static final private void setX0(Handle matrix, double x0);
native static final private void setY0(Handle matrix, double y0);
- // TODO: API JNI
native static final private void cairo_matrix_init(Handle matrix,
double xx, double yx, double xy, double yy, double x0, double y0);
- // TODO: API JNI
native static final private void cairo_matrix_init_identity(Handle matrix);
- // TODO: API JNI
native static final private void cairo_matrix_init_translate(Handle matrix,
double tx, double ty);
- // TODO: API JNI
native static final private void cairo_matrix_init_scale(Handle matrix,
double sx, double sy);
- // TODO: API JNI
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);
Index: ScaledFont.java
===================================================================
RCS file: /cvs/cairo/cairo-java/src/java/org/freedesktop/cairo/ScaledFont.java,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -d -r1.4 -r1.5
--- ScaledFont.java 13 Sep 2005 03:14:10 -0000 1.4
+++ ScaledFont.java 28 Oct 2005 23:04:46 -0000 1.5
@@ -40,11 +40,29 @@
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);
+ }
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);
- // TODO:
native static final private void cairo_scaled_font_glyph_extents(Handle obj, Handle[] glyphs, Handle extents);
// TODO: lifecycle
More information about the cairo-commit
mailing list