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


C# Gdk.Pixbuf类代码示例

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


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

示例1: EditorStock

    static EditorStock()
    {
        // Load Window icon.
        WindowIcon = Gdk.Pixbuf.LoadFromResource ("supertux-editor.png");

        AddIcon (Eye, Gtk.IconSize.Menu, "stock-eye-12.png");
        AddIcon (EyeHalf, Gtk.IconSize.Menu, "stock-eye-half-12.png");

        // HACK: This is needed to make tool icons show up on Windows, no idea why.
        // TODO: test if this is still needed with additional SizeWildcarded.
        // SizeWildcarded only gives fuzzy images, at least for stock-eye-12.png
        // It looks like windows are confusing large and small toolbar size ("SmallToolbar" causes 2x bigger buttons that "LargeToolbar"), bug in GTK for windows? bug in windows themselves?
        #if WINDOWS
        Gtk.IconSize ToolBarIconSize = Gtk.IconSize.SmallToolbar;
        #else
        Gtk.IconSize ToolBarIconSize = Gtk.IconSize.LargeToolbar;
        #endif
        AddIcon(ToolSelect, ToolBarIconSize, "stock-tool-select-24.png");
        AddIcon(ToolTiles, ToolBarIconSize, "stock-tool-tiles-24.png");
        AddIcon(ToolObjects, ToolBarIconSize, "stock-tool-objects-24.png");
        AddIcon(ToolBrush, ToolBarIconSize, "stock-tool-brush-24.png");
        AddIcon(ToolFill, ToolBarIconSize, "stock-tool-fill-24.png");
        AddIcon(ToolReplace, ToolBarIconSize, "stock-tool-replace-24.png");
        AddIcon(ToolPath, ToolBarIconSize, "stock-tool-path-24.png");
        AddIcon(Camera, ToolBarIconSize, "stock-camera-24.png");

        stock.AddDefault();
    }
开发者ID:Karkus476,项目名称:supertux-editor,代码行数:28,代码来源:EditorStock.cs

示例2: Initialize

		public static void Initialize ()
		{
			DefaultIcon = DockServices.Drawing.LoadIcon (DefaultIconName, NoteIconSize);
			statusIcon = new StatusIcon ();
			statusIcon.Pixbuf = DockServices.Drawing.LoadIcon (DefaultIconName, StatusIconSize);
			statusIcon.Visible = false;	
		}
开发者ID:Aurora-and-Equinox,项目名称:docky,代码行数:7,代码来源:NotificationService.cs

示例3: DoThumbnail

        public override void DoThumbnail(object sender, EventArgs e)
        {
            Gtk.TreeIter iter;

            try {
                iter = (Gtk.TreeIter) ((Task)sender).Data;
                string file = (string) store.GetValue (iter, COL_PATH);
                Gdk.Pixbuf im = Backends.ThumbnailCache.Factory.Provider.GetThumbnail (file, thumbnail_width, thumbnail_height);

                if (im == null)
                    im = new Gdk.Pixbuf (file);

                int max = Math.Max (im.Width, im.Height);
                Gdk.Pixbuf scaled = im.ScaleSimple (thumbnail_width * im.Width / max, thumbnail_height * im.Height / max, InterpType.Nearest);

                Application.Invoke (delegate {
                        store.SetValue (iter, COL_PIXBUF, scaled);
                    } );

                im.Dispose ();
            }

            catch (Exception ex) {
                Logger.Error ("ImagesFileView.DoThumbnail. Exception: " + ex.Message);
            }
        }
开发者ID:GNOME,项目名称:mistelix,代码行数:26,代码来源:ImagesFileView.cs

示例4: Draw

        protected override void Draw(Context cr, Pixbuf prev, Pixbuf next, int width, int height, double progress)
        {
            cr.Color = new Color (0, 0, 0, progress);
            if (next != null) {
                double scale = Math.Min ((double)width/(double)next.Width, (double)height/(double)next.Height);
                cr.Save ();

                cr.Rectangle (0, 0, width, .5 * (height - scale*next.Height));
                cr.Fill ();

                cr.Rectangle (0, height - .5 * (height - scale*next.Height), width, .5 * (height - scale*next.Height));
                cr.Fill ();

                cr.Rectangle (0, 0, .5 * (width - scale*next.Width), height);
                cr.Fill ();

                cr.Rectangle (width - .5 * (width - scale*next.Width), 0, .5 * (width - scale*next.Width), height);
                cr.Fill ();

                cr.Rectangle (0, 0, width, height);
                cr.Scale (scale, scale);
                CairoHelper.SetSourcePixbuf (cr, next, .5 * ((double)width/scale - next.Width), .5 * ((double)height/scale - next.Height));
                cr.PaintWithAlpha (progress);
                cr.Restore ();
            }
        }
