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


C# Pixbuf.Fill方法代码示例

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


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

示例1: MakeThumbnail

		/// <summary>
		/// Crea una imagen mas pequeña a partir de otra.
		/// </summary>
		/// <param name="image">
		/// La imagen a la que se le quiere hacer una previsualización.
		/// </param>
		/// <param name="size">
		/// El tamaño de la previsualización.
		/// </param>
		public static Gdk.Pixbuf MakeThumbnail(Gdk.Pixbuf image, int size)
		{
			float scale;
			
			// La escalamos para que no se distorsione.
			if(image.Width > image.Height)
			{
				scale = (float)(size)/image.Width;
			}
			else
			{
				scale = (float)(size)/image.Height;
			}
			
			int newWidth = (int)(scale*image.Width);
			int newHeight = (int)(scale*image.Height);
			
			Pixbuf res = 
				new Pixbuf(image.Colorspace, image.HasAlpha, image.BitsPerSample, size, size);
			
			res.Fill(0xFFFFFFFF);
				
			image.Scale(res,
			            0,0,
			            size, size,
			            (size -newWidth)/2,(size-newHeight)/2,
			            scale, scale, 
			            Gdk.InterpType.Bilinear );
			
				
			return res;
			
		}
开发者ID:coler706,项目名称:mathtextrecognizer,代码行数:42,代码来源:ImageUtils.cs

示例2: 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);
            sub.Fill (0x00000000);
            return output;
        }
开发者ID:Yetangitu,项目名称:f-spot,代码行数:9,代码来源:BlackoutEditor.cs

示例3: CreateEffect

	unsafe static Pixbuf CreateEffect (int src_width, int src_height, ConvFilter filter, int radius, int offset, double opacity)
	{
		Pixbuf dest;
		int x, y, i, j;
		int src_x, src_y;
		int suma;
		int dest_width, dest_height;
		int dest_rowstride;
		byte* dest_pixels;

		dest_width = src_width + 2 * radius + offset;
		dest_height = src_height + 2 * radius + offset;
		
		dest = new Pixbuf (Colorspace.Rgb, true, 8, dest_width, dest_height);
		dest.Fill (0);
	  
		dest_pixels = (byte*) dest.Pixels;
		
		dest_rowstride = dest.Rowstride;
	  
		for (y = 0; y < dest_height; y++)
		{
			for (x = 0; x < dest_width; x++)
			{
				suma = 0;

				src_x = x - radius;
				src_y = y - radius;

				/* We don't need to compute effect here, since this pixel will be 
				 * discarded when compositing */
				if (src_x >= 0 && src_x < src_width && src_y >= 0 && src_y < src_height) 
				   continue;

				for (i = 0; i < filter.size; i++)
				{
					for (j = 0; j < filter.size; j++)
					{
						src_y = -(radius + offset) + y - (filter.size >> 1) + i;
						src_x = -(radius + offset) + x - (filter.size >> 1) + j;

						if (src_y < 0 || src_y >= src_height ||
						    src_x < 0 || src_x >= src_width)
						  continue;

						suma += (int) (((byte)0xFF) * filter.data [i * filter.size + j]);
					}
				}
				
				byte r = (byte) (suma * opacity);
				dest_pixels [y * dest_rowstride + x * 4 + 3] = r;
			}
		}
		return dest;
	}
开发者ID:FreeBSD-DotNet,项目名称:monodevelop,代码行数:55,代码来源:Shadow.cs

示例4: CreateEmptyCursor

 public static Cursor CreateEmptyCursor(Display display)
 {
     try {
         Gdk.Pixbuf empty = new Gdk.Pixbuf (Gdk.Colorspace.Rgb, true, 8, 1, 1);
         empty.Fill (0x00000000);
         return new Gdk.Cursor (display, empty, 0, 0);
     } catch (Exception e){
         Log.Exception (e);
         return null;
     }
 }
开发者ID:Yetangitu,项目名称:f-spot,代码行数:11,代码来源:GdkUtils.cs

