[cairo-commit] CairoJava/src/org/cairographics/cairo CairoFont.java,NONE,1.1 CairoException.java,NONE,1.1 Cairo.java,1.4,1.5 CairoImage.java,1.3,1.4 CairoMatrix.java,1.3,1.4 CairoSurface.java,1.4,1.5

Soorya Kuloor commit at pdx.freedesktop.org
Tue Dec 23 09:36:04 PST 2003


Committed by: skuloor

Update of /cvs/cairo/CairoJava/src/org/cairographics/cairo
In directory pdx:/tmp/cvs-serv11975/src/org/cairographics/cairo

Modified Files:
	Cairo.java CairoImage.java CairoMatrix.java CairoSurface.java 
Added Files:
	CairoFont.java CairoException.java 
Log Message:
Port to latest Cairo CVS.

--- NEW FILE: CairoFont.java ---
/*
 * $Id: CairoFont.java,v 1.1 2003/12/23 17:36:01 skuloor Exp $
 * 
 * Copyright (C) 2003 Verano
 * 
 * Permission to use, copy, modify, distribute, and sell this software
 * and its documentation for any purpose is hereby granted without
 * fee, provided that the above copyright notice appear in all copies
 * and that both that copyright notice and this permission notice
 * appear in supporting documentation, and that the name of
 * Verano not be used in advertising or publicity pertaining to
 * distribution of the software without specific, written prior permission.
 * Verano makes no representations about the suitability of this
 * software for any purpose.  It is provided "as is" without express or
 * implied warranty.
 *
 * VERANO MAKES NO REPRESENTATIONS OR WARRANTIES OR COVENANTS, EITHER
 * EXPRESS OR IMPLIED, WITH RESPECT TO THIS SOFTWARE, INCLUDING
 * WITHOUT LIMITATION, STATUTORY OR IMPLIED WARRANTIES OR CONDITIONS
 * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, TITLE,
 * NON-INFRINGEMENT, OR ARISING FROM CUSTOM, COURSE OF DEALING, USAGE
 * OF TRADE OR COURSE OF PERFORMANCE, ALL OF WHICH ARE EXPRESSLY
 * DISCLAIMED TO THE FULLEST EXTENT ALLOWABLE BY APPLICABLE LAW.  IN
 * NO EVENT SHALL VERANO BE LIABLE FOR ANY SPECIAL, INDIRECT OR
 * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS
 * OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT,
 * NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN
 * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
 */
package org.cairographics.cairo;

import org.cairographics.cairo.internal.CairoAPI;

/**
 * This class implements Cairo font. Methods are provided to create and transform and scale the font.
 * Objects of this class can be used to set fonts for Cairo states before drawing text.
 */
public class CairoFont {

    /*
     * Font weight options.
     */
    public final static short WEIGHT_NORMAL = 0;
    public final static short WEIGHT_BOLD = 1;

    /*
     * Font slant options
     */
    public final static short SLANT_NORMAL = 0;
    public final static short SLANT_ITALIC = 1;
    public final static short SLANT_OBLIQUE = 2;
    
    /** Native font handle */
    long handle = 0;

    /**
     * Default ctor. Hidden from access.
     *
     */
    private CairoFont() {
    }

    /**
     * Protected ctor. Can be used to create font objects with existing native font.
     * @param handle The font handle (native address, pointer value).
     */
    CairoFont(long handle) {
        this.handle = handle;
    }

    /**
     * Create a new font with the given characteristics.
     * 
     * @param family The font family
     * @param slant The font slant
     * @param weight The font weight
     * @param height The font height
     */
    public CairoFont(String family, short slant, short weight, double height) {
        this.handle = CairoAPI.ftFontCreate(family, slant, weight);
        ref();

        CairoMatrix matrix = new CairoMatrix();
        matrix.scale(height, height);
        setTransform(matrix);
        matrix.dispose();
    }

