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


C# Gdk.Pixbuf类代码示例

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


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

示例1: ExtensionEditorWidget

		public ExtensionEditorWidget()
		{
			this.Build();
			
			pixAddin = ImageService.GetPixbuf (MonoDevelop.Ide.Gui.Stock.Addin, IconSize.Menu);
			pixLocalAddin = ImageService.GetPixbuf ("md-addinauthoring-current-addin", IconSize.Menu);
			pixExtensionPoint = ImageService.GetPixbuf ("md-extension-point", IconSize.Menu);
			pixExtensionNode = ImageService.GetPixbuf ("md-extension-node", IconSize.Menu);
			
			store = new TreeStore (typeof(string), typeof(string), typeof(Extension), typeof(ExtensionNodeDescription), typeof(Gdk.Pixbuf), typeof(bool), typeof(ExtensionPoint));
			state = new TreeViewState (tree, 0);

			TreeViewColumn col = new TreeViewColumn ();
			CellRendererPixbuf cpix = new CellRendererPixbuf ();
			col.PackStart (cpix, false);
			col.AddAttribute (cpix, "pixbuf", ColIcon);
			col.AddAttribute (cpix, "visible", ColShowIcon);
			
			CellRendererExtension crt = new CellRendererExtension ();
			crt.Yalign = 0;
			col.PackStart (crt, true);
			col.AddAttribute (crt, "markup", ColLabel);
			
			tree.AppendColumn (col);
			tree.Model = store;
			tree.HeadersVisible = false;
			
			tree.Selection.Changed += OnSelectionChanged;
			
			IdeApp.ProjectOperations.EndBuild += OnEndBuild;
		}
开发者ID:transformersprimeabcxyz,项目名称:monodevelop-1,代码行数:31,代码来源:ExtensionEditorWidget.cs

示例2: SparkleSpinner

        public SparkleSpinner(int size)
            : base()
        {
            int current_frame          = 0;
            Gdk.Pixbuf spinner_gallery = SparkleUIHelpers.GetIcon ("process-working", size);
            int frames_in_width        = spinner_gallery.Width / size;
            int frames_in_height       = spinner_gallery.Height / size;
            int frame_count            = (frames_in_width * frames_in_height) - 1;
            Gdk.Pixbuf [] frames       = new Gdk.Pixbuf [frame_count];

            int i = 0;
            for (int y = 0; y < frames_in_height; y++) {
                for (int x = 0; x < frames_in_width; x++) {
                    if (!(y == 0 && x == 0)) {
                        frames [i] = new Gdk.Pixbuf (spinner_gallery, x * size, y * size, size, size);
                        i++;
                    }
                }
            }

            timer = new Timer () {
                Interval = 600 / frame_count
            };

            timer.Elapsed += delegate {
                if (current_frame < frame_count - 1)
                    current_frame++;
                else
                    current_frame = 0;

                Application.Invoke (delegate {
                    Pixbuf = frames [current_frame];
                });
            };
        }
开发者ID:nicolas-raoul,项目名称:SparkleShare,代码行数:35,代码来源:SparkleSpinner.cs

示例3: WebViewer

        public WebViewer()
            : base(WindowType.Toplevel)
        {
            xml = new XML (null, "MainWindow.glade", "mainBox", null);
            xml.Autoconnect (this);
            Gdk.Pixbuf pix = new Gdk.Pixbuf (null, "webnotes-16.png");

            //Window settings
            Title = "WebNotes";
            WindowPosition = WindowPosition.Center;
            Icon = pix;
            Resize (650,600);

            //Trayicon stuff
            trayIcon = new TrayIcon ("WebNotes");
            EventBox ebox = new EventBox ();
            ebox.ButtonPressEvent += ButtonPressed;
            Image image = new Image (pix);
            ebox.Add (image);
            trayIcon.Add (ebox);
            trayIcon.ShowAll ();

            //Gecko webcontrol
            wc = new WebControl ();
            wc.LoadUrl ("http://localhost:8000");
            geckoBox.Add (wc);

            optionMenu.Changed += OptionChanged;
            BuildMenu ();
            int firstPage = list.IndexOf ("WikiHome");
            if (firstPage != -1)
            optionMenu.SetHistory ((uint)firstPage);

            Add (mainBox);
        }