开发者ID:nathansamson,项目名称:F-Spot-Album-Exporter,代码行数:26,代码来源:DissolveTransition.cs

示例5: UpdateCaceheInfo

 public void UpdateCaceheInfo()
 {
     m_model = new ListStore(typeof(Pixbuf), typeof(string), typeof(string));
     if (m_monitor.SelectedCache == null)
     {
         this.Sensitive = false;
         return;
     }
     this.Sensitive = true;
     string imagesFolder = GetImagesFolder ();
     fileLabel.Text = String.Format(Catalog.GetString("Images Folder: {0}"), imagesFolder);
     if(Directory.Exists(imagesFolder))
     {
         string[] files = Directory.GetFiles(imagesFolder);
         foreach(string file in files)
         {
             Pixbuf buf = new Pixbuf(file,256, 256);
             string[] filePath = file.Split('/');
             m_model.AppendValues(buf, filePath[filePath.Length -1],file);
         }
     }
     imagesView.Model = m_model;
     imagesView.PixbufColumn = 0;
     imagesView.TextColumn = 1;
     imagesView.SelectionMode = SelectionMode.Single;
 }
开发者ID:TweetyHH,项目名称:Open-Cache-Manager,代码行数:26,代码来源:ImagesWidget.cs

示例6: Adjust

		public Pixbuf Adjust ()
		{
			Gdk.Pixbuf final = new Gdk.Pixbuf (Gdk.Colorspace.Rgb,
							   false, 8,
							   Input.Width,
							   Input.Height);
			Cms.Profile [] list = GenerateAdjustments ().ToArray ();
			
			if (Input.HasAlpha) {
				Pixbuf alpha = PixbufUtils.Flatten (Input);
				Transform transform = new Transform (list,
								     PixbufUtils.PixbufCmsFormat (alpha),
								     PixbufUtils.PixbufCmsFormat (final),
								     intent, 0x0000);
				PixbufUtils.ColorAdjust (alpha, final, transform);
				PixbufUtils.ReplaceColor (final, Input);
				alpha.Dispose ();
				final.Dispose ();
				final = Input;
			} else {
				Cms.Transform transform = new Cms.Transform (list,
									     PixbufUtils.PixbufCmsFormat (Input),
									     PixbufUtils.PixbufCmsFormat (final),
									     intent, 0x0000);
				
				PixbufUtils.ColorAdjust (Input, final, transform);
			}

			return final;
		}
开发者ID:guadalinex-archive,项目名称:guadalinex-v6,代码行数:30,代码来源:Adjustment.cs

示例7: DoSave

        protected override void DoSave(Pixbuf pb, string fileName, string fileType)
        {
            int level = PintaCore.Actions.File.RaiseModifyCompression (85);

            if (level != -1)
                pb.Savev (fileName, fileType, new string[] { "quality", null }, new string[] { level.ToString(), null });
        }
开发者ID:RudoCris,项目名称:Pinta,代码行数:7,代码来源:JpegFormat.cs

示例8: AvatarManager

        public AvatarManager()
        {
            if (instance != null) {
                throw new Exception ("One instance please!");
            } else {
                instance = this;
            }

            genericAvatar = new Pixbuf(null, "FileFind.Meshwork.GtkClient.avatar-generic-large.png");
            smallGenericAvatar = new Pixbuf(null, "FileFind.Meshwork.GtkClient.avatar-generic-medium.png");
            miniGenericAvatar = new Pixbuf(null, "FileFind.Meshwork.GtkClient.avatar-generic-small.png");

            avatarsPath = Path.Combine (Settings.ConfigurationDirectory, "avatars");

            if (Directory.Exists (avatarsPath) == false) {
                Directory.CreateDirectory (avatarsPath);
            }

            foreach (Network network in Core.Networks) {
                AddNetwork (network);
            }

            Core.NetworkAdded += AddNetwork;

            UpdateMyAvatar ();
        }
开发者ID:codebutler,项目名称:meshwork,代码行数:26,代码来源:AvatarManager.cs

