本文整理汇总了C#中Gdk.GC类的典型用法代码示例。如果您正苦于以下问题:C# GC类的具体用法?C# GC怎么用?C# GC使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
GC类属于Gdk命名空间,在下文中一共展示了GC类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Preview
public Preview(Drawable drawable, SliceData sliceData)
{
MaxSize = drawable.Dimensions;
ExposeEvent += delegate {sliceData.Draw(Renderer);};
Realized += delegate
{
var gc = new Gdk.GC(GdkWindow);
Renderer = new PreviewRenderer(this, gc, drawable.Dimensions);
Draw(drawable);
};
SizeAllocated += delegate {Draw(drawable);};
Events = EventMask.ButtonPressMask | EventMask.ButtonReleaseMask |
EventMask.PointerMotionHintMask | EventMask.PointerMotionMask |
EventMask.LeaveNotifyMask;
ButtonPressEvent += (o, args) =>
{
var c = new IntCoordinate((int) args.Event.X, (int) args.Event.Y);
Func.GetActualFunc(c).OnButtonPress(o, args);
};
MotionNotifyEvent += (o, args) =>
{
GdkWindow.Cursor = Func.GetCursor(GetXY(args));
};
Func = new SelectFunc(sliceData, this);
}
示例2: drawTileset
//level must be declared prior to calling this
public void drawTileset()
{
_tilesetCache = new Gdk.Pixbuf(_editLevel.tilesetPath);
Pixmap pMap, mask;
_tilesetCache.RenderPixmapAndMask (out pMap, out mask, 0);
int imgWidth = _tilesetCache.Width,
imgHeight = _tilesetCache.Height;
_tilesetEventBox.SetSizeRequest (imgWidth, imgHeight);
tilesetDrawPane.SetSizeRequest (imgWidth, imgHeight);
if (_tilesetGrid) {
//get the context we're drawing in
Gdk.GC gc = new Gdk.GC (levelDrawPane.GdkWindow);
//draw the grid
for (int x = 0; x < imgWidth; x += _editLevel._tileWidth)
pMap.DrawLine (gc, x, 0, x, imgHeight);
for (int y = 0; y < imgHeight; y += _editLevel._tileHeight)
pMap.DrawLine (gc, 0, y, imgWidth, y);
}
tilesetDrawPane.SetFromPixmap (pMap, mask);
//----------------------
}
示例3: Paint
public override void Paint(Gdk.Drawable wnd, System.Drawing.Rectangle rect)
{
int one_width = (int) textArea.TextView.GetWidth ('w');
using (Gdk.GC gc = new Gdk.GC (wnd)) {
using (Pango.Layout ly = new Pango.Layout (TextArea.PangoContext)) {
ly.FontDescription = FontContainer.DefaultFont;
ly.Width = drawingPosition.Width;
ly.Alignment = Pango.Alignment.Right;
HighlightColor lineNumberPainterColor = textArea.Document.HighlightingStrategy.GetColorFor("LineNumbers");
gc.RgbBgColor = new Gdk.Color (lineNumberPainterColor.BackgroundColor);
gc.RgbFgColor = TextArea.Style.White;
wnd.DrawRectangle (gc, true, drawingPosition);
gc.RgbFgColor = new Gdk.Color (lineNumberPainterColor.Color);
gc.SetLineAttributes (1, LineStyle.OnOffDash, CapStyle.NotLast, JoinStyle.Miter);
wnd.DrawLine (gc, drawingPosition.X + drawingPosition.Width, drawingPosition.Y, drawingPosition.X + drawingPosition.Width, drawingPosition.Height);
//FIXME: This doesnt allow different fonts and what not
int fontHeight = TextArea.TextView.FontHeight;
for (int y = 0; y < (DrawingPosition.Height + textArea.TextView.VisibleLineDrawingRemainder) / fontHeight + 1; ++y) {
int ypos = drawingPosition.Y + fontHeight * y - textArea.TextView.VisibleLineDrawingRemainder;
int curLine = y + textArea.TextView.FirstVisibleLine;
if (curLine < textArea.Document.TotalNumberOfLines) {
ly.SetText ((curLine + 1).ToString ());
wnd.DrawLayout (gc, drawingPosition.X + drawingPosition.Width - one_width, ypos, ly);
}
}
}}
}
示例4: TileRenderer
public TileRenderer(Gtk.Image draw, int pixelWidth, int pixelHeight)
{
_renderTo = draw;
_tileCache = "null";
_levelPMap = new Pixmap(_renderTo.GdkWindow, pixelWidth, pixelHeight);
_graphicsContext = new Gdk.GC(_renderTo.GdkWindow);
}
示例5: GetDarkenedGC
public static Gdk.GC GetDarkenedGC(Gdk.Window window,
Gdk.Color color,
int darken_count)
{
DarkenColor (ref color, darken_count);
Gdk.GC gc = new Gdk.GC (window);
gc.RgbFgColor = color;
return gc;
}
示例6: CreateGC
public Gdk.GC CreateGC(Gdk.Color foregroundColor)
{
var gc = new Gdk.GC(GdkWindow);
gc.RgbFgColor = foregroundColor;
gc.RgbBgColor = new Gdk.Color(255, 255, 255);
gc.Background = new Gdk.Color(255, 255, 255);
gc.SetLineAttributes(1, LineStyle.OnOffDash, CapStyle.Projecting, JoinStyle.Round);
return gc;
}
示例7: drawStatsArea
protected virtual void drawStatsArea(object o, Gtk.ExposeEventArgs args)
{
Gdk.GC red = new Gdk.GC (statsArea.GdkWindow);
red.RgbFgColor = new Gdk.Color (255, 0, 0);
Gdk.GC blue = new Gdk.GC (statsArea.GdkWindow);
blue.RgbFgColor = new Gdk.Color (0, 0, 255);
statsArea.GdkWindow.DrawPoints(blue, speedPoints);
statsArea.GdkWindow.DrawPoints(red, accelPoints);
}
示例8: drawWidgetRect
public static void drawWidgetRect(Widget w, Pixbuf widgetBuffer, int offsetX, int offsetY, int drawX, int drawY, int drawW, int drawH)
{
Gdk.GC gc = new Gdk.GC(w.GdkWindow);
w.GdkWindow.DrawPixbuf (gc, widgetBuffer, 0, 0, offsetX, offsetY, -1, -1, Gdk.RgbDither.None, 0, 0);
w.GdkWindow.DrawRectangle(gc, false, new Rectangle (drawX + offsetX, drawY + offsetY, drawW, drawH));
//set colour to white
gc.RgbFgColor = new Color (255, 255, 255);
w.GdkWindow.DrawRectangle(gc, false, new Rectangle (drawX + offsetX + 1, drawY + offsetY + 1, drawW, drawH));
}
示例9: OnDrawingareaExposeEvent
protected virtual void OnDrawingareaExposeEvent(object o, Gtk.ExposeEventArgs args)
{
int width, height;
this.DrawingArea.GdkWindow.GetSize(out width, out height);
using(Gdk.GC g = new Gdk.GC(DrawingArea.GdkWindow))
{
g.SetLineAttributes(2, LineStyle.Solid, CapStyle.Round, JoinStyle.Miter);
DrawingArea.GdkWindow.DrawRectangle(g, false, new Rectangle(0, 0, width, height));
}
}
示例10: PreviewRenderer
public PreviewRenderer(Preview preview, Gdk.GC gc, Dimensions dimensions)
{
_window = preview.GdkWindow;
_gc = gc;
_width = dimensions.Width - 1;
_height = dimensions.Height - 1;
var colormap = Colormap.System;
_inactive = new Gdk.Color(0xff, 0, 0);
_active = new Gdk.Color(0, 0xff, 0);
colormap.AllocColor(ref _inactive, true, true);
colormap.AllocColor(ref _active, true, true);
}
示例11: PlaceholderWindow
public PlaceholderWindow (DockFrame frame): base (Gtk.WindowType.Popup)
{
SkipTaskbarHint = true;
Decorated = false;
TransientFor = (Gtk.Window) frame.Toplevel;
TypeHint = WindowTypeHint.Utility;
// Create the mask for the arrow
Realize ();
redgc = new Gdk.GC (GdkWindow);
redgc.RgbFgColor = frame.Style.Background (StateType.Selected);
}
示例12: OnDrawVolumeExposeEvent
protected void OnDrawVolumeExposeEvent(object o, Gtk.ExposeEventArgs args)
{
Gdk.Color back = Style.Background(StateType.Normal);
Gdk.Color fore = Style.Foreground(StateType.Normal);
Drawable draw = args.Event.Window;
int width;
int height;
draw.GetSize(out width, out height);
Gdk.GC gc = new Gdk.GC(draw);
gc.Foreground = back;
gc.Background = back;
draw.DrawRectangle(gc, true, 0, 0, width, height);
//Color lightSlateGray = new Color(119,136,153);
//gc.Colormap.AllocColor(ref lightSlateGray, false, true);
int outside = height * 8 / 10;
int middle = height * 6 / 10;
int inside = height * 4 / 10;
int startOut = 24;
int startMiddle = 30;
int startInside = 36;
int endOut = width - 24;
int endMiddle = width - 30;
int endInside = width - 36;
gc.Foreground = fore;
gc.Foreground = fore;
gc.SetLineAttributes(outside, LineStyle.Solid, CapStyle.Round, JoinStyle.Round);
draw.DrawLine(gc, startOut, height / 2, endOut, height / 2);
gc.Foreground = back;
gc.Background = back;
gc.SetLineAttributes(middle, LineStyle.Solid, CapStyle.Round, JoinStyle.Round);
draw.DrawLine(gc, startMiddle, height / 2, endMiddle, height / 2);
int endX = (endInside - startInside) * Percentage / 100 + startInside;
gc.Foreground = fore;
gc.Foreground = fore;
gc.SetLineAttributes(inside, LineStyle.Solid, CapStyle.Round, JoinStyle.Round);
draw.DrawLine(gc, startInside, height / 2, endX, height / 2);
gc.Dispose();
}
示例13: DrawGrid
public static void DrawGrid(Gdk.Drawable wnd, int Size)
{
int Width, Height;
var gc = new Gdk.GC (wnd);
Gdk.Color line_color = new Gdk.Color (0, 255, 255);
gc.RgbFgColor = line_color;
wnd.GetSize (out Width, out Height);
for (int i = 0; i < Width; i += Size)
wnd.DrawLine (gc, i, 0, i, Height);
for (int i = 0; i < Height; i += Size)
wnd.DrawLine (gc, 0, i, Width, i);
}
示例14: OptionsChanged
internal protected override void OptionsChanged ()
{
DisposeGCs ();
backgroundGC = new Gdk.GC (editor.GdkWindow);
backgroundGC.RgbFgColor = editor.ColorStyle.IconBarBg;
separatorGC = new Gdk.GC (editor.GdkWindow);
separatorGC.RgbFgColor = editor.ColorStyle.IconBarSeperator;
layout.FontDescription = editor.Options.Font;
layout.SetText ("!");
int tmp;
layout.GetPixelSize (out tmp, out this.marginWidth);
marginWidth *= 12;
marginWidth /= 10;
}
示例15: CreateMissingImage
// From MonoDevelop:
// https://github.com/mono/monodevelop/blob/master/main/src/core/MonoDevelop.Ide/gtk-gui/generated.cs
private static Pixbuf CreateMissingImage(int size)
{
var pmap = new Gdk.Pixmap (Gdk.Screen.Default.RootWindow, size, size);
var gc = new Gdk.GC (pmap);
gc.RgbFgColor = new Gdk.Color (255, 255, 255);
pmap.DrawRectangle (gc, true, 0, 0, size, size);
gc.RgbFgColor = new Gdk.Color (0, 0, 0);
pmap.DrawRectangle (gc, false, 0, 0, (size - 1), (size - 1));
gc.SetLineAttributes (3, Gdk.LineStyle.Solid, Gdk.CapStyle.Round, Gdk.JoinStyle.Round);
gc.RgbFgColor = new Gdk.Color (255, 0, 0);
pmap.DrawLine (gc, (size / 4), (size / 4), ((size - 1) - (size / 4)), ((size - 1) - (size / 4)));
pmap.DrawLine (gc, ((size - 1) - (size / 4)), (size / 4), (size / 4), ((size - 1) - (size / 4)));
return Gdk.Pixbuf.FromDrawable (pmap, pmap.Colormap, 0, 0, 0, 0, size, size);
}