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


C# Pixbuf.ScaleSimple方法代码示例

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


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

示例1: AmpacheSource

 public AmpacheSource () : base ("Ampache", "Ampache", 90, "Ampache")
 {
     _trackModel = new MemoryTrackListModel();
     Pixbuf icon = new Pixbuf (System.Reflection.Assembly.GetExecutingAssembly ()
                               .GetManifestResourceStream ("ampache.png"));
     Properties.Set<Pixbuf> ("Icon.Pixbuf_16", icon.ScaleSimple (16, 16, InterpType.Bilinear));
     ServiceManager.SourceManager.AddSource(this);
     preferences = new AmpachePreferences(this);
 }
开发者ID:h0rm,项目名称:No.Noise,代码行数:9,代码来源:AmpacheSource.cs

示例2: getScreenShot

        public byte[] getScreenShot()
        {
            int width, height;
            this.GetSize(out width, out height);
            Gdk.Pixbuf screenShot=new Gdk.Pixbuf(Gdk.Colorspace.Rgb, false, 8, width, height);
            screenShot=screenShot.CreateFromDrawable (this.GdkWindow, this.GdkWindow.Colormap, 0, 0, 0, 0, width, height);
            screenShot.ScaleSimple(100,80,Gdk.InterpType.Bilinear);

            return screenShot.SaveToBuffer("png");
        }
开发者ID:mauroguardarini,项目名称:sugar-sharp,代码行数:10,代码来源:Window.cs

示例3: Process

        protected override Pixbuf Process(Pixbuf input, Cms.Profile input_profile)
        {
            Pixbuf output = input.Copy ();

            Pixbuf sub = new Pixbuf (output, State.Selection.X, State.Selection.Y,
                    State.Selection.Width, State.Selection.Height);
            /* lazy man's pixelate: scale down and then back up */
            Pixbuf down = sub.ScaleSimple (State.Selection.Width/75, State.Selection.Height/75,
                    InterpType.Nearest);
            Pixbuf up = down.ScaleSimple (State.Selection.Width, State.Selection.Height,
                    InterpType.Nearest);
            up.CopyArea (0, 0, State.Selection.Width, State.Selection.Height, sub, 0, 0);
            return output;
        }
开发者ID:Yetangitu,项目名称:f-spot,代码行数:14,代码来源:PixelateEditor.cs

示例4: Client_DownloadDataCompleted

 void Client_DownloadDataCompleted(object sender, DownloadDataCompletedEventArgs e)
 {
     try {
         byte[] data = e.Result;
         Pixbuf temp = new Pixbuf(data);
         if (temp.Width == 100 && temp.Height == 100) {
             ReleaseImage();
             this.Artwork = temp.ScaleSimple(150,150,InterpType.Bilinear);
         }
         temp.Dispose();
     } catch (Exception ex) {
         Console.WriteLine(ex.Source);
         Console.WriteLine(ex.StackTrace);
         ReleaseImage();
     }
 }
开发者ID:peter-gregory,项目名称:ClockRadio,代码行数:16,代码来源:FindArtwork.cs

示例5: GetIcon

        public static Gdk.Pixbuf GetIcon(string iconName, int size)
        {
            try {
                return Gtk.IconTheme.Default.LoadIcon (iconName, size, 0);
            } catch (GLib.GException) {}

            try {
                Gdk.Pixbuf ret = new Gdk.Pixbuf (null, iconName + ".png");
                return ret.ScaleSimple (size, size, Gdk.InterpType.Bilinear);
            } catch (ArgumentException) {}

            // TODO: This is a temporary fix to allow installing all icons as assembly
            //       resources. The proper thing to do is to ship the actual icons,
            //       and append to the default gtk+ icon theme path. See Tomboy.
            try {
                Gdk.Pixbuf ret = new Gdk.Pixbuf (null, String.Format ("{0}-{1}.png", iconName, size));
                return ret.ScaleSimple (size, size, Gdk.InterpType.Bilinear);
            } catch (ArgumentException) { }

            Debug.WriteLine ("Unable to load icon '{0}'.", iconName);
            return null;
        }
开发者ID:mono-soc-2012,项目名称:Tasque,代码行数:22,代码来源:Utilities.cs