示例5: ColorMenuItem

        public ColorMenuItem(int markIndex, System.Drawing.Color color)
            : base(color.Name)
        {
            this.markIndex = markIndex;
              this.color = color;

              int fillColor = (color.R << 24) + (color.G << 16) + (color.B << 8) + 255;
              Pixbuf pixbuf = new Pixbuf(Colorspace.Rgb, false, 24, 120, 120);
              pixbuf.Fill((uint) fillColor);
              Gtk.Image markImage = new Gtk.Image(pixbuf);
              this.Image = markImage;
        }
开发者ID:magicmonty,项目名称:ShuffleMeter,代码行数:12,代码来源:ColorMenuItem.cs

示例6: Rating

        public Rating(int rating, bool editable)
        {
            this.rating = rating;
            this.editable = editable;

            MouseOver = false;
            EnterNotifyEvent += HandleMouseEnter;
            LeaveNotifyEvent += HandleMouseLeave;

            VisibleWindow = false;
            CanFocus = true;

            display_pixbuf = new Pixbuf (Gdk.Colorspace.Rgb, true, 8, Width, Height);

            display_pixbuf.Fill (0xffffff00);
            DrawRating (DisplayPixbuf, Value);
            Add (new Gtk.Image (display_pixbuf));

            ShowAll ();
        }
开发者ID:iainlane,项目名称:f-spot,代码行数:20,代码来源:Rating.cs