    /**
     * Create a new font with the given characteristics.
     * 
     * @param family The font family
     * @param slant The font slant
     * @param weight The font weight
     * @param height The font height
     */
    public CairoFont(String family, String style, String weight, double height) {
        this.handle = CairoAPI.ftFontCreate(family, style, weight);
        ref();
        
        CairoMatrix matrix = new CairoMatrix();
        matrix.scale(height, height);
        setTransform(matrix);
        matrix.dispose();
    }

    /**
     * Increments the reference count on the font object. This is done so that the native pointer
     * does not get freed prematurely.
     */
    public void ref() {
        CairoAPI.fontRef(handle);
    }

    /**
     * Decrements the reference count.
     */
    public void unref() {
        dispose();
    }

    /**
     * Disposes the font if no one in refering to the object, else decrements the reference count.
     *
     */
    public void dispose() {
        CairoAPI.destroyFont(handle);
    }
    
    /**
     * Sets the font transform to the given matrix. The font can be scaled or rotated using this
     * method.
     * 
     * @param matrix The transformation matrix.
     */
    public void setTransform(CairoMatrix matrix) {
        CairoAPI.fontSetTransform(this.handle, matrix.handle);
    }
}

--- NEW FILE: CairoException.java ---
/*
 * $Id: CairoException.java,v 1.1 2003/12/23 17:36:01 skuloor Exp $
 * 
 * Copyright (C) 2003 Verano
 * 
 * Permission to use, copy, modify, distribute, and sell this software
 * and its documentation for any purpose is hereby granted without
 * fee, provided that the above copyright notice appear in all copies
 * and that both that copyright notice and this permission notice
 * appear in supporting documentation, and that the name of
 * Verano not be used in advertising or publicity pertaining to
 * distribution of the software without specific, written prior permission.
 * Verano makes no representations about the suitability of this
 * software for any purpose.  It is provided "as is" without express or
 * implied warranty.
 *
 * VERANO MAKES NO REPRESENTATIONS OR WARRANTIES OR COVENANTS, EITHER
 * EXPRESS OR IMPLIED, WITH RESPECT TO THIS SOFTWARE, INCLUDING
 * WITHOUT LIMITATION, STATUTORY OR IMPLIED WARRANTIES OR CONDITIONS
 * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, TITLE,
 * NON-INFRINGEMENT, OR ARISING FROM CUSTOM, COURSE OF DEALING, USAGE
 * OF TRADE OR COURSE OF PERFORMANCE, ALL OF WHICH ARE EXPRESSLY
 * DISCLAIMED TO THE FULLEST EXTENT ALLOWABLE BY APPLICABLE LAW.  IN
 * NO EVENT SHALL VERANO BE LIABLE FOR ANY SPECIAL, INDIRECT OR
 * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS
 * OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT,
 * NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN
 * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
 */
package org.cairographics.cairo;

/**
 * This is the runtime exception thrown by almost all of Xr related methods and classes.
 */
public class CairoException extends RuntimeException {

    /**
     * The Xr error code. Will be one of Xr.STATUS_xxxx codes.
     */
    short errCode;

    /**
     * Constructor. Creates a new exception object.
     * 
     * @param code Error code
     * @param message Error message
     */
    public CairoException(short code, String message) {
        super(message);
        this.errCode = code;
    }

    /**
     * Returns the error code of this exception.
     * 
     * @return Xr error code, one of Xr.STATUS_xxx codes.
     */
    public short getErrorCode() {
        return errCode;
    }
}

Index: Cairo.java
===================================================================
RCS file: /cvs/cairo/CairoJava/src/org/cairographics/cairo/Cairo.java,v
retrieving revision 1.4
retrieving revision 1.5
diff -C2 -d -r1.4 -r1.5
*** Cairo.java	17 Nov 2003 17:46:50 -0000	1.4
--- Cairo.java	23 Dec 2003 17:36:01 -0000	1.5
***************
*** 30,35 ****
  package org.cairographics.cairo;
  
! import org.cairographics.cairo.internal.*;
! 
  import org.eclipse.swt.graphics.Color;
  import org.eclipse.swt.graphics.Image;
--- 30,34 ----
  package org.cairographics.cairo;
  
! import org.cairographics.cairo.internal.CairoAPI;
  import org.eclipse.swt.graphics.Color;
  import org.eclipse.swt.graphics.Image;
