本文整理汇总了C#中Pango.Layout.Dispose方法的典型用法代码示例。如果您正苦于以下问题:C# Pango.Layout.Dispose方法的具体用法?C# Pango.Layout.Dispose怎么用?C# Pango.Layout.Dispose使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Pango.Layout
的用法示例。
在下文中一共展示了Pango.Layout.Dispose方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: OptionsChanged
internal protected override void OptionsChanged ()
{
Pango.Layout layout = new Pango.Layout (Editor.PangoContext);
layout.FontDescription = Editor.Options.Font;
layout.SetText (string.Format ("0{0:X}", Data.Length) + "_");
int height;
layout.GetPixelSize (out this.width, out height);
layout.Dispose ();
}
示例2: ComputeRowHeight
public int ComputeRowHeight(Widget widget)
{
int lw, lh;
Pango.Layout layout = new Pango.Layout (widget.PangoContext);
layout.SetMarkup ("<big>W</big>");
layout.GetPixelSize (out lw, out lh);
layout.Dispose ();
return lh + 8;
}
示例3: OptionsChanged
internal protected override void OptionsChanged ()
{
Pango.Layout layout = new Pango.Layout (Editor.PangoContext);
layout.FontDescription = Editor.Options.Font;
layout.SetText (".");
int height;
layout.GetPixelSize (out charWidth, out height);
layout.Dispose ();
bgGC = GetGC (Style.HexDigitBg);
fgGC = GetGC (Style.HexDigit);
}
示例4: OptionsChanged
internal protected override void OptionsChanged ()
{
backgroundGC = GetGC (Style.IconBarBg);
separatorGC = GetGC (Style.IconBarSeperator);
Pango.Layout layout = new Pango.Layout (Editor.PangoContext);
layout.FontDescription = Editor.Options.Font;
layout.SetText ("!");
int tmp;
layout.GetPixelSize (out tmp, out this.marginWidth);
marginWidth *= 12;
marginWidth /= 10;
layout.Dispose ();
}
示例5: Render
protected override void Render (Drawable window, Widget widget, Gdk.Rectangle background_area, Gdk.Rectangle cell_area, Gdk.Rectangle expose_area, CellRendererState flags)
{
try{
Gdk.Rectangle text_area1 = new Gdk.Rectangle();
Gdk.Rectangle text_area2 = new Gdk.Rectangle();
Gdk.Rectangle text_area3 = new Gdk.Rectangle();
text_area1.Y= cell_area.Y;
text_area2.Y= cell_area.Y+33;
text_area3.X = cell_area.Width-20;
text_area3.Y= cell_area.Y+33;
text_area3.Width = 75;
Pango.Layout text_l1 = new Pango.Layout(widget.PangoContext);
text_l1.FontDescription = Pango.FontDescription.FromString ("Meiryo,Arial 10.5");
text_l1.SetText(text1);
Pango.Layout text_l2 = new Pango.Layout(widget.PangoContext);
text_l2.FontDescription = Pango.FontDescription.FromString ("Meiryo,MS Gothic,Arial 8");
text_l2.SetText(text2);
text_l2.Alignment = Pango.Alignment.Right;
Pango.Layout text_l3 = new Pango.Layout(widget.PangoContext);
text_l3.Width = Pango.Units.FromPixels(text_area3.Width);
text_l3.FontDescription = Pango.FontDescription.FromString ("Meiryo,MS Gothic,Arial 8");
text_l3.Alignment = Pango.Alignment.Right;
text_l3.SetText(text3);
text_l2.Width = Pango.Units.FromPixels(cell_area.Width-text_l3.Text.Length*8-13);
StateType state = flags.HasFlag(CellRendererState.Selected) ?
widget.IsFocus ? StateType.Selected : StateType.Active : StateType.Normal;
text_l3.SetMarkup("<span color=" + (char)34 + "grey" + (char)34 + ">" + text_l3.Text + "</span>");;
window.DrawLayout(widget.Style.TextGC(state), 55, text_area1.Y, text_l1);
window.DrawLayout(widget.Style.TextGC(state), 55, text_area2.Y, text_l2);
window.DrawLayout(widget.Style.TextGC(state), text_area3.X, text_area3.Y, text_l3);
text_l1.Dispose ();
text_l2.Dispose ();
text_l3.Dispose ();
}catch(Exception e){
Console.WriteLine (e);
}
}
示例6: OnExposeEvent
protected override bool OnExposeEvent (Gdk.EventExpose evnt)
{
Pango.Layout la = new Pango.Layout (PangoContext);
int w, h;
if (UseMarkup)
la.SetMarkup (Text);
else
la.SetText (Text);
la.GetPixelSize (out w, out h);
int tx = Allocation.X + (int) Xpad + (int) ((float)(Allocation.Width - (int)(Xpad*2) - w) * Xalign);
int ty = Allocation.Y + (int) Ypad + (int) ((float)(Allocation.Height - (int)(Ypad*2) - h) * Yalign);
using (var ctx = CairoHelper.Create (evnt.Window)) {
ctx.SetSourceColor (Style.Text (State).ToCairoColor ());
ctx.MoveTo (tx, ty);
// In order to get the same result as in MonoDevelop.Components.DockNotebook.TabStrip.DrawTab()
// (document tabs) we need to draw using a LinearGradient (because of issues below),
// but we don't want to mask the actual text here, like in the doc tabs.
// Therefore we use a LinearGradient and mask only the last vertical pixel line
// of the label with 0.99 alpha, which forces Cairo to render the whole layout
// in the desired way.
// Semi-transparent gradient disables sub-pixel rendering of the label (reverting to grayscale antialiasing).
// As Mac sub-pixel font rendering looks stronger than grayscale rendering, the label used in pad tabs
// looked different. We need to simulate same gradient treatment as we have in document tabs.
using (var lg = new LinearGradient (tx + w - 1, 0, tx + w, 0)) {
var color = Style.Text (State).ToCairoColor ();
lg.AddColorStop (0, color);
color.A = 0.99;
lg.AddColorStop (1, color);
ctx.SetSource (lg);
Pango.CairoHelper.ShowLayout (ctx, la);
}
}
la.Dispose ();
return true;
}
示例7: OptionsChanged
internal protected override void OptionsChanged ()
{
Pango.Layout layout = new Pango.Layout (Editor.PangoContext);
layout.FontDescription = Editor.Options.Font;
string groupString = new string ('0', Editor.Options.GroupBytes * 2);
layout.SetText (groupString + " ");
int lineHeight;
layout.GetPixelSize (out groupWidth, out lineHeight);
Data.LineHeight = lineHeight;
layout.SetText ("00");
layout.GetPixelSize (out byteWidth, out lineHeight);
layout.Dispose ();
tabArray = new Pango.TabArray (1, true);
tabArray.SetTab (0, Pango.TabAlign.Left, groupWidth);
bgGC = GetGC (Style.HexDigitBg);
fgGC = GetGC (Style.HexDigit);
}
示例8: OnExposeEvent
protected override bool OnExposeEvent (Gdk.EventExpose evnt)
{
if (!dropShadowVisible)
return base.OnExposeEvent (evnt);
Pango.Layout la = new Pango.Layout (PangoContext);
int w, h;
if (UseMarkup)
la.SetMarkup (Text);
else
la.SetText (Text);
la.GetPixelSize (out w, out h);
int tx = Allocation.X + (int) Xpad + (int) ((float)(Allocation.Width - (int)(Xpad*2) - w) * Xalign);
int ty = Allocation.Y + (int) Ypad + (int) ((float)(Allocation.Height - (int)(Ypad*2) - h) * Yalign);
GdkWindow.DrawLayout (Style.TextGC (State), tx, ty, la);
la.Dispose ();
return true;
}
示例9: DrawString
void DrawString (string text, bool isMarkup, Cairo.Context context, int x, int y, int width, double opacity, Pango.Context pango, StatusArea.RenderArg arg)
{
Pango.Layout pl = new Pango.Layout (pango);
if (isMarkup)
pl.SetMarkup (text);
else
pl.SetText (text);
pl.FontDescription = Styles.StatusFont;
pl.FontDescription.AbsoluteSize = Pango.Units.FromPixels (Styles.StatusFontPixelHeight);
pl.Ellipsize = Pango.EllipsizeMode.End;
pl.Width = Pango.Units.FromPixels(width);
int w, h;
pl.GetPixelSize (out w, out h);
context.Save ();
// use widget height instead of message box height as message box does not have a true height when no widgets are packed in it
// also ensures animations work properly instead of getting clipped
context.Rectangle (new Rectangle (x, arg.Allocation.Y, width, arg.Allocation.Height));
context.Clip ();
// Subtract off remainder instead of drop to prefer higher centering when centering an odd number of pixels
context.MoveTo (x, y - h / 2 - (h % 2));
context.Color = Styles.WithAlpha (FontColor (), opacity);
Pango.CairoHelper.ShowLayout (context, pl);
pl.Dispose ();
context.Restore ();
}
示例10: ComputeWidgetHeight
private int ComputeWidgetHeight()
{
int width, height;
Pango.Layout layout = new Pango.Layout (PangoContext);
layout.SetText ("W");
layout.GetPixelSize (out width, out height);
layout.Dispose ();
return 2 * height;
}
示例11: GetStringWidth
int GetStringWidth (string str)
{
int width, height;
var layout = new Pango.Layout (textview.PangoContext);
layout.SetText (str);
layout.GetPixelSize (out width, out height);
layout.Dispose ();
return width;
}
示例12: ComputeRowHeight
internal static int ComputeRowHeight(Widget widget)
{
int w_width, row_height;
Pango.Layout layout = new Pango.Layout (widget.PangoContext);
layout.SetText ("W");
layout.GetPixelSize (out w_width, out row_height);
layout.Dispose ();
return row_height + 8;
}
示例13: MeasureHeight
void MeasureHeight(IEnumerable<TableRow> rowList, ref int y)
{
heightMeasured = true;
Pango.Layout layout = new Pango.Layout (PangoContext);
foreach (var r in rowList) {
layout.SetText (r.Label);
int w,h;
layout.GetPixelSize (out w, out h);
if (r.IsCategory) {
r.EditorBounds = new Gdk.Rectangle (0, y, Allocation.Width, h + CategoryTopBottomPadding * 2);
y += h + CategoryTopBottomPadding * 2;
}
else {
int eh;
int dividerX = (int)((double)Allocation.Width * dividerPosition);
var cell = GetCell (r);
cell.GetSize (Allocation.Width - dividerX, out w, out eh);
eh = Math.Max (h + PropertyTopBottomPadding * 2, eh);
r.EditorBounds = new Gdk.Rectangle (dividerX + PropertyContentLeftPadding, y, Allocation.Width - dividerX - PropertyContentLeftPadding, eh);
y += eh;
}
if (r.ChildRows != null && (r.Expanded || r.AnimatingExpand)) {
int py = y;
MeasureHeight (r.ChildRows, ref y);
r.ChildrenHeight = y - py;
if (r.AnimatingExpand)
y = py + r.AnimationHeight;
}
}
layout.Dispose ();
}
示例14: ComputeRowHeight
public override int ComputeRowHeight (Widget widget)
{
int height;
int text_w, text_h;
Pango.Layout layout = new Pango.Layout (widget.PangoContext);
layout.FontDescription = widget.PangoContext.FontDescription;
layout.FontDescription.Weight = Pango.Weight.Bold;
layout.SetText ("W");
layout.GetPixelSize (out text_w, out text_h);
height = text_h;
layout.FontDescription.Weight = Pango.Weight.Normal;
layout.FontDescription.Size = (int)(layout.FontDescription.Size * Pango.Scale.Small);
layout.FontDescription.Style = Pango.Style.Italic;
layout.SetText ("W");
layout.GetPixelSize (out text_w, out text_h);
height += text_h;
layout.Dispose ();
return (height < image_size ? image_size : height) + 6;
}
示例15: DrawText
void DrawText(Gdk.Window window, Cairo.Context cr, string text)
{
bool theme;
Gdk.GC light;
const int marginx = 10;
int winWidth, winHeight, w, h;
window.GetSize (out winWidth, out winHeight);
if (project != null && project.Details.Theme != null) {
theme = true;
}
else
theme = false;
if (theme == true) {
if (winWidth > project.Details.Width)
winWidth = project.Details.Width;
if (winHeight > project.Details.Height)
winHeight = project.Details.Height;
}
Pango.Layout layout = new Pango.Layout (this.PangoContext);
layout.Width = winWidth * (int) Pango.Scale.PangoScale;
layout.SetMarkup (text);
layout.GetPixelSize (out w, out h);
if (theme) {
// TODO: We should force the ink colour too
cr.Color = new Cairo.Color (0, 0, 0, 0.7);
cr.Rectangle (((winWidth - w) /2) - marginx, (winHeight / 2), w + marginx * 2, h * 2);
cr.Fill ();
cr.Stroke ();
light = Style.LightGC (StateType.Normal);
}
light = Style.DarkGC (StateType.Normal);
window.DrawLayout (light, (winWidth - w) /2, (winHeight / 2) + 4, layout);
layout.Dispose ();
}