开发者ID:BackupTheBerlios,项目名称:mspace-svn,代码行数:35,代码来源:WebViewer.cs

示例4: AboutDialog

        public AboutDialog(Gtk.Window parent)
        {
            if (parent == null) {
                throw new ArgumentNullException("parent");
            }

            TransientFor = parent;
            Name = Frontend.Name;
            Version = "\n Frontend: " + Frontend.UIName + " " + Frontend.Version +
                      "\n Engine: " + Frontend.EngineVersion;
            Copyright = "Copyright © 2005-2010 Mirco Bauer <[email protected]>";
            Authors = new string[] {
                "Mirco Bauer <[email protected]>",
                "David Paleino <[email protected]>",
                "Clément Bourgeois <[email protected]>",
                "Chris Le Sueur <[email protected]>",
                "Tuukka Hastrup <[email protected]>"
            };
            Artists = new string[] {
                "Jakub Steiner <[email protected]>",
                "Rodney Dawes <[email protected]>",
                "Lapo Calamandrei <[email protected]>",
                "Ahmed Abdellah <[email protected]>"
            };
            TranslatorCredits = _("translator-credits");
            Logo = new Gdk.Pixbuf(null, "icon.svg", 256, 256);
            Website = "http://www.smuxi.org/";
            WebsiteLabel = _("Smuxi Website");
        }
开发者ID:tuukka,项目名称:smuxi,代码行数:29,代码来源:AboutDialog.cs

示例5: FolderChooserDialog

        public FolderChooserDialog( HComboFolder father )
            : base(Gtk.WindowType.Popup)
        {
            Gtk.IconTheme theme = Gtk.IconTheme.Default;

            folder_icon = new Gdk.Pixbuf( this.GetType().Assembly, "folder.png");
            drive_icon  = new Gdk.Pixbuf( this.GetType().Assembly, "drive.png");
            if( theme.HasIcon("folder") )
                folder_icon = theme.LoadIcon( "folder", 24, Gtk.IconLookupFlags.ForceSvg );
            if( theme.HasIcon("harddrive") )
                drive_icon = theme.LoadIcon( "harddrive", 24, Gtk.IconLookupFlags.ForceSvg );

            this.father = father;
            this.Build();
            //incarca baza
            DriveInfo[] difs = DriveInfo.GetDrives();
            foreach( DriveInfo di in difs )
            {
                // adauga doar discurile fixe
                if( di.DriveType == DriveType.Fixed )
                    FolderTree.Nodes.Add( new HTreeNode( di.Name, drive_icon ) );
            }
            //add dummy childs
            foreach( HTreeNode node in FolderTree.Nodes )
            {
                node.Nodes.Add( new HTreeNode("dummy") );
            }
        }
开发者ID:tizianomanni,项目名称:holly-gtk-widgets,代码行数:28,代码来源:FolderChooserDialog.cs

示例6: NoteBookLabel

 // Constructor
 private NoteBookLabel(DI.Diagram diagram)
     : base(1, 3, false)
 {
     _parent = null;
     _diagram = diagram;
     //this must change depending of the diagram's type
     string diagramType = ((DI.SimpleSemanticModelElement)diagram.SemanticModel).TypeInfo;
     _icon = GetIcon(diagramType);
     //_icon = new Gdk.Pixbuf (new Gdk.Colorspace(), false, 8, 15, 15);
     //_icon.Fill (0xffff0000);
     //
     Attach(new Gtk.Image(_icon), 0, 1, 0, 1);
     //
     _label = new Label(_diagram.Name);
     Attach(_label, 1, 2, 0, 1);
     //
     Image image = new Image();
     image.Stock = Gtk.Stock.Close;
     _close_button = new Button();
     _close_button.Add(image);
     _close_button.HeightRequest = 20;
     _close_button.WidthRequest = 20;
     _close_button.Relief = Gtk.ReliefStyle.None;
     _close_button.Clicked += OnCloseButtonClicked;
     Tooltips ttips = new Tooltips ();
     ttips.SetTip (_close_button, GettextCatalog.GetString ("Close diagram"), GettextCatalog.GetString ("Close diagram"));
     //_close_button.
     Attach(_close_button, 2, 3, 0, 1);
     ShowAll();
 }