***************
*** 80,83 ****
--- 79,91 ----
      public final static short STATUS_INVALID_MATRIX = 5;
  
+     /*
+      * Filter options
+      */
+     public final static short FILTER_FAST = 0;
+     public final static short FILTER_GOOD = 1;
+     public final static short FILTER_BEST = 2;
+     public final static short FILTER_NEAREST = 3;
+     public final static short FILTER_BILINEAR = 4;
+ 
      /** native cairo state handle */
      long handle = 0;
***************
*** 92,105 ****
  
      /**
-      * Constructs a new state that draws on a SWT image.
-      * 
-      * @param img SWT image
-      */
-     public Cairo(Image img) {
-         this();
-         setTarget(img);
-     }
- 
-     /**
       * Constructs a new cairo state that draws on an cairo surface.
       * 
--- 100,103 ----
***************
*** 112,122 ****
  
      /**
       * Constructs a new cairo state that draws on a SWT widget.
!      * 
       * @param widget SWT widget
       */
      public Cairo(Widget widget) {
          this();
!         setTarget(widget);
      }
  
--- 110,130 ----
  
      /**
+       * Constructs a new state that draws on a SWT image.
+       *
+       * @param img SWT image
+       */
+     public Cairo(Image img) {
+         this();
+         CairoAPI.setTargetImage(handle, img.pixmap);
+     }
+ 
+     /**
       * Constructs a new cairo state that draws on a SWT widget.
!      *
       * @param widget SWT widget
       */
      public Cairo(Widget widget) {
          this();
!         CairoAPI.setTargetDrawable(handle, widget.handle);
      }
  
***************
*** 172,193 ****
  
      /**
-      * Sets the image as the target for this state. All shapes will be drawn on this image.
-      * 
-      * @param img The target image.
-      */
-     public void setTarget(Image img) {
-         CairoAPI.setTargetImage(handle, img.pixmap);
-     }
- 
-     /**
-      * Sets the widget as the target for this state. All the shapes will be drawn on this widget.
-      * 
-      * @param widget An SWT widget.
-      */
-     public void setTarget(Widget widget) {
-         CairoAPI.setTargetDrawable(handle, widget.handle);
-     }
- 
-     /**
       * Sets the color for drawing. Note that the RGB values must be within the range of 0.0 and 1.0.
       * 
--- 180,183 ----
***************
*** 206,212 ****
       */
      public void setColor(Color color) {
!         double r = ((double) color.getRed()) / 255.0;
!         double g = ((double) color.getGreen()) / 255.0;
!         double b = ((double) color.getBlue()) / 255.0;
          CairoAPI.setRGBColor(handle, r, g, b);
      }
--- 196,202 ----
       */
      public void setColor(Color color) {
!         double r = color.getRed() / 255.0;
!         double g = color.getGreen() / 255.0;
!         double b = color.getBlue() / 255.0;
          CairoAPI.setRGBColor(handle, r, g, b);
      }
***************
*** 430,440 ****
       * @param y3 y co-ordinate of the end point
       */
!     public void curveTo(
!         double x1,
!         double y1,
!         double x2,
!         double y2,
!         double x3,
!         double y3) {
          CairoAPI.curveTo(handle, x1, y1, x2, y2, x3, y3);
      }
--- 420,424 ----
       * @param y3 y co-ordinate of the end point
       */
!     public void curveTo(double x1, double y1, double x2, double y2, double x3, double y3) {
          CairoAPI.curveTo(handle, x1, y1, x2, y2, x3, y3);
      }
***************
*** 451,461 ****
       * @param dy3 relative y co-ordinate of the end point
       */
!     public void relCurveTo(
!         double dx1,
!         double dy1,
!         double dx2,
!         double dy2,
!         double dx3,
!         double dy3) {
          CairoAPI.relCurveTo(handle, dx1, dy1, dx2, dy2, dx3, dy3);
      }
--- 435,439 ----
       * @param dy3 relative y co-ordinate of the end point
       */
