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


C# Gdk.DrawPixbuf方法代码示例

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


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

示例1: Render

        public override void Render(Gdk.Drawable window, Gdk.Rectangle bounds, Gtk.StateType state)
        {
            int iy = bounds.Y + (bounds.Height - imgSize) / 2;

            if (image != null) {
                int dy = (imgSize - image.Height) / 2;
                int dx = (imgSize - image.Width) / 2;
                window.DrawPixbuf (Container.Style.BackgroundGC (state), image, 0, 0, bounds.X + dx, iy + dy, -1, -1, Gdk.RgbDither.None, 0, 0);
            }

            window.DrawRectangle (Container.Style.DarkGC (state), false, bounds.X, iy, imgSize - 1, imgSize - 1);

            bounds.X += imgSize + spacing;
            base.Render (window, bounds, state);
        }
开发者ID:mono,项目名称:stetic,代码行数:15,代码来源:ImageSelector.cs

示例2: Render

        protected override void Render(Gdk.Drawable window, Widget widget, Gdk.Rectangle background_area, Gdk.Rectangle cell_area, Gdk.Rectangle expose_area, CellRendererState flags)
        {
            base.Render (window, widget, background_area, cell_area, expose_area, flags);
            int xPos = cell_area.X;
            if(this.Pixbuf != null){
                window.DrawPixbuf(widget.Style.MidGC( StateType.Normal), this.Pixbuf, 0, 0, xPos + 1, cell_area.Y + 1, 16, 16, Gdk.RgbDither.Normal, 0, 0);
                xPos += 20;
            }
            using (var layout = new Pango.Layout(widget.PangoContext)) {
                layout.Alignment = Pango.Alignment.Left;
                layout.SetText(this.Text ?? "");

                StateType state = flags.HasFlag(CellRendererState.Selected) ?
                    widget.IsFocus ? StateType.Selected : StateType.Active : StateType.Normal;

                window.DrawLayout(widget.Style.TextGC(state), xPos, cell_area.Y + 2, layout);
            }
        }
开发者ID:revenz,项目名称:iMeta,代码行数:18,代码来源:TreeItemCellRenderer.cs

示例3: DrawPosition

        private void DrawPosition(Gdk.Window window)
        {
            Gdk.GC gc = Style.ForegroundGC (StateType.Normal);

            for (int i = 0; i < 8; i++)
              {
                  for (int j = 0; j < 8; j += 1)
                    {

                        FigureType fig =
                            position.GetFigureAt (i,
                                      j);

                        if (fig != FigureType.None)
                          {
                              int x, y;

                              if (!side)
                            {
                                //White
                                x = start_x +
                                    i *
                                    space
                                    +
                                    i *
                                    size;
                                y = start_y +
                                    j *
                                    space
                                    +
                                    j *
                                    size;
                            }
                              else
                            {
                                //Black
                                x = start_x +
                                    (7 -
                                     i) *
                                    (space
                                     +
                                     size);
                                y = start_y +
                                    (7 -
                                     j) *
                                    (space
                                     +
                                     size);
                            }

                              window.DrawPixbuf
                                  (gc,
                                   figure.
                                   GetPixbuf
                                   (fig),
                                   0, 0,
                                   x, y,
                                   size,
                                   size,
                                   Gdk.
                                   RgbDither.
                                   None, 0, 0);
                          }
                    }
              }

            return;
        }
开发者ID:BackupTheBerlios,项目名称:csboard-svn,代码行数:68,代码来源:Board.cs

示例4: draw

 public override void draw(Gdk.Window win, int x, int y)
 {
     Gdk.GC context = new Gdk.GC(win);
      		GraphicsStorage store = GraphicsStorage.GetInstance();
     win.DrawPixbuf(context, store.LSat, 0, 0, x, y, store.LSat.Width, store.LSat.Height, RgbDither.Normal, 1, 1);
 }
开发者ID:jcjones,项目名称:Gpremacy,代码行数:6,代码来源:LSat.cs