示例9: PlayPauseButton

        public PlayPauseButton(string playXPM, string pauseXPM)
        {
            _paused = true;
            _playImage = new Pixbuf(playXPM);
            _pauseImage = new Pixbuf(pauseXPM);

            _image = new Gtk.Image();
            _image.Pixbuf = _playImage;

            Add(_image);
            _image.Show();

            this.ButtonPressEvent+=	 delegate(object o, ButtonPressEventArgs args) {
                if (_paused)
                    _image.Pixbuf = _pauseImage;
                else
                    _image.Pixbuf = _playImage;

                _paused = !_paused;

                if (Clicked != null)
                    Clicked(this, new PlayPauseButtonEventArgs(){ IsPaused = _paused });
            };

            this.WidthRequest = _image.Pixbuf.Width;
        }
开发者ID:danhigham,项目名称:MonoCloud,代码行数:26,代码来源:UIHelper.cs

示例10: Analyze

        public static void Analyze(App app)
        {
            if (app.Filename == null) return;

            // Analyze the sprite sheet and show fit options.
            string filename = app.Filename;
            app.Output = "(no output)";
            app.UI(UI.Output);
            app.UI(UI.Filename);

            app.Islands = null;
            app.Image = null;
            app.ErrorMessage = null;
            app.UI(UI.ErrorMessage);
            try {
                var buf = new Pixbuf(filename);
                app.Image = buf;
                app.Do(Act.AnalyzeHorizontal);
                app.Do(Act.AnalyzeVertical);
                app.Do(Act.AnalyzeIslands);
            }
            catch (Exception ex) {
                app.ErrorMessage = ex.Message;
                app.UI(UI.ErrorMessage);
                Console.WriteLine(ex.ToString());
            }

            // Update the island editor.
            app.UI(UI.IslandEditor);
            app.UI(UI.CompletedTask);
        }
开发者ID:bvssvni,项目名称:csharp-spritesheet-analyzer,代码行数:31,代码来源:AnalyzeAction.cs

示例11: SharpApp

    public SharpApp()
        : base("Fixed")
    {
        SetDefaultSize(300,280);
        SetPosition(WindowPosition.Center);
        ModifyBg(StateType.Normal, new Gdk.Color(10,40,40));
        DeleteEvent += delegate {Application.Quit();};

        try{
            bardejov = new Gdk.Pixbuf("bardejov.jpg");
            rotunda = new Gdk.Pixbuf("rotunda.jpg");
            mincol = new Gdk.Pixbuf("mincol.jpg");
        } catch {
            Console.WriteLine("Images not found");
            Environment.Exit(1);
        }

        Image image1 = new Image(bardejov);
        Image image2 = new Image(rotunda);
        Image image3 = new Image(mincol);

        VBox fix = new VBox(true,4);

        fix.PackStart(image1);
        fix.Pack(image2);
        fix.PackEnd(image3);

        Add(fix);

        ShowAll();
    }
开发者ID:Jimmyscene,项目名称:Random,代码行数:31,代码来源:fixed.cs

示例12: AboutUI

    private AboutUI()
    {
        Glade.XML gxml = new Glade.XML (null, "organizer.glade", "window4", null);
          gxml.Autoconnect (this);

          Gdk.Pixbuf pixbuf = new Gdk.Pixbuf(DeskFlickrUI.ICON_PATH);
          logoimage.Pixbuf = pixbuf;
          dfolabel.Markup = "<span font_desc='Sans Bold 16'>Desktop Flickr Organizer v0.8</span>";

          notebook2.SetTabLabelText(notebook2.CurrentPageWidget, "About");
          notebook2.NextPage();
          notebook2.SetTabLabelText(notebook2.CurrentPageWidget, "Attribution");
          notebook2.NextPage();
          notebook2.SetTabLabelText(notebook2.CurrentPageWidget, "License");
          notebook2.Page = 0;

          closebutton.Label = "Close";
          closebutton.Clicked += new EventHandler(OnCloseButtonClicked);

          SetAboutInfo();
          SetAttributionInfo();

          window4.SetIconFromFile(DeskFlickrUI.ICON_PATH);
          window4.ShowAll();
    }
开发者ID:joshuacox,项目名称:dfo,代码行数:25,代码来源:AboutUI.cs