!     public void relCurveTo(double dx1, double dy1, double dx2, double dy2, double dx3, double dy3) {
          CairoAPI.relCurveTo(handle, dx1, dy1, dx2, dy2, dx3, dy3);
      }
***************
*** 505,517 ****
          double end_x,
          double end_y) {
!         CairoAPI.arcTo(
!             handle,
!             rx,
!             ry,
!             x_axis_rotation,
!             large_arc_flag,
!             sweep_flag,
!             end_x,
!             end_y);
      }
  
--- 483,487 ----
          double end_x,
          double end_y) {
!         CairoAPI.arcTo(handle, rx, ry, x_axis_rotation, large_arc_flag, sweep_flag, end_x, end_y);
      }
  
***************
*** 536,548 ****
          double end_dx,
          double end_dy) {
!         CairoAPI.relArcTo(
!             handle,
!             rx,
!             ry,
!             x_axis_rotation,
!             large_arc_flag,
!             sweep_flag,
!             end_dx,
!             end_dy);
      }
  
--- 506,510 ----
          double end_dx,
          double end_dy) {
!         CairoAPI.relArcTo(handle, rx, ry, x_axis_rotation, large_arc_flag, sweep_flag, end_dx, end_dy);
      }
  
***************
*** 616,629 ****
  
      /**
!      * Sets the font for drawing text. The font names must be of the form "family:weight:style".
!      * e.g. "Verdana:bold:italic", "arial:normal:normal"
!      *  
!      * @param key The font specification as a string.
       */
!     public void selectFont(String key) {
!         CairoAPI.selectFont(handle, key);
      }
  
      /**
       * Uniformly scale the current font by the given amount. You can set font size using this method.
       * 
--- 578,616 ----
  
      /**
!      * Sets the font for drawing text.
!      * 
!      * @param name Font family name
!      * @param slant Font slant, one of the FONT_SLANT_xxx constants defined above.
!      * @param weight Font weight, one of the FONT_WEIGHT_xx constants defined above.
       */
!     public void selectFont(String name, short slant, short weight) {
!         CairoAPI.selectFont(handle, name, slant, weight);
      }
  
      /**
+      * Sets the font for drawing text.
+      * 
+      * @param name Font family name
+      * @param fontStyle Font style, one of italic, oblique or normal.
+      * @param fontWeight Font weight, one of the bold or normal.
+      */
+     public void selectFont(String name, String fontStyle, String fontWeight) {
+         short slant = CairoFont.SLANT_NORMAL;
+         short weight = CairoFont.WEIGHT_NORMAL;
+ 
+         if ("italic".equalsIgnoreCase(fontStyle)) {
+             slant = CairoFont.SLANT_ITALIC;
+         } else if ("oblique".equalsIgnoreCase(fontStyle)) {
+             slant = CairoFont.SLANT_OBLIQUE;
+         }
+ 
+         if ("bold".equalsIgnoreCase(fontWeight) || "demibold".equalsIgnoreCase(fontWeight)) {
+             weight = CairoFont.WEIGHT_BOLD;
+         }
+ 
+         selectFont(name, slant, weight);
+     }
+     
+     /**
       * Uniformly scale the current font by the given amount. You can set font size using this method.
       * 
***************
*** 638,648 ****
       * Note: tx, ty are not required.
       * 
!      * @param a affine parameter a
!      * @param b affine parameter b
!      * @param c affine parameter c
!      * @param d affine parameter d
       */
!     public void transformFont(double a, double b, double c, double d) {
!         CairoAPI.transformFont(handle, a, b, c, d);
      }
  
--- 625,632 ----
       * Note: tx, ty are not required.
       * 
!      * @param mat transformation matrix.
       */
!     public void transformFont(CairoMatrix mat) {
!         CairoAPI.transformFont(handle, mat.handle);
      }
  
***************
*** 653,666 ****
       * @return The extents of the given string
       */
!     
!     /**
!      * XXX: NYI 14.11.2003
!      * 
!      * public double[] getTextExtents(String str) {
          return CairoAPI.getTextExtents(handle, str);
      }
-      * 
-      */
-     
  
      /**
--- 637,643 ----
       * @return The extents of the given string
       */
