本文整理汇总了C#中Gdk.GC类的典型用法代码示例。如果您正苦于以下问题:C# GC类的具体用法?C# GC怎么用?C# GC使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
GC类属于Gdk命名空间,在下文中一共展示了GC类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的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);
}
开发者ID:unhammer,项目名称:gimp-sharp,代码行数:30,代码来源:Preview.cs
示例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);
//----------------------
}
开发者ID:dufresnep,项目名称:gs2emu-googlecode,代码行数:29,代码来源:MainWindow.cs
示例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);
}
}
}}
}
开发者ID:slluis,项目名称:monodevelop-prehistoric,代码行数:34,代码来源:GutterMargin.cs
示例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);
}
开发者ID:Guthius,项目名称:gs2emu-googlecode,代码行数:8,代码来源:TileRenderer.cs
示例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;
}
开发者ID:codebutler,项目名称:meshwork,代码行数:9,代码来源:GtkHelper.cs
示例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;
}
开发者ID:denisbarboni,项目名称:Projeto-AG,代码行数:10,代码来源:SampleContext.cs
示例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);
}
开发者ID:joebain,项目名称:MagnumHouse,代码行数:10,代码来源:PhysicsAdjuster.cs
示例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));
}
开发者ID:dufresnep,项目名称:gs2emu-googlecode,代码行数:11,代码来源:GtkHelpFuncs.cs
示例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));
}
}
开发者ID:physalis,项目名称:MeeGen,代码行数:11,代码来源:ColorSelectButton.cs
示例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);
}
开发者ID:unhammer,项目名称:gimp-sharp,代码行数:13,代码来源:PreviewRenderer.cs
示例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);
}
开发者ID:FreeBSD-DotNet,项目名称:monodevelop,代码行数:13,代码来源:PlaceholderWindow.cs
示例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();
}
开发者ID:peter-gregory,项目名称:ClockRadio,代码行数:51,代码来源:Volume.cs
示例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);
}
开发者ID:astarasikov,项目名称:HuffmanArchiver,代码行数:14,代码来源:TreeGraphics.cs
示例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;
}
开发者ID:transformersprimeabcxyz,项目名称:monodevelop-1,代码行数:16,代码来源:IconMargin.cs
示例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);
}
开发者ID:jobernolte,项目名称:Pinta,代码行数:19,代码来源:ResourceManager.cs
示例16: ArrowWindow
public ArrowWindow(DockToolbarFrame frame, Direction dir)
: base(Gtk.WindowType.Popup)
{
SkipTaskbarHint = true;
Decorated = false;
TransientFor = frame.TopWindow;
direction = dir;
arrow = CreateArrow ();
if (direction == Direction.Up || direction == Direction.Down) {
width = PointerWidth;
height = LineLength + PointerLength + 1;
} else {
height = PointerWidth;
width = LineLength + PointerLength + 1;
}
// Create the mask for the arrow
Gdk.Color black, white;
black = new Gdk.Color (0, 0, 0);
black.Pixel = 1;
white = new Gdk.Color (255, 255, 255);
white.Pixel = 0;
Gdk.Pixmap pm = new Pixmap (this.GdkWindow, width, height, 1);
Gdk.GC gc = new Gdk.GC (pm);
gc.Background = white;
gc.Foreground = white;
pm.DrawRectangle (gc, true, 0, 0, width, height);
gc.Foreground = black;
pm.DrawPolygon (gc, false, arrow);
pm.DrawPolygon (gc, true, arrow);
this.ShapeCombineMask (pm, 0, 0);
Realize ();
redgc = new Gdk.GC (GdkWindow);
redgc.RgbFgColor = new Gdk.Color (255, 0, 0);
Resize (width, height);
}
开发者ID:slluis,项目名称:monodevelop-prehistoric,代码行数:44,代码来源:ArrowWindow.cs
示例17: CreateShape
void CreateShape (int width, int height)
{
Gdk.Color black, white;
black = new Gdk.Color (0, 0, 0);
black.Pixel = 1;
white = new Gdk.Color (255, 255, 255);
white.Pixel = 0;
Gdk.Pixmap pm = new Pixmap (this.GdkWindow, width, height, 1);
Gdk.GC gc = new Gdk.GC (pm);
gc.Background = white;
gc.Foreground = white;
pm.DrawRectangle (gc, true, 0, 0, width, height);
gc.Foreground = black;
pm.DrawRectangle (gc, false, 0, 0, width - 1, height - 1);
pm.DrawRectangle (gc, false, 1, 1, width - 3, height - 3);
this.ShapeCombineMask (pm, 0, 0);
}
开发者ID:FreeBSD-DotNet,项目名称:monodevelop,代码行数:20,代码来源:PlaceholderWindow.cs
示例18: Draw
public void Draw(Drawable draw, Gdk.Color back)
{
Gdk.GC gc = new Gdk.GC(draw);
try {
int width;
int height;
draw.GetSize(out width, out height);
int xPoint = (width * Volume) / 100;
int yTop = height * Volume / 100;
List<Point> points = new List<Point>();
points.Add(new Point(0,0));
points.Add(new Point(xPoint, yTop));
points.Add(new Point(xPoint, height));
points.Add(new Point(0,height));
points.Add(new Point(0,0));
gc.Foreground = back;
gc.Background = back;
draw.DrawPolygon(gc, true, points.ToArray());
draw.DrawRectangle(gc, true, xPoint, 0, width, height);
points.Clear();
points.Add(new Point(0,0));
points.Add(new Point(xPoint, yTop));
points.Add(new Point(xPoint, 0));
points.Add(new Point(0,0));
gc.Foreground = new Gdk.Color(0,128,0);
gc.Background = new Gdk.Color(0,128,0);
draw.DrawPolygon(gc, true, points.ToArray());
} catch (Exception ex) {
Console.WriteLine(ex.Source);
Console.WriteLine(ex.StackTrace);
}
gc.Dispose();
}
开发者ID:peter-gregory,项目名称:ClockRadio,代码行数:41,代码来源:GuiVolume.cs
示例19: OnDrawWeatherExposeEvent
protected void OnDrawWeatherExposeEvent(object o, ExposeEventArgs args)
{
Gdk.Color back = Style.Background(StateType.Normal);
Gdk.Color fore = Style.Foreground(StateType.Normal);
Drawable draw = drawWeather.GdkWindow;
Gdk.GC gc = new Gdk.GC(draw);
try {
gc.Foreground = back;
gc.Background = back;
int width;
int height;
draw.GetSize(out width, out height);
draw.DrawRectangle(gc, true, 0, 0, width, height);
gc.Foreground = fore;
String text = "";
if (Weather.Forecasts.Count > SelectedForecast) {
WeatherService.WeatherPeriod info = Weather.Forecasts[SelectedForecast];
text = info.Title + " - " + info.Forecast + "\n";
}
Pango.FontDescription font = Pango.FontDescription.FromString("Serif 14");
Pango.Layout layout = drawWeather.CreatePangoLayout(text);
layout.FontDescription = font;
layout.Width = Pango.Units.FromPixels(width);
draw.DrawLayoutWithColors(gc, 0, 0, layout, fore, back);
layout.Dispose();
} catch (Exception ex) {
Console.WriteLine(ex.Source);
Console.WriteLine(ex.StackTrace);
}
gc.Dispose();
}
开发者ID:peter-gregory,项目名称:ClockRadio,代码行数:39,代码来源:WeatherView.cs
示例20: Draw
public override void Draw(TextEditor editor, Gdk.Drawable win,Pango.Layout layout, bool selected, int startOffset, int endOffset, int y, int startXPos, int endXPos)
{
int markerStart = LineSegment.Offset + System.Math.Max (StartCol, 0);
int markerEnd = LineSegment.Offset + (EndCol < 0? LineSegment.Length : EndCol);
if (markerEnd < startOffset || markerStart > endOffset)
return;
int from;
int to;
if (markerStart < startOffset && endOffset < markerEnd) {
from = startXPos;
to = endXPos;
} else {
int start = startOffset < markerStart ? markerStart : startOffset;
int end = endOffset < markerEnd ? endOffset : markerEnd;
from = startXPos + editor.GetWidth (editor.Document.GetTextAt (startOffset, start - startOffset));
to = startXPos + editor.GetWidth (editor.Document.GetTextAt (startOffset, end - startOffset));
}
from = System.Math.Max (from, editor.TextViewMargin.XOffset);
to = System.Math.Max (to, editor.TextViewMargin.XOffset);
if (from >= to) {
return;
}
using (Gdk.GC gc = new Gdk.GC (win)) {
// gc.RgbFgColor = ColorName == null ? Color : editor.ColorStyle.GetColorFromDefinition (ColorName);
int drawY = y + editor.LineHeight - 1;
win.DrawLine (gc, from, drawY, to, drawY);
if(@from<to){
//gc.RgbFgColor = editor.ColorStyle.BracketHighlightRectangle.BackgroundColor;
//win.DrawRectangle (gc, true, @from + 1, y + 1, to - @from - 1, editor.LineHeight - 2);
gc.RgbFgColor = editor.ColorStyle.BracketHighlightRectangle.Color;
win.DrawRectangle (gc, false, @from, y, to - @from, editor.LineHeight - 1);
}
}
}
开发者ID:moscrif,项目名称:ide,代码行数:39,代码来源:UsageMarker.cs
注:本文中的Gdk.GC类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论