开发者ID:MonoBrasil,项目名称:historico,代码行数:31,代码来源:NoteBookLabel.cs

示例7: ProjectFileSelectorDialog

		public ProjectFileSelectorDialog (Project project, string defaultFilterName, string defaultFilterPattern, string [] buildActions)
		{
			this.project = project;
			this.defaultFilter = new SelectFileDialogFilter (defaultFilterName, defaultFilterPattern ?? "*");
			this.buildActions = buildActions;
			
			this.Build();
			
			projBuf = ImageService.GetPixbuf (project.StockIcon, IconSize.Menu);
			dirClosedBuf = ImageService.GetPixbuf (MonoDevelop.Ide.Gui.Stock.ClosedFolder, IconSize.Menu);
			dirOpenBuf = ImageService.GetPixbuf (MonoDevelop.Ide.Gui.Stock.OpenFolder, IconSize.Menu);
			
			TreeViewColumn projectCol = new TreeViewColumn ();
			projectCol.Title = GettextCatalog.GetString ("Project Folders");
			var pixRenderer = new CellRendererPixbuf ();
			CellRendererText txtRenderer = new CellRendererText ();
			projectCol.PackStart (pixRenderer, false);
			projectCol.PackStart (txtRenderer, true);
			projectCol.SetCellDataFunc (pixRenderer, new TreeCellDataFunc (PixDataFunc));
			projectCol.SetCellDataFunc (txtRenderer, new TreeCellDataFunc (TxtDataFunc));
			projectTree.Model = dirStore;
			projectTree.AppendColumn (projectCol);
			TreeIter projectIter = dirStore.AppendValues ("", FilePath.Empty);
			InitDirs (projectIter);
			projectTree.ExpandAll ();
			projectTree.RowActivated += delegate {
				fileList.GrabFocus ();
			};
			projectTree.KeyPressEvent += ProjectListKeyPressEvent;
			
			TreeViewColumn fileCol = new TreeViewColumn ();
			var filePixRenderer = new CellRendererPixbuf ();
			fileCol.Title = GettextCatalog.GetString ("Files");
			fileCol.PackStart (filePixRenderer, false);
			fileCol.PackStart (txtRenderer, true);
			fileCol.AddAttribute (filePixRenderer, "pixbuf", 1);
			fileCol.SetCellDataFunc (txtRenderer, new TreeCellDataFunc (TxtFileDataFunc));
			fileList.Model = fileStore;
			fileList.AppendColumn (fileCol);
			fileList.RowActivated += delegate {
				TreeIter iter;
				if (fileList.Selection.GetSelected (out iter))
					Respond (ResponseType.Ok);
			};
			fileList.KeyPressEvent += FileListKeyPressEvent;
			fileList.KeyReleaseEvent += FileListKeyReleaseEvent;
			
			TreeIter root;
			if (dirStore.GetIterFirst (out root))
				projectTree.Selection.SelectIter (root);
			
			UpdateFileList (null, null);
			
			projectTree.Selection.Changed += UpdateFileList;
			fileList.Selection.Changed += UpdateSensitivity;
			
			
			this.DefaultResponse = ResponseType.Cancel;
			this.Modal = true;
		}
开发者ID:telebovich,项目名称:monodevelop,代码行数:60,代码来源:ProjectFileSelectorDialog.cs