示例5: Draw

        public void Draw(Gdk.Drawable d, Cairo.Context g, int width, int height, bool screenChanged)
        {
            if (!_visible)
            {
                return;
            }

            if (_w > 0 && _h > 0)
            {
                Gdk.GC gc = new Gdk.GC(d);

                d.DrawPixbuf(gc, _background, 0, 0, _x, _y, _w, _h, Gdk.RgbDither.None, 0, 0);

                int x0 = _x, x1 = _x + _w;
                int y0 = _y, y1 = _y + _h;

                g.MoveTo(x0 + 3, y0);
                g.LineTo(x1 - 3, y0);
                g.LineTo(x1, y0 + 3);
                g.LineTo(x1, y1 - 3);
                g.LineTo(x1 - 3, y1);
                g.LineTo(x0 + 3, y1);
                g.LineTo(x0, y1 - 3);
                g.LineTo(x0, y0 + 3);
                g.LineTo(x0 + 3, y0);
                g.ClosePath();
                g.LineWidth = 6;
                g.Color = BorderColor;
                g.Stroke();
            }

            g.Save();

            DrawContents(d, g, width, height, screenChanged);

            g.Restore();
        }
开发者ID:skinitimski,项目名称:Reverence,代码行数:37,代码来源:Menu.cs

示例6: Draw

		public void Draw (TextEditor editor, Gdk.Drawable win, int lineNr, Gdk.Rectangle lineArea)
		{
			EnsureLayoutCreated (editor);
			int lineNumber = editor.Document.OffsetToLineNumber (lineSegment.Offset);
			int errorNumber = lineNr - lineNumber;
			int x = editor.TextViewMargin.XOffset;
			int y = lineArea.Y;
			int right = editor.Allocation.Width;
			int errorCounterWidth = 0;
			
			int ew = 0, eh = 0;
			if (errors.Count > 1 && errorCountLayout != null) {
				errorCountLayout.GetPixelSize (out ew, out eh);
				errorCounterWidth = ew + 10;
			}
			
			int x2 = System.Math.Max (right - LayoutWidth - border - (ShowIconsInBubble ? errorPixbuf.Width : 0) - errorCounterWidth, fitsInSameLine ? editor.TextViewMargin.XOffset + editor.LineHeight / 2 : editor.TextViewMargin.XOffset);
//			bool isEolSelected = editor.IsSomethingSelected && editor.SelectionMode != SelectionMode.Block ? editor.SelectionRange.Contains (lineSegment.Offset  + lineSegment.EditableLength) : false;
			int active = editor.Document.GetTextAt (lineSegment) == initialText ? 0 : 1;
			bool isCaretInLine = lineSegment.Offset <= editor.Caret.Offset && editor.Caret.Offset <= lineSegment.EndOffset;
			int highlighted = active == 0 && isCaretInLine ? 1 : 0;
			int selected = 0;
			LayoutDescriptor layout = layouts[errorNumber];
			x2 = right - LayoutWidth - border - (ShowIconsInBubble ? errorPixbuf.Width : 0);
			
			x2 -= errorCounterWidth;
			x2 = System.Math.Max (x2, fitsInSameLine ? editor.TextViewMargin.XOffset + editor.LineHeight / 2 : editor.TextViewMargin.XOffset);
			
			using (var g = Gdk.CairoHelper.Create (win)) {
				g.LineWidth = Math.Max (1.0, editor.Options.Zoom);
				g.MoveTo (new Cairo.PointD (x2 + 0.5, y));
				g.LineTo (new Cairo.PointD (x2 + 0.5, y + editor.LineHeight));
				g.LineTo (new Cairo.PointD (right, y + editor.LineHeight));
				g.LineTo (new Cairo.PointD (right, y));
				g.ClosePath ();
				g.Color = colorMatrix[active, BOTTOM, LIGHT, highlighted, selected];
				g.Fill ();
				
				g.Color = colorMatrix[active, BOTTOM, LINE, highlighted, selected];
				g.MoveTo (new Cairo.PointD (x2 + 0.5, y));
				g.LineTo (new Cairo.PointD (x2 + 0.5, y + editor.LineHeight));
				if (errorNumber == errors.Count - 1)
					g.LineTo (new Cairo.PointD (lineArea.Right, y + editor.LineHeight));
				g.Stroke ();
				
				if (editor.Options.ShowRuler) {
					int divider = Math.Max (editor.TextViewMargin.XOffset, x + editor.TextViewMargin.RulerX);
					if (divider >= x2) {
						g.MoveTo (new Cairo.PointD (divider + 0.5, y));
						g.LineTo (new Cairo.PointD (divider + 0.5, y + editor.LineHeight));
						g.Color = colorMatrix[active, BOTTOM, DARK, highlighted, selected];
						g.Stroke ();
					}
				}
			}
			win.DrawLayout (selected == 0 ? gc : gcSelected, x2 + (ShowIconsInBubble ? errorPixbuf.Width : 0) + border, y + (editor.LineHeight - layout.Height) / 2 + layout.Height % 2, layout.Layout);
			if (ShowIconsInBubble)
				win.DrawPixbuf (editor.Style.BaseGC (Gtk.StateType.Normal), errors[errorNumber].IsError ? errorPixbuf : warningPixbuf, 0, 0, x2, y + (editor.LineHeight - errorPixbuf.Height) / 2, errorPixbuf.Width, errorPixbuf.Height, Gdk.RgbDither.None, 0, 0);
		}