示例6: Animate

	static bool Animate ()
	{
		if (walking) {
			current_frame_num += FRAME_STEP;

			if (current_frame_num > WALK_CYCLE_END) {
				num_walks++;
				if (num_walks > 10) {
					num_walks = 0;
					walking = false;
					current_frame_num = DEATH_CYCLE_START;
				}
				else {
					current_frame_num = WALK_CYCLE_START;
				}
			}
		}
		else /* dying */ {
			if (current_frame_num == DEATH_CYCLE_END) {
				death_timer ++;
				if (death_timer == 30) {
					death_timer = 0;
					walking = true;
					current_frame_num = WALK_CYCLE_START;
				}
			}
			else
				current_frame_num ++;
		}

		byte[] pixbuf_data = CreatePixbufData (grp.GetFrame (current_frame_num),
						       grp.Width, grp.Height,
						       Palette.default_palette);

		Gdk.Pixbuf temp = new Gdk.Pixbuf (pixbuf_data,
						  Colorspace.Rgb,
						  false,
						  8,
						  grp.Width, grp.Height,
						  grp.Width * 3,
						  null);

		current_frame = temp.ScaleSimple (grp.Width * 2, grp.Height * 2, InterpType.Nearest);

		temp.Dispose();

		drawing_area.QueueDraw ();

		return true;
	}
开发者ID:carriercomm,项目名称:scsharp,代码行数:50,代码来源:animate-grp.cs

示例7: RedrawBoard

    public void RedrawBoard(int pixelDim)
    {
        pixStep = pixelDim / xyDim;
        int min = xyDim * pixStep + 2;
        pBoard = new Gdk.Pixbuf (Gdk.Colorspace.Rgb, true,
            8, min, min);

        // SVG does not work well under windows yet
        /*string goodSmiley = "smiley100.svg";
        string badSmiley = "smiley111.svg";
        stone0 = Rsvg.Pixbuf.FromFileAtSize (ownPlayer == 0 ? goodSmiley : badSmiley,
            pixStep, pixStep);
        stone1 = Rsvg.Pixbuf.FromFileAtSize (ownPlayer == 1 ? goodSmiley : badSmiley,
            pixStep, pixStep);*/
        string goodSmiley = "smiley100.png";
        string badSmiley = "smiley111.png";

        stone0 = new Gdk.Pixbuf (ownPlayer == 0 ? goodSmiley : badSmiley);
        stone0 = stone0.ScaleSimple (pixStep, pixStep, Gdk.InterpType.Bilinear);

        stone1 = new Gdk.Pixbuf (ownPlayer == 1 ? goodSmiley : badSmiley);
        stone1 = stone1.ScaleSimple (pixStep, pixStep, Gdk.InterpType.Bilinear);

        // Draw board full with stones (DEBUG)
        for (int y = 0 ; y < xyDim ; ++y) {
            for (int x = 0 ; x < xyDim ; ++x) {
                if (board[x, y] == 0)
                    DrawStone (0, x, y);
                else if (board[x, y] == 1)
                    DrawStone (1, x, y);
            }
        }
        boardSizeChanged = min;
        RedrawLines ();

        boardImage.FromPixbuf = pBoard;
    }
开发者ID:gomoku,项目名称:Stahlfaust---Gomoku-AI-player,代码行数:37,代码来源:FiveGUI.cs

示例8: Notification

        public void Notification(Pixbuf image, string stripUrl, string name, string author)
        {
            const int maxWidth = 387;
            Pixbuf pixbuf = image.ScaleSimple (maxWidth, image.Height * maxWidth / image.Width, InterpType.Hyper);
            image.Dispose ();

            IDictionary<string, object> hints = new Dictionary<string, object> ();
            IconData icon_data = new IconData ();
            icon_data.Width = pixbuf.Width;
            icon_data.Height = pixbuf.Height;
            icon_data.Rowstride = pixbuf.Rowstride;
            icon_data.HasAlpha = pixbuf.HasAlpha;
            icon_data.BitsPerSample = pixbuf.BitsPerSample;
            icon_data.NChannels = pixbuf.NChannels;

            int len = (icon_data.Height - 1) * icon_data.Rowstride + icon_data.Width *
                ((icon_data.NChannels * icon_data.BitsPerSample + 7) / 8);
            icon_data.Pixels = new byte[len];
            System.Runtime.InteropServices.Marshal.Copy (pixbuf.Pixels, icon_data.Pixels, 0, len);

            hints["icon_data"] = icon_data;

            int x = Gdk.Screen.Default.Width / 2;
            int y = 0;
            hints["x"] = x;
            hints["y"] = y;

            proxy.Notify ("zencomic", 0, string.Empty, name + " of " + author,
                          string.Empty, new string[0], hints, popupDelay * 1000);
        }