示例8: GetPixbufFromNSBitmapImageRep

		static Gdk.Pixbuf GetPixbufFromNSBitmapImageRep (NSBitmapImageRep bitmap, int width, int height)
		{
			byte[] data;
			using (var tiff = bitmap.TiffRepresentation) {
				data = new byte[tiff.Length];
				System.Runtime.InteropServices.Marshal.Copy (tiff.Bytes, data, 0, data.Length);
			}

			int pw = bitmap.PixelsWide, ph = bitmap.PixelsHigh;
			var pixbuf = new Gdk.Pixbuf (data, pw, ph);

			// if one dimension matches, and the other is same or smaller, use as-is
			if ((pw == width && ph <= height) || (ph == height && pw <= width))
				return pixbuf;

			// otherwise scale proportionally such that the largest dimension matches the desired size
			if (pw == ph) {
				pw = width;
				ph = height;
			} else if (pw > ph) {
				ph = (int) (width * ((float) ph / pw));
				pw = width;
			} else {
				pw = (int) (height * ((float) pw / ph));
				ph = height;
			}

			var scaled = pixbuf.ScaleSimple (pw, ph, Gdk.InterpType.Bilinear);
			pixbuf.Dispose ();

			return scaled;
		}
开发者ID:StEvUgnIn,项目名称:xwt,代码行数:32,代码来源:GtkMacDesktopBackend.cs

示例9: CreatePixbufFromResource

 public static Gdk.Pixbuf CreatePixbufFromResource( Bitmap bitmap )
 {
     // creates a Gdk.Pixbuf from a Bitmap object
     // thanks to bratsche (Cody Russell) on #mono for the help!
     BitmapData data = bitmap.LockBits( new Rectangle( 0, 0,
         bitmap.Width,
         bitmap.Height),
         ImageLockMode.ReadOnly,
         System.Drawing.Imaging.PixelFormat.Format32bppArgb );
     IntPtr scan = data.Scan0;
     int size = bitmap.Width * bitmap.Height * 4;
     byte[] bdata = new byte[ size ];
     Gdk.Pixbuf pixbuf = null;
     unsafe {
         byte* p = (byte*)scan;
         for (int i = 0; i < size; i+=4) {
             // iterate through bytes.
             // Bitmap stores it's data in RGBA order.
             // Pixbuf stores it's data in BGRA order.
             bdata[ i ]   = p[ i+2 ]; // blue
             bdata[ i+1 ] = p[ i+1 ]; // green
             bdata[ i+2 ] = p[ i ];   // red
             bdata[ i+3 ] = p[ i+3 ]; // alpha
         }
     }
     pixbuf = new Gdk.Pixbuf( bdata, true, 8,
         bitmap.Width, bitmap.Height,
         data.Stride, null );
     bitmap.UnlockBits( data );
     return pixbuf;
 }
开发者ID:micolous,项目名称:igaeditor,代码行数:31,代码来源:Main.cs

示例10: LoadPdf

        /// <summary>
        /// Loads the pdf.  This is the function you call when you want to display a pdf.
        /// </summary>
        /// <param name='pdfFileName'>
        /// Pdf file name.
        /// </param>
        public void LoadPdf(string pdfFileName)
        {
            pdf = Poppler.Document.NewFromFile(pdfFileName, "");
            PageCountLabel.Text = @"/" + (pdf.NPages - 1).ToString();
            CurrentPage.Value = 0;
            CurrentPage.Adjustment.Upper = pdf.NPages-1;

            foreach (Gtk.Widget w in vboxImages.AllChildren)
            {
                vboxImages.Remove(w);
            }

            for (this.pageIndex = 0; this.pageIndex < pdf.NPages; this.pageIndex++)
            {
                Gdk.Pixbuf pixbuf = new Gdk.Pixbuf (Gdk.Colorspace.Rgb, false, 8, 0, 0);
                Gtk.Image img = new Gtk.Image();
                img.Pixbuf = pixbuf;
                img.Name = "image1";

                //vboxImages.Add (img);
                RenderPage(ref img);
            }

            this.ShowAll();
        }
开发者ID:majorsilence,项目名称:gtk-sharp-pdf-widget,代码行数:31,代码来源:PdfWidget.cs

示例11: WelcomePageListButton

		static WelcomePageListButton ()
		{
			starNormal = Gdk.Pixbuf.LoadFromResource ("star-normal.png");
			starNormalHover = Gdk.Pixbuf.LoadFromResource ("star-normal-hover.png");
			starPinned = Gdk.Pixbuf.LoadFromResource ("star-pinned.png");
			starPinnedHover = Gdk.Pixbuf.LoadFromResource ("star-pinned-hover.png");
		}
