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


C# Cairo.Context.Scale方法代码示例

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


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

示例1: UpdateThumbnail

		private void UpdateThumbnail ()
		{
			double scalex = (double)Allocation.Width / (double)PintaCore.Workspace.ImageSize.Width;
			double scaley = (double)Allocation.Height / (double)PintaCore.Workspace.ImageSize.Height;
			
			thumbnail = new Cairo.ImageSurface (Cairo.Format.Argb32, Allocation.Width, Allocation.Height);
			
			using (Cairo.Context g = new Cairo.Context (thumbnail)) {
				g.Scale (scalex, scaley);
				foreach (Layer layer in PintaCore.Layers.GetLayersToPaint ()) {
					layer.Draw(g);
				}
			}
		}
开发者ID:msiyer,项目名称:Pinta,代码行数:14,代码来源:PointPickerGraphic.cs

示例2: GetPattern

 public Cairo.Pattern GetPattern(ApplicationContext actx, double scaleFactor)
 {
     if (pattern == null || currentScaleFactor != scaleFactor) {
         if (pattern != null)
             pattern.Dispose ();
         Gdk.Pixbuf pb = ((GtkImage)Image.Backend).GetBestFrame (actx, scaleFactor, Image.Size.Width, Image.Size.Height, false);
         var imgs = new Cairo.ImageSurface (Cairo.Format.ARGB32, (int)(Image.Size.Width * scaleFactor), (int)(Image.Size.Height * scaleFactor));
         var ic = new Cairo.Context (imgs);
         ic.Scale ((double)imgs.Width / (double)pb.Width, (double)imgs.Height / (double)pb.Height);
         Gdk.CairoHelper.SetSourcePixbuf (ic, pb, 0, 0);
         ic.Paint ();
         imgs.Flush ();
         ((IDisposable)ic).Dispose ();
         pattern = new Cairo.SurfacePattern (imgs);
         pattern.Extend = Cairo.Extend.Repeat;
         var cm = new Cairo.Matrix ();
         cm.Scale (scaleFactor, scaleFactor);
         pattern.Matrix = cm;
         currentScaleFactor = scaleFactor;
     }
     return pattern;
 }
开发者ID:jbeaurain,项目名称:xwt,代码行数:22,代码来源:ImagePatternBackendHandler.cs

示例3: BgBufferUpdate

				public BgBufferUpdate (Minimpap mode)
				{
					this.mode = mode;
					
					cr = Gdk.CairoHelper.Create (mode.backgroundBuffer);
					
					cr.LineWidth = 1;
					int w = mode.backgroundBuffer.ClipRegion.Clipbox.Width;
					int h = mode.backgroundBuffer.ClipRegion.Clipbox.Height;
					cr.Rectangle (0, 0, w, h);
					if (mode.TextEditor.ColorStyle != null)
						cr.Color = mode.TextEditor.ColorStyle.Default.CairoBackgroundColor;
					cr.Fill ();
					
					maxLine = mode.TextEditor.GetTextEditorData ().VisibleLineCount;
					sx = w / (double)mode.TextEditor.Allocation.Width;
					sy = Math.Min (1, lineHeight * maxLine / (double)mode.TextEditor.GetTextEditorData ().TotalHeight );
					cr.Scale (sx, sy);
					
					handler = GLib.Idle.Add (BgBufferUpdater);
				}
开发者ID:sparek,项目名称:monodevelop,代码行数:21,代码来源:QuickTaskMiniMapMode.cs

示例4: OnDraw

		void OnDraw (object data)
		{
			Action<Cairo.Context> callback = (Action<Cairo.Context>) data;

			using (var context = new Cairo.Context (surface.Surface)) {
				context.Operator = Cairo.Operator.Source;
				context.SetSourceRGBA (0, 0, 0, 0);
				context.Paint ();
				context.Operator = Cairo.Operator.Over;

				context.Scale (Scale, Scale);
				callback (context);
			}
			runningSignal.Set ();
		}
开发者ID:jmloeffler,项目名称:monodevelop,代码行数:15,代码来源:ThreadedRenderer.cs

示例5: RenderFrame

		Gdk.Pixbuf RenderFrame (ApplicationContext actx, double scaleFactor, double width, double height)
		{
			var swidth = Math.Max ((int)(width * scaleFactor), 1);
			var sheight = Math.Max ((int)(height * scaleFactor), 1);

			using (var sf = new Cairo.ImageSurface (Cairo.Format.ARGB32, swidth, sheight))
			using (var ctx = new Cairo.Context (sf)) {
				ImageDescription idesc = new ImageDescription () {
					Alpha = 1,
					Size = new Size (width, height)
				};
				ctx.Scale (scaleFactor, scaleFactor);
				Draw (actx, ctx, scaleFactor, 0, 0, idesc);
				var f = new ImageFrame (ImageBuilderBackend.CreatePixbuf (sf), Math.Max((int)width,1), Math.Max((int)height,1), true);
				AddFrame (f);
				return f.Pixbuf;
			}
		}
开发者ID:StEvUgnIn,项目名称:xwt,代码行数:18,代码来源:ImageHandler.cs

示例6: UpdateThumbnail

        private void UpdateThumbnail()
        {
            double scalex = (double)Allocation.Width / (double)PintaCore.Workspace.ImageSize.Width;
            double scaley = (double)Allocation.Height / (double)PintaCore.Workspace.ImageSize.Height;

            thumbnail = new Cairo.ImageSurface (Cairo.Format.Argb32, Allocation.Width, Allocation.Height);

            using (Cairo.Context g = new Cairo.Context (thumbnail)) {
                g.Scale (scalex, scaley);
                foreach (Layer layer in PintaCore.Layers.GetLayersToPaint ()) {
                    g.SetSourceSurface (layer.Surface, (int)layer.Offset.X, (int)layer.Offset.Y);
                    g.PaintWithAlpha (layer.Opacity);
                }
            }
        }
开发者ID:RudoCris,项目名称:Pinta,代码行数:15,代码来源:PointPickerGraphic.cs

示例7: RenderFrame

        Gdk.Pixbuf RenderFrame(ApplicationContext actx, double scaleFactor, ImageDescription idesc)
        {
            var swidth = Math.Max ((int)(idesc.Size.Width * scaleFactor), 1);
            var sheight = Math.Max ((int)(idesc.Size.Height * scaleFactor), 1);

            using (var sf = new Cairo.ImageSurface (Cairo.Format.ARGB32, swidth, sheight))
            using (var ctx = new Cairo.Context (sf)) {
                ctx.Scale (scaleFactor, scaleFactor);
                Draw (actx, ctx, scaleFactor, 0, 0, idesc);
                var f = new ImageFrame (ImageBuilderBackend.CreatePixbuf (sf), Math.Max ((int)idesc.Size.Width, 1), Math.Max ((int)idesc.Size.Height, 1), true);
                if (drawCallback == null)
                    AddFrame (f);
                return f.Pixbuf;
            }
        }
开发者ID:mono,项目名称:xwt,代码行数:15,代码来源:ImageHandler.cs


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