!     public double[] getTextExtents(String str) {
          return CairoAPI.getTextExtents(handle, str);
      }
  
      /**
***************
*** 680,705 ****
       * @param y The y co-ordinate of the location
       */
-     
-     
-      
-      /*
-       *XXX: NYI 14.13.2003 - CairoSurface 
-       *
      public void showImage(Image img, double x, double y) {
  
          /*
           * Create a surface from the given image and then show the surface
!          *
          CairoSurface surface = new CairoSurface(img);
          translate(x, y);
!         CairoAPI.showSurface(
!             handle,
!             surface.handle,
!             img.getImageData().width,
!             img.getImageData().height);
          translate(-x, -y);
          surface.dispose();
      }
- 	*/
  
      /**
--- 657,671 ----
       * @param y The y co-ordinate of the location
       */
      public void showImage(Image img, double x, double y) {
  
          /*
           * Create a surface from the given image and then show the surface
!          */
          CairoSurface surface = new CairoSurface(img);
          translate(x, y);
!         CairoAPI.showSurface(handle, surface.handle, img.getImageData().width, img.getImageData().height);
          translate(-x, -y);
          surface.dispose();
      }
  
      /**
***************
*** 827,862 ****
          CairoAPI.newPath(handle);
          CairoAPI.moveTo(handle, cx + rx, cy);
!         CairoAPI.curveTo(
!             handle,
!             cx + rx,
!             cy + ry * SVG_ARC_MAGIC,
!             cx + rx * SVG_ARC_MAGIC,
!             cy + ry,
!             cx,
!             cy + ry);
!         CairoAPI.curveTo(
!             handle,
!             cx - rx * SVG_ARC_MAGIC,
!             cy + ry,
!             cx - rx,
!             cy + ry * SVG_ARC_MAGIC,
!             cx - rx,
!             cy);
!         CairoAPI.curveTo(
!             handle,
!             cx - rx,
!             cy - ry * SVG_ARC_MAGIC,
!             cx - rx * SVG_ARC_MAGIC,
!             cy - ry,
!             cx,
!             cy - ry);
!         CairoAPI.curveTo(
!             handle,
!             cx + rx * SVG_ARC_MAGIC,
!             cy - ry,
!             cx + rx,
!             cy - ry * SVG_ARC_MAGIC,
!             cx + rx,
!             cy);
          CairoAPI.closePath(handle);
      }
--- 793,800 ----
          CairoAPI.newPath(handle);
          CairoAPI.moveTo(handle, cx + rx, cy);
!         CairoAPI.curveTo(handle, cx + rx, cy + ry * SVG_ARC_MAGIC, cx + rx * SVG_ARC_MAGIC, cy + ry, cx, cy + ry);
!         CairoAPI.curveTo(handle, cx - rx * SVG_ARC_MAGIC, cy + ry, cx - rx, cy + ry * SVG_ARC_MAGIC, cx - rx, cy);
!         CairoAPI.curveTo(handle, cx - rx, cy - ry * SVG_ARC_MAGIC, cx - rx * SVG_ARC_MAGIC, cy - ry, cx, cy - ry);
!         CairoAPI.curveTo(handle, cx + rx * SVG_ARC_MAGIC, cy - ry, cx + rx, cy - ry * SVG_ARC_MAGIC, cx + rx, cy);
          CairoAPI.closePath(handle);
      }
***************
*** 872,882 ****
       * @param ry Y radius of rounded corners
       */