开发者ID:RainsSoft,项目名称:playscript-monodevelop,代码行数:7,代码来源:WelcomePageListButton.cs

示例12: DesaturateIcon

 public static Gdk.Pixbuf DesaturateIcon(Gdk.Pixbuf source)
 {
     Gdk.Pixbuf dest = new Gdk.Pixbuf (source.Colorspace, source.HasAlpha, source.BitsPerSample, source.Width, source.Height);
     dest.Fill (0);
     source.SaturateAndPixelate (dest, 0, false);
     return dest;
 }
开发者ID:JamesChan,项目名称:mono-addins,代码行数:7,代码来源:Services.cs

示例13: ToPixbuf

        public static Gdk.Pixbuf ToPixbuf(ArtworkFormat format, byte[] data)
        {
            Gdk.Pixbuf pixbuf = new Gdk.Pixbuf (Gdk.Colorspace.Rgb, false, 8, format.Width, format.Height);
            Gdk.Pixbuf rotated = null;

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

            if (format.Rotation > 0) {
                rotated = Rotate (pixbuf, format.Rotation);
                pixbuf.Dispose ();
                pixbuf = rotated;
            }

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

示例14: WelcomePageBarButton

		public WelcomePageBarButton (string title, string href, string iconResource = null)
		{
			FontFamily = Platform.IsMac ? Styles.WelcomeScreen.FontFamilyMac : Styles.WelcomeScreen.FontFamilyWindows;
			HoverColor = Styles.WelcomeScreen.Links.HoverColor;
			Color = Styles.WelcomeScreen.Links.Color;
			FontSize = Styles.WelcomeScreen.Links.FontSize;

			VisibleWindow = false;
			this.Text = GettextCatalog.GetString (title);
			this.actionLink = href;
			if (!string.IsNullOrEmpty (iconResource)) {
				imageHover = Gdk.Pixbuf.LoadFromResource (iconResource);
				imageNormal = ImageService.MakeTransparent (imageHover, 0.7);
			}

			HBox box = new HBox ();
			box.Spacing = Styles.WelcomeScreen.Links.IconTextSpacing;
			image = new Image ();
			label = new Label ();
			box.PackStart (image, false, false, 0);
			if (imageNormal == null)
				image.NoShowAll = true;
			box.PackStart (label, false, false, 0);
			box.ShowAll ();
			Add (box);

			Update ();

			Events |= (Gdk.EventMask.EnterNotifyMask | Gdk.EventMask.LeaveNotifyMask | Gdk.EventMask.ButtonReleaseMask);
		}
开发者ID:RainsSoft,项目名称:playscript-monodevelop,代码行数:30,代码来源:WelcomePageBarButton.cs

示例15: Load

		void Load ()
		{
			var monitor = loadMonitor;
			System.Threading.ThreadPool.QueueUserWorkItem (delegate {
				try {
					HttpWebRequest req = (HttpWebRequest) HttpWebRequest.Create (url);
					WebResponse resp = req.GetResponse ();
					MemoryStream ms = new MemoryStream ();
					using (var s = resp.GetResponseStream ()) {
						s.CopyTo (ms);
					}
					var data = ms.ToArray ();

					MonoDevelop.Ide.DispatchService.GuiSyncDispatch (delegate {
						Gdk.PixbufLoader l = new Gdk.PixbufLoader (resp.ContentType);
						l.Write (data);
						image = l.Pixbuf;
						l.Close ();
						monitor.Dispose ();
					});
					
					// Replace the async operation to avoid holding references to all
					// objects that subscribed the Completed event.
					loadOperation = NullAsyncOperation.Success;
				} catch (Exception ex) {
					loadMonitor.ReportError (null, ex);
					Gtk.Application.Invoke (delegate {
						monitor.Dispose ();
					});
					loadOperation = NullAsyncOperation.Failure;
				}
				loadMonitor = null;
			});
		}
开发者ID:RainsSoft,项目名称:playscript-monodevelop,代码行数:34,代码来源:ImageLoader.cs


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