Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/mono/mono.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMiguel de Icaza <miguel@gnome.org>2007-07-07 20:18:18 +0400
committerMiguel de Icaza <miguel@gnome.org>2007-07-07 20:18:18 +0400
commitda2d82e2c0563fc915d2b3645259ee6043a4fc82 (patch)
tree75aef7b582cd84939e5a4f30875016ab108a5d97 /mcs/class/Mono.Cairo
parentd7ff8098f720e65e7ec020e4b777f3bd4b847315 (diff)
2007-07-07 Miguel de Icaza <miguel@novell.com>
* Removed the ifdef CAIRO_1_2, the documentation already reflects that things are only available on Cairo 1.2. * Add new API calls to query Cairo for its version svn path=/trunk/mcs/; revision=81558
Diffstat (limited to 'mcs/class/Mono.Cairo')
-rw-r--r--mcs/class/Mono.Cairo/Mono.Cairo/Cairo.cs31
-rw-r--r--mcs/class/Mono.Cairo/Mono.Cairo/Context.cs4
-rw-r--r--mcs/class/Mono.Cairo/Mono.Cairo/DirectFBSurface.cs4
-rw-r--r--mcs/class/Mono.Cairo/Mono.Cairo/Extend.cs2
-rw-r--r--mcs/class/Mono.Cairo/Mono.Cairo/FontFace.cs6
-rw-r--r--mcs/class/Mono.Cairo/Mono.Cairo/FontType.cs4
-rw-r--r--mcs/class/Mono.Cairo/Mono.Cairo/Format.cs2
-rw-r--r--mcs/class/Mono.Cairo/Mono.Cairo/ImageSurface.cs2
-rw-r--r--mcs/class/Mono.Cairo/Mono.Cairo/PSSurface.cs4
-rw-r--r--mcs/class/Mono.Cairo/Mono.Cairo/Pattern.cs2
-rw-r--r--mcs/class/Mono.Cairo/Mono.Cairo/PatternType.cs3
-rw-r--r--mcs/class/Mono.Cairo/Mono.Cairo/PdfSurface.cs3
-rw-r--r--mcs/class/Mono.Cairo/Mono.Cairo/Status.cs4
-rw-r--r--mcs/class/Mono.Cairo/Mono.Cairo/Surface.cs61
-rw-r--r--mcs/class/Mono.Cairo/Mono.Cairo/SurfaceType.cs4
-rw-r--r--mcs/class/Mono.Cairo/Mono.Cairo/SvgSurface.cs3
-rw-r--r--mcs/class/Mono.Cairo/Mono.Cairo/SvgVersion.cs3
-rw-r--r--mcs/class/Mono.Cairo/Mono.Cairo/XlibSurface.cs3
18 files changed, 46 insertions, 99 deletions
diff --git a/mcs/class/Mono.Cairo/Mono.Cairo/Cairo.cs b/mcs/class/Mono.Cairo/Mono.Cairo/Cairo.cs
index 27590ce2bfb..6929db7592e 100644
--- a/mcs/class/Mono.Cairo/Mono.Cairo/Cairo.cs
+++ b/mcs/class/Mono.Cairo/Mono.Cairo/Cairo.cs
@@ -39,14 +39,24 @@ namespace Cairo
// sort these so it is easier to find what is missing
// http://www.cairographics.org/manual/ix01.html
// FIXME: this should be static and named NativeMethods
- internal sealed class CairoAPI
+ public static class CairoAPI
{
const string cairo = "libcairo-2.dll";
- private CairoAPI ()
- {
+ static public int Version {
+ get {
+ return Cairo.CairoAPI.cairo_version ();
+ }
}
-
+
+ static public string VersionString {
+ get {
+ IntPtr x = Cairo.CairoAPI.cairo_version_string ();
+ return Marshal.PtrToStringAnsi (x);
+ }
+ }
+
+#region Internal APIs
//[DllImport (cairo)]
//internal static extern void cairo_append_path (IntPtr cr, Path path);
@@ -116,10 +126,8 @@ namespace Cairo
[DllImport (cairo)]
internal static extern void cairo_font_face_destroy (IntPtr font_face);
-#if CAIRO_1_2
[DllImport (cairo)]
internal static extern FontType cairo_font_face_get_type (IntPtr font_face);
-#endif
//[DllImport (cairo)]
//internal static extern void cairo_font_face_get_user_data (IntPtr font_face);
@@ -417,10 +425,8 @@ namespace Cairo
[DllImport (cairo)]
internal static extern void cairo_pattern_get_matrix (IntPtr pattern, Matrix matrix);
-#if CAIRO_1_2
[DllImport (cairo)]
internal static extern PatternType cairo_pattern_get_type (IntPtr pattern);
-#endif
[DllImport (cairo)]
internal static extern IntPtr cairo_pattern_reference (IntPtr pattern);
@@ -520,7 +526,6 @@ namespace Cairo
[DllImport (cairo)]
internal static extern void cairo_scaled_font_extents (IntPtr scaled_font, out TextExtents extents);
-#if CAIRO_1_2
[DllImport (cairo)]
internal static extern void cairo_scaled_font_get_ctm (IntPtr scaled_font, out Matrix matrix);
@@ -535,7 +540,6 @@ namespace Cairo
[DllImport (cairo)]
internal static extern FontType cairo_scaled_font_get_type (IntPtr scaled_font);
-#endif
[DllImport (cairo)]
internal static extern void cairo_scaled_font_glyph_extents (IntPtr scaled_font, IntPtr glyphs, int num_glyphs, out TextExtents extents);
@@ -546,10 +550,8 @@ namespace Cairo
[DllImport (cairo)]
internal static extern Status cairo_scaled_font_status (IntPtr scaled_font);
-#if CAIRO_1_2
[DllImport (cairo)]
internal static extern void cairo_scaled_font_text_extents (IntPtr scaled_font, string utf8, out TextExtents extents);
-#endif
[DllImport (cairo)]
internal static extern void cairo_select_font_face (IntPtr cr, string family, FontSlant slant, FontWeight weight);
@@ -670,10 +672,8 @@ namespace Cairo
[DllImport (cairo)]
internal static extern void cairo_surface_get_font_options (IntPtr surface, IntPtr FontOptions);
-#if CAIRO_1_2
[DllImport (cairo)]
internal static extern SurfaceType cairo_surface_get_type (IntPtr surface);
-#endif
[DllImport (cairo)]
internal static extern void cairo_surface_mark_dirty (IntPtr surface);
@@ -705,10 +705,8 @@ namespace Cairo
//[DllImport (cairo)]
//internal static extern IntPtr cairo_svg_surface_create_for_stream (double width, double height);
-#if CAIRO_1_2
[DllImport (cairo)]
internal static extern IntPtr cairo_svg_surface_restrict_to_version (IntPtr surface, SvgVersion version);
-#endif
[DllImport (cairo)]
internal static extern void cairo_text_extents (IntPtr cr, string utf8, out TextExtents extents);
@@ -803,5 +801,6 @@ namespace Cairo
[DllImport (cairo)]
internal static extern void cairo_xlib_surface_set_size (IntPtr surface, int width, int height);
+#endregion
}
}
diff --git a/mcs/class/Mono.Cairo/Mono.Cairo/Context.cs b/mcs/class/Mono.Cairo/Mono.Cairo/Context.cs
index 05441abfc6c..d48ddbd6e24 100644
--- a/mcs/class/Mono.Cairo/Mono.Cairo/Context.cs
+++ b/mcs/class/Mono.Cairo/Mono.Cairo/Context.cs
@@ -399,12 +399,10 @@ namespace Cairo {
CairoAPI.cairo_new_path (state);
}
-#if CAIRO_1_2
public void NewSubPath ()
{
CairoAPI.cairo_new_sub_path (state);
}
-#endif
public void MoveTo (PointD p)
{
@@ -579,7 +577,6 @@ namespace Cairo {
return CairoAPI.cairo_in_fill (state, x, y);
}
-#if CAIRO_1_2
public Pattern PopGroup ()
{
IntPtr pattern = CairoAPI.cairo_pop_group (state);
@@ -619,7 +616,6 @@ namespace Cairo {
return Surface.LookupSurface (surface);
}
}
-#endif
public void Rotate (double angle)
{
diff --git a/mcs/class/Mono.Cairo/Mono.Cairo/DirectFBSurface.cs b/mcs/class/Mono.Cairo/Mono.Cairo/DirectFBSurface.cs
index 06f017332f2..ce3756945cf 100644
--- a/mcs/class/Mono.Cairo/Mono.Cairo/DirectFBSurface.cs
+++ b/mcs/class/Mono.Cairo/Mono.Cairo/DirectFBSurface.cs
@@ -26,8 +26,6 @@
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
//
-#if CAIRO_1_2
-
using System;
namespace Cairo {
@@ -46,5 +44,3 @@ namespace Cairo {
}
}
}
-
-#endif
diff --git a/mcs/class/Mono.Cairo/Mono.Cairo/Extend.cs b/mcs/class/Mono.Cairo/Mono.Cairo/Extend.cs
index ae49a5e035b..0ffee3fbfa1 100644
--- a/mcs/class/Mono.Cairo/Mono.Cairo/Extend.cs
+++ b/mcs/class/Mono.Cairo/Mono.Cairo/Extend.cs
@@ -40,8 +40,6 @@ namespace Cairo
None,
Repeat,
Reflect,
-#if CAIRO_1_2
Pad,
-#endif
}
}
diff --git a/mcs/class/Mono.Cairo/Mono.Cairo/FontFace.cs b/mcs/class/Mono.Cairo/Mono.Cairo/FontFace.cs
index 795dee9619a..585f6be42dd 100644
--- a/mcs/class/Mono.Cairo/Mono.Cairo/FontFace.cs
+++ b/mcs/class/Mono.Cairo/Mono.Cairo/FontFace.cs
@@ -15,11 +15,11 @@ namespace Cairo
get { return handle; }
}
-#if CAIRO_1_2
public FontType FontType {
- get { return CairoAPI.cairo_font_face_get_type (handle); }
+ get {
+ return CairoAPI.cairo_font_face_get_type (handle);
+ }
}
-#endif
}
}
diff --git a/mcs/class/Mono.Cairo/Mono.Cairo/FontType.cs b/mcs/class/Mono.Cairo/Mono.Cairo/FontType.cs
index 9aa7f4b8181..0c71fcb2c3b 100644
--- a/mcs/class/Mono.Cairo/Mono.Cairo/FontType.cs
+++ b/mcs/class/Mono.Cairo/Mono.Cairo/FontType.cs
@@ -26,8 +26,6 @@
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
//
-#if CAIRO_1_2
-
using System;
namespace Cairo {
@@ -41,5 +39,3 @@ namespace Cairo {
Atsui,
}
}
-
-#endif
diff --git a/mcs/class/Mono.Cairo/Mono.Cairo/Format.cs b/mcs/class/Mono.Cairo/Mono.Cairo/Format.cs
index 0027253c219..f0bded3c538 100644
--- a/mcs/class/Mono.Cairo/Mono.Cairo/Format.cs
+++ b/mcs/class/Mono.Cairo/Mono.Cairo/Format.cs
@@ -38,9 +38,7 @@ namespace Cairo
Rgb24 = 1,
A8 = 2,
A1 = 3,
-#if CAIRO_1_2
Rgb16565 = 4,
-#endif
//[Obsolete ("Use Argb32")]
ARGB32 = Argb32,
diff --git a/mcs/class/Mono.Cairo/Mono.Cairo/ImageSurface.cs b/mcs/class/Mono.Cairo/Mono.Cairo/ImageSurface.cs
index 0fe99a60089..cc33d86d0ee 100644
--- a/mcs/class/Mono.Cairo/Mono.Cairo/ImageSurface.cs
+++ b/mcs/class/Mono.Cairo/Mono.Cairo/ImageSurface.cs
@@ -75,7 +75,6 @@ namespace Cairo {
get { return CairoAPI.cairo_image_surface_get_height (surface); }
}
-#if CAIRO_1_2
public byte[] Data {
get {
IntPtr ptr = CairoAPI.cairo_image_surface_get_data (surface);
@@ -93,6 +92,5 @@ namespace Cairo {
public int Stride {
get { return CairoAPI.cairo_image_surface_get_stride (surface); }
}
-#endif
}
}
diff --git a/mcs/class/Mono.Cairo/Mono.Cairo/PSSurface.cs b/mcs/class/Mono.Cairo/Mono.Cairo/PSSurface.cs
index 348e4fec3ff..156fe087f8e 100644
--- a/mcs/class/Mono.Cairo/Mono.Cairo/PSSurface.cs
+++ b/mcs/class/Mono.Cairo/Mono.Cairo/PSSurface.cs
@@ -26,8 +26,6 @@
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
//
-#if CAIRO_1_2
-
using System;
namespace Cairo {
@@ -67,5 +65,3 @@ namespace Cairo {
}
}
}
-
-#endif
diff --git a/mcs/class/Mono.Cairo/Mono.Cairo/Pattern.cs b/mcs/class/Mono.Cairo/Mono.Cairo/Pattern.cs
index 7d46fe5f925..96f6b12c7e4 100644
--- a/mcs/class/Mono.Cairo/Mono.Cairo/Pattern.cs
+++ b/mcs/class/Mono.Cairo/Mono.Cairo/Pattern.cs
@@ -81,11 +81,9 @@ namespace Cairo {
get { return pattern; }
}
-#if CAIRO_1_2
public PatternType PatternType {
get { return CairoAPI.cairo_pattern_get_type (pattern); }
}
-#endif
}
}
diff --git a/mcs/class/Mono.Cairo/Mono.Cairo/PatternType.cs b/mcs/class/Mono.Cairo/Mono.Cairo/PatternType.cs
index 4aa69f4c3ea..002469ffd68 100644
--- a/mcs/class/Mono.Cairo/Mono.Cairo/PatternType.cs
+++ b/mcs/class/Mono.Cairo/Mono.Cairo/PatternType.cs
@@ -26,8 +26,6 @@
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
//
-#if CAIRO_1_2
-
using System;
namespace Cairo {
@@ -42,4 +40,3 @@ namespace Cairo {
}
}
-#endif
diff --git a/mcs/class/Mono.Cairo/Mono.Cairo/PdfSurface.cs b/mcs/class/Mono.Cairo/Mono.Cairo/PdfSurface.cs
index ca307f50e3e..0e5fdf88cab 100644
--- a/mcs/class/Mono.Cairo/Mono.Cairo/PdfSurface.cs
+++ b/mcs/class/Mono.Cairo/Mono.Cairo/PdfSurface.cs
@@ -26,8 +26,6 @@
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
//
-#if CAIRO_1_2
-
using System;
namespace Cairo {
@@ -53,4 +51,3 @@ namespace Cairo {
}
}
-#endif
diff --git a/mcs/class/Mono.Cairo/Mono.Cairo/Status.cs b/mcs/class/Mono.Cairo/Mono.Cairo/Status.cs
index 2f65be9ace6..6e5fbe01560 100644
--- a/mcs/class/Mono.Cairo/Mono.Cairo/Status.cs
+++ b/mcs/class/Mono.Cairo/Mono.Cairo/Status.cs
@@ -57,12 +57,8 @@ namespace Cairo
InvalidVisual,
FileNotFound,
InvalidDash,
-#if CAIRO_1_2
InvalidDscComment,
-#endif
-#if CAIRO_1_4
InvalidIndex,
ClipNotRepresentable,
-#endif
}
}
diff --git a/mcs/class/Mono.Cairo/Mono.Cairo/Surface.cs b/mcs/class/Mono.Cairo/Mono.Cairo/Surface.cs
index 72e64cdfb44..e6d02cfe9f0 100644
--- a/mcs/class/Mono.Cairo/Mono.Cairo/Surface.cs
+++ b/mcs/class/Mono.Cairo/Mono.Cairo/Surface.cs
@@ -68,37 +68,35 @@ namespace Cairo {
}
}
-#if CAIRO_1_2
static internal Surface LookupSurface (IntPtr surface)
{
- SurfaceType st = CairoAPI.cairo_surface_get_type (surface);
- switch (st) {
- case SurfaceType.Image:
- return new ImageSurface (surface, true);
- case SurfaceType.XLib:
- return new XlibSurface (surface, true);
- case SurfaceType.Xcb:
- return new XcbSurface (surface, true);
- case SurfaceType.Glitz:
- return new GlitzSurface (surface, true);
- case SurfaceType.Win32:
- return new Win32Surface (surface, true);
-//#if CAIRO_1_2
- case SurfaceType.Pdf:
- return new PdfSurface (surface, true);
- case SurfaceType.PS:
- return new PSSurface (surface, true);
- case SurfaceType.DirectFB:
- return new DirectFBSurface (surface, true);
- case SurfaceType.Svg:
- return new SvgSurface (surface, true);
-//#endif
- default:
- return Surface.LookupExternalSurface (surface);
- }
+ SurfaceType st = CairoAPI.cairo_surface_get_type (surface);
+ switch (st) {
+ case SurfaceType.Image:
+ return new ImageSurface (surface, true);
+ case SurfaceType.XLib:
+ return new XlibSurface (surface, true);
+ case SurfaceType.Xcb:
+ return new XcbSurface (surface, true);
+ case SurfaceType.Glitz:
+ return new GlitzSurface (surface, true);
+ case SurfaceType.Win32:
+ return new Win32Surface (surface, true);
+
+ case SurfaceType.Pdf:
+ return new PdfSurface (surface, true);
+ case SurfaceType.PS:
+ return new PSSurface (surface, true);
+ case SurfaceType.DirectFB:
+ return new DirectFBSurface (surface, true);
+ case SurfaceType.Svg:
+ return new SvgSurface (surface, true);
+
+ default:
+ return Surface.LookupExternalSurface (surface);
+ }
}
-#endif
-
+
[Obsolete ("Use an ImageSurface constructor instead.")]
public static Cairo.Surface CreateForImage (
ref byte[] data, Cairo.Format format, int width, int height, int stride)
@@ -187,13 +185,12 @@ namespace Cairo {
}
public PointD DeviceOffset {
-#if CAIRO_1_2
get {
double x, y;
CairoAPI.cairo_surface_get_device_offset (surface, out x, out y);
return new PointD (x, y);
}
-#endif
+
set {
CairoAPI.cairo_surface_set_device_offset (surface, value.X, value.Y);
}
@@ -204,12 +201,10 @@ namespace Cairo {
Dispose (true);
}
-#if CAIRO_1_2
public void SetFallbackResolution (double x, double y)
{
CairoAPI.cairo_surface_set_fallback_resolution (surface, x, y);
}
-#endif
public void WriteToPng (string filename)
{
@@ -227,7 +222,6 @@ namespace Cairo {
get { return CairoAPI.cairo_surface_status (surface); }
}
-#if CAIRO_1_2
public Content Content {
get { return CairoAPI.cairo_surface_get_content (surface); }
}
@@ -235,6 +229,5 @@ namespace Cairo {
public SurfaceType SurfaceType {
get { return CairoAPI.cairo_surface_get_type (surface); }
}
-#endif
}
}
diff --git a/mcs/class/Mono.Cairo/Mono.Cairo/SurfaceType.cs b/mcs/class/Mono.Cairo/Mono.Cairo/SurfaceType.cs
index 3c13a3dfa14..f33c9beb0e5 100644
--- a/mcs/class/Mono.Cairo/Mono.Cairo/SurfaceType.cs
+++ b/mcs/class/Mono.Cairo/Mono.Cairo/SurfaceType.cs
@@ -26,8 +26,6 @@
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
//
-#if CAIRO_1_2
-
using System;
namespace Cairo {
@@ -48,5 +46,3 @@ namespace Cairo {
Svg,
}
}
-
-#endif
diff --git a/mcs/class/Mono.Cairo/Mono.Cairo/SvgSurface.cs b/mcs/class/Mono.Cairo/Mono.Cairo/SvgSurface.cs
index ea926347973..8fc6752b6ca 100644
--- a/mcs/class/Mono.Cairo/Mono.Cairo/SvgSurface.cs
+++ b/mcs/class/Mono.Cairo/Mono.Cairo/SvgSurface.cs
@@ -26,8 +26,6 @@
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
//
-#if CAIRO_1_2
-
using System;
namespace Cairo {
@@ -53,4 +51,3 @@ namespace Cairo {
}
}
-#endif
diff --git a/mcs/class/Mono.Cairo/Mono.Cairo/SvgVersion.cs b/mcs/class/Mono.Cairo/Mono.Cairo/SvgVersion.cs
index f44b20acc23..99cee28962c 100644
--- a/mcs/class/Mono.Cairo/Mono.Cairo/SvgVersion.cs
+++ b/mcs/class/Mono.Cairo/Mono.Cairo/SvgVersion.cs
@@ -26,8 +26,6 @@
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
//
-#if CAIRO_1_2
-
using System;
namespace Cairo {
@@ -41,4 +39,3 @@ namespace Cairo {
}
}
-#endif
diff --git a/mcs/class/Mono.Cairo/Mono.Cairo/XlibSurface.cs b/mcs/class/Mono.Cairo/Mono.Cairo/XlibSurface.cs
index 021da355665..14ef13c54d3 100644
--- a/mcs/class/Mono.Cairo/Mono.Cairo/XlibSurface.cs
+++ b/mcs/class/Mono.Cairo/Mono.Cairo/XlibSurface.cs
@@ -68,7 +68,6 @@ namespace Cairo {
CairoAPI.cairo_xlib_surface_set_size (surface, width, height);
}
-#if CAIRO_1_2
public int Depth {
get { return CairoAPI.cairo_xlib_surface_get_depth (surface); }
}
@@ -96,6 +95,6 @@ namespace Cairo {
public int Width {
get { return CairoAPI.cairo_xlib_surface_get_width (surface); }
}
-#endif
+
}
}