当前位置: 首页>>代码示例>>C#>>正文


C# Cairo.Context类代码示例

本文整理汇总了C#中Cairo.Context的典型用法代码示例。如果您正苦于以下问题:C# Cairo.Context类的具体用法?C# Cairo.Context怎么用?C# Cairo.Context使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


Cairo.Context类属于命名空间,在下文中一共展示了Cairo.Context类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: DrawInRegionVisitor

 public DrawInRegionVisitor(Gdk.Region region, Cairo.Context context, IDrawingView view)
 {
     this.context = context;
     this.region = region;
     this.view = view;
     this.figures = new List<Figure> ();
 }
开发者ID:erbriones,项目名称:monodevelop-classdesigner,代码行数:7,代码来源:DrawInRegionVisitor.cs

示例2: Import

		public void Import (string fileName, Gtk.Window parent)
		{
			Pixbuf bg;

			// Handle any EXIF orientation flags
			using (var fs = new FileStream (fileName, FileMode.Open, FileAccess.Read))
				bg = new Pixbuf (fs);

			bg = bg.ApplyEmbeddedOrientation ();

			Size imagesize = new Size (bg.Width, bg.Height);

			Document doc = PintaCore.Workspace.CreateAndActivateDocument (fileName, imagesize);
			doc.HasFile = true;
			doc.ImageSize = imagesize;
			doc.Workspace.CanvasSize = imagesize;

			Layer layer = doc.AddNewLayer (Path.GetFileName (fileName));

			using (Cairo.Context g = new Cairo.Context (layer.Surface)) {
				CairoHelper.SetSourcePixbuf (g, bg, 0, 0);
				g.Paint ();
			}

			bg.Dispose ();
		}
开发者ID:msiyer,项目名称:Pinta,代码行数:26,代码来源:GdkPixbufFormat.cs

示例3: Activated

        private void Activated(object sender, EventArgs e)
        {
            Gtk.Clipboard cb = Gtk.Clipboard.Get (Gdk.Atom.Intern ("CLIPBOARD", false));

            if (cb.WaitIsImageAvailable ()) {
                PintaCore.Tools.Commit ();

                Gdk.Pixbuf image = cb.WaitForImage ();

                Layer l = PintaCore.Layers.AddNewLayer (string.Empty);

                using (Cairo.Context g = new Cairo.Context (l.Surface))
                    g.DrawPixbuf (image, new Cairo.Point (0, 0));

                // Make new layer the current layer
                PintaCore.Layers.SetCurrentLayer (l);

                PintaCore.Workspace.Invalidate ();

                AddLayerHistoryItem hist = new AddLayerHistoryItem (Stock.Paste, Catalog.GetString ("Paste Into New Layer"), PintaCore.Layers.IndexOf (l));
                PintaCore.History.PushNewItem (hist);
            } else {
                ClipboardEmptyError ();
            }
        }
开发者ID:rolandixor,项目名称:Pinta,代码行数:25,代码来源:PasteIntoNewLayerAction.cs

示例4: ClearSurface

		void ClearSurface ()
		{
			using (Cairo.Context ctx = new Cairo.Context (surface)) {
				ctx.SetSourceRGB (1, 1, 1);
				ctx.Paint ();
			}
		}
开发者ID:liberostelios,项目名称:gtk-sharp,代码行数:7,代码来源:Scribble.cs

示例5: HandlePintaCoreActionsFileNewActivated

        private void HandlePintaCoreActionsFileNewActivated(object sender, EventArgs e)
        {
            NewImageDialog dialog = new NewImageDialog ();

            dialog.ParentWindow = main_window.GdkWindow;
            dialog.WindowPosition = Gtk.WindowPosition.CenterOnParent;

            int response = dialog.Run ();

            if (response == (int)Gtk.ResponseType.Ok) {
                PintaCore.Workspace.ImageSize = new Cairo.PointD (dialog.NewImageWidth, dialog.NewImageHeight);
                PintaCore.Workspace.CanvasSize = new Cairo.PointD (dialog.NewImageWidth, dialog.NewImageHeight);

                PintaCore.Layers.Clear ();
                PintaCore.History.Clear ();
                PintaCore.Layers.DestroySelectionLayer ();
                PintaCore.Layers.ResetSelectionPath ();

                // Start with an empty white layer
                Layer background = PintaCore.Layers.AddNewLayer ("Background");

                using (Cairo.Context g = new Cairo.Context (background.Surface)) {
                    g.SetSourceRGB (255, 255, 255);
                    g.Paint ();
                }

                PintaCore.Workspace.Filename = "Untitled1";
                PintaCore.Workspace.IsDirty = false;
                PintaCore.Actions.View.ZoomToWindow.Activate ();
            }

            dialog.Destroy ();
        }
开发者ID:asbjornu,项目名称:Pinta,代码行数:33,代码来源:DialogHandlers.cs

示例6: RefreshBackground

 public void RefreshBackground(Field[,] fields)
 {
     background = new Cairo.ImageSurface (Cairo.Format.ARGB32, width * fieldSize, height * fieldSize);
     using (Cairo.Context context = new Cairo.Context(background)) {
         paintBackground (context, fields);
     }
 }
