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


C# Pixbuf.Composite方法代码示例

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


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

示例1: GetScaled

		private Pixbuf GetScaled (Pixbuf orig)
		{
			Gdk.Rectangle pos;
			int width = Allocation.Width;
			int height = Allocation.Height;
			double scale = PixbufUtils.Fit (orig, width, height, false, out pos.Width, out pos.Height);
			pos.X = (width - pos.Width) / 2;
			pos.Y = (height - pos.Height) / 2;
			
			Pixbuf scaled = new Pixbuf (Colorspace.Rgb, false, 8, width, height);
			scaled.Fill (0x000000); 
			
			Rectangle rect = new Rectangle (pos.X, pos.Y, 256, 256);
			Rectangle subarea;
			
			while (rect.Top < pos.Bottom) {
				while (rect.X < pos.Right) {
					if (IsRealized) 
						GdkWindow.ProcessUpdates (false);

					rect.Intersect (pos, out subarea);
					orig.Composite (scaled, subarea.X, subarea.Y, 
							subarea.Width, subarea.Height,
							pos.X, pos.Y, scale, scale,
							Gdk.InterpType.Bilinear,
							255);
					rect.X += rect.Width;
				}
				rect.X = pos.X;
				rect.Y += rect.Height;
			}
			
			orig.Dispose ();
			return scaled;
		}
开发者ID:AminBonyadUni,项目名称:facedetect-f-spot,代码行数:35,代码来源:SlideView.cs

示例2: RenderWaveform

    private Pixbuf RenderWaveform(Pixbuf original, long elapsed, long total, bool showProgress)
    {
        uint highlightColor = 0xf46c13FF;
        uint lowlightColor = 0xc9c9c9FF;

        Pixbuf p = original;

        float ratio = (float)p.Height / (float)p.Width;
        int width = 500;

        float progressRatio =  (float)elapsed / (float)total;

        int newHeight = (int)(width * ratio);

        int progressWidth = (int)(width * progressRatio);

        Pixbuf scaled = p.ScaleSimple(width, newHeight, Gdk.InterpType.Bilinear);

        Pixbuf bg = new Pixbuf(Gdk.Colorspace.Rgb, true, 8, width, newHeight);
        bg.Fill(lowlightColor);

        if (progressWidth > 0 && showProgress) {

            Pixbuf highlight = new Pixbuf(Gdk.Colorspace.Rgb, true, 8, progressWidth, newHeight);
            highlight.Fill(highlightColor);

            highlight.Composite(bg, 0, 0, progressWidth, newHeight, 0, 0, 1, 1, Gdk.InterpType.Bilinear, 255);

        }

        scaled.Composite(bg, 0, 0, width, newHeight, 0, 0, 1, 1, Gdk.InterpType.Bilinear, 255);

        return bg;
    }
开发者ID:danhigham,项目名称:MonoCloud,代码行数:34,代码来源:MainWindow.cs

示例3: 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

示例4: CrossFade

		private Pixbuf CrossFade (Pixbuf current, Pixbuf prev, Pixbuf next, double percent)
		{ 
			Rectangle area = new Rectangle (0, 0, Allocation.Width, Allocation.Height);
			BlockProcessor proc = new BlockProcessor (area, 256);
			Rectangle subarea;

			while (proc.Step (out subarea)) {
				if (IsRealized)
					GdkWindow.ProcessUpdates (false);
				
				prev.CopyArea (subarea.X, subarea.Y, subarea.Width, subarea.Height, current, subarea.X, subarea.Y);
				next.Composite (current, subarea.X, subarea.Y, subarea.Width, subarea.Height, 0, 0, 1, 1,
						Gdk.InterpType.Nearest, (int) System.Math.Round (255 * percent));
			}
			return current;
		}
开发者ID:AminBonyadUni,项目名称:facedetect-f-spot,代码行数:16,代码来源:SlideView.cs

