the enums no longer need to be nested inside the Cairo class.
* Mono.Cairo/Matrix.cs:
* Mono.Cairo/Object.cs:
* Mono.Cairo/Surface.cs: I never liked having the word 'Object' in
the name of a class, esp. now that we have namespaces. So I have
decided to rename them.
svn path=/trunk/mcs/; revision=17284
+2003-08-12 Duncan Mak <duncan@ximian.com>
+
+ * Mono.Cairo/Cairo.cs: Now that the namespace is called 'Cairo',
+ the enums no longer need to be nested inside the Cairo class.
+
+ * Mono.Cairo/Matrix.cs:
+ * Mono.Cairo/Object.cs:
+ * Mono.Cairo/Surface.cs: I never liked having the word 'Object' in
+ the name of a class, esp. now that we have namespaces. So I have
+ decided to rename them.
+
+ CairoObject -> Cairo.Object
+ CairoMatrixObject -> Cairo.Matrix
+ CairoSurfaceObject -> Cairo.Surface
+
+ I didn't like the Mono.Cairo namespace either, so they're just in
+ the Cairo namespace now. I know it's icky that the directory is
+ called Mono.Cairo, and the dll we write to is called
+ 'Mono.Cairo.dll', and yet the namespace now gonna just be 'Cairo'
+ and not 'Mono.Cairo'. C'est la vie.
+
2003-08-12 Duncan Mak <duncan@ximian.com>
* Mono.Cairo/CairoObject.cs (Pattern): Re-enable this. This
-./Mono.Cairo/CairoObject.cs
./Mono.Cairo/Cairo.cs
-./Mono.Cairo/CairoSurfaceObject.cs
-./Mono.Cairo/CairoMatrixObject.cs
+./Mono.Cairo/Matrix.cs
+./Mono.Cairo/Object.cs
+./Mono.Cairo/Surface.cs
using System.Drawing;
using System.Runtime.InteropServices;
-namespace Mono.Cairo {
+namespace Cairo {
public class Cairo
{
[DllImport (CairoImp)]
public static extern Cairo.Status cairo_matrix_transform_point (
IntPtr matrix, ref double x, ref double y);
-
- public enum Format {
- ARGB32 = 0,
- RGB24 = 1,
- A8 = 2,
- A1 = 4
- }
-
- public enum Operator {
- Clear = 0,
- Src = 1,
- Dst = 2,
- Over = 3,
- OverReverse = 4,
- In = 5,
- InReverse = 6,
- Out = 7,
- OutReverse = 8,
- Atop = 9,
- AtopReverse = 10,
- Xor = 11,
- Add = 12,
- Saturate = 13,
+ }
+
+ //
+ // Enumerations
+ //
+ public enum Format {
+ ARGB32 = 0,
+ RGB24 = 1,
+ A8 = 2,
+ A1 = 4
+ }
+
+ public enum Operator {
+ Clear = 0,
+ Src = 1,
+ Dst = 2,
+ Over = 3,
+ OverReverse = 4,
+ In = 5,
+ InReverse = 6,
+ Out = 7,
+ OutReverse = 8,
+ Atop = 9,
+ AtopReverse = 10,
+ Xor = 11,
+ Add = 12,
+ Saturate = 13,
- DisjointClear = 16,
- DisjointSrc = 17,
- DisjointDst = 18,
- DisjointOver = 19,
- DisjointOverReverse = 20,
- DisjointIn = 21,
- DisjointInReverse = 22,
- DisjointOut = 23,
- DisjointOutReverse = 24,
- DisjointAtop = 25,
- DisjointAtopReverse = 26,
- DisjointXor = 27,
-
- ConjointClear = 32,
- ConjointSrc = 33,
- ConjointDst = 34,
- ConjointOver = 35,
- ConjointOverReverse = 36,
- ConjointIn = 37,
- ConjointInReverse = 38,
- ConjointOut = 39,
- ConjointOutReverse = 40,
- ConjointAtop = 41,
- ConjointAtopReverse = 42,
- ConjointXor = 43
- }
-
- public enum FillRule {
- Winding,
- EvenOdd
- }
-
- public enum LineCap {
- Butt, Round, Square
- }
-
- public enum LineJoin {
- Miter, Round, Bevel
- }
-
- public enum Status {
- Success = 0,
- NoMemory,
- InvalidRestore,
- InvalidPopGroup,
- NoCurrentPoint,
- InvalidMatrix
- }
-
- public enum Filter {
- Fast,
- Good,
- Best,
- Nearest,
- Bilinear
- }
+ DisjointClear = 16,
+ DisjointSrc = 17,
+ DisjointDst = 18,
+ DisjointOver = 19,
+ DisjointOverReverse = 20,
+ DisjointIn = 21,
+ DisjointInReverse = 22,
+ DisjointOut = 23,
+ DisjointOutReverse = 24,
+ DisjointAtop = 25,
+ DisjointAtopReverse = 26,
+ DisjointXor = 27,
+
+ ConjointClear = 32,
+ ConjointSrc = 33,
+ ConjointDst = 34,
+ ConjointOver = 35,
+ ConjointOverReverse = 36,
+ ConjointIn = 37,
+ ConjointInReverse = 38,
+ ConjointOut = 39,
+ ConjointOutReverse = 40,
+ ConjointAtop = 41,
+ ConjointAtopReverse = 42,
+ ConjointXor = 43
+ }
+
+ public enum FillRule {
+ Winding,
+ EvenOdd
+ }
+
+ public enum LineCap {
+ Butt, Round, Square
+ }
+
+ public enum LineJoin {
+ Miter, Round, Bevel
+ }
+
+ public enum Status {
+ Success = 0,
+ NoMemory,
+ InvalidRestore,
+ InvalidPopGroup,
+ NoCurrentPoint,
+ InvalidMatrix
+ }
+
+ public enum Filter {
+ Fast,
+ Good,
+ Best,
+ Nearest,
+ Bilinear
}
}
+++ /dev/null
-//
-// Mono.Cairo.CairoMatrixObject.cs
-//
-// Author: Duncan Mak
-//
-// (C) Ximian Inc, 2003.
-//
-// This is an OO wrapper API for the Cairo API
-//
-
-using System;
-using System.Drawing;
-using System.Runtime.InteropServices;
-using Mono.Cairo;
-
-namespace Mono.Cairo {
-
- public class CairoMatrixObject
- {
- IntPtr matrix;
-
- public CairoMatrixObject ()
- : this (Create ())
- {
- }
-
- internal CairoMatrixObject (IntPtr ptr)
- {
- matrix = ptr;
- }
-
- public static IntPtr Create ()
- {
- return Cairo.cairo_matrix_create ();
- }
-
- public void Destroy ()
- {
- Cairo.cairo_matrix_destroy (matrix);
- }
-
- public Cairo.Status Copy (out CairoMatrixObject other)
- {
- IntPtr p = IntPtr.Zero;
-
- Cairo.Status status = Cairo.cairo_matrix_copy (matrix, out p);
-
- other = new CairoMatrixObject (p);
-
- return status;
- }
-
- public IntPtr Pointer {
- get { return matrix; }
- }
-
- public Cairo.Status SetIdentity ()
- {
- return Cairo.cairo_matrix_set_identity (matrix);
- }
-
- public Cairo.Status SetAffine (
- double a, double b, double c, double d, double tx, double ty)
- {
- return Cairo.cairo_matrix_set_affine (
- matrix, a, b, c, d, tx, ty);
- }
-
- public Cairo.Status GetAffine (
- out double a, out double b, out double c, out double d, out double tx, out double ty)
- {
- return Cairo.cairo_matrix_get_affine (
- matrix, out a, out b, out c, out d, out tx, out ty);
- }
-
- public Cairo.Status Scale (double sx, double sy)
- {
- return Cairo.cairo_matrix_scale (matrix, sx, sy);
- }
-
- public Cairo.Status Rotate (double radians)
- {
- return Cairo.cairo_matrix_rotate (matrix, radians);
- }
-
- public Cairo.Status Invert ()
- {
- return Cairo.cairo_matrix_invert (matrix);
- }
-
- public static Cairo.Status Multiply (
- out CairoMatrixObject result,
- CairoMatrixObject a, CairoMatrixObject b)
- {
- IntPtr p = IntPtr.Zero;
-
- Cairo.Status status = Cairo.cairo_matrix_multiply (
- out p, a.Pointer, b.Pointer);
-
- result = new CairoMatrixObject (p);
-
- return status;
- }
-
- public Cairo.Status TransformDistance (ref double dx, ref double dy)
- {
- return Cairo.cairo_matrix_transform_distance (
- matrix, ref dx, ref dy);
- }
-
- public Cairo.Status TransformPoint (ref double x, ref double y)
- {
- return Cairo.cairo_matrix_transform_distance (
- matrix, ref x, ref y);
- }
- }
-}
+++ /dev/null
-//
-// Mono.Cairo.CairoObject.cs
-//
-// Author: Duncan Mak
-//
-// (C) Ximian Inc, 2003.
-//
-// This is an OO wrapper API for the Cairo API.
-//
-
-using System;
-using System.Drawing;
-using System.Runtime.InteropServices;
-using Mono.Cairo;
-
-namespace Mono.Cairo {
-
- public class CairoObject
- {
- IntPtr state;
-
- public CairoObject ()
- : this (Create ())
- {
- }
-
- public CairoObject (IntPtr ptr)
- {
- state = ptr;
- }
-
- public static IntPtr Create ()
- {
- return Cairo.cairo_create ();
- }
-
- public IntPtr Destroy ()
- {
- return Cairo.cairo_destroy (state);
- }
-
- public void Save ()
- {
- Cairo.cairo_save (state);
- }
-
- public void Restore ()
- {
- Cairo.cairo_restore (state);
- }
-
- public Cairo.Status Status {
- get {
- return Cairo.cairo_get_status (state);
- }
- }
-
- public string StatusString {
- get {
- return Cairo.cairo_get_status_string (state);
- }
- }
-
- public IntPtr Pointer {
- get {
- return state;
- }
- }
-
- public Cairo.Operator Operator {
- set {
- Cairo.cairo_set_operator (state, value);
- }
-
- get {
- return Cairo.cairo_get_operator (state);
- }
- }
-
- public void SetRGBColor (double r, double g, double b)
- {
- Cairo.cairo_set_rgb_color (state, r, g, b);
- }
-
- public double Tolerence {
- set {
- Cairo.cairo_set_tolerence (state, value);
- }
-
- get {
- return Cairo.cairo_get_tolerence (state);
- }
- }
-
- public double Alpha {
- set {
- Cairo.cairo_set_alpha (state, value);
- }
-
- get {
- return Cairo.cairo_get_alpha (state);
- }
- }
-
- public Cairo.FillRule FillRule {
- set {
- Cairo.cairo_set_fill_rule (state, value);
- }
-
- get {
- return Cairo.cairo_get_fill_rule (state);
- }
- }
-
- public double LineWidth {
- set {
- Cairo.cairo_set_line_width (state, value);
- }
-
- get {
- return Cairo.cairo_get_line_width (state);
- }
- }
-
- public Cairo.LineCap LineCap {
- set {
- Cairo.cairo_set_line_cap (state, value);
- }
-
- get {
- return Cairo.cairo_get_line_cap (state);
- }
- }
-
- public Cairo.LineJoin LineJoin {
- set {
- Cairo.cairo_set_line_join (state, value);
- }
-
- get {
- return Cairo.cairo_get_line_join (state);
- }
- }
-
- public void SetDash (double [] dashes, int ndash, double offset)
- {
- Cairo.cairo_set_dash (state, dashes, ndash, offset);
- }
-
- public CairoSurfaceObject Pattern {
- set {
- Cairo.cairo_set_pattern (state, value.Pointer);
- }
- }
-
- public double MiterLimit {
- set {
- Cairo.cairo_set_miter_limit (state, value);
- }
-
- get {
- return Cairo.cairo_get_miter_limit (state);
- }
- }
-
- public void GetCurrentPoint (out double x, out double y)
- {
- Cairo.cairo_get_current_point (state, out x, out y);
- }
-
- public Point CurrentPoint {
- get {
- double x, y;
- Cairo.cairo_get_current_point (state, out x, out y);
- return new Point ((int) x, (int) y);
- }
- }
-
-#region Path methods
-
- public void NewPath ()
- {
- Cairo.cairo_new_path (state);
- }
-
- public void MoveTo (double x, double y)
- {
- Cairo.cairo_move_to (state, x, y);
- }
-
- public void LineTo (double x, double y)
- {
- Cairo.cairo_line_to (state, x, y);
- }
-
- public void CurveTo (double x1, double y1, double x2, double y2, double x3, double y3)
- {
- Cairo.cairo_curve_to (state, x1, y1, x2, x2, x3, y3);
- }
-
- public void CurveTo (Point p1, Point p2, Point p3)
- {
- Cairo.cairo_curve_to (state, p1.X, p1.Y, p2.X, p2.Y, p3.X, p3.Y);
- }
-
- public void RelMoveTo (double dx, double dy)
- {
- Cairo.cairo_rel_move_to (state, dx, dy);
- }
-
- public void RelLineTo (double dx, double dy)
- {
- Cairo.cairo_rel_line_to (state, dx, dy);
- }
-
- public void RelCurveTo (double dx1, double dy1, double dx2, double dy2, double dx3, double dy3)
- {
- Cairo.cairo_rel_curve_to (state, dx1, dy1, dx2, dy2, dx3, dy3);
- }
-
- public void Rectangle (double x, double y, double width, double height)
- {
- Cairo.cairo_rectangle (state, x, y, width, height);
- }
-
- public void ClosePath ()
- {
- Cairo.cairo_close_path (state);
- }
-#endregion
-
-#region Painting Methods
-
- public void Stroke ()
- {
- Cairo.cairo_stroke (state);
- }
-
- public void Fill ()
- {
- Cairo.cairo_fill (state);
- }
-
-#endregion
-
- public void Clip ()
- {
- Cairo.cairo_clip (state);
- }
-
-#region Modified state
-
- public void SetTargetImage (
- string data, Cairo.Format format, int width, int height, int stride)
- {
- Cairo.cairo_set_target_image (state, data, format, width, height, stride);
- }
-
-#endregion
-
- public void Rotate (double angle)
- {
- Cairo.cairo_rotate (state, angle);
- }
-
- public void Scale (double sx, double sy)
- {
- Cairo.cairo_scale (state, sx, sy);
- }
-
- public void Translate (double tx, double ty)
- {
- Cairo.cairo_translate (state, tx, ty);
- }
-
- public void TransformPoint (ref double x, ref double y)
- {
- Cairo.cairo_transform_point (state, ref x, ref y);
- }
-
- public void TransformDistance (ref double dx, ref double dy)
- {
- Cairo.cairo_transform_distance (state, ref dx, ref dy);
- }
-
- public void InverseTransformPoint (ref double x, ref double y)
- {
- Cairo.cairo_inverse_transform_point (state, ref x, ref y);
- }
-
- public void InverseTransformDistance (ref double dx, ref double dy)
- {
- Cairo.cairo_inverse_transform_distance (state, ref dx, ref dy);
- }
-
- public void ConcatMatrix (CairoMatrixObject matrix)
- {
- Cairo.cairo_concat_matrix (state, matrix.Pointer);
- }
-
- public CairoMatrixObject Matrix {
- set {
- Cairo.cairo_set_matrix (state, value.Pointer);
- }
- }
- }
-}
+++ /dev/null
-//
-// Mono.Cairo.CairoSurfaceObject.cs
-//
-// Author: Duncan Mak
-//
-// (C) Ximian Inc, 2003.
-//
-// This is an OO wrapper API for the Cairo API
-//
-
-using System;
-using System.Drawing;
-using System.Runtime.InteropServices;
-using Mono.Cairo;
-
-namespace Mono.Cairo {
-
- public class CairoSurfaceObject
- {
- IntPtr surface;
-
- CairoSurfaceObject (IntPtr ptr)
- {
- surface = ptr;
- }
-
- public static CairoSurfaceObject CreateForImage (
- string data, Cairo.Format format, int width, int height, int stride)
- {
- IntPtr p = Cairo.cairo_surface_create_for_image (
- data, format, width, height, stride);
-
- return new CairoSurfaceObject (p);
- }
-
- public static CairoSurfaceObject CreateSimilar (
- CairoSurfaceObject surface, Cairo.Format format, int width, int height)
- {
- IntPtr p = Cairo.cairo_surface_create_similar (
- surface.Pointer, format, width, height);
-
- return new CairoSurfaceObject (p);
- }
-
- public static CairoSurfaceObject CreateSimilarSolid (
- CairoSurfaceObject surface, Cairo.Format format,
- int width, int height, double red, double green, double blue, double alpha)
- {
- IntPtr p = Cairo.cairo_surface_create_similar_solid (
- surface.Pointer, format, width, height, red, green, blue, alpha);
-
- return new CairoSurfaceObject (p);
- }
-
- public void Destroy ()
- {
- Cairo.cairo_surface_destroy (surface);
- }
-
- public void PutImage (string data, int width, int height, int stride)
- {
- Cairo.cairo_surface_put_image (surface, data, width, height, stride);
- }
-
- public IntPtr Pointer {
- get { return surface; }
- }
-
- public int Repeat {
- set {
- Cairo.cairo_surface_set_repeat (surface, value);
- }
- }
-
- public CairoMatrixObject Matrix {
- set {
- Cairo.cairo_surface_set_matrix (surface, value.Pointer);
- }
-
- get {
- IntPtr p = IntPtr.Zero;
-
- Cairo.cairo_surface_get_matrix (surface, ref p);
-
- return new CairoMatrixObject (p);
- }
- }
-
- public Cairo.Filter Filter {
- set {
- Cairo.cairo_surface_set_filter (surface, value);
- }
- }
- }
-}
--- /dev/null
+//
+// Mono.Cairo.Matrix.cs
+//
+// Author: Duncan Mak
+//
+// (C) Ximian Inc, 2003.
+//
+// This is an OO wrapper API for the Cairo API
+//
+
+using System;
+using System.Drawing;
+using System.Runtime.InteropServices;
+using Cairo;
+
+namespace Cairo {
+
+ public class Matrix
+ {
+ IntPtr matrix;
+
+ public Matrix ()
+ : this (Create ())
+ {
+ }
+
+ internal Matrix (IntPtr ptr)
+ {
+ matrix = ptr;
+ }
+
+ public static IntPtr Create ()
+ {
+ return Cairo.cairo_matrix_create ();
+ }
+
+ public void Destroy ()
+ {
+ Cairo.cairo_matrix_destroy (matrix);
+ }
+
+ public Cairo.Status Copy (out Cairo.Matrix other)
+ {
+ IntPtr p = IntPtr.Zero;
+
+ Cairo.Status status = Cairo.cairo_matrix_copy (matrix, out p);
+
+ other = new Cairo.Matrix (p);
+
+ return status;
+ }
+
+ public IntPtr Pointer {
+ get { return matrix; }
+ }
+
+ public Cairo.Status SetIdentity ()
+ {
+ return Cairo.cairo_matrix_set_identity (matrix);
+ }
+
+ public Cairo.Status SetAffine (
+ double a, double b, double c, double d, double tx, double ty)
+ {
+ return Cairo.cairo_matrix_set_affine (
+ matrix, a, b, c, d, tx, ty);
+ }
+
+ public Cairo.Status GetAffine (
+ out double a, out double b, out double c, out double d, out double tx, out double ty)
+ {
+ return Cairo.cairo_matrix_get_affine (
+ matrix, out a, out b, out c, out d, out tx, out ty);
+ }
+
+ public Cairo.Status Scale (double sx, double sy)
+ {
+ return Cairo.cairo_matrix_scale (matrix, sx, sy);
+ }
+
+ public Cairo.Status Rotate (double radians)
+ {
+ return Cairo.cairo_matrix_rotate (matrix, radians);
+ }
+
+ public Cairo.Status Invert ()
+ {
+ return Cairo.cairo_matrix_invert (matrix);
+ }
+
+ public static Cairo.Status Multiply (
+ out Cairo.Matrix result, Cairo.Matrix a, Cairo.Matrix b)
+ {
+ IntPtr p = IntPtr.Zero;
+
+ Cairo.Status status = Cairo.cairo_matrix_multiply (
+ out p, a.Pointer, b.Pointer);
+
+ result = new Cairo.Matrix (p);
+
+ return status;
+ }
+
+ public Cairo.Status TransformDistance (ref double dx, ref double dy)
+ {
+ return Cairo.cairo_matrix_transform_distance (
+ matrix, ref dx, ref dy);
+ }
+
+ public Cairo.Status TransformPoint (ref double x, ref double y)
+ {
+ return Cairo.cairo_matrix_transform_distance (
+ matrix, ref x, ref y);
+ }
+ }
+}
--- /dev/null
+//
+// Mono.Cairo.Object.cs
+//
+// Author: Duncan Mak
+//
+// (C) Ximian Inc, 2003.
+//
+// This is an OO wrapper API for the Cairo API.
+//
+
+using System;
+using System.Drawing;
+using System.Runtime.InteropServices;
+using Cairo;
+
+namespace Cairo {
+
+ public class Object
+ {
+ IntPtr state;
+
+ public Object ()
+ : this (Create ())
+ {
+ }
+
+ public Object (IntPtr ptr)
+ {
+ state = ptr;
+ }
+
+ public static IntPtr Create ()
+ {
+ return Cairo.cairo_create ();
+ }
+
+ public IntPtr Destroy ()
+ {
+ return Cairo.cairo_destroy (state);
+ }
+
+ public void Save ()
+ {
+ Cairo.cairo_save (state);
+ }
+
+ public void Restore ()
+ {
+ Cairo.cairo_restore (state);
+ }
+
+ public Cairo.Status Status {
+ get {
+ return Cairo.cairo_get_status (state);
+ }
+ }
+
+ public string StatusString {
+ get {
+ return Cairo.cairo_get_status_string (state);
+ }
+ }
+
+ public IntPtr Pointer {
+ get {
+ return state;
+ }
+ }
+
+ public Cairo.Operator Operator {
+ set {
+ Cairo.cairo_set_operator (state, value);
+ }
+
+ get {
+ return Cairo.cairo_get_operator (state);
+ }
+ }
+
+ public void SetRGBColor (double r, double g, double b)
+ {
+ Cairo.cairo_set_rgb_color (state, r, g, b);
+ }
+
+ public double Tolerence {
+ set {
+ Cairo.cairo_set_tolerence (state, value);
+ }
+
+ get {
+ return Cairo.cairo_get_tolerence (state);
+ }
+ }
+
+ public double Alpha {
+ set {
+ Cairo.cairo_set_alpha (state, value);
+ }
+
+ get {
+ return Cairo.cairo_get_alpha (state);
+ }
+ }
+
+ public Cairo.FillRule FillRule {
+ set {
+ Cairo.cairo_set_fill_rule (state, value);
+ }
+
+ get {
+ return Cairo.cairo_get_fill_rule (state);
+ }
+ }
+
+ public double LineWidth {
+ set {
+ Cairo.cairo_set_line_width (state, value);
+ }
+
+ get {
+ return Cairo.cairo_get_line_width (state);
+ }
+ }
+
+ public Cairo.LineCap LineCap {
+ set {
+ Cairo.cairo_set_line_cap (state, value);
+ }
+
+ get {
+ return Cairo.cairo_get_line_cap (state);
+ }
+ }
+
+ public Cairo.LineJoin LineJoin {
+ set {
+ Cairo.cairo_set_line_join (state, value);
+ }
+
+ get {
+ return Cairo.cairo_get_line_join (state);
+ }
+ }
+
+ public void SetDash (double [] dashes, int ndash, double offset)
+ {
+ Cairo.cairo_set_dash (state, dashes, ndash, offset);
+ }
+
+ public Cairo.Surface Pattern {
+ set {
+ Cairo.cairo_set_pattern (state, value.Pointer);
+ }
+ }
+
+ public double MiterLimit {
+ set {
+ Cairo.cairo_set_miter_limit (state, value);
+ }
+
+ get {
+ return Cairo.cairo_get_miter_limit (state);
+ }
+ }
+
+ public void GetCurrentPoint (out double x, out double y)
+ {
+ Cairo.cairo_get_current_point (state, out x, out y);
+ }
+
+ public Point CurrentPoint {
+ get {
+ double x, y;
+ Cairo.cairo_get_current_point (state, out x, out y);
+ return new Point ((int) x, (int) y);
+ }
+ }
+
+#region Path methods
+
+ public void NewPath ()
+ {
+ Cairo.cairo_new_path (state);
+ }
+
+ public void MoveTo (double x, double y)
+ {
+ Cairo.cairo_move_to (state, x, y);
+ }
+
+ public void LineTo (double x, double y)
+ {
+ Cairo.cairo_line_to (state, x, y);
+ }
+
+ public void CurveTo (double x1, double y1, double x2, double y2, double x3, double y3)
+ {
+ Cairo.cairo_curve_to (state, x1, y1, x2, x2, x3, y3);
+ }
+
+ public void CurveTo (Point p1, Point p2, Point p3)
+ {
+ Cairo.cairo_curve_to (state, p1.X, p1.Y, p2.X, p2.Y, p3.X, p3.Y);
+ }
+
+ public void RelMoveTo (double dx, double dy)
+ {
+ Cairo.cairo_rel_move_to (state, dx, dy);
+ }
+
+ public void RelLineTo (double dx, double dy)
+ {
+ Cairo.cairo_rel_line_to (state, dx, dy);
+ }
+
+ public void RelCurveTo (double dx1, double dy1, double dx2, double dy2, double dx3, double dy3)
+ {
+ Cairo.cairo_rel_curve_to (state, dx1, dy1, dx2, dy2, dx3, dy3);
+ }
+
+ public void Rectangle (double x, double y, double width, double height)
+ {
+ Cairo.cairo_rectangle (state, x, y, width, height);
+ }
+
+ public void ClosePath ()
+ {
+ Cairo.cairo_close_path (state);
+ }
+#endregion
+
+#region Painting Methods
+
+ public void Stroke ()
+ {
+ Cairo.cairo_stroke (state);
+ }
+
+ public void Fill ()
+ {
+ Cairo.cairo_fill (state);
+ }
+
+#endregion
+
+ public void Clip ()
+ {
+ Cairo.cairo_clip (state);
+ }
+
+#region Modified state
+
+ public void SetTargetImage (
+ string data, Cairo.Format format, int width, int height, int stride)
+ {
+ Cairo.cairo_set_target_image (state, data, format, width, height, stride);
+ }
+
+#endregion
+
+ public void Rotate (double angle)
+ {
+ Cairo.cairo_rotate (state, angle);
+ }
+
+ public void Scale (double sx, double sy)
+ {
+ Cairo.cairo_scale (state, sx, sy);
+ }
+
+ public void Translate (double tx, double ty)
+ {
+ Cairo.cairo_translate (state, tx, ty);
+ }
+
+ public void TransformPoint (ref double x, ref double y)
+ {
+ Cairo.cairo_transform_point (state, ref x, ref y);
+ }
+
+ public void TransformDistance (ref double dx, ref double dy)
+ {
+ Cairo.cairo_transform_distance (state, ref dx, ref dy);
+ }
+
+ public void InverseTransformPoint (ref double x, ref double y)
+ {
+ Cairo.cairo_inverse_transform_point (state, ref x, ref y);
+ }
+
+ public void InverseTransformDistance (ref double dx, ref double dy)
+ {
+ Cairo.cairo_inverse_transform_distance (state, ref dx, ref dy);
+ }
+
+ public void ConcatMatrix (Cairo.Matrix matrix)
+ {
+ Cairo.cairo_concat_matrix (state, matrix.Pointer);
+ }
+
+ public Cairo.Matrix Matrix {
+ set {
+ Cairo.cairo_set_matrix (state, value.Pointer);
+ }
+ }
+ }
+}
--- /dev/null
+//
+// Mono.Cairo.CairoSurfaceObject.cs
+//
+// Author: Duncan Mak
+//
+// (C) Ximian Inc, 2003.
+//
+// This is an OO wrapper API for the Cairo API
+//
+
+using System;
+using System.Drawing;
+using System.Runtime.InteropServices;
+using Cairo;
+
+namespace Cairo {
+
+ public class Surface
+ {
+ IntPtr surface;
+
+ Surface (IntPtr ptr)
+ {
+ surface = ptr;
+ }
+
+ public static Cairo.Surface CreateForImage (
+ string data, Cairo.Format format, int width, int height, int stride)
+ {
+ IntPtr p = Cairo.cairo_surface_create_for_image (
+ data, format, width, height, stride);
+
+ return new Cairo.Surface (p);
+ }
+
+ public static Cairo.Surface CreateSimilar (
+ Cairo.Surface surface, Cairo.Format format, int width, int height)
+ {
+ IntPtr p = Cairo.cairo_surface_create_similar (
+ surface.Pointer, format, width, height);
+
+ return new Cairo.Surface (p);
+ }
+
+ public static Cairo.Surface CreateSimilarSolid (
+ Cairo.Surface surface, Cairo.Format format,
+ int width, int height, double red, double green, double blue, double alpha)
+ {
+ IntPtr p = Cairo.cairo_surface_create_similar_solid (
+ surface.Pointer, format, width, height, red, green, blue, alpha);
+
+ return new Cairo.Surface (p);
+ }
+
+ public void Destroy ()
+ {
+ Cairo.cairo_surface_destroy (surface);
+ }
+
+ public void PutImage (string data, int width, int height, int stride)
+ {
+ Cairo.cairo_surface_put_image (surface, data, width, height, stride);
+ }
+
+ public IntPtr Pointer {
+ get { return surface; }
+ }
+
+ public int Repeat {
+ set {
+ Cairo.cairo_surface_set_repeat (surface, value);
+ }
+ }
+
+ public Cairo.Matrix Matrix {
+ set {
+ Cairo.cairo_surface_set_matrix (surface, value.Pointer);
+ }
+
+ get {
+ IntPtr p = IntPtr.Zero;
+
+ Cairo.cairo_surface_get_matrix (surface, ref p);
+
+ return new Cairo.Matrix (p);
+ }
+ }
+
+ public Cairo.Filter Filter {
+ set {
+ Cairo.cairo_surface_set_filter (surface, value);
+ }
+ }
+ }
+}