diff options
Diffstat (limited to 'src')
43 files changed, 308 insertions, 204 deletions
diff --git a/src/BmpPicture.cs b/src/BmpPicture.cs index e3af9c79..a549f339 100644 --- a/src/BmpPicture.cs +++ b/src/BmpPicture.cs @@ -26,7 +26,7 @@ using System; using System.IO; -using Cairo; +using vkvg; namespace Crow { @@ -110,14 +110,13 @@ namespace Crow widthRatio = heightRatio; } - using (ImageSurface tmp = new ImageSurface (Format.Argb32, bounds.Width, bounds.Height)) { + using (Surface tmp = new Surface (CrowApplication.dev, bounds.Width, bounds.Height)) { using (Context gr = new Context (tmp)) { gr.Translate (bounds.Left, bounds.Top); gr.Scale (widthRatio, heightRatio); gr.Translate ((bounds.Width/widthRatio - Dimensions.Width)/2, (bounds.Height/heightRatio - Dimensions.Height)/2); - using (ImageSurface imgSurf = new ImageSurface (image, Format.Argb32, - Dimensions.Width, Dimensions.Height, 4 * Dimensions.Width)) { + using (Surface imgSurf = new Surface (CrowApplication.dev, ref image, Dimensions.Width, Dimensions.Height)) { gr.SetSourceSurface (imgSurf, 0,0); gr.Paint (); } @@ -157,8 +156,7 @@ namespace Crow gr.Scale (widthRatio, heightRatio); gr.Translate ((rect.Width/widthRatio - Dimensions.Width)/2, (rect.Height/heightRatio - Dimensions.Height)/2); - using (ImageSurface imgSurf = new ImageSurface (image, Format.Argb32, - Dimensions.Width, Dimensions.Height, 4 * Dimensions.Width)) { + using (Surface imgSurf = new Surface (CrowApplication.dev, ref image, Dimensions.Width, Dimensions.Height)) { gr.SetSourceSurface (imgSurf, 0,0); gr.Paint (); } diff --git a/src/Cairo/CairoHelpers.cs b/src/Cairo/CairoHelpers.cs index 44060259..2290e319 100644 --- a/src/Cairo/CairoHelpers.cs +++ b/src/Cairo/CairoHelpers.cs @@ -28,6 +28,7 @@ using System; using System.Collections.Generic; using System.Linq; using System.Text; +using vkvg; namespace Crow { @@ -57,18 +58,18 @@ namespace Crow return arr[minp]; } - public static void CairoRectangle(Cairo.Context gr, Rectangle r, double radius, double stroke = 0.0) + public static void CairoRectangle(Context gr, Rectangle r, double radius, double stroke = 0.0) { if (radius > 0) CairoHelpers.DrawRoundedRectangle (gr, r, radius, stroke); else gr.Rectangle (r, stroke); } - public static void CairoCircle(Cairo.Context gr, Rectangle r) + public static void CairoCircle(Context gr, Rectangle r) { gr.Arc(r.X + r.Width/2, r.Y + r.Height/2, Math.Min(r.Width,r.Height)/2, 0, 2*Math.PI); } - public static void DrawRoundedRectangle(Cairo.Context gr, Rectangle r, double radius, double stroke = 0.0) + public static void DrawRoundedRectangle(Context gr, Rectangle r, double radius, double stroke = 0.0) { if (stroke>0.0) { gr.LineWidth = stroke; @@ -78,7 +79,7 @@ namespace Crow }else DrawRoundedRectangle(gr, r.X, r.Y, r.Width, r.Height, radius); } - public static void DrawRoundedRectangle(Cairo.Context gr, double x, double y, double width, double height, double radius) + public static void DrawRoundedRectangle(Context gr, double x, double y, double width, double height, double radius) { gr.Save(); @@ -96,7 +97,7 @@ namespace Crow gr.ClosePath(); gr.Restore(); } - public static void StrokeRaisedRectangle(Cairo.Context gr, Rectangle r, double width = 1) + public static void StrokeRaisedRectangle(Context gr, Rectangle r, double width = 1) { gr.Save(); r.Inflate((int)-width / 2, (int)-width / 2); @@ -115,7 +116,7 @@ namespace Crow gr.Restore(); } - public static void StrokeLoweredRectangle(Cairo.Context gr, Rectangle r, double width = 1) + public static void StrokeLoweredRectangle(Context gr, Rectangle r, double width = 1) { gr.Save(); r.Inflate((int)-width / 2, (int)-width / 2); diff --git a/src/CrowApplication.cs b/src/CrowApplication.cs new file mode 100644 index 00000000..3f7f8ade --- /dev/null +++ b/src/CrowApplication.cs @@ -0,0 +1,101 @@ +// +// CrowApplication.cs +// +// Author: +// Jean-Philippe Bruyère <jp_bruyere@hotmail.com> +// +// Copyright (c) 2013-2017 Jean-Philippe Bruyère +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to deal +// in the Software without restriction, including without limitation the rights +// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +// copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +// THE SOFTWARE. +using System; +using System.Threading; +using vkglfw; + +namespace Crow +{ + public class CrowApplication : IDisposable + { + public static VkEngine vke; + public static vkvg.Device dev; + + Interface iFace; + vkvg.Surface surf; + + public CrowApplication (int width, int height) + { + vke = new VkEngine (width, height); + dev = new vkvg.Device (vke); + surf = new vkvg.Surface (dev, width, height); + + using (vkvg.Context ctx = new vkvg.Context (surf)) { + ctx.SetSource (0.1, 0.1, 0.1); + ctx.Paint (); + } + + + iFace = new Interface (surf); + iFace.Init (); + + Thread t = new Thread (interfaceThread); + t.IsBackground = true; + t.Start (); + } + ~CrowApplication () + { + Dispose (false); + } + + public void Run () { + vke.Run (surf); + } + public GraphicObject Load (string path){ + return iFace.AddWidget (path); + } + void interfaceThread() + { + while (iFace.ClientRectangle.Size.Width == 0) + Thread.Sleep (5); + + while (true) { + iFace.Update (); + Thread.Sleep (2); + } + } + + #region IDisposable implementation + public void Dispose () + { + Dispose (true); + GC.SuppressFinalize (this); + } + + protected virtual void Dispose (bool disposing) + { + if (!disposing) + return; + + surf.Dispose (); + dev.Dispose (); + vke.Dispose (); + } + #endregion + + } +} + diff --git a/src/ExtensionsMethods.cs b/src/ExtensionsMethods.cs index 340a8ceb..3d9716f8 100644 --- a/src/ExtensionsMethods.cs +++ b/src/ExtensionsMethods.cs @@ -26,6 +26,7 @@ using System; using System.Linq.Expressions; +using vkvg; namespace Crow { @@ -33,7 +34,7 @@ namespace Crow { #region Cairo extensions - public static void Rectangle(this Cairo.Context ctx, Rectangle r, double stroke = 0.0) + public static void Rectangle(this Context ctx, Rectangle r, double stroke = 0.0) { if (stroke > 0.0) { ctx.LineWidth = stroke; @@ -43,41 +44,41 @@ namespace Crow }else ctx.Rectangle (r.X, r.Y, r.Width, r.Height); } - public static double GetLength(this Cairo.PointD p){ + public static double GetLength(this PointD p){ return Math.Sqrt (Math.Pow (p.X, 2) + Math.Pow (p.Y, 2)); } - public static Cairo.PointD GetPerp(this Cairo.PointD p){ - return new Cairo.PointD(-p.Y, p.X); + public static PointD GetPerp(this PointD p){ + return new PointD(-p.Y, p.X); } - public static Cairo.PointD GetNormalized(this Cairo.PointD p){ + public static PointD GetNormalized(this PointD p){ double length = p.GetLength(); p.X /= length; p.Y /= length; return p; } - public static Cairo.PointD Substract(this Cairo.PointD p1, Cairo.PointD p2){ - return new Cairo.PointD(p1.X - p2.X, p1.Y - p2.Y); + public static PointD Substract(this PointD p1, PointD p2){ + return new PointD(p1.X - p2.X, p1.Y - p2.Y); } - public static Cairo.PointD Divide(this Cairo.PointD p1, double d){ - return new Cairo.PointD(p1.X / d, p1.Y / d); + public static PointD Divide(this PointD p1, double d){ + return new PointD(p1.X / d, p1.Y / d); } - public static Cairo.PointD Add(this Cairo.PointD p1, Cairo.PointD p2){ - return new Cairo.PointD(p1.X + p2.X, p1.Y + p2.Y); + public static PointD Add(this PointD p1, PointD p2){ + return new PointD(p1.X + p2.X, p1.Y + p2.Y); } - public static Cairo.PointD Multiply(this Cairo.PointD p1, double v){ - return new Cairo.PointD(p1.X * v, p1.Y * v); + public static PointD Multiply(this PointD p1, double v){ + return new PointD(p1.X * v, p1.Y * v); } - public static void DrawCote(this Cairo.Context ctx, Cairo.PointD p1, Cairo.PointD p2, + public static void DrawCote(this Context ctx, PointD p1, PointD p2, double stroke = 1.0, bool fill = false, double arrowWidth = 3.0, double arrowLength = 7.0) { - Cairo.PointD vDir = p2.Substract(p1); + PointD vDir = p2.Substract(p1); vDir = vDir.GetNormalized (); - Cairo.PointD vPerp = vDir.GetPerp (); + PointD vPerp = vDir.GetPerp (); - Cairo.PointD pA0 = p1.Add(vDir.Multiply(arrowLength)); - Cairo.PointD pA1 = p2.Substract(vDir.Multiply(arrowLength)); + PointD pA0 = p1.Add(vDir.Multiply(arrowLength)); + PointD pA1 = p2.Substract(vDir.Multiply(arrowLength)); - Cairo.PointD vA = vPerp.Multiply (arrowWidth); + PointD vA = vPerp.Multiply (arrowWidth); ctx.MoveTo (p1); ctx.LineTo (pA0.Add (vA)); @@ -104,17 +105,17 @@ namespace Crow ctx.LineWidth = stroke; ctx.Stroke (); } - public static void DrawCoteInverse(this Cairo.Context ctx, Cairo.PointD p1, Cairo.PointD p2, + public static void DrawCoteInverse(this Context ctx, PointD p1, PointD p2, double stroke = 1.0, bool fill = false, double arrowWidth = 3.0, double arrowLength = 7.0) { - Cairo.PointD vDir = p2.Substract(p1); + PointD vDir = p2.Substract(p1); vDir = vDir.GetNormalized (); - Cairo.PointD vPerp = vDir.GetPerp (); + PointD vPerp = vDir.GetPerp (); - Cairo.PointD pA0 = p1.Add(vDir.Multiply(arrowLength)); - Cairo.PointD pA1 = p2.Substract(vDir.Multiply(arrowLength)); + PointD pA0 = p1.Add(vDir.Multiply(arrowLength)); + PointD pA1 = p2.Substract(vDir.Multiply(arrowLength)); - Cairo.PointD vA = vPerp.Multiply (arrowWidth); + PointD vA = vPerp.Multiply (arrowWidth); ctx.MoveTo (p1.Add (vA)); ctx.LineTo (pA0); @@ -136,13 +137,13 @@ namespace Crow ctx.LineWidth = stroke; ctx.Stroke (); } - public static void DrawCoteFixed(this Cairo.Context ctx, Cairo.PointD p1, Cairo.PointD p2, + public static void DrawCoteFixed(this Context ctx, PointD p1, PointD p2, double stroke = 1.0, double coteWidth = 3.0) { - Cairo.PointD vDir = p2.Substract(p1); + PointD vDir = p2.Substract(p1); vDir = vDir.GetNormalized (); - Cairo.PointD vPerp = vDir.GetPerp (); - Cairo.PointD vA = vPerp.Multiply (coteWidth); + PointD vPerp = vDir.GetPerp (); + PointD vA = vPerp.Multiply (coteWidth); ctx.MoveTo (p1.Add (vA)); ctx.LineTo (p1.Substract (vA)); @@ -153,9 +154,9 @@ namespace Crow ctx.LineWidth = stroke; ctx.Stroke (); } - public static void SetSourceColor(this Cairo.Context ctx, Color c) + public static void SetSourceColor(this Context ctx, Color c) { - ctx.SetSourceRGBA(c.R,c.G,c.B,c.A); + ctx.SetSource (c.R,c.G,c.B,c.A); } public static void AddColorStop(this Cairo.Gradient grad, double offset, Color c) { diff --git a/src/Fill/Fill.cs b/src/Fill/Fill.cs index d98e47cf..5e36832b 100644 --- a/src/Fill/Fill.cs +++ b/src/Fill/Fill.cs @@ -26,7 +26,7 @@ using System; using System.Collections.Generic; -using Cairo; +using vkvg; namespace Crow { diff --git a/src/Font.cs b/src/Font.cs index bab2c853..e6782026 100644 --- a/src/Font.cs +++ b/src/Font.cs @@ -25,7 +25,7 @@ // THE SOFTWARE. using System; -using Cairo; +using vkvg; namespace Crow { diff --git a/src/Gradient.cs b/src/Gradient.cs index 0806e885..cc695795 100644 --- a/src/Gradient.cs +++ b/src/Gradient.cs @@ -26,7 +26,7 @@ using System; using System.Collections.Generic; -using Cairo; +using vkvg; namespace Crow { @@ -99,7 +99,7 @@ namespace Crow foreach (ColorStop cs in Stops) grad.AddColorStop (cs.Offset, cs.Color); - ctx.SetSource (grad); + //ctx.SetSource (grad); grad.Dispose (); } #endregion diff --git a/src/GraphicObjects/Border.cs b/src/GraphicObjects/Border.cs index adeb32e7..2c11d1db 100644 --- a/src/GraphicObjects/Border.cs +++ b/src/GraphicObjects/Border.cs @@ -28,7 +28,7 @@ using System; using System.Xml.Serialization; using System.ComponentModel; using System.Diagnostics; -using Cairo; +using vkvg; namespace Crow { diff --git a/src/GraphicObjects/Button.cs b/src/GraphicObjects/Button.cs index 8b60dcb9..43d03a02 100644 --- a/src/GraphicObjects/Button.cs +++ b/src/GraphicObjects/Button.cs @@ -33,7 +33,7 @@ using System.Text; using System.Diagnostics; using System.Xml.Serialization; -using Cairo; +using vkvg; using System.ComponentModel; namespace Crow diff --git a/src/GraphicObjects/DockStack.cs b/src/GraphicObjects/DockStack.cs index ae8b9c89..7cb4fe2a 100644 --- a/src/GraphicObjects/DockStack.cs +++ b/src/GraphicObjects/DockStack.cs @@ -25,6 +25,7 @@ // THE SOFTWARE. using System; using Crow.IML; +using vkvg; namespace Crow { @@ -82,7 +83,7 @@ namespace Crow // } Rectangle rIn = default(Rectangle); - double dockThresh = 0.2; + double dockThresh = 0.2f; GraphicObject focusedChild; internal GraphicObject stretchedChild; @@ -178,7 +179,7 @@ namespace Crow RegisterForGraphicUpdate (); } - protected override void onDraw (Cairo.Context gr) + protected override void onDraw (Context gr) { gr.Save (); @@ -237,9 +238,9 @@ namespace Crow break; } gr.LineWidth = 1; - gr.SetSourceRGBA (0.4, 0.4, 0.9, 0.4); + gr.SetSource (0.4, 0.4, 0.9, 0.4); gr.FillPreserve (); - gr.SetSourceRGBA (0.9, 0.9, 1.0, 0.8); + gr.SetSource (0.9, 0.9, 1.0, 0.8); gr.Stroke (); } gr.Restore (); diff --git a/src/GraphicObjects/GraduatedSlider.cs b/src/GraphicObjects/GraduatedSlider.cs index e1d4dd46..932378ba 100644 --- a/src/GraphicObjects/GraduatedSlider.cs +++ b/src/GraphicObjects/GraduatedSlider.cs @@ -28,7 +28,7 @@ using System; using System.Collections.Generic; using System.Linq; using System.Text; -using Cairo; +using vkvg; using System.Xml.Serialization; namespace Crow diff --git a/src/GraphicObjects/GraphicObject.cs b/src/GraphicObjects/GraphicObject.cs index bc955368..07954a63 100644 --- a/src/GraphicObjects/GraphicObject.cs +++ b/src/GraphicObjects/GraphicObject.cs @@ -31,7 +31,7 @@ using System.Xml.Serialization; using System.Reflection; using System.Reflection.Emit; using System.Runtime.CompilerServices; -using Cairo; +using vkvg; using System.Diagnostics; using Crow.IML; using System.Threading; @@ -127,10 +127,10 @@ namespace Crow parentElem.AppendChild (xe); } public Surface CreateIcon (int dragIconSize = 32) { - ImageSurface di = new ImageSurface (Format.Argb32, dragIconSize, dragIconSize); + Surface di = new Surface (CrowApplication.dev, dragIconSize, dragIconSize); using (Context ctx = new Context (di)) { - double div = Math.Max (LastPaintedSlot.Width, LastPaintedSlot.Height); - double s = (double)dragIconSize / div; + float div = Math.Max (LastPaintedSlot.Width, LastPaintedSlot.Height); + float s = (float)dragIconSize / div; ctx.Scale (s, s); if (bmp == null) this.onDraw (ctx); @@ -206,7 +206,7 @@ namespace Crow /// are repeated at each cached levels of the tree with correspondig coordinate system. This is done /// in a dedicated step of the update between layouting and drawing. /// </summary> - public Region Clipping; + public Cairo.Region Clipping; #region IValueChange implementation /// <summary> @@ -233,7 +233,7 @@ namespace Crow /// action. /// </summary> protected GraphicObject () { - Clipping = new Region (); + Clipping = new Cairo.Region(); #if DEBUG uid = currentUid; currentUid++; @@ -1628,9 +1628,9 @@ namespace Crow IsDirty = false; if (bmp != null) bmp.Dispose (); - bmp = new ImageSurface (Format.Argb32, Slot.Width, Slot.Height); + bmp = new Surface (CrowApplication.dev, Slot.Width, Slot.Height); using (Context gr = new Context (bmp)) { - gr.Antialias = Interface.Antialias; + //gr.Antialias = Interface.Antialias; onDraw (gr); } bmp.Flush (); @@ -1650,7 +1650,7 @@ namespace Crow ctx.SetSourceSurface (bmp, rb.X, rb.Y); ctx.Paint (); Clipping.Dispose (); - Clipping = new Region (); + Clipping = new Cairo.Region(); } /// <summary> Chained painting routine on the parent context of the actual cached version /// of the widget </summary> @@ -1692,7 +1692,7 @@ namespace Crow } void paintDisabled(Context gr, Rectangle rb){ gr.Operator = Operator.Xor; - gr.SetSourceRGBA (0.6, 0.6, 0.6, 0.3); + gr.SetSource (0.6, 0.6, 0.6, 0.3); gr.Rectangle (rb); gr.Fill (); gr.Operator = Operator.Over; diff --git a/src/GraphicObjects/Group.cs b/src/GraphicObjects/Group.cs index a90947a5..2d64fde1 100644 --- a/src/GraphicObjects/Group.cs +++ b/src/GraphicObjects/Group.cs @@ -28,7 +28,7 @@ using System; using System.Collections.Generic; using System.ComponentModel; using System.Xml.Serialization; -using Cairo; +using vkvg; using System.Diagnostics; using System.Reflection; using System.Threading; @@ -332,7 +332,7 @@ namespace Crow foreach (GraphicObject c in Children) { if (!c.Visible) continue; - if (Clipping.Contains (c.Slot + ClientRectangle.Position) == RegionOverlap.Out) + if (Clipping.Contains (c.Slot + ClientRectangle.Position) == Cairo.RegionOverlap.Out) continue; c.Paint (ref gr); } @@ -349,7 +349,7 @@ namespace Crow ctx.Paint (); Clipping.Dispose(); - Clipping = new Region (); + Clipping = new Cairo.Region(); } #endregion diff --git a/src/GraphicObjects/HueSelector.cs b/src/GraphicObjects/HueSelector.cs index 67f4ec6e..ad33243d 100644 --- a/src/GraphicObjects/HueSelector.cs +++ b/src/GraphicObjects/HueSelector.cs @@ -27,7 +27,7 @@ using System; using System.Xml.Serialization; using System.ComponentModel; -using Cairo; +using vkvg; namespace Crow { diff --git a/src/GraphicObjects/Image.cs b/src/GraphicObjects/Image.cs index e83183c0..dd383fc8 100644 --- a/src/GraphicObjects/Image.cs +++ b/src/GraphicObjects/Image.cs @@ -25,7 +25,7 @@ // THE SOFTWARE. using System; -using Cairo; +using vkvg; using System.Xml.Serialization; using System.ComponentModel; using System.Diagnostics; @@ -43,7 +43,7 @@ namespace Crow Picture _pic; string _svgSub; bool scaled, keepProps; - double opacity; + float opacity; #region Public properties /// <summary> @@ -138,7 +138,7 @@ namespace Crow /// </summary> // TODO:could be moved in GraphicObject [XmlAttributeAttribute()][DefaultValue(1.0)] - public virtual double Opacity { + public virtual float Opacity { get { return opacity; } set { if (opacity == value) @@ -203,7 +203,7 @@ namespace Crow _pic.Paint (gr, ClientRectangle, _svgSub); if (Opacity<1.0) { - gr.SetSourceRGBA (0.0, 0.0, 0.0, 1.0-Opacity); + gr.SetSource (0, 0, 0, 1-Opacity); gr.Operator = Operator.DestOut; gr.Rectangle (ClientRectangle); gr.Fill (); diff --git a/src/GraphicObjects/Label.cs b/src/GraphicObjects/Label.cs index 0e0d9fe1..da332d02 100644 --- a/src/GraphicObjects/Label.cs +++ b/src/GraphicObjects/Label.cs @@ -28,7 +28,7 @@ using System; using System.Collections.Generic; using System.Linq; using System.Diagnostics; -using Cairo; +using vkvg; using System.Text.RegularExpressions; using System.Xml.Serialization; using System.ComponentModel; @@ -447,14 +447,17 @@ namespace Crow if (lines == null) lines = getLines; if (!textMeasureIsUpToDate) { - using (ImageSurface img = new ImageSurface (Format.Argb32, 10, 10)) { - using (Context gr = new Context (img)) { + //using (Surface img = new Surface (CrowApplication.dev, 10, 10)) { + if (bmp == null) + bmp = new Surface (CrowApplication.dev, 10, 10); + using (Context gr = new Context (bmp)) { //Cairo.FontFace cf = gr.GetContextFontFace (); - gr.SelectFontFace (Font.Name, Font.Slant, Font.Wheight); - gr.SetFontSize (Font.Size); - gr.FontOptions = Interface.FontRenderingOptions; - gr.Antialias = Interface.Antialias; + gr.FontFace = Font.Name; +// gr.SelectFontFace (Font.Name, Font.Slant, Font.Wheight); +// gr.SetFontSize (Font.Size); +// gr.FontOptions = Interface.FontRenderingOptions; +// gr.Antialias = Interface.Antialias; fe = gr.FontExtents; te = new TextExtents (); @@ -476,7 +479,7 @@ namespace Crow return -1; } } - } + //} } return lt == LayoutingType.Height ? cachedTextSize.Height : cachedTextSize.Width; @@ -485,10 +488,11 @@ namespace Crow { base.onDraw (gr); - gr.SelectFontFace (Font.Name, Font.Slant, Font.Wheight); - gr.SetFontSize (Font.Size); - gr.FontOptions = Interface.FontRenderingOptions; - gr.Antialias = Interface.Antialias; + gr.FontFace = Font.Name; +// gr.SelectFontFace (Font.Name, Font.Slant, Font.Wheight); +// gr.SetFontSize (Font.Size); +// gr.FontOptions = Interface.FontRenderingOptions; +// gr.Antialias = Interface.Antialias; rText = new Rectangle(new Size( measureRawSize(LayoutingType.Width), measureRawSize(LayoutingType.Height))); diff --git a/src/GraphicObjects/PrivateContainer.cs b/src/GraphicObjects/PrivateContainer.cs index d6637247..45aae6c1 100644 --- a/src/GraphicObjects/PrivateContainer.cs +++ b/src/GraphicObjects/PrivateContainer.cs @@ -27,7 +27,7 @@ using System; using System.Xml.Serialization; using System.ComponentModel; -using Cairo; +using vkvg; namespace Crow { @@ -211,7 +211,7 @@ namespace Crow ctx.SetSourceSurface (bmp, rb.X, rb.Y); ctx.Paint (); Clipping.Dispose(); - Clipping = new Region (); + Clipping = new Cairo.Region(); } #endregion diff --git a/src/GraphicObjects/ProgressBar.cs b/src/GraphicObjects/ProgressBar.cs index e8165fd2..d86e6b38 100644 --- a/src/GraphicObjects/ProgressBar.cs +++ b/src/GraphicObjects/ProgressBar.cs @@ -28,7 +28,7 @@ using System; using System.Collections.Generic; using System.Linq; using System.Text; -using Cairo; +using vkvg; using System.Diagnostics; using System.Xml.Serialization; using System.ComponentModel; diff --git a/src/GraphicObjects/SaturationValueSelector.cs b/src/GraphicObjects/SaturationValueSelector.cs index 485a33d2..e7da3ab7 100644 --- a/src/GraphicObjects/SaturationValueSelector.cs +++ b/src/GraphicObjects/SaturationValueSelector.cs @@ -25,7 +25,7 @@ // THE SOFTWARE. using System; -using Cairo; +using vkvg; using System.Xml.Serialization; namespace Crow diff --git a/src/GraphicObjects/Scroller.cs b/src/GraphicObjects/Scroller.cs index 30dd1480..72252c70 100644 --- a/src/GraphicObjects/Scroller.cs +++ b/src/GraphicObjects/Scroller.cs @@ -28,7 +28,7 @@ using System; using System.Xml.Serialization; using System.ComponentModel; using System.Diagnostics; -using Cairo; +using vkvg; namespace Crow { diff --git a/src/GraphicObjects/ScrollingObject.cs b/src/GraphicObjects/ScrollingObject.cs index de4b2113..893fe466 100644 --- a/src/GraphicObjects/ScrollingObject.cs +++ b/src/GraphicObjects/ScrollingObject.cs @@ -28,7 +28,7 @@ using System; using System.Xml.Serialization; using System.ComponentModel; using System.Collections; -using Cairo; +using vkvg; namespace Crow diff --git a/src/GraphicObjects/Shape.cs b/src/GraphicObjects/Shape.cs index a4b3193e..77345b31 100644 --- a/src/GraphicObjects/Shape.cs +++ b/src/GraphicObjects/Shape.cs @@ -28,7 +28,7 @@ using System.Xml.Serialization; using System.ComponentModel; using System.IO; using System.Text; -using Cairo; +using vkvg; namespace Crow { @@ -62,7 +62,7 @@ namespace Crow #endregion string path; - double strokeWidth; + float strokeWidth; public string Path { get { return path; } @@ -76,7 +76,7 @@ namespace Crow } } [XmlAttributeAttribute][DefaultValue(1.0)] - public double StokeWidth { + public float StokeWidth { get { return strokeWidth; } set { if (strokeWidth == value) @@ -113,22 +113,22 @@ namespace Crow continue; switch (c) { case 'M': - gr.MoveTo (sr.ReadDouble (), sr.ReadDouble ()); + gr.MoveTo ((float)sr.ReadDouble (), (float)sr.ReadDouble ()); break; case 'm': - gr.RelMoveTo (sr.ReadDouble (), sr.ReadDouble ()); + gr.RelMoveTo ((float)sr.ReadDouble (), (float)sr.ReadDouble ()); break; case 'L': - gr.LineTo (sr.ReadDouble (), sr.ReadDouble ()); + gr.LineTo ((float)sr.ReadDouble (), (float)sr.ReadDouble ()); break; case 'l': - gr.RelLineTo (sr.ReadDouble (), sr.ReadDouble ()); + gr.RelLineTo ((float)sr.ReadDouble (), (float)sr.ReadDouble ()); break; case 'C': - gr.CurveTo (sr.ReadDouble (), sr.ReadDouble (), sr.ReadDouble (), sr.ReadDouble (), sr.ReadDouble (), sr.ReadDouble ()); + gr.CurveTo ((float)sr.ReadDouble (), (float)sr.ReadDouble (), (float)sr.ReadDouble (), (float)sr.ReadDouble (), (float)sr.ReadDouble (), (float)sr.ReadDouble ()); break; case 'c': - gr.RelCurveTo (sr.ReadDouble (), sr.ReadDouble (), sr.ReadDouble (), sr.ReadDouble (), sr.ReadDouble (), sr.ReadDouble ()); + gr.RelCurveTo ((float)sr.ReadDouble (), (float)sr.ReadDouble (), (float)sr.ReadDouble (), (float)sr.ReadDouble (), (float)sr.ReadDouble (), (float)sr.ReadDouble ()); break; case 'Z': gr.ClosePath (); @@ -145,20 +145,20 @@ namespace Crow } } } - protected override int measureRawSize (LayoutingType lt) - { - if ((lt == LayoutingType.Width && contentSize.Width == 0) || (lt == LayoutingType.Height && contentSize.Height == 0)) { - using (Surface drawing = new ImageSurface (Format.A1, 1,1)) { - using (Context ctx = new Context (drawing)) { - executePath (ctx); - Rectangle r = ctx.StrokeExtents (); - contentSize = new Size (r.Right, r.Bottom); - } - } - } - return lt == LayoutingType.Width ? - contentSize.Width + 2 * Margin: contentSize.Height + 2 * Margin; - } +// protected override int measureRawSize (LayoutingType lt) +// { +// if ((lt == LayoutingType.Width && contentSize.Width == 0) || (lt == LayoutingType.Height && contentSize.Height == 0)) { +// using (Surface drawing = new ImageSurface (Format.A1, 1,1)) { +// using (Context ctx = new Context (drawing)) { +// executePath (ctx); +// Rectangle r = ctx.StrokeExtents (); +// contentSize = new Size (r.Right, r.Bottom); +// } +// } +// } +// return lt == LayoutingType.Width ? +// contentSize.Width + 2 * Margin: contentSize.Height + 2 * Margin; +// } } } diff --git a/src/GraphicObjects/Slider.cs b/src/GraphicObjects/Slider.cs index 2bdd5b8a..33915a26 100644 --- a/src/GraphicObjects/Slider.cs +++ b/src/GraphicObjects/Slider.cs @@ -25,7 +25,7 @@ // THE SOFTWARE. using System; -using Cairo; +using vkvg; using System.Xml.Serialization; using System.ComponentModel; using System.Diagnostics; diff --git a/src/GraphicObjects/TabItem.cs b/src/GraphicObjects/TabItem.cs index 473fc313..37a33ac0 100644 --- a/src/GraphicObjects/TabItem.cs +++ b/src/GraphicObjects/TabItem.cs @@ -28,7 +28,7 @@ using System; using System.Xml.Serialization; using System.ComponentModel; using System.Diagnostics; -using Cairo; +using vkvg; using System.Linq; namespace Crow @@ -159,29 +159,29 @@ namespace Crow internal TabView savedParent = null; void makeFloating (TabView tv) { - lock (IFace.UpdateMutex) { - ImageSurface di = new ImageSurface (Format.Argb32, dis, dis); - IFace.DragImageHeight = dis; - IFace.DragImageWidth = dis; - using (Context ctx = new Context (di)) { - double div = Math.Max (LastPaintedSlot.Width, LastPaintedSlot.Height); - double s = (double)dis / div; - ctx.Scale (s, s); - if (bmp == null) - this.onDraw (ctx); - else { - if (LastPaintedSlot.Width>LastPaintedSlot.Height) - ctx.SetSourceSurface (bmp, 0, (LastPaintedSlot.Width-LastPaintedSlot.Height)/2); - else - ctx.SetSourceSurface (bmp, (LastPaintedSlot.Height-LastPaintedSlot.Width)/2, 0); - - ctx.Paint (); - } - } - IFace.DragImage = di; - } - tv.RemoveChild (this); - savedParent = tv; +// lock (IFace.UpdateMutex) { +// ImageSurface di = new ImageSurface (Format.Argb32, dis, dis); +// IFace.DragImageHeight = dis; +// IFace.DragImageWidth = dis; +// using (Context ctx = new Context (di)) { +// double div = Math.Max (LastPaintedSlot.Width, LastPaintedSlot.Height); +// double s = (double)dis / div; +// ctx.Scale (s, s); +// if (bmp == null) +// this.onDraw (ctx); +// else { +// if (LastPaintedSlot.Width>LastPaintedSlot.Height) +// ctx.SetSourceSurface (bmp, 0, (LastPaintedSlot.Width-LastPaintedSlot.Height)/2); +// else +// ctx.SetSourceSurface (bmp, (LastPaintedSlot.Height-LastPaintedSlot.Width)/2, 0); +// +// ctx.Paint (); +// } +// } +// IFace.DragImage = di; +// } +// tv.RemoveChild (this); +// savedParent = tv; } public override ILayoutable Parent { diff --git a/src/GraphicObjects/TabView.cs b/src/GraphicObjects/TabView.cs index 304e820d..339f707c 100644 --- a/src/GraphicObjects/TabView.cs +++ b/src/GraphicObjects/TabView.cs @@ -27,7 +27,7 @@ using System; using System.Xml.Serialization; using System.ComponentModel; -using Cairo; +using vkvg; using System.Diagnostics; using System.Linq; diff --git a/src/GraphicObjects/TemplatedControl.cs b/src/GraphicObjects/TemplatedControl.cs index 54991a41..d51268ed 100644 --- a/src/GraphicObjects/TemplatedControl.cs +++ b/src/GraphicObjects/TemplatedControl.cs @@ -34,7 +34,7 @@ using System.Linq; using System.Collections.Generic; using System.Text; using System.Reflection; -using Cairo; +using vkvg; namespace Crow { diff --git a/src/GraphicObjects/TextBox.cs b/src/GraphicObjects/TextBox.cs index e29ff9bf..7bfa62e0 100644 --- a/src/GraphicObjects/TextBox.cs +++ b/src/GraphicObjects/TextBox.cs @@ -25,7 +25,7 @@ // THE SOFTWARE. using System; -using Cairo; +using vkvg; using System.Diagnostics; using System.Xml.Serialization; diff --git a/src/GraphicObjects/TextRun.cs b/src/GraphicObjects/TextRun.cs index 17e3b770..1f0bb271 100644 --- a/src/GraphicObjects/TextRun.cs +++ b/src/GraphicObjects/TextRun.cs @@ -29,7 +29,7 @@ using System.Collections.Generic; using System.Linq; using System.Text; using System.Diagnostics; -using Cairo; +using vkvg; using System.Text.RegularExpressions; using System.Xml.Serialization; using System.ComponentModel; @@ -259,7 +259,7 @@ namespace Crow } } - gr.FontMatrix = new Matrix (widthRatio * Font.Size, 0, 0, heightRatio * Font.Size, 0, 0); + //gr.FontMatrix = new Matrix (widthRatio * Font.Size, 0, 0, heightRatio * Font.Size, 0, 0); int curLineCount = 0; diff --git a/src/GraphicObjects/Trend.cs b/src/GraphicObjects/Trend.cs index e9d3c2d3..d1a835eb 100644 --- a/src/GraphicObjects/Trend.cs +++ b/src/GraphicObjects/Trend.cs @@ -28,7 +28,7 @@ using System; using System.Collections.Generic; using System.Xml.Serialization; using System.ComponentModel; -using Cairo; +using vkvg; namespace Crow { @@ -156,7 +156,7 @@ namespace Crow double stepX = (double)r.Width / (double)(nbValues-1); gr.LineWidth = 1.0; - gr.SetDash (new double[]{ 1.0 },0.0); + //gr.SetDash (new double[]{ 1.0 },0.0); @@ -175,7 +175,7 @@ namespace Crow gr.MoveTo (ptrX, values [i] * scaleY); Foreground.SetAsSource (gr); - gr.SetDash (new double[]{ }, 0.0); + //gr.SetDash (new double[]{ }, 0.0); while (i >= 0) { gr.LineTo (ptrX, r.Bottom - values [i] * scaleY); diff --git a/src/Interface.cs b/src/Interface.cs index cc62a1aa..f9821b73 100644 --- a/src/Interface.cs +++ b/src/Interface.cs @@ -33,7 +33,7 @@ using System.Reflection; using System.Threading; using System.Xml; using System.Xml.Serialization; -using Cairo; +using vkvg; using System.Globalization; using Crow.IML; @@ -83,19 +83,21 @@ namespace Crow foreach (string af in Directory.GetFiles (AppDomain.CurrentDomain.BaseDirectory, "*.dll")){ try { Assembly.LoadFrom (af); - } catch (Exception ex) { + } catch { Console.WriteLine ("{0} not loaded as assembly.", af); } } - FontRenderingOptions = new FontOptions (); - FontRenderingOptions.Antialias = Antialias.Subpixel; - FontRenderingOptions.HintMetrics = HintMetrics.On; - FontRenderingOptions.HintStyle = HintStyle.Full; - FontRenderingOptions.SubpixelOrder = SubpixelOrder.Rgb; +// FontRenderingOptions = new FontOptions (); +// FontRenderingOptions.Antialias = Antialias.Subpixel; +// FontRenderingOptions.HintMetrics = HintMetrics.On; +// FontRenderingOptions.HintStyle = HintStyle.Full; +// FontRenderingOptions.SubpixelOrder = SubpixelOrder.Rgb; } - public Interface(){ + public Interface(Surface surface){ CultureInfo.DefaultThreadCurrentCulture = System.Globalization.CultureInfo.InvariantCulture; + this.surf = surface; + this.clientRectangle = new Rectangle (0, 0, surface.Width, surface.Height); } #endregion @@ -104,8 +106,8 @@ namespace Crow loadCursors (); loadStyling (); findAvailableTemplates (); - initTooltip (); - initContextMenus (); + //initTooltip (); + //initContextMenus (); } #region Static and constants @@ -139,9 +141,9 @@ namespace Crow /// will not be rendered on screen </summary> public const int MaxDiscardCount = 5; /// <summary> Global font rendering settings for Cairo </summary> - public static FontOptions FontRenderingOptions; + //public static FontOptions FontRenderingOptions; /// <summary> Global font rendering settings for Cairo </summary> - public static Antialias Antialias = Antialias.Subpixel; + //public static Antialias Antialias = Antialias.Subpixel; /// <summary> /// Each control need a ref to the root interface containing it, if not set in GraphicObject.currentInterface, @@ -181,11 +183,6 @@ namespace Crow #region Public Fields /// <summary>Graphic Tree of this interface</summary> public List<GraphicObject> GraphicTree = new List<GraphicObject>(); - /// <summary>Interface's resulting bitmap</summary> - public byte[] bmp; - /// <summary>resulting bitmap limited to last redrawn part</summary> - public byte[] dirtyBmp; - /// <summary>True when host has to repaint Interface</summary> public bool IsDirty = false; /// <summary>Coordinate of the dirty bmp on the original bmp</summary> public Rectangle DirtyRect; @@ -231,11 +228,11 @@ namespace Crow /// <summary>Client rectangle in the host context</summary> Rectangle clientRectangle; /// <summary>Clipping rectangles on the root context</summary> - Region clipping = new Region(); + Cairo.Region clipping = new Cairo.Region(); /// <summary>Main Cairo context</summary> Context ctx; /// <summary>Main Cairo surface</summary> - Surface surf; + public Surface surf; #endregion #region Default values and Style loading @@ -643,8 +640,7 @@ namespace Crow drawingMeasure.StartCycle(); #endif if (DragImage != null) - clipping.UnionRectangle(new Rectangle (DragImageX, DragImageY, DragImageWidth, DragImageHeight)); - using (surf = new ImageSurface (bmp, Format.Argb32, ClientRectangle.Width, ClientRectangle.Height, ClientRectangle.Width * 4)) { + clipping.UnionRectangle(new Rectangle (DragImageX, DragImageY, DragImageWidth, DragImageHeight)); using (ctx = new Context (surf)){ if (!clipping.IsEmpty) { @@ -660,7 +656,7 @@ namespace Crow GraphicObject p = GraphicTree[i]; if (!p.Visible) continue; - if (clipping.Contains (p.Slot) == RegionOverlap.Out) + if (clipping.Contains (p.Slot) == Cairo.RegionOverlap.Out) continue; ctx.Save (); @@ -676,7 +672,7 @@ namespace Crow ctx.Save (); ctx.ResetClip (); ctx.SetSourceSurface (DragImage, DragImageX, DragImageY); - ctx.PaintWithAlpha (0.8); + //ctx.PaintWithAlpha (0.8); ctx.Restore (); DirtyRect += new Rectangle (DragImageX, DragImageY, DragImageWidth, DragImageHeight); IsDirty = true; @@ -687,6 +683,7 @@ namespace Crow #if DEBUG_CLIP_RECTANGLE clipping.stroke (ctx, Color.Red.AdjustAlpha(0.5)); #endif + /* lock (RenderMutex) { // Array.Copy (bmp, dirtyBmp, bmp.Length); @@ -714,11 +711,12 @@ namespace Crow } else IsDirty = false; } + */ clipping.Dispose (); - clipping = new Region (); + clipping = new Cairo.Region(); } //surf.WriteToPng (@"/mnt/data/test.png"); - } + } #if MEASURE_TIME drawingMeasure.StopCycle(); @@ -840,10 +838,10 @@ namespace Crow public void ProcessResize(Rectangle bounds){ lock (UpdateMutex) { clientRectangle = bounds; - int stride = 4 * ClientRectangle.Width; - int bmpSize = Math.Abs (stride) * ClientRectangle.Height; - bmp = new byte[bmpSize]; - dirtyBmp = new byte[bmpSize]; +// int stride = 4 * ClientRectangle.Width; +// int bmpSize = Math.Abs (stride) * ClientRectangle.Height; +// bmp = new byte[bmpSize]; +// dirtyBmp = new byte[bmpSize]; foreach (GraphicObject g in GraphicTree) g.RegisterForLayouting (LayoutingType.All); diff --git a/src/Mono.Cairo/Color.cs b/src/Mono.Cairo/Color.cs index 030089e8..4d76565f 100644 --- a/src/Mono.Cairo/Color.cs +++ b/src/Mono.Cairo/Color.cs @@ -1,5 +1,5 @@ // -// Mono.Cairo.Context.cs +// Mono.Context.cs // // Author: // Duncan Mak (duncan@ximian.com) diff --git a/src/Mono.Cairo/Context.cs b/src/Mono.Cairo/Context.cs index 264774dd..120a661f 100644 --- a/src/Mono.Cairo/Context.cs +++ b/src/Mono.Cairo/Context.cs @@ -1,5 +1,5 @@ // -// Mono.Cairo.Context.cs +// Mono.Context.cs // // Author: // Duncan Mak (duncan@ximian.com) @@ -37,11 +37,11 @@ using System; using System.Runtime.InteropServices; using System.Text; -using Cairo; +using vkvg; namespace Cairo { - [Obsolete ("Renamed Cairo.Context per suggestion from cairo binding guidelines.")] + [Obsolete ("Renamed Context per suggestion from cairo binding guidelines.")] public class Graphics : Context { public Graphics (IntPtr state) : base (state) {} public Graphics (Surface surface) : base (surface) {} diff --git a/src/Mono.Cairo/Distance.cs b/src/Mono.Cairo/Distance.cs index 7cba3729..68300e9d 100644 --- a/src/Mono.Cairo/Distance.cs +++ b/src/Mono.Cairo/Distance.cs @@ -1,5 +1,5 @@ // -// Mono.Cairo.Context.cs +// Mono.Context.cs // // Author: // Duncan Mak (duncan@ximian.com) diff --git a/src/Mono.Cairo/NativeMethods.cs b/src/Mono.Cairo/NativeMethods.cs index 53501369..7237f061 100644 --- a/src/Mono.Cairo/NativeMethods.cs +++ b/src/Mono.Cairo/NativeMethods.cs @@ -548,7 +548,7 @@ namespace Cairo internal static extern bool cairo_region_contains_point (IntPtr region, int x, int y); [DllImport (cairo, CallingConvention=CallingConvention.Cdecl)] - internal static extern RegionOverlap cairo_region_contains_rectangle (IntPtr region, ref Crow.Rectangle rectangle); + internal static extern Cairo.RegionOverlap cairo_region_contains_rectangle (IntPtr region, ref Crow.Rectangle rectangle); [DllImport (cairo, CallingConvention=CallingConvention.Cdecl)] internal static extern IntPtr cairo_region_copy (IntPtr original); diff --git a/src/Mono.Cairo/Path.cs b/src/Mono.Cairo/Path.cs index 184c606c..6807f38d 100644 --- a/src/Mono.Cairo/Path.cs +++ b/src/Mono.Cairo/Path.cs @@ -1,5 +1,5 @@ // -// Mono.Cairo.Context.cs +// Mono.Context.cs // // Author: // Miguel de Icaza (miguel@novell.com) @@ -30,7 +30,7 @@ using System; using System.Runtime.InteropServices; -using Cairo; +using vkvg; namespace Cairo { diff --git a/src/Mono.Cairo/Point.cs b/src/Mono.Cairo/Point.cs index e72ca6c5..d21abdc2 100644 --- a/src/Mono.Cairo/Point.cs +++ b/src/Mono.Cairo/Point.cs @@ -1,5 +1,5 @@ // -// Mono.Cairo.Context.cs +// Mono.Context.cs // // Author: // Duncan Mak (duncan@ximian.com) diff --git a/src/Mono.Cairo/PointD.cs b/src/Mono.Cairo/PointD.cs index c2e3587d..8c2b2e02 100644 --- a/src/Mono.Cairo/PointD.cs +++ b/src/Mono.Cairo/PointD.cs @@ -1,5 +1,5 @@ // -// Mono.Cairo.Context.cs +// Mono.Context.cs // // Author: // Duncan Mak (duncan@ximian.com) diff --git a/src/Mono.Cairo/Region.cs b/src/Mono.Cairo/Region.cs index 4a82842a..937457d1 100644 --- a/src/Mono.Cairo/Region.cs +++ b/src/Mono.Cairo/Region.cs @@ -138,7 +138,7 @@ namespace Cairo get { return NativeMethods.cairo_region_is_empty (Handle); } } - public RegionOverlap Contains (Crow.Rectangle rectangle) + public Cairo.RegionOverlap Contains (Crow.Rectangle rectangle) { return NativeMethods.cairo_region_contains_rectangle (Handle, ref rectangle); } diff --git a/src/Picture.cs b/src/Picture.cs index 3784780b..81069f31 100644 --- a/src/Picture.cs +++ b/src/Picture.cs @@ -26,7 +26,7 @@ using System; using System.IO; -using Cairo; +using vkvg; using System.Collections.Generic; namespace Crow diff --git a/src/Point.cs b/src/Point.cs index 6175efc7..cc486ac8 100644 --- a/src/Point.cs +++ b/src/Point.cs @@ -62,9 +62,9 @@ namespace Crow { return new Cairo.Point(p.X, p.Y); } - public static implicit operator Cairo.PointD(Point p) + public static implicit operator vkvg.PointD(Point p) { - return new Cairo.PointD(p.X, p.Y); + return new vkvg.PointD(p.X, p.Y); } public static implicit operator System.Drawing.Point(Point p) { diff --git a/src/SolidColor.cs b/src/SolidColor.cs index d6423d31..4cb212b1 100644 --- a/src/SolidColor.cs +++ b/src/SolidColor.cs @@ -31,7 +31,7 @@ using System.Text; using System.Xml.Serialization; using System.Reflection; using System.Diagnostics; -using Cairo; +using vkvg; @@ -51,7 +51,7 @@ namespace Crow public override void SetAsSource (Context ctx, Rectangle bounds = default(Rectangle)) { - ctx.SetSourceRGBA (color.R, color.G, color.B, color.A); + ctx.SetSource (color.R, color.G, color.B, color.A); } public static object Parse(string s) { diff --git a/src/SvgPicture.cs b/src/SvgPicture.cs index f676a497..1e03010d 100644 --- a/src/SvgPicture.cs +++ b/src/SvgPicture.cs @@ -26,7 +26,7 @@ using System; using System.IO; -using Cairo; +using vkvg; namespace Crow { @@ -95,16 +95,16 @@ namespace Crow widthRatio = heightRatio; } - using (ImageSurface tmp = new ImageSurface (Format.Argb32, bounds.Width, bounds.Height)) { - using (Context gr = new Context (tmp)) { - gr.Translate (bounds.Left, bounds.Top); - gr.Scale (widthRatio, heightRatio); - gr.Translate ((bounds.Width/widthRatio - Dimensions.Width)/2, (bounds.Height/heightRatio - Dimensions.Height)/2); - - hSVG.RenderCairo (gr); - } - ctx.SetSource (tmp); - } +// using (Surface tmp = new Surface (bounds.Width, bounds.Height)) { +// using (Context gr = new Context (tmp)) { +// gr.Translate (bounds.Left, bounds.Top); +// gr.Scale (widthRatio, heightRatio); +// gr.Translate ((bounds.Width/widthRatio - Dimensions.Width)/2, (bounds.Height/heightRatio - Dimensions.Height)/2); +// +// hSVG.RenderCairo (gr); +// } +// ctx.SetSource (tmp); +// } } #endregion diff --git a/src/rsvg/Handle.cs b/src/rsvg/Handle.cs index e13f79ad..46a907c1 100644 --- a/src/rsvg/Handle.cs +++ b/src/rsvg/Handle.cs @@ -1,5 +1,5 @@ //Copyright GPL2 -using Cairo; +using vkvg; namespace Rsvg { @@ -108,7 +108,7 @@ namespace Rsvg { [DllImport("rsvg-2")] static extern void rsvg_handle_render_cairo_sub(IntPtr raw, IntPtr cr, string id); - public void RenderCairoSub(Cairo.Context cr, string id) { + public void RenderCairoSub(Context cr, string id) { rsvg_handle_render_cairo_sub(Raw, cr == null ? IntPtr.Zero : cr.Handle, id); } |