开发者ID:transformersprimeabcxyz,项目名称:monodevelop-1,代码行数:59,代码来源:MessageBubbleTextMarker.cs

示例7: DrawBackground


//.........这里部分代码省略.........
					
					// stroke left line
					if (fitsInSameLine) {
						g.MoveTo (new Cairo.PointD (x2 + 0.5, y2));
						g.LineTo (new Cairo.PointD (x2 - editor.LineHeight / 2 + 0.5, y2 + editor.LineHeight / 2));
						g.LineTo (new Cairo.PointD (x2 + 0.5, y2Bottom));
					} else {
						g.MoveTo (new Cairo.PointD (x2 + 0.5, y2 - 1));
						g.LineTo (new Cairo.PointD (x2 + 0.5, y2Bottom + 1));
					}
					
					g.Color = colorMatrix[active, BOTTOM, LINE, highlighted, selected];
					g.Stroke ();
					
					// stroke top line
					if (fitsInSameLine) {
						g.Color = colorMatrix[active, BOTTOM, LINE, highlighted, selected];
						g.MoveTo (new Cairo.PointD (right, y2));
						g.LineTo (new Cairo.PointD (x2 + 0.5, y2));
						g.Stroke ();
					}
				}
				
				if (editor.Options.ShowRuler) {
					int divider = Math.Max (editor.TextViewMargin.XOffset, x + editor.TextViewMargin.RulerX);
					if (divider >= x2) {
						g.MoveTo (new Cairo.PointD (divider + 0.5, y2));
						g.LineTo (new Cairo.PointD (divider + 0.5, y2Bottom));
						g.Color = colorMatrix[active, BOTTOM, DARK, highlighted, selected];
						g.Stroke ();
					}
				}
				
				if (errors.Count > 1 && errorCountLayout != null) {
					int rX = x2 + (ShowIconsInBubble ? errorPixbuf.Width : 0) + border + LayoutWidth;
					int rY = y + editor.LineHeight / 6;
					int rW = errorCounterWidth - 2;
					int rH = editor.LineHeight * 3 / 4;
					BookmarkMarker.DrawRoundRectangle (g, rX, rY, 8, rW, rH);
					
					g.Color = oldIsOver ? new Cairo.Color (0.3, 0.3, 0.3) : new Cairo.Color (0.5, 0.5, 0.5);
					g.Fill ();
					if (CollapseExtendedErrors) {
						win.DrawLayout (gcLight, x2 + (ShowIconsInBubble ? errorPixbuf.Width : 0) + border + LayoutWidth + 4, y + (editor.LineHeight - eh) / 2 + eh % 2, errorCountLayout);
					} else {
						g.MoveTo (rX + rW / 2 - rW / 4, rY + rH - rH / 4);
						g.LineTo (rX + rW / 2 + rW / 4, rY + rH - rH / 4);
						g.LineTo (rX + rW / 2, rY + rH / 4);
						g.ClosePath ();
						
						g.Color = new Cairo.Color (1, 1, 1);
						g.Fill ();
					}
				}
				
				for (int i = 0; i < layouts.Count; i++) {
					LayoutDescriptor layout = layouts[i];
					x2 = right - layout.Width - border - errorPixbuf.Width;
					if (i == 0)
						x2 -= errorCounterWidth;
					x2 = System.Math.Max (x2, fitsInSameLine ? editor.TextViewMargin.XOffset + editor.LineHeight / 2 : editor.TextViewMargin.XOffset);
					if (i > 0) {
						editor.TextViewMargin.DrawRectangleWithRuler (win, x, new Gdk.Rectangle (x, y, right, editor.LineHeight), isEolSelected ? editor.ColorStyle.Selection.BackgroundColor : editor.ColorStyle.Default.BackgroundColor, true);
						g.MoveTo (new Cairo.PointD (x2 + 0.5, y));
						g.LineTo (new Cairo.PointD (x2 + 0.5, y + editor.LineHeight));
						g.LineTo (new Cairo.PointD (right, y + editor.LineHeight));
						g.LineTo (new Cairo.PointD (right, y));
						g.ClosePath ();
						
						if (CollapseExtendedErrors) {
							Cairo.Gradient pat = new Cairo.LinearGradient (x2, y, x2, y + editor.LineHeight);
							pat.AddColorStop (0, colorMatrix[active, TOP, LIGHT, highlighted, selected]);
							pat.AddColorStop (1, colorMatrix[active, BOTTOM, LIGHT, highlighted, selected]);
							g.Pattern = pat;
						} else {
							g.Color = colorMatrix[active, TOP, LIGHT, highlighted, selected];
						}
						g.Fill ();
						if (editor.Options.ShowRuler) {
							int divider = Math.Max (editor.TextViewMargin.XOffset, x + editor.TextViewMargin.RulerX);
							if (divider >= x2) {
								g.MoveTo (new Cairo.PointD (divider + 0.5, y));
								g.LineTo (new Cairo.PointD (divider + 0.5, y + editor.LineHeight));
								g.Color = colorMatrix[active, BOTTOM, DARK, highlighted, selected];
								g.Stroke ();
							}
						}
					}
					int lw, lh;
					layout.Layout.GetPixelSize (out lw, out lh);
					win.DrawLayout (selected == 0 ? gc : gcSelected, x2 + errorPixbuf.Width + border, y + (editor.LineHeight - layout.Height) / 2 + layout.Height % 2, layout.Layout);
					if (ShowIconsInBubble)
						win.DrawPixbuf (editor.Style.BaseGC (Gtk.StateType.Normal), errors[i].IsError ? errorPixbuf : warningPixbuf, 0, 0, x2, y + (editor.LineHeight - errorPixbuf.Height) / 2, errorPixbuf.Width, errorPixbuf.Height, Gdk.RgbDither.None, 0, 0);
					y += editor.LineHeight;
					if (!UseVirtualLines)
						break;
				}
			}
			return true;
		}
