本文整理汇总了C#中Gdk.EventExpose类的典型用法代码示例。如果您正苦于以下问题:C# EventExpose类的具体用法?C# EventExpose怎么用?C# EventExpose使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
EventExpose类属于Gdk命名空间,在下文中一共展示了EventExpose类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: OnExposeEvent
protected override bool OnExposeEvent (EventExpose evnt)
{
base.OnExposeEvent (evnt);
using (var e = CairoHelper.Create (evnt.Window))
{
Render (e);
}
return true;
}
示例2: OnExposeEvent
protected override bool OnExposeEvent (EventExpose evnt)
{
using (var cr = CairoHelper.Create (evnt.Window)) {
cr.Color = (Mono.TextEditor.HslColor)Style.Dark (StateType.Normal);
cr.Rectangle (0, 0, Allocation.Width, Allocation.Height);
cr.Fill ();
}
return true;
}
示例3: OnExposeEvent
protected override bool OnExposeEvent(EventExpose args)
{
using (Context context = CairoHelper.Create (base.GdkWindow)) {
CairoHelper.Rectangle (context, args.Area);
context.Clip ();
CreatePath (context);
StrokeAndFill (context);
}
return true;
}
示例4: OnExposeEvent
protected override bool OnExposeEvent (EventExpose evnt)
{
Gdk.Window win = evnt.Window;
win.DrawRectangle (Style.BaseGC (string.IsNullOrEmpty (Markup) ? StateType.Insensitive : StateType.Normal), true, evnt.Area);
int x = 0;
int y = 0;
if (string.IsNullOrEmpty (Markup)) {
layout.SetMarkup (GettextCatalog.GetString ("No documentation available."));
int width, height;
layout.GetPixelSize (out width, out height);
x = (Allocation.Width - width) / 2;
y = (Allocation.Height - height) / 2;
} else {
layout.SetMarkup (Markup);
}
layout.Width = Allocation.Width * (int)Pango.Scale.PangoScale;
win.DrawLayout (Style.TextGC (StateType.Normal), x, y, layout);
return true;
}
示例5: OnExposeEvent
protected override bool OnExposeEvent (EventExpose evnt)
{
base.OnExposeEvent (evnt);
using (var e = CairoHelper.Create (evnt.Window))
{
var hourRadians = (time.Hour % 12 + time.Minute / 60F) * 30 * Math.PI / 180;
DrawHand (3, hourLength, hourColor, hourRadians, e);
var minuteRadians = (time.Minute) * 6 * Math.PI / 180;
DrawHand (2, minuteLength, minuteColor, minuteRadians, e);
var secondRadians = (time.Second) * 6 * Math.PI / 180;
DrawHand (1, secondLength, secondColor, secondRadians, e);
for (int i = 0; i < 60; i++) {
if (i % 5 == 0) {
var p1 = new Cairo.PointD (center.X + (radius / 1.50 * Math.Sin (i * 6 * Math.PI / 180)), center.Y - (radius / 1.50 * Math.Cos (i * 6 * Math.PI / 180)));
var p2 = new Cairo.PointD (center.X + (radius / 1.65 * Math.Sin (i * 6 * Math.PI / 180)), center.Y - (radius / 1.65 * Math.Cos (i * 6 * Math.PI / 180)));
e.LineWidth = 1;
e.Color = ticksColor;
e.MoveTo (p1);
e.LineTo (p2);
e.ClosePath ();
e.Stroke ();
} else {
var p1 = new Cairo.PointD (center.X + (radius / 1.50 * Math.Sin (i * 6 * Math.PI / 180)), center.Y - (radius / 1.50 * Math.Cos (i * 6 * Math.PI / 180)));
var p2 = new Cairo.PointD ( center.X + (radius / 1.55 * Math.Sin (i * 6 * Math.PI / 180)), center.Y - (radius / 1.55 * Math.Cos (i * 6 * Math.PI / 180)));
e.LineWidth = 1;
e.Color = ticksColor;
e.MoveTo (p1);
e.LineTo (p2);
e.ClosePath ();
e.Stroke ();
}
}
DrawFace (center, (radius / 2) + 17, e);
DrawFace (center, 8, e);
}
return true;
}
示例6: OnExposeEvent
protected override bool OnExposeEvent(EventExpose e)
{
base.OnExposeEvent (e);
if (!PintaCore.Workspace.HasOpenDocuments)
return true;
double scale = PintaCore.Workspace.Scale;
int x = (int)PintaCore.Workspace.Offset.X;
int y = (int)PintaCore.Workspace.Offset.Y;
// Translate our expose area for the whole drawingarea to just our canvas
Rectangle canvas_bounds = new Rectangle (x, y, PintaCore.Workspace.CanvasSize.Width, PintaCore.Workspace.CanvasSize.Height);
canvas_bounds.Intersect (e.Area);
if (canvas_bounds.IsEmpty)
return true;
canvas_bounds.X -= x;
canvas_bounds.Y -= y;
// Resize our offscreen surface to a surface the size of our drawing area
if (canvas == null || canvas.Width != canvas_bounds.Width || canvas.Height != canvas_bounds.Height) {
if (canvas != null)
(canvas as IDisposable).Dispose ();
canvas = new Cairo.ImageSurface (Cairo.Format.Argb32, canvas_bounds.Width, canvas_bounds.Height);
}
cr.Initialize (PintaCore.Workspace.ImageSize, PintaCore.Workspace.CanvasSize);
using (Cairo.Context g = CairoHelper.Create (GdkWindow)) {
// Draw our canvas drop shadow
g.DrawRectangle (new Cairo.Rectangle (x, y, PintaCore.Workspace.CanvasSize.Width + 1, PintaCore.Workspace.CanvasSize.Height + 1), new Cairo.Color (.5, .5, .5), 1);
g.DrawRectangle (new Cairo.Rectangle (x - 1, y - 1, PintaCore.Workspace.CanvasSize.Width + 3, PintaCore.Workspace.CanvasSize.Height + 3), new Cairo.Color (.8, .8, .8), 1);
g.DrawRectangle (new Cairo.Rectangle (x - 2, y - 2, PintaCore.Workspace.CanvasSize.Width + 5, PintaCore.Workspace.CanvasSize.Height + 5), new Cairo.Color (.9, .9, .9), 1);
// Set up our clip rectangle
g.Rectangle (new Cairo.Rectangle (x, y, PintaCore.Workspace.CanvasSize.Width, PintaCore.Workspace.CanvasSize.Height));
g.Clip ();
g.Translate (x, y);
// Render all the layers to a surface
var layers = PintaCore.Layers.GetLayersToPaint ();
if (layers.Count == 0) {
canvas.Clear ();
}
cr.Render (layers, canvas, canvas_bounds.Location);
// Paint the surface to our canvas
g.SetSourceSurface (canvas, canvas_bounds.X + (int)(0 * scale), canvas_bounds.Y + (int)(0 * scale));
g.Paint ();
// Selection outline
if (PintaCore.Layers.ShowSelection) {
g.Save ();
g.Translate (0.5, 0.5);
g.Scale (scale, scale);
g.AppendPath (PintaCore.Layers.SelectionPath);
if (PintaCore.Tools.CurrentTool.Name.Contains ("Select") && !PintaCore.Tools.CurrentTool.Name.Contains ("Selected")) {
g.Color = new Cairo.Color (0.7, 0.8, 0.9, 0.2);
g.FillRule = Cairo.FillRule.EvenOdd;
g.FillPreserve ();
}
g.LineWidth = 1 / scale;
// Draw a white line first so it shows up on dark backgrounds
g.Color = new Cairo.Color (1, 1, 1);
g.StrokePreserve ();
// Draw a black dashed line over the white line
g.SetDash (new double[] { 2 / scale, 4 / scale }, 0);
g.Color = new Cairo.Color (0, 0, 0);
g.Stroke ();
g.Restore ();
}
}
return true;
}
示例7: OnExposeEvent
protected override bool OnExposeEvent (EventExpose evnt)
{
using (var ctx = Gdk.CairoHelper.Create (GdkWindow)) {
ctx.Rectangle (0, 0, Allocation.Width, Allocation.Height);
using (var g = new Cairo.LinearGradient (0, 0, 0, Allocation.Height)) {
g.AddColorStop (0, Styles.BreadcrumbBackgroundColor);
g.AddColorStop (1, Styles.BreadcrumbGradientEndColor);
ctx.SetSource (g);
}
ctx.Fill ();
if (widths == null)
return true;
// Calculate the total required with, and the reduction to be applied in case it doesn't fit the available space
bool widthReduced;
var currentWidths = GetCurrentWidths (out widthReduced);
// Render the paths
int textTopPadding = topPadding + (height - textHeight) / 2;
int xpos = leftPadding, ypos = topPadding;
for (int i = 0; i < leftPath.Length; i++) {
bool last = i == leftPath.Length - 1;
// Reduce the item size when required
int itemWidth = currentWidths [i];
int x = xpos;
xpos += itemWidth;
if (hoverIndex >= 0 && hoverIndex < Path.Length && leftPath [i] == Path [hoverIndex] && (menuVisible || pressed || hovering))
DrawButtonBorder (ctx, x - padding, itemWidth + padding + padding);
int textOffset = 0;
if (leftPath [i].DarkIcon != null) {
int iy = (height - (int)leftPath [i].DarkIcon.Height) / 2 + topPadding;
ctx.DrawImage (this, leftPath [i].DarkIcon, x, iy);
textOffset += (int) leftPath [i].DarkIcon.Width + iconSpacing;
}
layout.Attributes = (i == activeIndex) ? boldAtts : null;
layout.SetMarkup (GetFirstLineFromMarkup (leftPath [i].Markup));
ctx.Save ();
// If size is being reduced, ellipsize it
bool showText = true;
if (widthReduced) {
int w = itemWidth - textOffset;
if (w > 0) {
ctx.Rectangle (x + textOffset, textTopPadding, w, height);
ctx.Clip ();
} else
showText = false;
} else
layout.Width = -1;
if (showText) {
// Text
ctx.SetSourceColor (Styles.BreadcrumbTextColor.ToCairoColor ());
ctx.MoveTo (x + textOffset, textTopPadding);
Pango.CairoHelper.ShowLayout (ctx, layout);
}
ctx.Restore ();
if (!last) {
xpos += arrowLeftPadding;
if (leftPath [i].IsPathEnd) {
Style.PaintVline (Style, GdkWindow, State, evnt.Area, this, "", ypos, ypos + height, xpos - arrowSize / 2);
} else {
int arrowH = Math.Min (height, arrowSize);
int arrowY = ypos + (height - arrowH) / 2;
DrawPathSeparator (ctx, xpos, arrowY, arrowH);
}
xpos += arrowSize + arrowRightPadding;
}
}
int xposRight = Allocation.Width - rightPadding;
for (int i = 0; i < rightPath.Length; i++) {
// bool last = i == rightPath.Length - 1;
// Reduce the item size when required
int itemWidth = currentWidths [i + leftPath.Length];
xposRight -= itemWidth;
xposRight -= arrowSize;
int x = xposRight;
if (hoverIndex >= 0 && hoverIndex < Path.Length && rightPath [i] == Path [hoverIndex] && (menuVisible || pressed || hovering))
DrawButtonBorder (ctx, x - padding, itemWidth + padding + padding);
int textOffset = 0;
if (rightPath [i].DarkIcon != null) {
ctx.DrawImage (this, rightPath [i].DarkIcon, x, ypos);
textOffset += (int) rightPath [i].DarkIcon.Width + padding;
}
//.........这里部分代码省略.........
示例8: OnExposeEvent
protected override bool OnExposeEvent(EventExpose evnt)
{
if (evnt.Window != GdkWindow)
return true;
if (selection.Collection.Count == 0)
return true;
if (Orientation == Orientation.Horizontal && (extendable && Allocation.Width >= BackgroundPixbuf.Width + (2 * x_offset) + BackgroundTile.Width) ||
Orientation == Orientation.Vertical && (extendable && Allocation.Height >= BackgroundPixbuf.Height + (2 * y_offset) + BackgroundTile.Height) )
BackgroundPixbuf = null;
if ( Orientation == Orientation.Horizontal && (extendable && Allocation.Width < BackgroundPixbuf.Width + (2 * x_offset) ) ||
Orientation == Orientation.Vertical && ( extendable && Allocation.Height < BackgroundPixbuf.Height + (2 * y_offset) ))
BackgroundPixbuf = null;
int xpad = 0, ypad = 0;
if (Allocation.Width > BackgroundPixbuf.Width + (2 * x_offset))
xpad = (int) (x_align * (Allocation.Width - (BackgroundPixbuf.Width + (2 * x_offset))));
if (Allocation.Height > BackgroundPixbuf.Height + (2 * y_offset))
ypad = (int) (y_align * (Allocation.Height - (BackgroundPixbuf.Height + (2 * y_offset))));
GdkWindow.DrawPixbuf (Style.BackgroundGC (StateType.Normal), BackgroundPixbuf,
0, 0, x_offset + xpad, y_offset + ypad,
BackgroundPixbuf.Width, BackgroundPixbuf.Height, RgbDither.None, 0, 0);
//drawing the icons...
start_indexes = new Dictionary<int, int> ();
Pixbuf icon_pixbuf = null;
if (Orientation == Orientation.Horizontal)
icon_pixbuf = new Pixbuf (Colorspace.Rgb, true, 8, BackgroundPixbuf.Width, thumb_size);
else if (Orientation == Orientation.Vertical)
icon_pixbuf = new Pixbuf (Colorspace.Rgb, true, 8, thumb_size, BackgroundPixbuf.Height);
icon_pixbuf.Fill (0x00000000);
Pixbuf current = GetPixbuf ((int) Math.Round (Position));
int ref_x = (int)(icon_pixbuf.Width / 2.0 - current.Width * (Position + 0.5f - Math.Round (Position))); //xpos of the reference icon
int ref_y = (int)(icon_pixbuf.Height / 2.0 - current.Height * (Position + 0.5f - Math.Round (Position)));
int start_x = Orientation == Orientation.Horizontal ? ref_x : 0;
int start_y = Orientation == Orientation.Vertical ? ref_y : 0;
for (int i = (int) Math.Round (Position); i < selection.Collection.Count; i++) {
current = GetPixbuf (i, ActiveItem == i);
if (Orientation == Orientation.Horizontal) {
current.CopyArea (0, 0, Math.Min (current.Width, icon_pixbuf.Width - start_x) , current.Height, icon_pixbuf, start_x, start_y);
start_indexes [start_x] = i;
start_x += current.Width + spacing;
if (start_x > icon_pixbuf.Width)
break;
} else if (Orientation == Orientation.Vertical) {
current.CopyArea (0, 0, current.Width, Math.Min (current.Height, icon_pixbuf.Height - start_y), icon_pixbuf, start_x, start_y);
start_indexes [start_y] = i;
start_y += current.Height + spacing;
if (start_y > icon_pixbuf.Height)
break;
}
}
filmstrip_end_pos = (Orientation == Orientation.Horizontal ? start_x : start_y);
start_x = Orientation == Orientation.Horizontal ? ref_x : 0;
start_y = Orientation == Orientation.Vertical ? ref_y : 0;
for (int i = (int) Math.Round (Position) - 1; i >= 0; i--) {
current = GetPixbuf (i, ActiveItem == i);
if (Orientation == Orientation.Horizontal) {
start_x -= (current.Width + spacing);
current.CopyArea (Math.Max (0, -start_x), 0, Math.Min (current.Width, current.Width + start_x), current.Height, icon_pixbuf, Math.Max (start_x, 0), 0);
start_indexes [Math.Max (0, start_x)] = i;
if (start_x < 0)
break;
} else if (Orientation == Orientation.Vertical) {
start_y -= (current.Height + spacing);
current.CopyArea (0, Math.Max (0, -start_y), current.Width, Math.Min (current.Height, current.Height + start_y), icon_pixbuf, 0, Math.Max (start_y, 0));
start_indexes [Math.Max (0, start_y)] = i;
if (start_y < 0)
break;
}
}
filmstrip_start_pos = Orientation == Orientation.Horizontal ? start_x : start_y;
GdkWindow.DrawPixbuf (Style.BackgroundGC (StateType.Normal), icon_pixbuf,
0, 0, x_offset + xpad, y_offset + ypad + thumb_offset,
icon_pixbuf.Width, icon_pixbuf.Height, RgbDither.None, 0, 0);
icon_pixbuf.Dispose ();
return true;
}
示例9: OnSelectionExposeEvent
bool OnSelectionExposeEvent(EventExpose evnt)
{
if (selection == Rectangle.Zero)
return false;
Rectangle win_selection = ImageCoordsToWindow (selection);
using (var evnt_region = evnt.Region.Copy ()) {
using (Region r = new Region ()) {
r.UnionWithRect (win_selection);
evnt_region.Subtract (r);
}
using (Cairo.Context ctx = CairoHelper.Create (GdkWindow)) {
ctx.SetSourceRGBA (.5, .5, .5, .7);
CairoHelper.Region (ctx, evnt_region);
ctx.Fill ();
}
}
return true;
}
示例10: OnExposeEvent
protected override bool OnExposeEvent (EventExpose evnt)
{
if (canvas != null) {
GdkWindow.DrawDrawable (Style.BackgroundGC (State), canvas,
0, 0, widget_alloc.X, widget_alloc.Y, widget_alloc.Width, widget_alloc.Height);
return true;
} else {
return base.OnExposeEvent (evnt);
}
}
示例11: OnExposeEvent
protected override bool OnExposeEvent (EventExpose evnt)
{
int w, h;
GetSize (out w, out h);
using (var ctx = CairoHelper.Create (evnt.Window)) {
ctx.SetSourceColor (new Cairo.Color (0.17, 0.55, 0.79));
ctx.Rectangle (Allocation.ToCairoRect ());
ctx.Fill ();
}
return true;
}
示例12: OnExposeEvent
protected override bool OnExposeEvent (EventExpose evnt)
{
using (Cairo.Context cr = Gdk.CairoHelper.Create (evnt.Window)) {
cr.LineWidth = 1;
var alloc = Allocation;
int right = alloc.RightInside ();
int bottom = alloc.BottomInside ();
cr.SharpLineX (alloc.X, alloc.Y, alloc.X, bottom);
cr.SharpLineX (right, alloc.Y, right, bottom);
cr.SharpLineY (alloc.X, alloc.Y, right, alloc.Y);
cr.SharpLineY (alloc.X, bottom, right, bottom);
cr.Color = Mono.TextEditor.Highlighting.ColorSheme.ToCairoColor (Style.Dark (State));
cr.Stroke ();
}
return base.OnExposeEvent (evnt);
}
示例13: OnExposeEvent
protected override bool OnExposeEvent(EventExpose evnt)
{
ExposeIt();
return base.OnExposeEvent (evnt);
}
示例14: GdkDraw
private void GdkDraw(EventExpose evnt,int height,int width)
{
Time time = new Time();
layout.SetMarkup("0");
this.GdkWindow.DrawLayout(this.Style.TextGC(StateType.Normal),0,height-23,layout);
Gdk.Point topL= new Gdk.Point((int)(CurrentFrame/pixelRatio-Scroll-5),height-15);
Gdk.Point topR= new Gdk.Point((int)(CurrentFrame/pixelRatio-Scroll+5),height-15);
Gdk.Point bottom= new Gdk.Point((int)(CurrentFrame/pixelRatio-Scroll),height);
this.GdkWindow.DrawPolygon(this.Style.TextGC(StateType.Normal),true,new Gdk.Point[] {topL,topR,bottom});
for(int i=10*FrameRate; i<=frames/pixelRatio;) {
// Drawing separator line
evnt.Window.DrawLine(Style.DarkGC(StateType.Normal),i-(int)Scroll,height,i-(int)Scroll,height-10);
time.Seconds = (int)(i/FrameRate*pixelRatio);
layout.SetMarkup(time.ToSecondsString());
this.GdkWindow.DrawLayout(this.Style.TextGC(StateType.Normal),i-(int)Scroll-13,height-23,layout);
//g.ShowText(time.ToSecondsString());
i=i+10*FrameRate;
}
for(int i=0; i<=frames/pixelRatio;) {
evnt.Window.DrawLine(Style.DarkGC(StateType.Normal),i-(int)Scroll,height,i-(int)Scroll,height-5);
i=i+FrameRate;
}
// Drawing main line
evnt.Window.DrawLine(Style.DarkGC(StateType.Normal),0,height,width,height);
}
示例15: OnExposeEvent
//draw the background
protected override bool OnExposeEvent (EventExpose evnt)
{
if (logoPixbuf != null) {
var gc = Style.BackgroundGC (State);
var lRect = new Rectangle (Allocation.X, Allocation.Y, logoPixbuf.Width, logoPixbuf.Height);
if (evnt.Region.RectIn (lRect) != OverlapType.Out)
GdkWindow.DrawPixbuf (gc, logoPixbuf, 0, 0, lRect.X, lRect.Y, lRect.Width, lRect.Height, RgbDither.None, 0, 0);
var bgRect = new Rectangle (Allocation.X + logoPixbuf.Width, Allocation.Y, Allocation.Width - logoPixbuf.Width, bgPixbuf.Height);
if (evnt.Region.RectIn (bgRect) != OverlapType.Out)
for (int x = bgRect.X; x < bgRect.Right; x += bgPixbuf.Width)
GdkWindow.DrawPixbuf (gc, bgPixbuf, 0, 0, x, bgRect.Y, bgPixbuf.Width, bgRect.Height, RgbDither.None, 0, 0);
}
foreach (Widget widget in Children)
PropagateExpose (widget, evnt);
return true;
}