开发者ID:Teyras,项目名称:Bounce,代码行数:7,代码来源:BoardRenderer.cs

示例7: GetFileBytes

        public byte[] GetFileBytes(Report report)
        {
            var pages = report.BuildPages();
            int width = (int)report.PageWidthPoints;
            int height = (int)report.PageHeightPoints;
            string filename = string.Format("gen-{0}.pdf", Guid.NewGuid());
			
            try
            {
                using (Cairo.PdfSurface pdf = new Cairo.PdfSurface(filename, width, height))
                {
                    using (Cairo.Context g = new Cairo.Context(pdf))
                    {
						
                        var render = new  fyiReporting.RdlGtkViewer.RenderCairo(g);
                        render.RunPages(pages);
                    }
                }
                byte[] bytes = File.ReadAllBytes(filename);
                return bytes;
				
            }
            finally
            {
                if (File.Exists(filename))
                {
                    File.Delete(filename);
                }
            }
        }
开发者ID:myersBR,项目名称:My-FyiReporting,代码行数:30,代码来源:CairoPdfWriter.cs

示例8: OnContextInitialize

 public void OnContextInitialize(RenderContextInitEventArgs args)
 {
     DrawingArea area = args.Widget as DrawingArea;
     if (area != null)
     {
         _context = Gdk.CairoHelper.Create(area.GdkWindow);
     }
 }
开发者ID:oraora81,项目名称:NOCmono,代码行数:8,代码来源:RenderContext.cs

示例9: FillContains

 internal bool FillContains(Point point)
 {
     using (var context = new Cairo.Context(new Cairo.ImageSurface(Cairo.Format.Argb32, 0, 0)))
     {
         context.AppendPath(Path);
         return context.InFill(point.X, point.Y); 
     }
 }
开发者ID:CarlSosaDev,项目名称:Avalonia,代码行数:8,代码来源:StreamGeometryContextImpl.cs

示例10: RenderCairo

        public RenderCairo(Cairo.Context g, float scale)
        {
            this.g = g;
            this.layout = Pango.CairoHelper.CreateLayout(g);
			
            dpiX *= scale;
            dpiY *= scale;
        }
开发者ID:myersBR,项目名称:My-FyiReporting,代码行数:8,代码来源:RenderCairo.cs

示例11: DrawBrush

		void DrawBrush (double x, double y)
		{
			using (Cairo.Context ctx = new Cairo.Context (surface)) {
				ctx.Rectangle ((int) x - 3, (int) y - 3, 6, 6);
				ctx.Fill ();
			}

			QueueDrawArea ((int) x - 3, (int) y - 3, 6, 6);
		}
开发者ID:liberostelios,项目名称:gtk-sharp,代码行数:9,代码来源:Scribble.cs

示例12: WithAlpha

        public static Gdk.Pixbuf WithAlpha (this Gdk.Pixbuf image, double opacity)
        {
            using (var surf = new Cairo.ImageSurface (Cairo.Format.Argb32, image.Width, image.Height)) {
                using (var g = new Cairo.Context (surf)) {
                    CairoHelper.SetSourcePixbuf (g, image, 0, 0);
                    g.PaintWithAlpha (opacity);
                }

                return new Gdk.Pixbuf (surf.Data, true, 8, surf.Width, surf.Height, surf.Stride);
            }
        }
开发者ID:msiyer,项目名称:Pinta,代码行数:11,代码来源:GdkExtensions.cs

示例13: Dispose

        public void Dispose ()
        {
            if (Surface != null && Surface.Handle != IntPtr.Zero) {
                ((IDisposable)Surface).Dispose ();
            }
            Surface = null;

            if (Context != null) {
                Hyena.Gui.CairoExtensions.DisposeContext (Context);
                Context = null;
            }
        }
开发者ID:GNOME,项目名称:pdfmod,代码行数:12,代码来源:PageThumbnail.cs

示例14: StreamGeometryContextImpl

		public StreamGeometryContextImpl(Cairo.Path path = null)
        {

			_surf = new Cairo.ImageSurface (Cairo.Format.Argb32, 0, 0);
			_context = new Cairo.Context (_surf);
			this.Path = path;

			if (this.Path != null) 
			{
				_context.AppendPath(this.Path);
			}
        }
开发者ID:rdterner,项目名称:Perspex,代码行数:12,代码来源:StreamGeometryContextImpl.cs

示例15: Create

 public override object Create(object img)
 {
     Gdk.Pixbuf pb = (Gdk.Pixbuf)img;
     var imgs = new Cairo.ImageSurface (Cairo.Format.ARGB32, pb.Width, pb.Height);
     var ic = new Cairo.Context (imgs);
     Gdk.CairoHelper.SetSourcePixbuf (ic, pb, 0, 0);
     ic.Paint ();
     imgs.Flush ();
     ((IDisposable)ic).Dispose ();
     var p = new Cairo.SurfacePattern (imgs);
     p.Extend = Cairo.Extend.Repeat;
     return p;
 }
开发者ID:garuma,项目名称:xwt,代码行数:13,代码来源:ImagePatternBackendHandler.cs


注:本文中的Cairo.Context类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。