开发者ID:garuma,项目名称:zencomic,代码行数:30,代码来源:Notifications.cs

示例9: OnOpenActionActivated

        protected void OnOpenActionActivated(object sender, EventArgs e)
        {
            TreeIter iter;
            FileChooserDialog Chooser = new FileChooserDialog("Выберите изображения для загрузки...",
                                                          this,
                                                          FileChooserAction.Open,
                                                          "Отмена", ResponseType.Cancel,
                                                          "Открыть", ResponseType.Accept );
            Chooser.SelectMultiple = true;

            FileFilter Filter = new FileFilter();
            Filter.AddPixbufFormats ();
            Filter.Name = "Все изображения";
            Chooser.AddFilter(Filter);

            if((ResponseType) Chooser.Run () == ResponseType.Accept)
            {
                Chooser.Hide();
                progresswork.Text = "Загрузка изображений...";
                progresswork.Adjustment.Upper = Chooser.Filenames.Length;
                foreach(string File in Chooser.Filenames)
                {
                    logger.Debug(File);

                    iter = ImageListNewDoc();

                    FileStream fs = new FileStream(File, FileMode.Open, FileAccess.Read);
                    Pixbuf image = new Pixbuf(fs);
                    double ratio = 150f / Math.Max(image.Height, image.Width);
                    Pixbuf thumb = image.ScaleSimple((int)(image.Width * ratio),(int)(image.Height * ratio), InterpType.Bilinear);
                    fs.Close();

                    ImageList.AppendValues (iter,
                                            0,
                                            System.IO.Path.GetFileName(File),
                                            File,
                                            null,
                                            thumb,
                                            image,
                                            true,
                                            "",
                                            "");
                    progresswork.Adjustment.Value++;
                    MainClass.WaitRedraw();
                }
                treeviewImages.ExpandAll ();
                progresswork.Text = "Ок";
                progresswork.Fraction = 0;
            }
            Chooser.Destroy ();
        }
开发者ID:QualitySolution,项目名称:earchive,代码行数:51,代码来源:InputDocs.cs

示例10: CreateWidgets

 private Widget CreateWidgets()
 {
     EventBox widgetEventbox = new EventBox();
             widgetEventbox.ModifyBg(StateType.Normal, this.Style.Background(StateType.Normal));
                 VBox vbox = new VBox(false, 0);
                 widgetEventbox.Add(vbox);
                 KeyRecoveryPixbuf = new Gdk.Pixbuf(Util.ImagesPath("ifolder48.png"));
                 KeyRecoveryPixbuf = KeyRecoveryPixbuf.ScaleSimple(48, 48, Gdk.InterpType.Bilinear);
                 KeyRecoveryDruid = new Gnome.Druid();
                 vbox.PackStart(KeyRecoveryDruid, false,false ,0);
                 KeyRecoveryDruid.ShowHelp = true;
                 KeyRecoveryDruid.Help += new EventHandler(OnKeyRecoveryWizardHelp);
        KeyRecoveryDruid.AppendPage(CreateDomainSelectionPage());
        KeyRecoveryDruid.AppendPage(CreateEnterPassphrasePage());
        KeyRecoveryDruid.AppendPage(CreateInfoPage());
                 KeyRecoveryDruid.AppendPage(CreateSelectionPage());
                 KeyRecoveryDruid.AppendPage(CreateSingleWizPage());
        KeyRecoveryDruid.AppendPage(CreateImportKeyPage());
                KeyRecoveryDruid.AppendPage(CreateExportKeyPage());
        KeyRecoveryDruid.AppendPage(CreateEmailPage());
       KeyRecoveryDruid.AppendPage(CreateFinishPage());
                 return widgetEventbox;
 }
开发者ID:RoDaniel,项目名称:featurehouse,代码行数:23,代码来源:KeyRecoveryWizard.cs

示例11: DrawMatrix

    void DrawMatrix(Matrix matrix)
    {
        if (matrix == null)
            return;

        var buffer = ToBitmap(matrix, rowWiseView);
        var pb = new Pixbuf(buffer, false, 8,
                               matrix.Width,
                               matrix.Height, matrix.Width * 3);
        matrixImage.Pixbuf = pb.ScaleSimple(300, 300, InterpType.Nearest);
    }
