當前位置: 首頁>>代碼示例>>C#>>正文


C# Backends.ImageDescription類代碼示例

本文整理匯總了C#中Xwt.Backends.ImageDescription的典型用法代碼示例。如果您正苦於以下問題:C# ImageDescription類的具體用法?C# ImageDescription怎麽用?C# ImageDescription使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


ImageDescription類屬於Xwt.Backends命名空間,在下文中一共展示了ImageDescription類的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的C#代碼示例。

示例1: SetImage

		public void SetImage (ImageDescription image)
		{
			Gtk.ImageMenuItem it = item as Gtk.ImageMenuItem;
			if (it == null)
				return;
			if (!image.IsNull) {
				if (defImage == null)
					item.StateChanged += ImageMenuItemStateChanged;
				defImage = image;
				selImage = new ImageDescription {
					Backend = image.Backend,
					Size = image.Size,
					Alpha = image.Alpha,
					Styles = image.Styles.Add ("sel")
				};
				var img = new ImageBox (context, image);
				img.ShowAll ();
				it.Image = img;
				GtkWorkarounds.ForceImageOnMenuItem (it);
			} else {
				if (defImage.HasValue) {
					item.StateChanged -= ImageMenuItemStateChanged;
					defImage = selImage = null;
				}
				it.Image = null;
			}
		}
開發者ID:TheBrainTech,項目名稱:xwt,代碼行數:27,代碼來源:MenuItemBackend.cs

示例2: Create

 public override object Create(ImageDescription img)
 {
     NSImage nimg = img.ToNSImage ();
     return new ImagePatternInfo () {
         Image = nimg
     };
 }
開發者ID:jbeaurain,項目名稱:xwt,代碼行數:7,代碼來源:ImagePatternBackendHandler.cs

示例3: Draw

 void Draw(object ctx, Rectangle bounds, ImageDescription idesc, Toolkit toolkit)
 {
     var c = new Context (ctx, toolkit);
     if (idesc.Styles != StyleSet.Empty)
         c.SetStyles (idesc.Styles);
     c.Reset (null);
     c.Save ();
     c.GlobalAlpha = idesc.Alpha;
     OnDraw (c, bounds);
     c.Restore ();
 }
開發者ID:akrisiun,項目名稱:xwt,代碼行數:11,代碼來源:DrawingImage.cs

示例4: SetImage

		public void SetImage (ImageDescription image)
		{
			Gtk.ImageMenuItem it = item as Gtk.ImageMenuItem;
			if (it == null)
				return;
			if (!image.IsNull) {
				var img = new ImageBox (context, image);
				img.ShowAll ();
				it.Image = img;
				GtkWorkarounds.ForceImageOnMenuItem (it);
			}
			else
				it.Image = null;
		}
開發者ID:m13253,項目名稱:xwt,代碼行數:14,代碼來源:MenuItemBackend.cs

示例5: Draw

        public void Draw(ApplicationContext actx, SWM.DrawingContext dc, double scaleFactor, double x, double y, ImageDescription idesc)
        {
            if (drawCallback != null) {
                DrawingContext c = new DrawingContext (dc, scaleFactor);
                actx.InvokeUserCode (delegate {
                    drawCallback (c, new Rectangle (x, y, idesc.Size.Width, idesc.Size.Height), idesc, actx.Toolkit);
                });
            }
            else {
                if (idesc.Alpha < 1)
                    dc.PushOpacity (idesc.Alpha);

                var f = GetBestFrame (actx, scaleFactor, idesc.Size.Width, idesc.Size.Height, false);
                var bmpImage = f as BitmapSource;

                // When an image is a single bitmap that doesn't have the same intrinsic size as the drawing size, dc.DrawImage makes a very poor job of down/up scaling it.
                // Thus we handle this manually by using a TransformedBitmap to handle the conversion in a better way when it's needed.

                var scaledWidth = idesc.Size.Width * scaleFactor;
                var scaledHeight = idesc.Size.Height * scaleFactor;
                if (bmpImage != null && (Math.Abs (bmpImage.PixelHeight - scaledHeight) > 0.001 || Math.Abs (bmpImage.PixelWidth - scaledWidth) > 0.001))
                    f = new TransformedBitmap (bmpImage, new ScaleTransform (scaledWidth / bmpImage.PixelWidth, scaledHeight / bmpImage.PixelHeight));

                dc.DrawImage (f, new Rect (x, y, idesc.Size.Width, idesc.Size.Height));

                if (idesc.Alpha < 1)
                    dc.Pop ();
            }
        }