开发者ID:transformersprimeabcxyz,项目名称:monodevelop-1,代码行数:101,代码来源:MessageBubbleTextMarker.cs

示例8: DrawContents

        protected override void DrawContents(Gdk.Drawable d)
        {
            Gdk.GC gc = new Gdk.GC(d);
            Cairo.Context g = Gdk.CairoHelper.Create(d);

            g.SelectFontFace("Lucida Console", FontSlant.Normal, FontWeight.Bold);
            g.SetFontSize(24);

            TextExtents te;

            Cairo.Color greenish = new Color(.3, .8, .8);
            Cairo.Color gray = new Color(.4, .4, .4);
            Cairo.Color white = new Color(1, 1, 1);

            string lvl, hp, hpm, mp, mpm, s;

            #region Character Status

            d.DrawPixbuf(gc, Graphics.GetProfile(Selected.Name), 0, 0,
                X + xpic, Y + ypic,
                Graphics.PROFILE_WIDTH, Graphics.PROFILE_HEIGHT,
                Gdk.RgbDither.None, 0, 0);

            g.Color = new Color(.3, .8, .8);
            g.MoveTo(X + x3, Y + ya);
            g.ShowText("LV");
            g.MoveTo(X + x3, Y + yb);
            g.ShowText("HP");
            g.MoveTo(X + x3, Y + yc);
            g.ShowText("MP");
            g.Color = new Color(1, 1, 1);

            Graphics.ShadowedText(g, Selected.Name, X + x3, Y + y);

            lvl = Selected.Level.ToString();
            hp = Selected.HP.ToString() + "/";
            hpm = Selected.MaxHP.ToString();
            mp = Selected.MP.ToString() + "/";
            mpm = Selected.MaxMP.ToString();

            te = g.TextExtents(lvl);
            Graphics.ShadowedText(g, lvl, X + x4 - te.Width, Y + ya);

            te = g.TextExtents(hp);
            Graphics.ShadowedText(g, hp, X + x5 - te.Width, Y + yb);

            te = g.TextExtents(hpm);
            Graphics.ShadowedText(g, hpm, X + x6 - te.Width, Y + yb);

            te = g.TextExtents(mp);
            Graphics.ShadowedText(g, mp, X + x5 - te.Width, Y + yc);

            te = g.TextExtents(mpm);
            Graphics.ShadowedText(g, mpm, X + x6 - te.Width, Y + yc);

            #endregion Status

            Graphics.ShadowedText(g, greenish, "Attack", X + x0, Y + ym);
            Graphics.ShadowedText(g, greenish, "Halve", X + x0, Y + yn);
            Graphics.ShadowedText(g, greenish, "Void", X + x0, Y + yo);
            Graphics.ShadowedText(g, greenish, "Absorb", X + x0, Y + yp);

            g.SetFontSize(16);

            double x = (double)x1;
            double r = (double)(ym + ys);
            foreach (Element e in Enum.GetValues(typeof(Element)))
            {
                if (x > W - stop)
                {
                    x = x1;
                    r = r + ys;
                }

                s = e.ToString() + " ";
                te = g.TextExtents(s);
                if (Selected.Halves(e))
                    Graphics.ShadowedText(g, white, e.ToString(), X + x, Y + r);
                else
                    Graphics.ShadowedText(g, gray, e.ToString(), X + x, Y + r);
                x += te.XAdvance;
            }

            x = (double)x1;
            r = (double)(yn + ys);
            foreach (Element e in Enum.GetValues(typeof(Element)))
            {
                if (x > W - stop)
                {
                    x = x1;
                    r = r + ys;
                }

                s = e.ToString() + " ";
                te = g.TextExtents(s);
                if (Selected.Halves(e))
                    Graphics.ShadowedText(g, white, e.ToString(), X + x, Y + r);
                else
                    Graphics.ShadowedText(g, gray, e.ToString(), X + x, Y + r);
                x += te.XAdvance;
//.........这里部分代码省略.........
开发者ID:skinitimski,项目名称:Reverence,代码行数:101,代码来源:StatusScreen.cs

示例9: DrawContents

        protected override void DrawContents(Gdk.Drawable d)
        {
            Gdk.GC gc = new Gdk.GC(d);
            Cairo.Context g = Gdk.CairoHelper.Create(d);

            g.SelectFontFace("Lucida Console", FontSlant.Normal, FontWeight.Bold);
            g.SetFontSize(24);

            TextExtents te;

            string lvl, hp, hpm, mp, mpm;
            string weapon, armor, acc;

            #region Character Status

            d.DrawPixbuf(gc, Graphics.GetProfile(Selected.Name), 0, 0,
                X + xpic, Y + ypic,
                Graphics.PROFILE_WIDTH, Graphics.PROFILE_HEIGHT,
                Gdk.RgbDither.None, 0, 0);

            g.Color = new Color(.3, .8, .8);
            g.MoveTo(X + x3, Y + y + ya);
            g.ShowText("LV");
            g.MoveTo(X + x3, Y + y + yb);
            g.ShowText("HP");
            g.MoveTo(X + x3, Y + y + yc);
            g.ShowText("MP");
            g.Color = new Color(1, 1, 1);

            Graphics.ShadowedText(g, Selected.Name, X + x3, Y + y);

            lvl = Selected.Level.ToString();
            hp = Selected.HP.ToString() + "/";
            hpm = Selected.MaxHP.ToString();
            mp = Selected.MP.ToString() + "/";
            mpm = Selected.MaxMP.ToString();

            te = g.TextExtents(lvl);
            Graphics.ShadowedText(g, lvl, X + x4 - te.Width, Y + y + ya);

            te = g.TextExtents(hp);
            Graphics.ShadowedText(g, hp, X + x5 - te.Width, Y + y + yb);

            te = g.TextExtents(hpm);
            Graphics.ShadowedText(g, hpm, X + x6 - te.Width, Y + y + yb);

            te = g.TextExtents(mp);
            Graphics.ShadowedText(g, mp, X + x5 - te.Width, Y + y + yc);

            te = g.TextExtents(mpm);
            Graphics.ShadowedText(g, mpm, X + x6 - te.Width, Y + y + yc);

            #endregion Status

            #region Equipment

            g.Color = new Color(.3, .8, .8);
            g.MoveTo(X + x7, Y + yi);
            g.ShowText("Wpn.");
            g.MoveTo(X + x7, Y + yj);
            g.ShowText("Arm.");
            g.MoveTo(X + x7, Y + yk);
            g.ShowText("Acc.");
            g.Color = new Color(1, 1, 1);

            weapon = Selected.Weapon.Name;
            armor = Selected.Armor.Name;
            acc = Selected.Accessory.Name;

            te = g.TextExtents(weapon);
            Graphics.ShadowedText(g, weapon, X + x8, Y + yi);
            te = g.TextExtents(armor);
            Graphics.ShadowedText(g, armor, X + x8, Y + yj);
            te = g.TextExtents(acc);
            Graphics.ShadowedText(g, acc, X + x8, Y + yk);

            #endregion Equipment

            if (IsControl)
                Graphics.RenderCursor(g, X + cx, Y + cy - 10);

            ((IDisposable)g.Target).Dispose();
            ((IDisposable)g).Dispose();
        }
开发者ID:skinitimski,项目名称:Reverence,代码行数:84,代码来源:EquipScreen.cs

示例10: Render

        protected override void Render(Gdk.Drawable drawable, 
            Widget widget, Gdk.Rectangle background_area, 
            Gdk.Rectangle cell_area, Gdk.Rectangle expose_area, 
            CellRendererState flags)
        {
            StateType state = RendererStateToWidgetState(flags);
            int text_indent = 6;
            int text_layout_width, text_layout_height;
            Gdk.Pixbuf render_icon = radio_icon;
            Track track = null;
            RadioTrackInfo radio_track = null;
            string text = Text;

            if(widget is TreeView) {
                TreePath path;
                if((widget as TreeView).GetPathAtPos(cell_area.X, cell_area.Y, out path)) {
                    track = model.GetTrack(path);
                    radio_track = model.GetRadioTrackInfo(path);
                }
            }

            FontDescription font_description = widget.PangoContext.FontDescription.Copy();

            if(playing_icon != null && track != null && PlayerEngineCore.CurrentTrack is RadioTrackInfo
                && (PlayerEngineCore.CurrentTrack as RadioTrackInfo).XspfTrack.Title == track.Title
                && (PlayerEngineCore.CurrentTrack as RadioTrackInfo).XspfTrack.Annotation == track.Annotation) {
                render_icon = playing_icon;
                font_description.Style = Pango.Style.Normal;
                font_description.Weight = Pango.Weight.Bold;
            } else if(radio_track != null && radio_track.ParsingPlaylist) {
                render_icon = loading_icon;
                font_description.Style = Pango.Style.Italic;
                font_description.Weight = Pango.Weight.Normal;
                text = String.Format("{0}: {1}", Catalog.GetString("Loading"), Text);
            } else if(radio_track != null && radio_track.PlaybackError != TrackPlaybackError.None) {
                render_icon = error_icon;
                font_description.Style = Pango.Style.Italic;
                font_description.Weight = Pango.Weight.Normal;
                string prefix = null;

                switch(radio_track.PlaybackError) {
                    case TrackPlaybackError.ResourceNotFound:
                        prefix = Catalog.GetString("Missing");
                        break;
                    case TrackPlaybackError.CodecNotFound:
                        prefix = Catalog.GetString("No Codec");
                        break;
                    case TrackPlaybackError.Unknown:
                        prefix = Catalog.GetString("Unknown Error");
                        break;
                    default:
                        break;
                }

                if(prefix != null) {
                    text = String.Format("({0}) {1}", prefix, Text);
                }

                if(!(CellRendererState.Selected & flags).Equals(CellRendererState.Selected)) {
                    state = StateType.Insensitive;
                }

                if(track != null) {
                    track.Title = String.Empty;
                }
            } else {
                font_description.Style = Pango.Style.Normal;
                font_description.Weight = Pango.Weight.Normal;
            }

            Gdk.GC main_gc = widget.Style.TextGC(state);

            if(track != null) {
                drawable.DrawPixbuf(main_gc, render_icon, 0, 0,
                cell_area.X - render_icon.Width,
                cell_area.Y + ((cell_area.Height - render_icon.Height) / 2),
                render_icon.Width, render_icon.Height,
                RgbDither.None, 0, 0);
            } else {
                text_indent = 0;
            }

            Pango.Layout text_layout = new Pango.Layout(widget.PangoContext);
            text_layout.FontDescription = font_description;
            text_layout.SetMarkup(GLib.Markup.EscapeText(text));
            text_layout.GetPixelSize(out text_layout_width, out text_layout_height);

            drawable.DrawLayout(main_gc,
                cell_area.X + text_indent,
                cell_area.Y + ((cell_area.Height - text_layout_height) / 2),
                text_layout);
        }
开发者ID:jrmuizel,项目名称:banshee-unofficial-plugins,代码行数:92,代码来源:CellRendererStation.cs

示例11: RenderProfile

        public static void RenderProfile(Gdk.Drawable d, int x, int y, Character c)
        {
            Gdk.GC gc = new Gdk.GC(d);

            d.DrawPixbuf(gc, c.Profile, 0, 0, x, y, c.Profile.Width, c.Profile.Height, Gdk.RgbDither.None, 0, 0);
        }
开发者ID:skinitimski,项目名称:Reverence,代码行数:6,代码来源:Images.cs

示例12: draw

        public void draw(Gdk.Window win, Gdk.Color terr, Gdk.Color textcolor, Pango.Context pango_context)
        {
            Gdk.GC textcoloring = new Gdk.GC(win);
               		textcoloring.RgbFgColor = textcolor;
               	int carriedUnits = 0;
               	string extraLabel = "";
            GraphicsStorage store = GraphicsStorage.GetInstance();
            int cenTerrX = MapTerritory.centerX;
            int cenTerrY = MapTerritory.centerY;

               	/* Show flag */
               	Gdk.Pixbuf flag = store.AppropriateFlag(owner.CountryID);
               	if (flag != null && owner.Active)
               		win.DrawPixbuf(textcoloring, flag, 0, 0, cenTerrX, cenTerrY, flag.Width, flag.Height, RgbDither.Normal, 1, 1);

            /* Draw the map */
               	MapTerritory.draw(win, terr, textcolor);

               	/* Show radiation if destroyed */
               	if (destroyed)
            win.DrawPixbuf(textcoloring, store.Radiation, 0, 0, cenTerrX, cenTerrY, store.Radiation.Width, store.Radiation.Height, RgbDither.Normal, 1, 1);

               	/* Determine personnel carrier status */
               	foreach(TacticalUnit joe in units)
               		carriedUnits += joe.UnitsAboardCount;
               	if (carriedUnits > 0)
               		extraLabel = "(" + carriedUnits + ")";

            /* Draw the first N units staggered, then use a label to show further #'s */
               	for (int offset=0; offset < units.Count && offset < 3; offset++)
               	{
               		((TacticalUnit)units[offset]).draw(win, offset*5);
               	}

               	/* Label */
               	if (units.Count > 1 || carriedUnits > 0)
               	{
               	        Pango.Layout label = new Pango.Layout (pango_context);
            label.Wrap = Pango.WrapMode.Word;
            label.FontDescription = FontDescription.FromString ("Tahoma 8");
            label.SetMarkup ( units.Count.ToString() + extraLabel );

            int szX, szY;
            label.GetPixelSize(out szX, out szY);

            /*Redraw*/
            //			win.InvalidateRect(new Gdk.Rectangle(MapTerritory.centerX, MapTerritory.centerY, szX, szY), true);

            win.DrawLayout (textcoloring, MapTerritory.centerX, MapTerritory.centerY, label);
               	}
        }
开发者ID:jcjones,项目名称:Gpremacy,代码行数:51,代码来源:Territory.cs

示例13: Render

        protected override void Render (Gdk.Drawable drawable, Widget widget, Gdk.Rectangle background_area,
            Gdk.Rectangle cell_area, Gdk.Rectangle expose_area, CellRendererState flags)
        {
            if (source == null) {
                return;
            }

            view = widget as SourceView;
            bool selected = view != null && view.Selection.IterIsSelected (iter);
            StateType state = RendererStateToWidgetState (widget, flags);

            RenderSelection (drawable, background_area, selected, state);

            int title_layout_width = 0, title_layout_height = 0;
            int count_layout_width = 0, count_layout_height = 0;
            int max_title_layout_width;

            bool hide_counts = source.EnabledCount <= 0;

            Pixbuf icon = SourceIconResolver.ResolveIcon (source, RowHeight);

            bool dispose_icon = false;
            if (state == StateType.Insensitive) {
                // Code ported from gtk_cell_renderer_pixbuf_render()
                var icon_source = new IconSource () {
                    Pixbuf = icon,
                    Size = IconSize.SmallToolbar,
                    SizeWildcarded = false
                };

                icon = widget.Style.RenderIcon (icon_source, widget.Direction, state,
                    (IconSize)(-1), widget, "SourceRowRenderer");

                dispose_icon = true;
                icon_source.Dispose ();
            }

            FontDescription fd = widget.PangoContext.FontDescription.Copy ();
            fd.Weight = (ISource)ServiceManager.PlaybackController.NextSource == (ISource)source
                ? Pango.Weight.Bold
                : Pango.Weight.Normal;

            if (view != null && source == view.NewPlaylistSource) {
                fd.Style = Pango.Style.Italic;
                hide_counts = true;
            }

            Pango.Layout title_layout = new Pango.Layout (widget.PangoContext);
            Pango.Layout count_layout = null;

            if (!hide_counts) {
                count_layout = new Pango.Layout (widget.PangoContext);
                count_layout.FontDescription = fd;
                count_layout.SetMarkup (String.Format ("<span size=\"small\">{0}</span>", source.EnabledCount));
                count_layout.GetPixelSize (out count_layout_width, out count_layout_height);
            }

            max_title_layout_width = cell_area.Width - (icon == null ? 0 : icon.Width) - count_layout_width - 10;

            if (!hide_counts && max_title_layout_width < 0) {
                hide_counts = true;
            }

            title_layout.FontDescription = fd;
            title_layout.Width = (int)(max_title_layout_width * Pango.Scale.PangoScale);
            title_layout.Ellipsize = EllipsizeMode.End;
            title_layout.SetText (source.Name);
            title_layout.GetPixelSize (out title_layout_width, out title_layout_height);

            Gdk.GC main_gc = widget.Style.TextGC (state);

            drawable.DrawLayout (main_gc,
                cell_area.X + (icon == null ? 0 : icon.Width) + 6,
                Middle (cell_area, title_layout_height),
                title_layout);

            title_layout.Dispose ();

            if (icon != null) {
                drawable.DrawPixbuf (main_gc, icon, 0, 0,
                    cell_area.X, Middle (cell_area, icon.Height),
                    icon.Width, icon.Height, RgbDither.None, 0, 0);

                if (dispose_icon) {
                    icon.Dispose ();
                }
            }

            if (hide_counts) {
                fd.Dispose ();
                return;
            }

            if (view != null && view.Cr != null) {
                view.Cr.Color = state == StateType.Normal || (view != null && state == StateType.Prelight)
                    ? view.Theme.TextMidColor
                    : view.Theme.Colors.GetWidgetColor (GtkColorClass.Text, state);

                view.Cr.MoveTo (
                    cell_area.X + cell_area.Width - count_layout_width - 2,
//.........这里部分代码省略.........
开发者ID:allquixotic,项目名称:banshee-gst-sharp-work,代码行数:101,代码来源:SourceRowRenderer.cs

示例14: showNuke

        public void showNuke(Gdk.Window win, int frame)
        {
            Gdk.GC whocares = new Gdk.GC(win);
             			GraphicsStorage store = GraphicsStorage.GetInstance();

             			Gdk.Pixbuf gfx = store.getFrame(store.Detonation, frame, store.DetonationFrames);

             			int x = MapTerritory.centerX - (gfx.Width/2);
             			int y = MapTerritory.centerY - (gfx.Height/2);

            win.DrawPixbuf(whocares, gfx, 0, 0, x, y, gfx.Width, gfx.Height, RgbDither.Normal, 1, 1);
        }
开发者ID:jcjones,项目名称:Gpremacy,代码行数:12,代码来源:Territory.cs

示例15: DrawProfile

 public static void DrawProfile(Gdk.Drawable d, Gdk.GC gc, string name, int x, int y)
 {
     d.DrawPixbuf(gc, GetProfile(name), 0, 0, x, y,
         PROFILE_WIDTH, PROFILE_HEIGHT,
         Gdk.RgbDither.None, 0, 0);
 }
开发者ID:skinitimski,项目名称:Reverence,代码行数:6,代码来源:Graphics.cs


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