本文整理汇总了C#中Gdk.Rectangle类的典型用法代码示例。如果您正苦于以下问题:C# Gdk.Rectangle类的具体用法?C# Gdk.Rectangle怎么用?C# Gdk.Rectangle使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
Gdk.Rectangle类属于命名空间,在下文中一共展示了Gdk.Rectangle类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: HeaderMouseEventArgs
/// <summary>
/// Initializes a new instance of the HeaderMouseEventArgs class with
/// the specified source Column, Table, column index and column header bounds
/// </summary>
/// <param name="column">The Column that Raised the event</param>
/// <param name="table">The Table the Column belongs to</param>
/// <param name="index">The index of the Column</param>
/// <param name="headerRect">The column header's bounding rectangle</param>
public HeaderMouseEventArgs(Column column, HTable table, int index, Gdk.Rectangle headerRect)
{
this.column = column;
this.table = table;
this.index = index;
this.headerRect = headerRect;
}
示例2: Render
public override void Render (CellContext context, StateType state, double cellWidth, double cellHeight)
{
if (data_handler == null) {
return;
}
if (!has_sort) {
base.Render (context, state, cellWidth, cellHeight);
return;
}
Gdk.Rectangle arrow_alloc = new Gdk.Rectangle ();
arrow_alloc.Width = (int)(cellHeight / 3.0);
arrow_alloc.Height = (int)((double)arrow_alloc.Width / 1.6);
arrow_alloc.X = (int)cellWidth - arrow_alloc.Width - Spacing;
arrow_alloc.Y = ((int)cellHeight - arrow_alloc.Height) / 2;
double textWidth = arrow_alloc.X - Spacing;
if (textWidth > 0) {
base.Render (context, state, textWidth, cellHeight);
}
SortType sort_type = ((ISortableColumn)data_handler ()).SortType;
if (sort_type != SortType.None) {
context.Theme.DrawArrow (context.Context, arrow_alloc, sort_type);
}
}
示例3: CreateBlur
private ImageInfo CreateBlur (ImageInfo source)
{
double scale = Math.Max (256 / (double) source.Bounds.Width,
256 / (double) source.Bounds.Height);
Gdk.Rectangle small = new Gdk.Rectangle (0, 0,
(int) Math.Ceiling (source.Bounds.Width * scale),
(int) Math.Ceiling (source.Bounds.Height * scale));
MemorySurface image = new MemorySurface (Format.Argb32,
small.Width,
small.Height);
Context ctx = new Context (image);
//Pattern solid = new SolidPattern (0, 0, 0, 0);
//ctx.Source = solid;
//ctx.Paint ();
//solid.Destroy ();
ctx.Matrix = source.Fit (small);
ctx.Operator = Operator.Source;
Pattern p = new SurfacePattern (source.Surface);
ctx.Source = p;
//Log.Debug (small);
ctx.Paint ();
p.Destroy ();
((IDisposable)ctx).Dispose ();
Gdk.Pixbuf normal = MemorySurface.CreatePixbuf (image);
Gdk.Pixbuf blur = PixbufUtils.Blur (normal, 3);
ImageInfo overlay = new ImageInfo (blur);
blur.Dispose ();
normal.Dispose ();
image.Destroy ();
return overlay;
}
示例4: OnSizeAllocated
protected override void OnSizeAllocated(Gdk.Rectangle allocation)
{
allocated = true;
current_allocation = allocation;
UpdateCache ();
base.OnSizeAllocated (allocation);
}
示例5: SelectionEventArgs
/// <summary>
/// Initializes a new instance of the SelectionEventArgs class with
/// the specified TableModel source, old selected indicies and new
/// selected indicies
/// </summary>
/// <param name="source">The TableModel that originated the event</param>
/// <param name="oldSelectedIndicies">An array of the previously selected Rows</param>
/// <param name="newSelectedIndicies">An array of the newly selected Rows</param>
public SelectionEventArgs(TableModel source, int[] oldSelectedIndicies, int[] newSelectedIndicies)
: base()
{
if (source == null)
{
throw new ArgumentNullException("source", "TableModel cannot be null");
}
this.source = source;
this.oldSelectedIndicies = oldSelectedIndicies;
this.newSelectedIndicies = newSelectedIndicies;
this.oldSelectionBounds = new Gdk.Rectangle();
this.newSelectionBounds = new Gdk.Rectangle();
if (oldSelectedIndicies.Length > 0)
{
this.oldSelectionBounds = source.Selections.CalcSelectionBounds(oldSelectedIndicies[0],
oldSelectedIndicies[oldSelectedIndicies.Length-1]);
}
if (newSelectedIndicies.Length > 0)
{
this.newSelectionBounds = source.Selections.CalcSelectionBounds(newSelectedIndicies[0],
newSelectedIndicies[newSelectedIndicies.Length-1]);
}
}
示例6: CellMouseEventArgs
/// <summary>
/// Initializes a new instance of the CellMouseEventArgs class with
/// the specified source Cell, table, row index, column index and
/// cell bounds
/// </summary>
/// <param name="cell">The Cell that Raised the event</param>
/// <param name="table">The Table the Cell belongs to</param>
/// <param name="cellPos"></param>
/// <param name="cellRect">The Cell's bounding rectangle</param>
public CellMouseEventArgs(Cell cell, HTable table, CellPos cellPos, Gdk.Rectangle cellRect)
{
this.cell = cell;
this.table = table;
this.row = cellPos.Row;
this.column = cellPos.Column;
this.cellRect = cellRect;
}
示例7: CellKeyEventArgs
/// <summary>
/// Initializes a new instance of the CellKeyEventArgs class with
/// the specified source Cell, table, row index, column index, cell
/// bounds and KeyEventArgs
/// </summary>
/// <param name="cell">The Cell that Raised the event</param>
/// <param name="table">The Table the Cell belongs to</param>
/// <param name="row">The Row index of the Cell</param>
/// <param name="column">The Column index of the Cell</param>
/// <param name="cellRect">The Cell's bounding rectangle</param>
/// <param name="kea"></param>
public CellKeyEventArgs(Cell cell, HTable table, int row, int column, Gdk.Rectangle cellRect, Gtk.KeyReleaseEventArgs kea)
{
this.cell = cell;
this.table = table;
this.row = row;
this.column = column;
this.cellRect = cellRect;
}
示例8: GetCellBox
private Gdk.Rectangle GetCellBox (int x, int y, int cellSize) {
int widthBoxNum = x % cellSize;
int heightBoxNum = y % cellSize;
var leftUpper = new Gdk.Point (x - widthBoxNum, y - heightBoxNum);
var returnMe = new Gdk.Rectangle (leftUpper, new Gdk.Size (cellSize, cellSize));
return returnMe;
}
示例9: OnExposeEvent
protected override bool OnExposeEvent(Gdk.EventExpose evnt)
{
Gdk.Rectangle rect = new Gdk.Rectangle( Allocation.X, Allocation.Y, Allocation.Width , Allocation.Height );
Gtk.Style.PaintFlatBox( Entry.Style, this.GdkWindow, Entry.State, Entry.ShadowType, this.Allocation, Entry, "entry_bg", rect.X, rect.Y, rect.Width, rect.Height );
Gtk.Style.PaintShadow ( Entry.Style, this.GdkWindow, Entry.State, Entry.ShadowType, this.Allocation, Entry, "entry" , rect.X, rect.Y, rect.Width, rect.Height );
return base.OnExposeEvent (evnt);
}
示例10: OnExposeEvent
protected override bool OnExposeEvent (Gdk.EventExpose evt)
{
if (!IsDrawable)
return false;
int width, height;
GdkWindow.GetSize (out width, out height);
Gdk.Rectangle a = new Gdk.Rectangle (0,0,width,height);
byte b2 = 210;
int ssLT = 12;
int ssRB = 7;
double grey = 0.6;
double greyb1 = 0.9;
double greyb2 = 0.6;
Gdk.Rectangle rect = a;
Cairo.Color back1 = new Cairo.Color (greyb1, greyb1, greyb1);
Cairo.Color back2 = new Cairo.Color (greyb2, greyb2, greyb2);
Cairo.Color cdark = new Cairo.Color (grey, grey, grey, 1);
Cairo.Color clight = new Cairo.Color (grey, grey, grey, 0);
using (Cairo.Context cr = Gdk.CairoHelper.Create (evt.Window)) {
DrawGradient (cr, rect, 0, 0, 1, 1, back1, back2);
rect.X = a.X;
rect.Y = a.Y;
rect.Height = ssLT;
rect.Width = a.Width;
DrawGradient (cr, rect, 0, 0, 0, 1, cdark, clight);
rect.Y = a.Bottom - ssRB;
rect.Height = ssRB;
DrawGradient (cr, rect, 0, 0, 0, 1, clight, cdark);
rect.X = a.X;
rect.Y = a.Y;
rect.Width = ssLT;
rect.Height = a.Height;
DrawGradient (cr, rect, 0, 0, 1, 0, cdark, clight);
rect.X = a.Right - ssRB;
rect.Width = ssRB;
DrawGradient (cr, rect, 0, 0, 1, 0, clight, cdark);
Gdk.GC gc = new Gdk.GC (GdkWindow);
gc.RgbBgColor = new Gdk.Color (b2,b2,b2);
gc.RgbFgColor = new Gdk.Color (b2,b2,b2);
GdkWindow.DrawRectangle (gc, false, a.X, a.Y, a.Width, a.Height);
gc.Dispose ();
}
return base.OnExposeEvent (evt);
}
示例11: Execute
public override void Execute(SurfaceReceiver receiver)
{
int x, y;
int tx, ty;
int width, height;
Gdk.Pixbuf pixbuf;
Gdk.Rectangle[] rects;
Gdk.Rectangle clippedRect;
if (codecID != CODEC_ID_REMOTEFX)
return;
RfxMessage rfxMsg = receiver.rfx.ParseMessage(bitmapData, bitmapDataLength);
x = y = 0;
width = height = 64;
rects = new Gdk.Rectangle[rfxMsg.RectCount];
int count = 0;
while (rfxMsg.HasNextRect())
{
rfxMsg.GetNextRect(ref x, ref y, ref width, ref height);
tx = x + destLeft;
ty = y + destTop;
rects[count++] = new Gdk.Rectangle(tx, ty, width, height);
}
while (rfxMsg.HasNextTile())
{
rfxMsg.GetNextTile(buffer, ref x, ref y);
tx = x + destLeft;
ty = y + destTop;
Gdk.Rectangle tileRect = new Gdk.Rectangle(tx, ty, 64, 64);
foreach (Gdk.Rectangle rect in rects)
{
rect.Intersect(tileRect, out clippedRect);
if (!clippedRect.IsEmpty)
{
pixbuf = new Gdk.Pixbuf(buffer, Gdk.Colorspace.Rgb, true, 8, 64, 64, 64 * 4);
pixbuf.CopyArea(0, 0, clippedRect.Width, clippedRect.Height,
receiver.surface, clippedRect.X, clippedRect.Y);
receiver.InvalidateRect(clippedRect.X, clippedRect.Y, clippedRect.Width, clippedRect.Height);
}
}
}
}
示例12: ShowTooltip
bool ShowTooltip ()
{
if (!string.IsNullOrEmpty (tip)) {
HideTooltip ();
tooltipWindow = new TooltipPopoverWindow ();
tooltipWindow.ShowArrow = true;
tooltipWindow.Text = tip;
tooltipWindow.Severity = Severity;
var rect = new Gdk.Rectangle (0, 0, eventBox.Allocation.Width, eventBox.Allocation.Height + 5);
tooltipWindow.ShowPopup (eventBox, rect, Position);
}
return false;
}
示例13: ApplyBase
/// <summary>
/// Provides a default implementation for performing dst = F(dst, src) or F(src) over some rectangle
/// of interest. May be slightly faster than calling the other multi-parameter Apply method, as less
/// variables are used in the implementation, thus inducing less register pressure.
/// </summary>
/// <param name="dst">The Surface to write pixels to, and from which pixels are read and used as the lhs parameter for calling the method <b>ColorBgra Apply(ColorBgra, ColorBgra)</b>.</param>
/// <param name="dstOffset">The pixel offset that defines the upper-left of the rectangle-of-interest for the dst Surface.</param>
/// <param name="src">The Surface to read pixels from for the rhs parameter given to the method <b>ColorBgra Apply(ColorBgra, ColorBgra)</b>.</param>
/// <param name="srcOffset">The pixel offset that defines the upper-left of the rectangle-of-interest for the src Surface.</param>
/// <param name="roiSize">The size of the rectangles-of-interest for all Surfaces.</param>
public void ApplyBase (ImageSurface dst, Gdk.Point dstOffset, ImageSurface src, Gdk.Point srcOffset, Gdk.Size roiSize)
{
// Create bounding rectangles for each Surface
Gdk.Rectangle dstRect = new Gdk.Rectangle (dstOffset, roiSize);
if (dstRect.Width == 0 || dstRect.Height == 0)
return;
Gdk.Rectangle srcRect = new Gdk.Rectangle (srcOffset, roiSize);
if (srcRect.Width == 0 || srcRect.Height == 0)
return;
// Clip those rectangles to those Surface's bounding rectangles
Gdk.Rectangle dstClip = Gdk.Rectangle.Intersect (dstRect, dst.GetBounds ());
Gdk.Rectangle srcClip = Gdk.Rectangle.Intersect (srcRect, src.GetBounds ());
// If any of those Rectangles actually got clipped, then throw an exception
if (dstRect != dstClip)
throw new ArgumentOutOfRangeException
(
"roiSize",
"Destination roi out of bounds" +
string.Format (", dst.Size=({0},{1}", dst.Width, dst.Height) +
", dst.Bounds=" + dst.GetBounds ().ToString () +
", dstOffset=" + dstOffset.ToString () +
string.Format (", src.Size=({0},{1}", src.Width, src.Height) +
", srcOffset=" + srcOffset.ToString () +
", roiSize=" + roiSize.ToString () +
", dstRect=" + dstRect.ToString () +
", dstClip=" + dstClip.ToString () +
", srcRect=" + srcRect.ToString () +
", srcClip=" + srcClip.ToString ()
);
if (srcRect != srcClip)
throw new ArgumentOutOfRangeException ("roiSize", "Source roi out of bounds");
// Cache the width and height properties
int width = roiSize.Width;
int height = roiSize.Height;
// Do the work.
unsafe {
for (int row = 0; row < height; ++row) {
ColorBgra* dstPtr = dst.GetPointAddress (dstOffset.X, dstOffset.Y + row);
ColorBgra* srcPtr = src.GetPointAddress (srcOffset.X, srcOffset.Y + row);
Apply (dstPtr, srcPtr, width);
}
}
}
示例14: AllocateArea
public void AllocateArea (TextArea textArea, Gdk.Rectangle allocation)
{
if (!Visible)
Show ();
allocation.Height -= (int)textArea.LineHeight;
if (lastAllocation == allocation)
return;
lastAllocation = allocation;
if (textArea.Allocation != allocation)
textArea.SizeAllocate (allocation);
SetSizeRequest (allocation.Width, (int)editor.LineHeight);
var pos = ((TextEditor.EditorContainerChild)editor [this]);
if (pos.X != 0 || pos.Y != allocation.Height)
editor.MoveTopLevelWidget (this, 0, allocation.Height);
}
示例15: Render
public override void Render (CellContext context, double cellWidth, double cellHeight)
{
Gdk.Rectangle area = new Gdk.Rectangle (0, 0, (int)cellWidth, (int)cellHeight);
// FIXME: Compute font height and set to renderer.Size
renderer.Value = Value;
bool is_hovering = hover_bound == BoundObjectParent && hover_bound != null;
renderer.Render (context.Context, area, context.Theme.Colors.GetWidgetColor (GtkColorClass.Text, context.State),
is_hovering, is_hovering, hover_value, 0.8, 0.45, 0.35);
// FIXME: Something is hosed in the view when computing cell dimensions
// The cell width request is always smaller than the actual cell, so
// this value is preserved once we compute it from rendering so the
// input stuff can do its necessary calculations
actual_area_hack = area;
}