开发者ID:pxqr,项目名称:nanon,代码行数:11,代码来源:MainWindow.cs

示例12: ProcessFiles

 // To be run in a thread by OnOpenButtonClicked method.
 private void ProcessFiles()
 {
     string[] filenames = null;
       filenames = filechooserdialog1.Filenames;
       if (filenames == null) return;
       PersistentInformation.GetInstance().UploadFilename = filenames[0];
       Gdk.Pixbuf thumbnail;
       Gdk.Pixbuf smallimage;
       Gdk.Pixbuf sqimage;
       Gtk.Application.Invoke(delegate{
     progressbar3.Adjustment.Lower = 0;
     progressbar3.Adjustment.Upper = filenames.Length;
     progressbar3.Adjustment.Value = 0;
     progressbar3.Text = "Processing files...";
     button10.Sensitive = false;
       });
       foreach (string filename in filenames) {
     Gtk.Application.Invoke(delegate{
       progressbar3.Adjustment.Value += 1;
     });
     try {
       Gdk.Pixbuf buf = new Gdk.Pixbuf(filename);
       thumbnail = buf.ScaleSimple(75, 75, Gdk.InterpType.Bilinear);
       smallimage = buf.ScaleSimple(240, 180, Gdk.InterpType.Bilinear);
       sqimage = buf.ScaleSimple(150, 150, Gdk.InterpType.Bilinear);
       buf.Dispose();
     } catch (GLib.GException) {
       continue;
       // Couldn't process the file.
     }
     Gtk.Application.Invoke(delegate{
       label16.Markup = GetInfo(filename);
       image6.Pixbuf = sqimage;
     });
     PersistentInformation.GetInstance().SetThumbnail(filename, thumbnail);
     thumbnail.Dispose();
     PersistentInformation.GetInstance().SetSmallImage(filename, smallimage);
     smallimage.Dispose();
     PersistentInformation.GetInstance().InsertEntryToUpload(filename);
       }
       Gtk.Application.Invoke(delegate{
     DeskFlickrUI.GetInstance().UpdateToolBarButtons();
     DeskFlickrUI.GetInstance().RefreshUploadPhotos();
     filechooserdialog1.Destroy();
     DeskFlickrUI.GetInstance().SetUploadWindow(true);
       });
 }
开发者ID:joshuacox,项目名称:dfo,代码行数:48,代码来源:UploadFileChooserUI.cs

示例13: InitializeNewsTreeView

    private void InitializeNewsTreeView()
    {
        using (WebClient wc = new WebClient())
        {
            Gtk.ListStore model = new ListStore(typeof(Gdk.Pixbuf), typeof(string), typeof(string));
            pgeNewsTree.AppendColumn("Thumbnail", new CellRendererPixbuf(), "pixbuf", 0);
            pgeNewsTree.AppendColumn("Title", new CellRendererText(), "text", 1);
            pgeNewsTree.AppendColumn("Date", new CellRendererText(), "text", 2);
            for (int i = 0; i < PGENews.Count; i++)
            {
                wc.DownloadFile(PGENews[i].picture, Program.ProgramSettings.ConfigDirectory + System.IO.Path.DirectorySeparatorChar + i + ".png");
                Gdk.Pixbuf pix = new Gdk.Pixbuf(Program.ProgramSettings.ConfigDirectory + System.IO.Path.DirectorySeparatorChar + i + ".png");
                model.AppendValues(pix.ScaleSimple(50, 50, Gdk.InterpType.Bilinear), PGENews[i].title, PGENews[i].posted);
            }

            pgeNewsTree.Model = model;
        }
    }
开发者ID:tcvicio,项目名称:PGE-Project,代码行数:18,代码来源:MainWindow.cs

