本文整理汇总了C#中Gdk.GC.Copy方法的典型用法代码示例。如果您正苦于以下问题:C# Gdk.GC.Copy方法的具体用法?C# Gdk.GC.Copy怎么用?C# Gdk.GC.Copy使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Gdk.GC
的用法示例。
在下文中一共展示了Gdk.GC.Copy方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: RenderPlaceholderText
internal static void RenderPlaceholderText (Gtk.Entry entry, Gtk.ExposeEventArgs args, string placeHolderText, ref Pango.Layout layout)
{
// The Entry's GdkWindow is the top level window onto which
// the frame is drawn; the actual text entry is drawn into a
// separate window, so we can ensure that for themes that don't
// respect HasFrame, we never ever allow the base frame drawing
// to happen
if (args.Event.Window == entry.GdkWindow)
return;
if (entry.Text.Length > 0)
return;
if (layout == null) {
layout = new Pango.Layout (entry.PangoContext);
layout.FontDescription = entry.PangoContext.FontDescription.Copy ();
}
int wh, ww;
args.Event.Window.GetSize (out ww, out wh);
int width, height;
layout.SetText (placeHolderText);
layout.GetPixelSize (out width, out height);
using (var gc = new Gdk.GC (args.Event.Window)) {
gc.Copy (entry.Style.TextGC (Gtk.StateType.Normal));
Color color_a = entry.Style.Base (Gtk.StateType.Normal).ToXwtValue ();
Color color_b = entry.Style.Text (Gtk.StateType.Normal).ToXwtValue ();
gc.RgbFgColor = color_b.BlendWith (color_a, 0.5).ToGtkValue ();
args.Event.Window.DrawLayout (gc, 2, (wh - height) / 2 + 1, layout);
}
}
示例2: RefreshGC
private void RefreshGC()
{
if(text_window == null) {
return;
}
text_gc = new Gdk.GC(text_window);
text_gc.Copy(Style.TextGC(StateType.Normal));
Gdk.Color color_a = parent.Style.Base(StateType.Normal);
Gdk.Color color_b = parent.Style.Text(StateType.Normal);
text_gc.RgbFgColor = Hyena.Gui.GtkUtilities.ColorBlend(color_a, color_b);
}
示例3: RefreshGC
private void RefreshGC()
{
if(text_window == null) {
return;
}
text_gc = new Gdk.GC(text_window);
text_gc.Copy(Style.TextGC(StateType.Normal));
Gdk.Color color_a = parent.Style.Base(StateType.Normal);
Gdk.Color color_b = parent.Style.Text(StateType.Normal);
text_gc.RgbFgColor = DockServices.Drawing.ColorBlend(color_a, color_b);
}
示例4: OnExposeEvent
protected override bool OnExposeEvent (Gdk.EventExpose evnt)
{
// The Entry's GdkWindow is the top level window onto which
// the frame is drawn; the actual text entry is drawn into a
// separate window, so we can ensure that for themes that don't
// respect HasFrame, we never ever allow the base frame drawing
// to happen
if (evnt.Window == GdkWindow) {
return true;
}
bool ret = base.OnExposeEvent (evnt);
if (text_gc == null) {
text_gc = new Gdk.GC (evnt.Window);
text_gc.Copy (Style.TextGC (StateType.Normal));
Gdk.Color color_a = parent.Style.Base (StateType.Normal);
Gdk.Color color_b = parent.Style.Text (StateType.Normal);
text_gc.RgbFgColor = ColorBlend (color_a, color_b);
}
if (Text.Length > 0 || HasFocus || parent.EmptyMessage == null) {
return ret;
}
if (layout == null) {
layout = new Pango.Layout (PangoContext);
layout.FontDescription = PangoContext.FontDescription.Copy ();
}
int width, height;
layout.SetMarkup (parent.EmptyMessage);
layout.GetPixelSize (out width, out height);
evnt.Window.DrawLayout (text_gc, 2, (SizeRequest ().Height - height) / 2, layout);
return ret;
}
示例5: Render
protected override void Render(Gdk.Drawable drawable, Widget widget,
Gdk.Rectangle background_area, Gdk.Rectangle cell_area,
Gdk.Rectangle expose_area, CellRendererState flags)
{
Pango.Layout layout = GetLayout (widget);
// FIXME: If this code is ever built into its own library,
// the call to Tomboy will definitely have to change
layout.SetText (Utilities.GetPrettyPrintDate (date, show_time));
int x, y, w, h;
CalculateSize (layout, out x, out y, out w, out h);
StateType state = RendererStateToWidgetState(flags);
Gdk.GC gc;
if (state.Equals(StateType.Selected)) {
// Use the proper Gtk.StateType so text appears properly when selected
gc = new Gdk.GC(drawable);
gc.Copy(widget.Style.TextGC(state));
gc.RgbFgColor = widget.Style.Foreground(state);
} else
gc = widget.Style.TextGC(Gtk.StateType.Normal);
drawable.DrawLayout (
gc,
cell_area.X + (int)Xalign + (int)Xpad,
cell_area.Y + ((cell_area.Height - h) / 2),
layout);
}
示例6: HandleWidgetExposeEvent
void HandleWidgetExposeEvent(object o, Gtk.ExposeEventArgs args)
{
// The Entry's GdkWindow is the top level window onto which
// the frame is drawn; the actual text entry is drawn into a
// separate window, so we can ensure that for themes that don't
// respect HasFrame, we never ever allow the base frame drawing
// to happen
if (args.Event.Window == Widget.GdkWindow)
return;
if (Widget.Text.Length > 0)
return;
if (layout == null) {
layout = new Pango.Layout (Widget.PangoContext);
layout.FontDescription = Widget.PangoContext.FontDescription.Copy ();
}
int wh, ww;
args.Event.Window.GetSize (out ww, out wh);
int width, height;
layout.SetText (placeHolderText);
layout.GetPixelSize (out width, out height);
Gdk.GC gc = new Gdk.GC (args.Event.Window);
gc.Copy (Widget.Style.TextGC (Gtk.StateType.Normal));
Color color_a = Util.ToXwtColor (Widget.Style.Base (Gtk.StateType.Normal));
Color color_b = Util.ToXwtColor (Widget.Style.Text (Gtk.StateType.Normal));
gc.RgbFgColor = Util.ToGdkColor (color_b.BlendWith (color_a, 0.5));
args.Event.Window.DrawLayout (gc, 2, (wh - height) / 2 + 1, layout);
gc.Dispose ();
}
示例7: OnExposeEvent
protected override bool OnExposeEvent (Gdk.EventExpose evnt)
{
bool res = base.OnExposeEvent (evnt);
if (Text.Length == 0 && !string.IsNullOrEmpty (EmptyMessage)) {
if (text_gc == null) {
text_gc = new Gdk.GC (evnt.Window);
text_gc.Copy (Style.TextGC (Gtk.StateType.Normal));
Gdk.Color color_a = Style.Base (Gtk.StateType.Normal);
Gdk.Color color_b = Style.Text (Gtk.StateType.Normal);
text_gc.RgbFgColor = ColorBlend (color_a, color_b);
}
if (layout == null) {
layout = new Pango.Layout (PangoContext);
layout.FontDescription = PangoContext.FontDescription.Copy ();
}
int width, height;
layout.SetMarkup (EmptyMessage);
layout.GetPixelSize (out width, out height);
evnt.Window.DrawLayout (text_gc, 2, 2, layout);
}
return res;
}
示例8: RefreshGC
private void RefreshGC()
{
if(text_window == null) {
return;
}
text_gc = new Gdk.GC(text_window);
text_gc.Copy(Style.TextGC(StateType.Normal));
Gdk.Color color_a = parent.Style.Foreground(StateType.Normal);
Gdk.Color color_b = parent.Style.Background(StateType.Normal);
text_gc.RgbFgColor = DrawingUtilities.ColorBlend(color_a, color_b, 0.5);
}