!     public void rect(
!         double x,
!         double y,
!         double width,
!         double height,
!         double rx,
!         double ry) {
  
          /*
--- 810,814 ----
       * @param ry Y radius of rounded corners
       */
!     public void rect(double x, double y, double width, double height, double rx, double ry) {
  
          /*
***************
*** 885,888 ****
--- 817,824 ----
          CairoAPI.newPath(handle);
          if (rx > 0.0 || ry > 0.0) {
+             // Make sure that rx is not more than width/2 and ry is not more than height/2
+             rx = Math.min(rx, width / 2.0);
+             ry = Math.min(ry, height / 2.0);
+ 
              CairoAPI.moveTo(handle, x + rx, y);
              CairoAPI.lineTo(handle, x + width - rx, y);
***************
*** 907,911 ****
       * point remains unchanged.
       * 
!      * @param pt The point in local co-ordinates
       * @return The transformed point
       */
--- 843,848 ----
       * point remains unchanged.
       * 
!      * @param x The x cordinate of the point in local co-ordinates
!      * @param y The y cordinate of the point in local co-ordinates
       * @return The transformed point
       */
***************
*** 913,915 ****
--- 850,942 ----
          return CairoAPI.transformPoint(handle, x, y);
      }
+     
+     /**
+      * Returns the current transformation matrix for this state.
+      * 
+      * @return current transformation matrix.
+      */
+     public CairoMatrix getMatrix() {
+         CairoMatrix mat = new CairoMatrix();
+         CairoAPI.getMatrix(handle, mat.handle);
+         return mat;
+     }
+ 
+     /**
+      * 
+      * @param s
+      * @param colors
+      * @return
+      */
+     public CairoSurface getGradientPattern(short s, Color[] colors) {
+         CairoSurface g;
+ 
+         if (s == 0) {
+             g = new CairoSurface(getTargetSurface(), Cairo.FORMAT_ARGB32, colors.length, 2);
+         } else {
+             g = new CairoSurface(getTargetSurface(), Cairo.FORMAT_ARGB32, 2, colors.length);
+         }
+ 
+         Cairo cairo = new Cairo(g);
+         cairo.save();
+ 
+         for (int i = 0; i < colors.length; i++) {
+             cairo.setColor(colors[i]);
+             if (s == 0) {
+                 cairo.rect(i, 0, 1, 2, 0, 0);
+             } else {
+                 cairo.rect(0, i, 2, 1, 0, 0);
+             }
+             cairo.fill();
+         }
+ 
+         cairo.restore();
+         cairo.dispose();
+ 
+         g.setFilter(Cairo.FILTER_BILINEAR);
+         return g;
+     }
+ 
+     /**
+      * 
+      * @param s
+      * @param colors
+      * @param x
+      * @param y
+      * @param width
+      * @param height
+      */
+     public void setGradientPattern(short s, Color[] colors, double x, double y, double width, double height) {
+         CairoSurface pattern = getGradientPattern(s, colors);
+ 
+         CairoMatrix mat = new CairoMatrix();
+         if (s == 0) {
+             mat.scale((colors.length - 1) / width, 1.0 / height);
+         } else {
+             mat.scale(1.0 / width, (colors.length - 1) / height);
+         }
+         mat.translate(-x, -y);
+         pattern.setMatrix(mat);
+         mat.dispose();
+ 
+         setPattern(pattern);
+     }
+     
+     /**
+      * Returns the current font for this state.
+      * 
+      * @return current font.
+      */
+     public CairoFont getFont() {
+         long fontHandle = CairoAPI.getCurrentFont(this.handle);
+         return (fontHandle == 0) ? null : new CairoFont(fontHandle);
+     }
+     
+     /**
+      * Sets the font to use for this state.
+      * 
+      * @param font The font to use.
+      */
+     public void setFont(CairoFont font) {
+         CairoAPI.setFont(this.handle, font.handle);
+     }
  }

Index: CairoImage.java
===================================================================
RCS file: /cvs/cairo/CairoJava/src/org/cairographics/cairo/CairoImage.java,v
retrieving revision 1.3
retrieving revision 1.4
diff -C2 -d -r1.3 -r1.4

Index: CairoMatrix.java
===================================================================
RCS file: /cvs/cairo/CairoJava/src/org/cairographics/cairo/CairoMatrix.java,v
retrieving revision 1.3
retrieving revision 1.4
diff -C2 -d -r1.3 -r1.4
*** CairoMatrix.java	7 Aug 2003 20:43:38 -0000	1.3
--- CairoMatrix.java	23 Dec 2003 17:36:01 -0000	1.4
***************
*** 40,44 ****
       * Native matrix handle.
       */
!     long handle = 0;
  
      /**
--- 40,44 ----
       * Native matrix handle.
       */
