[cairo-commit] CairoJava/src/org/cairographics/cairo CairoSurface.java, 1.5, 1.6

Soorya Kuloor commit at pdx.freedesktop.org
Fri Apr 30 10:53:05 PDT 2004


Committed by: skuloor

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

Modified Files:
	CairoSurface.java 
Log Message:
Added native methods to the class.

Index: CairoSurface.java
===================================================================
RCS file: /cvs/cairo/CairoJava/src/org/cairographics/cairo/CairoSurface.java,v
retrieving revision 1.5
retrieving revision 1.6
diff -C2 -d -r1.5 -r1.6
*** a/CairoSurface.java	23 Dec 2003 17:36:01 -0000	1.5
--- b/CairoSurface.java	30 Apr 2004 17:53:02 -0000	1.6
***************
*** 4,43 ****
   * 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.*;
- 
- import org.eclipse.swt.graphics.Image;
- 
  /**
!  * The CairoSurface class represents an Cairo drawing surface. An Cairo object is used to draw on the drawing
!  * surface.
   */
  public class CairoSurface {
!     
      /** Native handle for the drawing surface */
      long handle = 0;
--- 4,36 ----
   * 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;
  
  /**
!  * The CairoSurface class represents an Cairo drawing surface. An Cairo object
!  * is used to draw on the drawing surface.
   */
  public class CairoSurface {
! 
      /** Native handle for the drawing surface */
      long handle = 0;
***************
*** 45,57 ****
      /**
       * Default constructor. This is private.
!      *
       */
!     private CairoSurface() {
      }
  
      /**
       * Creates an Cairo surface using a native surface handle.
!      *  
!      * @param surface The surface handle.
       */
      CairoSurface(long surface) {
--- 38,51 ----
      /**
       * Default constructor. This is private.
!      *  
       */
!     protected CairoSurface() {
      }
  
      /**
       * Creates an Cairo surface using a native surface handle.
!      * 
!      * @param surface
!      *            The surface handle.
       */
      CairoSurface(long surface) {
***************
*** 59,100 ****
      }
  
!     /**
!      * Constructs a surface using an SWT image object. Anything drawn on the surface will be stored in the 
!      * image.
!      * 
!      * @param img The image to draw on.
!      */
!     public CairoSurface(CairoImage img) {
!         handle = CairoAPI.surfaceCreateForImage(img.handle);
!     }
! 
!     /**
!      * Creates a new surface for the given image.
!      * 
!      * @param img The SWT image object
!      */
!     public CairoSurface(Image img) {
!         handle = CairoAPI.surfaceCreateForPixmap(img.pixmap);    
      }
      
      /**
!      * 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
       */
!     public CairoSurface(CairoSurface neighbor, short format, int width, int height) {
!         handle = CairoAPI.surfaceCreateSimilar(neighbor.handle, format, width, height);
      }
  
      /**
!      * Disposes native resources used by the surface. Do not use the surface once it is
!      * disposed.
!      *
       */
      public void dispose() {
!         CairoAPI.surfaceDestroy(handle);
      }
  
--- 53,88 ----
      }
  
!     void makeTarget(Cairo cairo) {
!         Cairo.cairo_set_target_surface(cairo.handle, this.handle);
      }
      
      /**
!      * 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
       */
!     public CairoSurface createSimilar(CairoSurface neighbor, short format, int width, int height) {
!         return new CairoSurface(cairo_surface_create_similar(neighbor.handle, format, width, height));
!     }
! 
!     public void ref() {
!         cairo_surface_reference(handle);
      }
  
      /**
!      * Disposes native resources used by the surface. Do not use the surface
!      * once it is disposed.
!      *  
       */
      public void dispose() {
!         cairo_surface_destroy(handle);
      }
  
***************
*** 102,111 ****
       * Sets the transformation matrix for the surface.
       * 
!      * @param matrix Transformation matrix
       */
      public void setMatrix(CairoMatrix matrix) {
!         CairoAPI.surfaceSetMatrix(handle, matrix.handle);
      }
!     
      /**
       * Returns the transformation matrix of the surface.
--- 90,100 ----
       * Sets the transformation matrix for the surface.
       * 
!      * @param matrix
!      *            Transformation matrix
       */
      public void setMatrix(CairoMatrix matrix) {
!         cairo_surface_set_matrix(handle, matrix.handle);
      }
! 
      /**
       * Returns the transformation matrix of the surface.
***************
*** 115,119 ****
      public CairoMatrix getMatrix() {
          CairoMatrix mat = new CairoMatrix();
!         CairoAPI.surfaceGetMatrix(handle, mat.handle);
          return mat;
      }
--- 104,108 ----
      public CairoMatrix getMatrix() {
          CairoMatrix mat = new CairoMatrix();
!         cairo_surface_get_matrix(handle, mat.handle);
          return mat;
      }
***************
*** 122,129 ****
       * Sets the filter for the surface (???)
       * 
!      * @param filter The filter specification
       */
      public void setFilter(short filter) {
!         CairoAPI.surfaceSetFilter(handle, filter);
      }
  
--- 111,119 ----
       * Sets the filter for the surface (???)
       * 
!      * @param filter
!      *            The filter specification
       */
      public void setFilter(short filter) {
!         cairo_surface_set_filter(handle, filter);
      }
  
***************
*** 131,150 ****
       * Sets the repeat count for filling (//TODO: Figure out what this is)
       * 
!      * @param repeat The repeat count.
       */
      public void setRepeat(int repeat) {
!         CairoAPI.surfaceSetRepeat(handle, repeat);
      }
  
!     /**
!      * 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);
!     }
! }
--- 121,149 ----
       * Sets the repeat count for filling (//TODO: Figure out what this is)
       * 
!      * @param repeat
!      *            The repeat count.
       */
      public void setRepeat(int repeat) {
!         cairo_surface_set_repeat(handle, repeat);
      }
  
!     /*
!      * Native methods
       */
!     native static long cairo_surface_create_similar(long other, short format,
!             int width, int height);
! 
!     native static void cairo_surface_reference(long surface);
! 
!     native static void cairo_surface_destroy(long surface);
! 
!     native static void cairo_surface_set_repeat(long surface, int repeat);
! 
!     native static void cairo_surface_set_matrix(long surface, long matrix);
! 
!     native static void cairo_surface_get_matrix(long surface, long matrix);
! 
!     native static void cairo_surface_set_filter(long surface, short filter);
! 
!     native static short cairo_surface_get_filter(long surface);
! }
\ No newline at end of file





More information about the cairo-commit mailing list