示例13: sMenu

        public sMenu(string path)
        {
            clear 		= new Pixbuf(path + "clear_16.png");
            collapse 	= new Pixbuf(path + "collapse_16.png");
            configure	= new Pixbuf(path + "configure_16.png");
            info		= new Pixbuf(path + "info_16.png");
            minus 		= new Pixbuf(path + "remove_16.png");
            mute 		= new Pixbuf(path + "volume_mute_16.png");
            next		= new Pixbuf(path + "next_16.png");
            pause		= new Pixbuf(path + "pause_16.png");
            play		= new Pixbuf(path + "play_16.png");
            plus		= new Pixbuf(path + "add_16.png");
            previous	= new Pixbuf(path + "previous_16.png");
            refresh		= new Pixbuf(path + "refresh_16.png");
            repeat		= new Pixbuf(path + "repeat_16.png");
            stop		= new Pixbuf(path + "stop_16.png");
            shuffle		= new Pixbuf(path + "shuffle_16.png");
            partymode	= new Pixbuf(path + "partymode_16.png");
            volume_down = new Pixbuf(path + "volume_down_16.png");
            volume_up	= new Pixbuf(path + "volume_up_16.png");

            artist			= new Pixbuf(path + "mic_16.png");
            cd				= new Pixbuf(path + "cd_16.png");
            connect			= new Pixbuf(path + "connect_16.png");
            disconnect		= new Pixbuf(path + "disconnect_16.png");
            file			= new Pixbuf(path + "file_files.png");
            file_music		= new Pixbuf(path + "file_music.png");
            file_picture	= new Pixbuf(path + "file_pictures.png");
            file_video		= new Pixbuf(path + "file_video.png");
            folder_closed	= new Pixbuf(path + "folder_closed.png");
            folder_open		= new Pixbuf(path + "folder_open.png");
            icon			= new Pixbuf(path + "icon.png");
            pixel			= new Pixbuf(path + "pixel.gif");
        }
开发者ID:Bram77,项目名称:xbmcontrol-evo,代码行数:34,代码来源:Images.cs

示例14: drawTileset

        //level must be declared prior to calling this
        public void drawTileset()
        {
            _tilesetCache = new Gdk.Pixbuf(_editLevel.tilesetPath);

            Pixmap pMap, mask;
            _tilesetCache.RenderPixmapAndMask (out pMap, out mask, 0);

            int imgWidth = _tilesetCache.Width,
            imgHeight = _tilesetCache.Height;

            _tilesetEventBox.SetSizeRequest (imgWidth, imgHeight);
            tilesetDrawPane.SetSizeRequest (imgWidth, imgHeight);

            if (_tilesetGrid) {
                //get the context we're drawing in
                Gdk.GC gc = new Gdk.GC (levelDrawPane.GdkWindow);

                //draw the grid
                for (int x = 0; x < imgWidth; x += _editLevel._tileWidth)
                    pMap.DrawLine (gc, x, 0, x, imgHeight);
                for (int y = 0; y < imgHeight; y += _editLevel._tileHeight)
                    pMap.DrawLine (gc, 0, y, imgWidth, y);
            }

            tilesetDrawPane.SetFromPixmap (pMap, mask);

            //----------------------
        }
开发者ID:dufresnep,项目名称:gs2emu-googlecode,代码行数:29,代码来源:MainWindow.cs

示例15: OnBtnGenerateClicked

    protected void OnBtnGenerateClicked(object sender, EventArgs e)
    {
        try {
            BarcodeLib.Barcode codeBar = new BarcodeLib.Barcode ();
            codeBar.Alignment = BarcodeLib.AlignmentPositions.CENTER;
            codeBar.IncludeLabel = true;
            codeBar.LabelPosition = BarcodeLib.LabelPositions.BOTTOMCENTER;

            BarcodeLib.TYPE bCodeType = (BarcodeLib.TYPE)Enum.Parse (typeof(BarcodeLib.TYPE), cmbBarCodeType.ActiveText.ToString ());
            System.Drawing.Image imgTmpCodeBar = codeBar.Encode (bCodeType, txtData.Text.Trim (), System.Drawing.Color.Black, System.Drawing.Color.White, 300, 300);

            MemoryStream memoryStream = new MemoryStream();
            imgTmpCodeBar.Save(memoryStream, ImageFormat.Png);
            Gdk.Pixbuf pb = new Gdk.Pixbuf (memoryStream.ToArray());

            imgCodeBar.Pixbuf = pb;

        } catch (Exception err) {
            MessageDialog dlg = new MessageDialog (this, DialogFlags.Modal, MessageType.Error, ButtonsType.Ok, string.Format ("Ocurrió un error \n {0}", err.Message));
            dlg.Run ();
            dlg.Destroy ();
            dlg.Dispose ();
            dlg = null;
        }
    }
开发者ID:xmalmorthen,项目名称:monoCodeBarGenerator,代码行数:25,代码来源:MainWindow.cs


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