示例5: AddItemToCurrentMarketGroup

    void AddItemToCurrentMarketGroup(ECM.EveItem item, TreeModel model, TreeIter iter)
    {
        if (vbbMarketGroups.IsRealized == false)
            vbbMarketGroups.Realize();

        Image itemPic = new Image();
        itemPic.PixbufAnimation = new Gdk.PixbufAnimation(ECM.Core.LoadingSpinnerGIF);
        itemPic.WidthRequest = 64;
        itemPic.HeightRequest = 64;

        BackgroundWorker fetchImage = new BackgroundWorker();
        fetchImage.DoWork += delegate(object sender, DoWorkEventArgs e)
        {
            itemPic.Pixbuf = ECM.API.ImageApi.GetItemImageGTK(item.ID, ECM.API.ImageApi.ImageRequestSize.Size64x64);
        };

        fetchImage.RunWorkerAsync();

        Gdk.Pixbuf buf = new Gdk.Pixbuf(Gdk.Colorspace.Rgb, true, 8, 22, 22);
        Gdk.Pixbuf book = new Gdk.Pixbuf(ECM.Core.Skillbook22PNG);

        EveItemUseability useability = Core.CurrentCharacter.GetItemUseability(item);

        if (useability == EveItemUseability.Untrainable)
            buf.Fill(m_Untrainable.ToUint());
        else if (useability == EveItemUseability.Trainable)
            buf.Fill(m_Trainable.ToUint());
        else
            buf.Fill(m_Useable.ToUint());

        book.Composite(buf, 0, 0, buf.Width, buf.Height, 0, 0, 1, 1, Gdk.InterpType.Hyper, 255);

        Image skillsMet = new Image(buf);
        skillsMet.WidthRequest = 22;
        skillsMet.HeightRequest = 22;
        skillsMet.Xalign = 0;

        Pango.FontDescription font = new Pango.FontDescription();
        font.Size = 24;

        Label itemName = new Label();
        itemName.UseMarkup = true;
        itemName.Markup = string.Format("<span size=\"large\" weight=\"bold\">{0}</span>", item.Name);
        itemName.Xalign = 0;
        //itemName.ModifyFont(font);

        Image infoPic = new Image(ECM.Core.Info16PNG);
        infoPic.WidthRequest = 16;
        infoPic.HeightRequest = 16;

        Button btnInfo = new Button();
        btnInfo.Relief = ReliefStyle.None;
        btnInfo.Add(infoPic);
        btnInfo.Clicked += delegate(object sender, EventArgs e)
        {
            m_ViewDetails.ShowItemDetails(item);
        };

        HBox itemNameHeader = new HBox();
        itemNameHeader.PackStart(itemName, false, false, 0);
        itemNameHeader.PackStart(btnInfo, false, false, 3);

        WrapLabel itemDesc = new WrapLabel(item.Description);

        Frame picFrame = new Frame();
        picFrame.Shadow = ShadowType.Out;
        picFrame.Add(itemPic);

        VBox heading = new VBox();
        heading.Spacing = 6;
        heading.PackEnd(itemNameHeader, false, false, 0);

        if(item.HasRequirements)
            heading.PackEnd(skillsMet, false, false, 0);

        HBox inner = new HBox();
        inner.PackStart(picFrame, false, false, 0);
        inner.PackStart(heading, true, true, 1);

        Button viewDets = new Button(new Label("View Market Details"));
        viewDets.Clicked += delegate(object sender, EventArgs e)
        {
            ShowItemMarketDetails(item, model, iter);
        };

        HButtonBox itemButtons = new HButtonBox();
        itemButtons.Layout = ButtonBoxStyle.End;
        itemButtons.BorderWidth = 3;
        itemButtons.Add(viewDets);
        itemButtons.ShowAll();

        HSeparator sep = new HSeparator();

        VBox itemBlock = new VBox();
        itemBlock.Spacing = 10;
        itemBlock.PackStart(inner, false, false, 0);
        itemBlock.PackStart(itemDesc, true, true, 0);
        itemBlock.PackEnd(itemButtons, false, false, 0);

        itemBlock.ShowAll();
//.........这里部分代码省略.........
开发者ID:SilkyPantsDan,项目名称:ECM,代码行数:101,代码来源:MainWindow.Market.cs

示例6: CreatePixbuf

        /// <summary>
        /// An internal function to actually create the pixbuf. This
        /// method also adds it to the cache.
        /// </summary>
        protected virtual Pixbuf CreatePixbuf(
			DrawableState state,
			string cacheKey)
        {
            // Create the image from the disk. If we are exactly the
            // right size, return it immediately.
            Pixbuf image = new Pixbuf(file.FullName);

            if (image.Width == state.Width && image.Height == state.Height)
            {
                return image;
            }

            // Create a pixbuf of the given size
            Colorspace colorspace = image.Colorspace;
            bool hasAlpha = image.HasAlpha;
            int bitsPerSample = image.BitsPerSample;
            Pixbuf p = new Pixbuf(
                colorspace, hasAlpha, bitsPerSample, state.Width, state.Height);

            // Scale copy it in
            image.Composite(
                p,
                0,
                0,
                state.Width,
                state.Height,
                0,
                0,
                image.Width / state.Width,
                image.Height / state.Height,
                InterpType.Bilinear,
                255);

            // Cache and return
            PixbufCache[cacheKey] = p;
            return p;
        }
开发者ID:dmoonfire,项目名称:wordplay,代码行数:42,代码来源:PixbufDrawable.cs

示例7: CompositeEmblemIcon

		private string CompositeEmblemIcon (String emblem) 
		{
			if (emblem == null)
				return "internal:bookmark.png";
			
			if (! File.Exists (emblem)) {
				return "internal:bookmark.png";
  		} 

			// Composite an icon...
			Gdk.Pixbuf icon = new Pixbuf (emblem);
			Gdk.Pixbuf bookmark =
				new Pixbuf (GetImage ("bookmark.png"));
			Gdk.Pixbuf white =
				new Pixbuf (GetImage ("white.png"));

			white.Composite (bookmark,
			                 0,   0,   // dest x,y
			                 48, 20,   // height,width
			                 0,   0,   // offset x,y
			                 1,   1,   // scaling x,y
			                 Gdk.InterpType.Bilinear,
			                 127);     // Alpha

			// I just want to make the icon be 16x16.
			// This does it for me!
			Gdk.Pixbuf small_icon = icon.ScaleSimple (16, 16, // x,y
			                        Gdk.InterpType.Bilinear);

			small_icon.Composite(bookmark,
			                     0,   0,   // dest x,y
			                     48, 18,   // height,width
			                     31,  2,   // offset x,y
			                     1,   1,   // scaling x,y
			                     Gdk.InterpType.Bilinear,
			                     255);     // Alpha

			emblem = System.IO.Path.GetFileName (emblem);
			emblem = PathFinder.AppDataFileName ("transient:WebLinkHitRenderer",
							     "emblem-" + emblem);
			bookmark.Savev (emblem, "png", null, null);
			return emblem;
		}
开发者ID:ArsenShnurkov,项目名称:beagle-1,代码行数:43,代码来源:WebLinkHitRenderer.cs


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