開發者ID:RandallFlagg,項目名稱:xwt,代碼行數:29,代碼來源:ImageHandler.cs

示例6: SetIcon

		public void SetIcon(ImageDescription icon)
		{
			Window.IconList = ((GtkImage)icon.Backend).Frames.Select (f => f.Pixbuf).ToArray ();
		}
開發者ID:m13253,項目名稱:xwt,代碼行數:4,代碼來源:WindowFrameBackend.cs

示例7: DrawImage

        public override void DrawImage(object backend, ImageDescription img, double x, double y)
        {
            CairoContextBackend ctx = (CairoContextBackend)backend;

            img.Alpha *= ctx.GlobalAlpha;
            var pix = (Xwt.GtkBackend.GtkImage) img.Backend;

            pix.Draw (ApplicationContext, ctx.Context, ctx.ScaleFactor, x, y, img);
        }
開發者ID:nirenyang,項目名稱:xwt,代碼行數:9,代碼來源:CairoContextBackendHandler.cs

示例8: SetIcon

 public void SetIcon(ImageDescription imageBackend)
 {
     window.Icon = imageBackend.ToImageSource ();
 }
開發者ID:Jeha,項目名稱:xwt,代碼行數:4,代碼來源:WindowFrameBackend.cs

示例9: DrawImage

 public override void DrawImage(object backend, ImageDescription img, double x, double y)
 {
     var srcRect = new Rectangle (Point.Zero, img.Size);
     var destRect = new Rectangle (x, y, img.Size.Width, img.Size.Height);
     DrawImage (backend, img, srcRect, destRect);
 }
開發者ID:jbeaurain,項目名稱:xwt,代碼行數:6,代碼來源:ContextBackendHandler.cs

示例10: Create

		public override object Create (ImageDescription img)
		{
			return new ImagePattern (ApplicationContext, img);
		}
開發者ID:m13253,項目名稱:xwt,代碼行數:4,代碼來源:ImagePatternBackendHandler.cs

示例11: Create

		public abstract object Create (ImageDescription img);
開發者ID:m13253,項目名稱:xwt,代碼行數:1,代碼來源:ImagePatternBackendHandler.cs

示例12: SetImage

 public void SetImage(ImageDescription imageBackend)
 {
     if (imageBackend.IsNull)
         this.menuItem.Icon = null;
     else
         this.menuItem.Icon = new ImageBox (Context) { ImageSource = imageBackend };
 }
開發者ID:Gaushick,項目名稱:xwt,代碼行數:7,代碼來源:MenuItemBackend.cs

示例13: RenderFrame

 Gdk.Pixbuf RenderFrame(ApplicationContext actx, double scaleFactor, double width, double height)
 {
     using (var sf = new Cairo.ImageSurface (Cairo.Format.ARGB32, (int)(width * scaleFactor), (int)(height * scaleFactor)))
     using (var ctx = new Cairo.Context (sf)) {
         ImageDescription idesc = new ImageDescription () {
             Alpha = 1,
             Size = new Size (width * scaleFactor, height * scaleFactor)
         };
         Draw (actx, ctx, 1, 0, 0, idesc);
         var f = new ImageFrame (ImageBuilderBackend.CreatePixbuf (sf), (int)width, (int)height);
         AddFrame (f);
         return f.Pixbuf;
     }
 }
開發者ID:neiz,項目名稱:xwt,代碼行數:14,代碼來源:ImageHandler.cs

示例14: DrawPixbuf

 void DrawPixbuf(Cairo.Context ctx, Gdk.Pixbuf img, double x, double y, ImageDescription idesc)
 {
     ctx.Save ();
     ctx.Translate (x, y);
     ctx.Scale (idesc.Size.Width / (double)img.Width, idesc.Size.Height / (double)img.Height);
     Gdk.CairoHelper.SetSourcePixbuf (ctx, img, 0, 0);
     if (idesc.Alpha == 1)
         ctx.Paint ();
     else
         ctx.PaintWithAlpha (idesc.Alpha);
     ctx.Restore ();
 }
開發者ID:neiz,項目名稱:xwt,代碼行數:12,代碼來源:ImageHandler.cs

示例15: SetIcon

		public void SetIcon (ImageDescription icon)
		{
		}
開發者ID:TheBrainTech,項目名稱:xwt,代碼行數:3,代碼來源:WindowBackend.cs


注:本文中的Xwt.Backends.ImageDescription類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。