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


C# Gdk.Dispose方法代码示例

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


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

示例1: ToBytes

        public static byte[] ToBytes(ArtworkFormat format, Gdk.Pixbuf pixbuf, out short horizontalPadding,
                                      out short verticalPadding)
        {
            horizontalPadding = 0;
            verticalPadding = 0;

            bool disposePixbuf = false;

            if (format.Rotation > 0) {
                pixbuf = Rotate (pixbuf, format.Rotation);
                disposePixbuf = true;
            }

            if (pixbuf.Height != format.Height || pixbuf.Width != format.Width) {
                int padX, padY;
                Gdk.Pixbuf scaled = Scale (pixbuf, format.Width, format.Height, out padX, out padY);

                horizontalPadding = (short) padX;
                verticalPadding = (short) padY;

                if (disposePixbuf) {
                    pixbuf.Dispose ();
                }

                pixbuf = scaled;
                disposePixbuf = true;
            }

            byte[] data = null;

            switch (format.PixelFormat) {
            case PixelFormat.Rgb565:
                data = PackRgb565 (pixbuf, false);
                break;
            case PixelFormat.Rgb565BE:
                data = PackRgb565 (pixbuf, true);
                break;
            case PixelFormat.IYUV:
                data = PackIYUV (pixbuf);
                break;
            default:
                throw new ApplicationException ("Unknown pixel format: " + format.PixelFormat);
            }

            if (disposePixbuf) {
                pixbuf.Dispose ();
            }

            return data;
        }
开发者ID:mono,项目名称:ipod-sharp,代码行数:50,代码来源:ArtworkHelpers.cs

示例2: PixbufImageSurface

        private PixbufImageSurface(Gdk.Pixbuf pixbuf, IntPtr data, int width, int height, int channels, int rowstride, IntPtr pixels)
            : base(data, channels == 3 ? Format.Rgb24 : Format.Argb32, width, height, width * 4)
        {
            this.data = data;

            CreateSurface (width, height, channels, rowstride, pixels);
            SetDestroyFunc ();

            if (pixbuf != null && pixbuf.Handle != IntPtr.Zero) {
                pixbuf.Dispose ();
            }
        }
开发者ID:GNOME,项目名称:hyena,代码行数:12,代码来源:PixbufImageSurface.cs

示例3: TransformAndDispose

		protected Gdk.Pixbuf TransformAndDispose (Gdk.Pixbuf orig)
		{
			if (orig == null)
				return null;

			Gdk.Pixbuf rotated = PixbufUtils.TransformOrientation (orig, this.Orientation, true);
			//ValidateThumbnail (photo, rotated);
			if (rotated != orig)
				orig.Dispose ();
			
			return rotated;
		}
开发者ID:ArsenShnurkov,项目名称:beagle-1,代码行数:12,代码来源:ImageFile.cs

示例4: TransformAndDispose

        protected Gdk.Pixbuf TransformAndDispose(Gdk.Pixbuf orig)
        {
            if (orig == null)
                return null;

            Gdk.Pixbuf rotated = FSpot.Utils.PixbufUtils.TransformOrientation (orig, this.Orientation);

            orig.Dispose ();

            return rotated;
        }
开发者ID:iainlane,项目名称:f-spot,代码行数:11,代码来源:ImageFile.cs

示例5: Save

		public override void Save (Gdk.Pixbuf pixbuf, System.IO.Stream stream)
		{

			// Console.WriteLine ("starting save");
			// First save the imagedata
			int quality = Header.GuessQuality ();
			quality = quality == 0 ? 75 : quality;
			byte [] image_data = PixbufUtils.Save (pixbuf, "jpeg", new string [] {"quality" }, new string [] { quality.ToString () });
			System.IO.MemoryStream buffer = new System.IO.MemoryStream ();
			buffer.Write (image_data, 0, image_data.Length);
			buffer.Position = 0;
			
			// Console.WriteLine ("setting thumbnail");
			SetThumbnail (pixbuf);
			SetDimensions (pixbuf.Width, pixbuf.Height);
			pixbuf.Dispose ();
			
			// Console.WriteLine ("saving metatdata");
			SaveMetaData (buffer, stream);
			// Console.WriteLine ("done");
			buffer.Close ();
		}
开发者ID:guadalinex-archive,项目名称:guadalinex-v6,代码行数:22,代码来源:JpegFile.cs

示例6: WindowDestroy

        public static void WindowDestroy (Gdk.Window window)
        {
            // There is a bug in GDK, and subsequently in Gdk# 2.8.5 through 2.12.1
            // where the managed Gdk.Window.Destroy function does not obtain a
            // normal reference (non-toggle) on the GdkWindow before calling
            // _destroy on it, which the native function apparently expects.

            // https://bugzilla.novell.com/show_bug.cgi?id=382186
            // http://anonsvn.mono-project.com/viewcvs/trunk/gtk-sharp/gdk/Window.custom?rev=101734&r1=42529&r2=101734

            if (window == null) {
                return;
            }

            if (!toggle_ref_supported) {
                window.Destroy ();
                return;
            }

            // If this ever happens I will move out west and start farming...
            if (g_object_ref == null || gdk_window_destroy == null) {
                window.Destroy ();
                return;
            }

            if (invoke_args == null) {
                invoke_args = new object[1];
            }

            invoke_args[0] = window.Handle;
            g_object_ref.Invoke (null, invoke_args);
            gdk_window_destroy.Invoke (null, invoke_args);

            window.Dispose ();
        }
开发者ID:Yetangitu,项目名称:f-spot,代码行数:35,代码来源:GtkWorkarounds.cs


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