示例14: RefreshSongInformation

		public void RefreshSongInformation(AudioFile audioFile, long lengthBytes, int playlistIndex, int playlistCount)
		{
			Gtk.Application.Invoke(delegate{
				if(audioFile != null)
				{
			        // Refresh labels
					Console.WriteLine("MainWindow - RefreshSongInformation");
			        lblArtistName.Text = audioFile.ArtistName;
			        lblAlbumTitle.Text = audioFile.AlbumTitle;
			        lblSongTitle.Text = audioFile.Title;
			        lblSongFilePath.Text = audioFile.FilePath;	        
					//lblCurrentPosition.Text = audioFile.Position;
					lblCurrentLength.Text = audioFile.Length;
								
					lblCurrentFileType.Text = audioFile.FileType.ToString();
					lblCurrentBitrate.Text = audioFile.Bitrate.ToString();
					lblCurrentSampleRate.Text = audioFile.SampleRate.ToString();
					lblCurrentBitsPerSample.Text = audioFile.BitsPerSample.ToString();
								
					//Pixbuf stuff = new Pixbuf("icon48.png");
					//stuff = stuff.ScaleSimple(150, 150, InterpType.Bilinear);
					//imageAlbumCover.Pixbuf = stuff;
					
					System.Drawing.Image drawingImage = AudioFile.ExtractImageForAudioFile(audioFile.FilePath);			
					
					if(drawingImage != null)
					{
						// Resize image and set cover
						drawingImage = SystemDrawingHelper.ResizeImage(drawingImage, 150, 150);
						imageAlbumCover.Pixbuf = ImageToPixbuf(drawingImage);
					}
					else
					{
						// Get Unix-style directory information (i.e. case sensitive file names)
						if(!String.IsNullOrEmpty(audioFile.FilePath))
						{
							try
							{
								bool imageFound = false;
								string folderPath = System.IO.Path.GetDirectoryName(audioFile.FilePath);
								UnixDirectoryInfo rootDirectoryInfo = new UnixDirectoryInfo(folderPath);
								
								// For each directory, search for new directories
								UnixFileSystemInfo[] infos = rootDirectoryInfo.GetFileSystemEntries();
				            	foreach (UnixFileSystemInfo fileInfo in rootDirectoryInfo.GetFileSystemEntries())
				            	{
									// Check if the file matches
									string fileName = fileInfo.Name.ToUpper();
									if((fileName.EndsWith(".JPG") ||
									    fileName.EndsWith(".JPEG") ||
									    fileName.EndsWith(".PNG") ||
									    fileName.EndsWith(".GIF")) &&
									   (fileName.StartsWith("FOLDER") ||
									 	fileName.StartsWith("COVER")))
									{
										// Get image from file
										imageFound = true;
										Pixbuf imageCover = new Pixbuf(fileInfo.FullName);
										imageCover = imageCover.ScaleSimple(150, 150, InterpType.Bilinear);
										imageAlbumCover.Pixbuf = imageCover;
									}
								}
								
								// Set empty image if not cover not found
								if(!imageFound)
									imageAlbumCover.Pixbuf = null;
							}
							catch
							{
								imageAlbumCover.Pixbuf = null;
							}
						}
						else
						{
							// Set empty album cover
							imageAlbumCover.Pixbuf = null;
						}
					}
					
					// Check if image cover is still empty
					if(imageAlbumCover.Pixbuf == null)
					{				
                        Pixbuf imageCover = ResourceHelper.GetEmbeddedImageResource("black.png");
						imageCover = imageCover.ScaleSimple(150, 150, InterpType.Bilinear);
						imageAlbumCover.Pixbuf = imageCover;
					}
				}
			});
		}		
开发者ID:pascalfr,项目名称:MPfm,代码行数:89,代码来源:MainWindow.cs

示例15: GetThumbnail

 // Retrive the thumbnail of the photo.
 public Gdk.Pixbuf GetThumbnail(string photoid)
 {
     Gdk.Pixbuf buf;
       try {
         string safephotoid = photoid.Replace("/", "_");
         if (_thumbnailbuffer.ContainsKey(safephotoid)) {
           return _thumbnailbuffer[safephotoid];
         }
         // Load the photo from the thumbnails directory.
         if (System.IO.File.Exists(GetThumbnailPath(safephotoid))) {
       	      buf = new Gdk.Pixbuf(GetThumbnailPath(safephotoid));
       	    } else {
       	      // Photo isn't present in thumbnails directory, so load it from
       	      // file directly. This photo must be an new upload photo.
       string filename = photoid;
       	      Gdk.Pixbuf original = new Gdk.Pixbuf(filename);
       	      buf = original.ScaleSimple(75, 75, Gdk.InterpType.Bilinear);
       	      original.Dispose();
       	      SetThumbnail(photoid, buf);
       	    }
       	    if (buf != null && !_thumbnailbuffer.ContainsKey(safephotoid)) {
       	      _thumbnailbuffer.Add(safephotoid, buf);
       	    }
       	    return buf;
       		} catch(Exception) {
       		  return null;
       		}
 }
开发者ID:joshuacox,项目名称:dfo,代码行数:29,代码来源:PersistentInformation.cs


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