示例7: OnExposeEvent

		protected override bool OnExposeEvent (EventExpose evnt)
		{
			if (evnt.Window != GdkWindow)
				return true;

			if (extendable && Allocation.Width >= BackgroundPixbuf.Width + (2 * x_offset) + BackgroundTile.Width)
				BackgroundPixbuf = null;

			if (extendable && Allocation.Width < BackgroundPixbuf.Width + (2 * x_offset))
				BackgroundPixbuf = null;

			int xpad = 0, ypad = 0;
			if (Allocation.Width > BackgroundPixbuf.Width + (2 * x_offset))
				xpad = (int) (x_align * (Allocation.Width - (BackgroundPixbuf.Width + (2 * x_offset))));

			if (Allocation.Height > BackgroundPixbuf.Height + (2 * y_offset))
				ypad = (int) (y_align * (Allocation.Height - (BackgroundPixbuf.Height + (2 * y_offset))));

			GdkWindow.DrawPixbuf (Style.BackgroundGC (StateType.Normal), BackgroundPixbuf, 
					0, 0, x_offset + xpad, y_offset + ypad, 
					BackgroundPixbuf.Width, BackgroundPixbuf.Height, Gdk.RgbDither.None, 0, 0);

			//drawing the icons...
			start_indexes = new Hashtable ();

			Pixbuf icon_pixbuf = new Pixbuf (Gdk.Colorspace.Rgb, true, 8, BackgroundPixbuf.Width, thumb_size);
			icon_pixbuf.Fill (0x00000000);

			Pixbuf current = GetPixbuf ((int) Math.Round (Position));
			int ref_x = (int)(icon_pixbuf.Width / 2.0 - current.Width * (Position + 0.5f - Math.Round (Position))); //xpos of the reference icon

			int start_x = ref_x;
			for (int i = (int) Math.Round (Position); i < selection.Collection.Count; i++) {
				current = GetPixbuf (i, ActiveItem == i);
				current.CopyArea (0, 0, Math.Min (current.Width, icon_pixbuf.Width - start_x) , current.Height, icon_pixbuf, start_x, 0);
				start_indexes [start_x] = i; 
				start_x += current.Width + spacing;
				if (start_x > icon_pixbuf.Width)
					break;
			}
			filmstrip_end_pos = start_x;

			start_x = ref_x;
			for (int i = (int) Math.Round (Position) - 1; i >= 0; i--) {
				current = GetPixbuf (i, ActiveItem == i);
				start_x -= (current.Width + spacing);
				current.CopyArea (Math.Max (0, -start_x), 0, Math.Min (current.Width, current.Width + start_x), current.Height, icon_pixbuf, Math.Max (start_x, 0), 0);
				start_indexes [Math.Max (0, start_x)] = i; 
				if (start_x < 0)
					break;
			}
			
			GdkWindow.DrawPixbuf (Style.BackgroundGC (StateType.Normal), icon_pixbuf,
					0, 0, x_offset + xpad, y_offset + ypad + thumb_offset,
					icon_pixbuf.Width, icon_pixbuf.Height, Gdk.RgbDither.None, 0, 0);

			icon_pixbuf.Dispose ();

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

示例8: RenderEventColor

	private void RenderEventColor (Gtk.TreeViewColumn column, Gtk.CellRenderer cell, Gtk.TreeModel model, Gtk.TreeIter iter)
	{
		if (model.GetValue (iter, 0) is CustomNotification) {
			CustomNotification tevent = (CustomNotification)model.GetValue (iter, 0);
			Gdk.Pixbuf pb = new Gdk.Pixbuf (Gdk.Colorspace.Rgb, false, 8, 16, 16);
			pb.Fill ((uint)(0xff + tevent.Color.R * 0x1000000 + tevent.Color.G * 0x10000 + tevent.Color.B * 0x100));
			(cell as Gtk.CellRendererPixbuf).Pixbuf = pb;
		}
	}
开发者ID:pipermatt,项目名称:blinkstick-client,代码行数:9,代码来源:MainWindow.cs

示例9: PhotoView

		public PhotoView (IBrowsableCollection query)
			: base ()
		{
			this.query = query;
	
			commit_delay = new FSpot.Delay (1000, new GLib.IdleHandler (CommitPendingChanges));
			this.Destroyed += HandleDestroy;
	
			Name = "ImageContainer";
			Box vbox = new VBox (false, 6);
			Add (vbox);
	
		        background = new EventBox ();
			Frame frame = new Frame ();
			background.Add (frame);
	
			frame.ShadowType = ShadowType.In;
			vbox.PackStart (background, true, true, 0);
			
			Box inner_vbox = new VBox (false , 2);
	
			frame.Add (inner_vbox);
			
			BrowsablePointer bp = new BrowsablePointer (query, -1);
			photo_view = new FSpot.PhotoImageView (bp);
	
			filmstrip = new Filmstrip (bp);
			Gdk.Pixbuf bg = new Gdk.Pixbuf (Gdk.Colorspace.Rgb, true, 8, 1, 69);
			bg.Fill (0x00000000);
			filmstrip.BackgroundTile = bg;
			filmstrip.ThumbOffset = 1;
			filmstrip.Spacing = 4;
			inner_vbox.PackStart (filmstrip, false, false, 0);
	
			photo_view.PhotoChanged += HandlePhotoChanged;
	
			photo_view_scrolled = new ScrolledWindow (null, null);

			photo_view_scrolled.SetPolicy (PolicyType.Automatic, PolicyType.Automatic);
			photo_view_scrolled.ShadowType = ShadowType.None;
			photo_view_scrolled.Add (photo_view);
			photo_view_scrolled.Child.ButtonPressEvent += HandleButtonPressEvent;
			photo_view.AddEvents ((int) EventMask.KeyPressMask);
			inner_vbox.PackStart (photo_view_scrolled, true, true, 0);
			
			HBox inner_hbox = new HBox (false, 2);
			//inner_hbox.BorderWidth = 6;
	
			tag_view = new Widgets.TagView (MainWindow.ToolTips);
			inner_hbox.PackStart (tag_view, false, true, 0);
	
			Label comment = new Label (Catalog.GetString ("Comment:"));
			inner_hbox.PackStart (comment, false, false, 0);
			description_entry = new Entry ();
			inner_hbox.PackStart (description_entry, true, true, 0);
			description_entry.Changed += HandleDescriptionChanged;
	
			rating = new Widgets.Rating();
			inner_hbox.PackStart (rating, false, false, 0);
			rating.Changed += HandleRatingChanged;
	
			SetColors ();
			
			inner_vbox.PackStart (inner_hbox, false, true, 0);
	
			vbox.ShowAll ();
	
			Realized += delegate (object o, EventArgs e) {SetColors ();};
		}
开发者ID:guadalinex-archive,项目名称:guadalinex-v6,代码行数:69,代码来源:PhotoView.cs

示例10: DrawRating

        public override void DrawRating(Pixbuf pbuf, int val)
        {
            // Clean pixbuf
            pbuf.Fill (0xffffff00);

            //Stars
            for (int i = 0; i < MaxRating; i ++)
                if (i <= val - 1)
                    IconRated.CopyArea (0, 0, IconRated.Width, IconRated.Height,
                            pbuf, i * IconRated.Width, 0);
        }
开发者ID:iainlane,项目名称:f-spot,代码行数:11,代码来源:Rating.cs

示例11: Empty

		public Gdk.Cursor Empty () 
		{
			Gdk.Cursor cempty = null;
			
			try {
				Gdk.Pixbuf empty = new Gdk.Pixbuf (Gdk.Colorspace.Rgb, true, 8, 1, 1);
			        empty.Fill (0x00000000);
				cempty = new Gdk.Cursor (GdkWindow.Display, empty, 0, 0);
			} catch (System.Exception e){
				System.Console.WriteLine (e.ToString ());
				return null;
			}

			return cempty;
		}
开发者ID:AminBonyadUni,项目名称:facedetect-f-spot,代码行数:15,代码来源:SlideView.cs

示例12: GetPixbuf

        protected virtual Pixbuf GetPixbuf(int i, bool highlighted)
        {
            Pixbuf current = null;
            SafeUri uri = (selection.Collection [i]).DefaultVersion.Uri;
            try {
                var pixbuf = thumb_cache.Get (uri);
                if (pixbuf != null)
                    current = pixbuf.ShallowCopy ();
            } catch (IndexOutOfRangeException) {
                current = null;
            }

            if (current == null) {
                var pixbuf = XdgThumbnailSpec.LoadThumbnail (uri, ThumbnailSize.Large, null);
                if (pixbuf == null) {
                    ThumbnailLoader.Default.Request (uri, ThumbnailSize.Large, 0);
                    current = FSpot.Core.Global.IconTheme.LoadIcon ("gtk-missing-image", ThumbSize, (IconLookupFlags)0);
                } else {
                    if (SquaredThumbs) {
                        current = PixbufUtils.IconFromPixbuf (pixbuf, ThumbSize);
                    } else {
                        current = pixbuf.ScaleSimple (ThumbSize, ThumbSize, InterpType.Nearest);
                    }
                    pixbuf.Dispose ();
                    thumb_cache.Add (uri, current);
                }
            }

            //FIXME: we might end up leaking a pixbuf here
            Cms.Profile screen_profile;
            if (ColorManagement.Profiles.TryGetValue (Preferences.Get<string> (Preferences.COLOR_MANAGEMENT_DISPLAY_PROFILE), out screen_profile)) {
                Pixbuf t = current.Copy ();
                current = t;
                ColorManagement.ApplyProfile (current, screen_profile);
            }

            // Add a four pixel white border around the thumbnail
            // for some reason we cannot use "using" here, it looks like the pixbuf copy is not done properly
            Pixbuf whiteBorder = new Pixbuf (Colorspace.Rgb, true, 8, current.Width, current.Height);
            whiteBorder.Fill (0);
            current.CopyArea (1, 1, current.Width - 8, current.Height - 8, whiteBorder, 4, 4);
            current = whiteBorder;

            if (!highlighted)
                return current;

            Pixbuf highlight = new Pixbuf (Colorspace.Rgb, true, 8, current.Width, current.Height);

            highlight.Fill (ColorToInt (Style.Light (StateType.Selected)));

            // Add a two pixel highlight around the thumbnail
            current.CopyArea (2, 2, current.Width - 4, current.Height - 4, highlight, 2, 2);

            return highlight;
        }
开发者ID:Yetangitu,项目名称:f-spot,代码行数:55,代码来源:Filmstrip.cs

示例13: HandlePixbufLoaded

        private void HandlePixbufLoaded(FSpot.PixbufCache Cache, FSpot.PixbufCache.CacheEntry entry)
        {
            Gdk.Pixbuf result = entry.ShallowCopyPixbuf ();
            int order = (int) entry.Data;

            if (result == null)
                return;

            // We have to do the scaling here rather than on load because we need to preserve the
            // Pixbuf option iformation to verify the thumbnail validity later
            int width, height;
            PixbufUtils.Fit (result, ThumbnailWidth, ThumbnailHeight, false, out width, out height);
            if (result.Width > width && result.Height > height) {
                //  Log.Debug ("scaling");
                Gdk.Pixbuf temp = PixbufUtils.ScaleDown (result, width, height);
                result.Dispose ();
                result = temp;
            } else if (result.Width < ThumbnailWidth && result.Height < ThumbnailHeight) {
                // FIXME this is a workaround to handle images whose actual size is smaller than
                // the thumbnail size, it needs to be fixed at a different level.
                Gdk.Pixbuf temp = new Gdk.Pixbuf (Gdk.Colorspace.Rgb, true, 8, ThumbnailWidth, ThumbnailHeight);
                temp.Fill (0x00000000);
                result.CopyArea (0, 0,
                        result.Width, result.Height,
                        temp,
                        (temp.Width - result.Width)/ 2,
                        temp.Height - result.Height);

                result.Dispose ();
                result = temp;
            }

            Cache.Update (entry, result);
            InvalidateCell (order);
        }
开发者ID:Yetangitu,项目名称:f-spot,代码行数:35,代码来源:CollectionCellGridView.cs

示例14: HandleTagSelectionDragBegin

	void HandleTagSelectionDragBegin (object sender, DragBeginArgs args)
	{
		Tag [] tags = tag_selection_widget.TagHighlight;
		int len = tags.Length;
		int size = 32;
		int csize = size/2 + len * size / 2 + 2;
		
		Pixbuf container = new Pixbuf (Gdk.Colorspace.Rgb, true, 8, csize, csize);
		container.Fill (0x00000000);
		
		bool use_icon = false;;
		while (len-- > 0) {
			Pixbuf thumbnail = tags[len].Icon;
			
			if (thumbnail != null) {
				Pixbuf small = PixbufUtils.ScaleToMaxSize (thumbnail, size, size);				
				
				int x = len * (size/2) + (size - small.Width)/2;
				int y = len * (size/2) + (size - small.Height)/2;

				small.Composite (container, x, y, small.Width, small.Height, x, y, 1.0, 1.0, Gdk.InterpType.Nearest, 0xff);
				small.Dispose ();

				use_icon = true;
			}
		}
		if (use_icon)
			Gtk.Drag.SetIconPixbuf (args.Context, container, 0, 0);
		container.Dispose ();
	}
开发者ID:guadalinex-archive,项目名称:guadalinex-v6,代码行数:30,代码来源:MainWindow.cs

示例15: BlackFade

		private Pixbuf BlackFade (Pixbuf current, Pixbuf prev, Pixbuf next, double percent)
		{ 
			int width = Allocation.Width;
			int height = Allocation.Height;
			
			current.Fill (0);		
			
			if (percent < 0.5)
				prev.Composite (current, 0,0, width, height, 0, 0, 1, 1,
						Gdk.InterpType.Nearest, (int)System.Math.Round (255  * (1 - percent * 2)));
			else
				next.Composite (current, 0,0, width, height, 0, 0, 1, 1,
						Gdk.InterpType.Nearest, (int)System.Math.Round (255 * (percent * 2 - 1)));
			return current;
		}
开发者ID:AminBonyadUni,项目名称:facedetect-f-spot,代码行数:15,代码来源:SlideView.cs


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