!     protected long handle = 0;
  
      /**
***************
*** 138,143 ****
       * Appends a transaltion transformation to this matrix.
       * 
!      * @param x X axis translation
!      * @param y Y axis translation
       */
      public void translate(double tx, double ty) {
--- 138,143 ----
       * Appends a transaltion transformation to this matrix.
       * 
!      * @param tx X axis translation
!      * @param ty Y axis translation
       */
      public void translate(double tx, double ty) {
***************
*** 158,162 ****
       * Appends rotation transformation to this matrix.
       * 
!      * @param angle The rotation angle in radians.
       */
      public void rotate(double radians) {
--- 158,162 ----
       * Appends rotation transformation to this matrix.
       * 
!      * @param radians The rotation angle in radians.
       */
      public void rotate(double radians) {
***************
*** 199,211 ****
  
      /**
-      * Returns a copy of the matrix.
-      * 
-      * @return A new matrix that is copy of this matrix.
-      */
-     public CairoMatrix getCopy() {
-         return copy();
-     }
- 
-     /**
       * Multiples this matrix with another matrix.
       * 
--- 199,202 ----
***************
*** 213,217 ****
       */
      public void multiply(CairoMatrix secondMatrix) {
!         CairoMatrix other = (CairoMatrix) secondMatrix;
          CairoMatrix tmp = copy();
          CairoAPI.matrixMultiply(handle, tmp.handle, other.handle);
--- 204,208 ----
       */
      public void multiply(CairoMatrix secondMatrix) {
!         CairoMatrix other = secondMatrix;
          CairoMatrix tmp = copy();
          CairoAPI.matrixMultiply(handle, tmp.handle, other.handle);

Index: CairoSurface.java
===================================================================
RCS file: /cvs/cairo/CairoJava/src/org/cairographics/cairo/CairoSurface.java,v
retrieving revision 1.4
retrieving revision 1.5
diff -C2 -d -r1.4 -r1.5
*** CairoSurface.java	17 Nov 2003 17:46:50 -0000	1.4
--- CairoSurface.java	23 Dec 2003 17:36:01 -0000	1.5
***************
*** 74,84 ****
       * @param img The SWT image object
       */
-     /**
-      *XXX: NYI 14.11.2003 
-      *
      public CairoSurface(Image img) {
          handle = CairoAPI.surfaceCreateForPixmap(img.pixmap);    
      }
-     */
      
      /**
--- 74,80 ----
***************
*** 95,135 ****
  
      /**
-      * Creates a new surface similar to one given, but with slightly different specs.
-      * 
-      * @param neighbor The surface to use as a template
-      * @param format The RGB format (one of Cairo.FORMAT_xxx constants)
-      * @param width Width of the new surface
-      * @param height Height of the new surface
-      * @param red The red component of the background color
-      * @param green The green component of the background color
-      * @param blue The blue component of the background color
-      * @param alpha The alpha component of the background color
-      */
-     /*
-      *XXX NYI 14.11.2003 surfaceCreateSimilarSolid 
-      *
-     public CairoSurface(
-         CairoSurface neighbor,
-         short format,
-         int width,
-         int height,
-         double red,
-         double green,
-         double blue,
-         double alpha) {
-         handle =
-             CairoAPI.surfaceCreateSimilarSolid(
-                 neighbor.handle,
-                 format,
-                 width,
-                 height,
-                 red,
-                 green,
-                 blue,
-                 alpha);
-     }
-     */
- 
-     /**
       * Disposes native resources used by the surface. Do not use the surface once it is
       * disposed.
--- 91,94 ----
***************
*** 178,180 ****
--- 137,150 ----
      }
  
+     /**
+      * Sets a rectangular clip on the given surface.
+      * 
+      * @param x The x co-ordinate of the top left corner of the clip
+      * @param y The y co-ordinate of the top left corner of the clip
+      * @param width Clip width
+      * @param height Clip height
+      */
+     public void clipRectanglex(int x, int y, int width, int height) {
+         //CairoAPI.surfaceClipRectangle(handle, x, y, width, height);
+     }
  }





More information about the cairo-commit mailing list