本文整理汇总了C#中Cairo.Rectangle类 的典型用法代码示例。如果您正苦于以下问题:C# Cairo.Rectangle类的具体用法?C# Cairo.Rectangle怎么用?C# Cairo.Rectangle使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
Cairo.Rectangle类 属于命名空间,在下文中一共展示了Cairo.Rectangle类 的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。
示例1: OnExposeEvent
protected override bool OnExposeEvent (Gdk.EventExpose evnt)
{
using (var ctx = Gdk.CairoHelper.Create (evnt.Window)) {
ctx.LineWidth = 1;
var rect = new Gdk.Rectangle (Allocation.X, Allocation.Y, Allocation.Width, Allocation.Height);
var shadowColor = CairoExtensions.ParseColor (Styles.WelcomeScreen.Pad.ShadowColor);
int inset = 2;
var ss = Styles.WelcomeScreen.Pad.ShadowSize;
var r = new Cairo.Rectangle (rect.X + ss + 0.5, rect.Y + ss + 0.5, rect.Width - ss * 2 - 1, rect.Height - ss * 2 - 1);
var sr = new Cairo.Rectangle (r.X + inset, r.Y + inset + Styles.WelcomeScreen.Pad.ShadowVerticalOffset, r.Width - inset * 2, r.Height - inset * 2);
int size = Styles.WelcomeScreen.Pad.ShadowSize;
double alpha = 0.2;
double alphaDec = 0.2 / (double)size;
for (int n=0; n<size; n++) {
sr = new Cairo.Rectangle (sr.X - 1, sr.Y - 1, sr.Width + 2, sr.Height + 2);
CairoExtensions.RoundedRectangle (ctx, sr.X, sr.Y, sr.Width, sr.Height, 4);
shadowColor.A = alpha;
ctx.SetSourceColor (shadowColor);
ctx.Stroke ();
alpha -= alphaDec;
}
CairoExtensions.RoundedRectangle (ctx, r.X, r.Y, r.Width, r.Height, 4);
ctx.SetSourceColor (CairoExtensions.ParseColor (Styles.WelcomeScreen.Pad.BackgroundColor));
ctx.FillPreserve ();
ctx.SetSourceColor (CairoExtensions.ParseColor (Styles.WelcomeScreen.Pad.BorderColor));
ctx.Stroke ();
}
PropagateExpose (Child, evnt);
return true;
}
开发者ID:vvarshne, 项目名称:monodevelop, 代码行数:33, 代码来源:WelcomePageSection.cs
示例2: Popup
public virtual void Popup ()
{
if (editor.GdkWindow == null){
editor.Realized += HandleRealized;
return;
}
bounds = CalculateInitialBounds ();
//GTK uses integer position coords, so round fractions down, we'll add them back later as draw offsets
int x = (int) System.Math.Floor (bounds.X);
int y = (int) System.Math.Floor (bounds.Y);
//capture any lost fractions to pass as an offset to Draw
userspaceArea = new Cairo.Rectangle (bounds.X - x, bounds.Y - y, bounds.Width, bounds.Height);
//lose half-pixels on the expansion, it's not a big deal
xExpandedOffset = (int) (System.Math.Floor (ExpandWidth / 2d));
yExpandedOffset = (int) (System.Math.Floor (ExpandHeight / 2d));
//round the width/height up to make sure we have room for restored fractions
int width = System.Math.Max (1, (int) (System.Math.Ceiling (bounds.Width) + ExpandWidth));
int height = System.Math.Max (1, (int) (System.Math.Ceiling (bounds.Height) + ExpandHeight));
this.SetSizeRequest (width, height);
editor.TextArea.AddTopLevelWidget (this, x - xExpandedOffset, y - yExpandedOffset);
stage.AddOrReset (this, Duration);
stage.Play ();
Show ();
}
开发者ID:FreeBSD-DotNet, 项目名称:monodevelop, 代码行数:30, 代码来源:BounceFadePopupWindow.cs
示例3: Draw
internal protected override void Draw (Cairo.Context cr, Cairo.Rectangle area, LineSegment lineSegment, int line, double x, double y, double lineHeight)
{
foldSegmentSize = marginWidth * 4 / 6;
foldSegmentSize -= (foldSegmentSize) % 2;
Cairo.Rectangle drawArea = new Cairo.Rectangle (x, y, marginWidth, lineHeight);
var state = editor.Document.GetLineState (lineSegment);
bool isFoldStart = false;
bool isContaining = false;
bool isFoldEnd = false;
bool isStartSelected = false;
bool isContainingSelected = false;
bool isEndSelected = false;
if (line <= editor.Document.LineCount) {
startFoldings.Clear ();
containingFoldings.Clear ();
endFoldings.Clear ();
foreach (FoldSegment segment in editor.Document.GetFoldingContaining (lineSegment)) {
if (segment.StartLine.Offset == lineSegment.Offset) {
startFoldings.Add (segment);
} else if (segment.EndLine.Offset == lineSegment.Offset) {
endFoldings.Add (segment);
} else {
containingFoldings.Add (segment);
}
}
isFoldStart = startFoldings.Count > 0;
isContaining = containingFoldings.Count > 0;
isFoldEnd = endFoldings.Count > 0;
isStartSelected = this.lineHover != null && IsMouseHover (startFoldings);
isContainingSelected = this.lineHover != null && IsMouseHover (containingFoldings);
isEndSelected = this.lineHover != null && IsMouseHover (endFoldings);
}
var bgGC = foldBgGC;
if (editor.TextViewMargin.BackgroundRenderer != null) {
if (isContainingSelected || isStartSelected || isEndSelected) {
bgGC = foldBgGC;
} else {
bgGC = foldLineHighlightedGCBg;
}
}
cr.Rectangle (drawArea);
cr.Color = bgGC;
cr.Fill ();
if (state == TextDocument.LineState.Changed) {
cr.Color = lineStateChangedGC;
cr.Rectangle (x + 1, y, marginWidth / 3, lineHeight);
cr.Fill ();
} else if (state == TextDocument.LineState.Dirty) {
cr.Color = lineStateDirtyGC;
cr.Rectangle (x + 1, y, marginWidth / 3, lineHeight);
cr.Fill ();
}
if (line < editor.Document.LineCount) {
double foldSegmentYPos = y + System.Math.Floor (editor.LineHeight - foldSegmentSize) / 2;
double xPos = x + System.Math.Floor (marginWidth / 2) + 0.5;
if (isFoldStart) {
bool isVisible = true;
bool moreLinedOpenFold = false;
foreach (FoldSegment foldSegment in startFoldings) {
if (foldSegment.IsFolded) {
isVisible = false;
} else {
moreLinedOpenFold = foldSegment.EndLine.Offset > foldSegment.StartLine.Offset;
}
}
bool isFoldEndFromUpperFold = false;
foreach (FoldSegment foldSegment in endFoldings) {
if (foldSegment.EndLine.Offset > foldSegment.StartLine.Offset && !foldSegment.IsFolded)
isFoldEndFromUpperFold = true;
}
DrawFoldSegment (cr, x, y, isVisible, isStartSelected);
if (isContaining || isFoldEndFromUpperFold)
cr.DrawLine (isContainingSelected ? foldLineHighlightedGC : foldLineGC, xPos, drawArea.Y, xPos, foldSegmentYPos - 2);
if (isContaining || moreLinedOpenFold)
cr.DrawLine (isEndSelected || (isStartSelected && isVisible) || isContainingSelected ? foldLineHighlightedGC : foldLineGC, xPos, foldSegmentYPos + foldSegmentSize + 2, xPos, drawArea.Y + drawArea.Height);
} else {
if (isFoldEnd) {
double yMid = drawArea.Y + drawArea.Height / 2;
cr.DrawLine (isEndSelected ? foldLineHighlightedGC : foldLineGC, xPos, yMid, x + marginWidth - 2, yMid);
cr.DrawLine (isContainingSelected || isEndSelected ? foldLineHighlightedGC : foldLineGC, xPos, drawArea.Y, xPos, yMid);
if (isContaining)
cr.DrawLine (isContainingSelected ? foldLineHighlightedGC : foldLineGC, xPos, yMid + 1, xPos, drawArea.Y + drawArea.Height);
} else if (isContaining) {
cr.DrawLine (isContainingSelected ? foldLineHighlightedGC : foldLineGC, xPos, drawArea.Y, xPos, drawArea.Y + drawArea.Height);
}
//.........这里部分代码省略.........
开发者ID:txdv, 项目名称:monodevelop, 代码行数:101, 代码来源:FoldMarkerMargin.cs
示例4: Draw
internal protected override void Draw (Cairo.Context cr, Cairo.Rectangle area, DocumentLine lineSegment, int line, double x, double y, double lineHeight)
{
foldSegmentSize = marginWidth * 4 / 6;
foldSegmentSize -= (foldSegmentSize) % 2;
Cairo.Rectangle drawArea = new Cairo.Rectangle (x, y, marginWidth, lineHeight);
var state = editor.Document.GetLineState (lineSegment);
bool isSelected = false;
int nextDepth = 0;
if (line <= editor.Document.LineCount) {
containingFoldings.Clear ();
startFoldings.Clear ();
foreach (FoldSegment segment in editor.Document.GetFoldingContaining (lineSegment)) {
if (segment.StartLine == lineSegment)
startFoldings.Add (segment);
containingFoldings.Add (segment);
}
nextDepth = containingFoldings.Count;
if (lineSegment.NextLine != null)
nextDepth = editor.Document.GetFoldingContaining (lineSegment.NextLine).Count ();
isSelected = containingFoldings.Contains (hoverSegment);
}
var bgGC = foldLineHighlightedGC;
if (editor.TextViewMargin.BackgroundRenderer != null) {
if (isSelected) {
bgGC = foldLineHighlightedGCBg;
} else {
bgGC = foldBgGC;
}
} else {
HslColor col = foldLineHighlightedGCBg;
if (col.L < 0.5) {
col.L = System.Math.Min (1.0, col.L + containingFoldings.Count / 15.0);
} else {
col.L = System.Math.Max (0.0, col.L - containingFoldings.Count / 15.0);
}
bgGC = col;
}
cr.Rectangle (drawArea);
cr.Color = bgGC;
cr.Fill ();
if (editor.TextViewMargin.BackgroundRenderer == null) {
int delta = nextDepth - containingFoldings.Count ();
if (delta != 0) {
HslColor col = foldLineHighlightedGCBg;
if (col.L < 0.5) {
col.L = System.Math.Min (1.0, col.L + (nextDepth - delta * 1.5) / 15.0);
} else {
col.L = System.Math.Max (0.0, col.L - (nextDepth - delta * 1.5) / 15.0);
}
cr.Color = col;
cr.MoveTo (x, y + lineHeight - 0.5);
cr.LineTo (x + marginWidth, y + lineHeight - 0.5);
cr.Stroke ();
}
}
if (state == TextDocument.LineState.Changed) {
cr.Color = lineStateChangedGC;
cr.Rectangle (x + 1, y, marginWidth / 3, lineHeight);
cr.Fill ();
} else if (state == TextDocument.LineState.Dirty) {
cr.Color = lineStateDirtyGC;
cr.Rectangle (x + 1, y, marginWidth / 3, lineHeight);
cr.Fill ();
}
if (line < editor.Document.LineCount) {
bool isVisible = true;
foreach (FoldSegment foldSegment in startFoldings) {
if (foldSegment.IsFolded) {
isVisible = false;
}
}
if (!isVisible) {
DrawClosedFolding (cr, bgGC, x, y);
} else {
if (hoverSegment != null && editor.TextViewMargin.BackgroundRenderer != null) {
if (hoverSegment.StartLine == lineSegment) {
DrawUpFolding (cr, bgGC, x, y);
} else if (hoverSegment.EndLine == lineSegment) {
DrawDownFolding (cr, bgGC, x, y);
}
}
}
}
}
开发者ID:FreeBSD-DotNet, 项目名称:monodevelop, 代码行数:94, 代码来源:SolidFoldMarkerMargin.cs
示例5: DrawBackground
public override void DrawBackground (MonoTextEditor editor, Cairo.Context cr, LineMetrics metrics, int startOffset, int endOffset)
{
try {
double fromX, toX;
GetLineDrawingPosition (metrics, startOffset, out fromX, out toX);
fromX = Math.Max (fromX, editor.TextViewMargin.XOffset);
toX = Math.Max (toX, editor.TextViewMargin.XOffset);
if (fromX < toX) {
var bracketMatch = new Cairo.Rectangle (fromX + 0.5, metrics.LineYRenderStartPosition + 0.5, toX - fromX - 1, editor.LineHeight - 2);
if (editor.TextViewMargin.BackgroundRenderer == null) {
cr.SetSourceColor (editor.ColorStyle.BraceMatchingRectangle.Color);
cr.Rectangle (bracketMatch);
cr.FillPreserve ();
cr.SetSourceColor (editor.ColorStyle.BraceMatchingRectangle.SecondColor);
cr.Stroke ();
}
}
} catch (Exception e) {
LoggingService.LogError ($"Error while drawing bracket matcher ({this}) startOffset={startOffset} lineCharLength={metrics.Layout.LineChars.Length}", e);
}
}
开发者ID:powerumc, 项目名称:monodevelop_korean, 代码行数:22, 代码来源:SourceEditorView.cs
示例6: DrawAlphaBetaMarker
void DrawAlphaBetaMarker (Cairo.Context c, ref Cairo.PointD bottomRight, string text)
{
c.SelectFontFace (SplashFontFamily, Cairo.FontSlant.Normal, Cairo.FontWeight.Bold);
c.SetFontSize (SplashFontSize);
// Create a rectangle larger than the text so we can have a nice border
var extents = c.TextExtents (text);
var x = bottomRight.X - extents.Width * 1.3;
var y = bottomRight.Y - extents.Height * 1.5;
var rectangle = new Cairo.Rectangle (x, y, bottomRight.X - x, bottomRight.Y - y);
// Draw the background color the text will be overlaid on
DrawRoundedRectangle (c, rectangle);
// Calculate the offset the text will need to be at to be centralised
// in the border
x = x + extents.XBearing + (rectangle.Width - extents.Width) / 2;
y = y - extents.YBearing + (rectangle.Height - extents.Height) / 2;
c.MoveTo (x, y);
// Draw the text
c.Color = new Cairo.Color (1, 1, 1);
c.ShowText (text);
bottomRight.Y -= rectangle.Height - 2;
}
开发者ID:nieve, 项目名称:monodevelop, 代码行数:26, 代码来源:SplashScreen.cs
示例7: DecorateMatchingBracket
void DecorateMatchingBracket (Cairo.Context ctx, LayoutWrapper layout, int offset, int length, double xPos, double y, int selectionStart, int selectionEnd)
{
uint curIndex = 0, byteIndex = 0;
if (offset <= highlightBracketOffset && highlightBracketOffset <= offset + length) {
int index = highlightBracketOffset - offset;
Pango.Rectangle rect = layout.Layout.IndexToPos ((int)TranslateToUTF8Index (layout.LineChars, (uint)index, ref curIndex, ref byteIndex));
var bracketMatch = new Cairo.Rectangle (xPos + rect.X / Pango.Scale.PangoScale + 0.5, y + 0.5, (rect.Width / Pango.Scale.PangoScale) - 1, (rect.Height / Pango.Scale.PangoScale) - 1);
if (BackgroundRenderer == null) {
ctx.Color = this.ColorStyle.BraceMatchingRectangle.Color;
ctx.Rectangle (bracketMatch);
ctx.FillPreserve ();
ctx.Color = this.ColorStyle.BraceMatchingRectangle.SecondColor;
ctx.Stroke ();
}
}
}
开发者ID:OnorioCatenacci, 项目名称:monodevelop, 代码行数:17, 代码来源:TextViewMargin.cs
示例8: ProcessPage
private void ProcessPage(Cairo.Context g, IEnumerable p)
{
foreach (PageItem pi in p)
{
if (pi is PageTextHtml)
{ // PageTextHtml is actually a composite object (just like a page)
ProcessHtml(pi as PageTextHtml, g);
continue;
}
if (pi is PageLine)
{
PageLine pl = pi as PageLine;
DrawLine(
pl.SI.BColorLeft.ToCairoColor(), pl.SI.BStyleLeft, pl.SI.BWidthLeft,
g, PixelsX(pl.X), PixelsY(pl.Y), PixelsX(pl.X2), PixelsY(pl.Y2)
);
continue;
}
// RectangleF rect = new RectangleF(PixelsX(pi.X), PixelsY(pi.Y), PixelsX(pi.W), PixelsY(pi.H));
Cairo.Rectangle rect = new Cairo.Rectangle(PixelsX(pi.X), PixelsY(pi.Y), PixelsX(pi.W), PixelsY(pi.H));
if (pi.SI.BackgroundImage != null)
{
// put out any background image
PageImage i = pi.SI.BackgroundImage;
DrawImage(i, g, rect);
continue;
}
if (pi is PageText)
{
PageText pt = pi as PageText;
DrawString(pt, g, rect);
}
if (pi is PageImage)
{
PageImage i = pi as PageImage;
DrawImage(i, g, rect);
}
if (pi is PageRectangle)
{
//DrawBackground(g, rect, pi.SI);
}
// else if (pi is PageEllipse)
// {
// PageEllipse pe = pi as PageEllipse;
// DrawEllipse(pe, g, rect);
// }
// else if (pi is PagePie)
// {
// PagePie pp = pi as PagePie;
// DrawPie(pp, g, rect);
// }
// else if (pi is PagePolygon)
// {
// PagePolygon ppo = pi as PagePolygon;
// FillPolygon(ppo, g, rect);
// }
// else if (pi is PageCurve)
// {
// PageCurve pc = pi as PageCurve;
// DrawCurve(pc.SI.BColorLeft, pc.SI.BStyleLeft, pc.SI.BWidthLeft,
// g, pc.Points, pc.Offset, pc.Tension);
// }
//
DrawBorder(pi, g, rect);
}
}
开发者ID:myersBR, 项目名称:My-FyiReporting, 代码行数:73, 代码来源:RenderCairo.cs
示例9: OnExposeEvent
protected override bool OnExposeEvent (Gdk.EventExpose evnt)
{
base.OnExposeEvent (evnt);
if (size == Gdk.Size.Empty)
return true;
var preview_size = Gdk.Size.Empty;
var widget_size = GdkWindow.GetBounds ();
// Figure out the dimensions of the preview to draw
if (size.Width <= max_size && size.Height <= max_size)
preview_size = size;
else if (size.Width > size.Height)
preview_size = new Gdk.Size (max_size, (int)(max_size / ((float)size.Width / (float)size.Height)));
else
preview_size = new Gdk.Size ((int)(max_size / ((float)size.Height / (float)size.Width)), max_size);
using (var g = Gdk.CairoHelper.Create (GdkWindow)) {
var r = new Cairo.Rectangle ((widget_size.Width - preview_size.Width) / 2, (widget_size.Height - preview_size.Height) / 2, preview_size.Width, preview_size.Height);
if (color.A == 0) {
// Fill with transparent checkerboard pattern
using (var grid = GdkExtensions.CreateTransparentColorSwatch (false))
using (var surf = grid.ToSurface ())
using (var pattern = surf.ToTiledPattern ())
g.FillRectangle (r, pattern);
} else {
// Fill with selected color
g.FillRectangle (r, color);
}
// Draw our canvas drop shadow
g.DrawRectangle (new Cairo.Rectangle (r.X - 1, r.Y - 1, r.Width + 2, r.Height + 2), new Cairo.Color (.5, .5, .5), 1);
g.DrawRectangle (new Cairo.Rectangle (r.X - 2, r.Y - 2, r.Width + 4, r.Height + 4), new Cairo.Color (.8, .8, .8), 1);
g.DrawRectangle (new Cairo.Rectangle (r.X - 3, r.Y - 3, r.Width + 6, r.Height + 6), new Cairo.Color (.9, .9, .9), 1);
}
return true;
}
开发者ID:msiyer, 项目名称:Pinta, 代码行数:40, 代码来源:NewImageDialog.cs
示例10: DrawImageSized
private void DrawImageSized(PageImage pi, Gdk.Pixbuf im, Cairo.Context g, Cairo.Rectangle r)
{
double height, width; // some work variables
StyleInfo si = pi.SI;
// adjust drawing rectangle based on padding
// System.Drawing.RectangleF r2 = new System.Drawing.RectangleF(r.Left + PixelsX(si.PaddingLeft),
// r.Top + PixelsY(si.PaddingTop),
// r.Width - PixelsX(si.PaddingLeft + si.PaddingRight),
// r.Height - PixelsY(si.PaddingTop + si.PaddingBottom));
Cairo.Rectangle r2 = new Cairo.Rectangle(r.X + PixelsX(si.PaddingLeft),
r.Y + PixelsY(si.PaddingTop),
r.Width - PixelsX(si.PaddingLeft + si.PaddingRight),
r.Height - PixelsY(si.PaddingTop + si.PaddingBottom));
Cairo.Rectangle ir; // int work rectangle
switch (pi.Sizing)
{
case ImageSizingEnum.AutoSize:
// // Note: GDI+ will stretch an image when you only provide
// // the left/top coordinates. This seems pretty stupid since
// // it results in the image being out of focus even though
// // you don't want the image resized.
// if (g.DpiX == im.HorizontalResolution &&
// g.DpiY == im.VerticalResolution)
float imwidth = PixelsX(im.Width);
float imheight = PixelsX(im.Height);
ir = new Cairo.Rectangle(Convert.ToInt32(r2.X), Convert.ToInt32(r2.Y),
imwidth, imheight);
// else
// ir = new Cairo.Rectangle(Convert.ToInt32(r2.X), Convert.ToInt32(r2.Y),
// Convert.ToInt32(r2.Width), Convert.ToInt32(r2.Height));
//g.DrawImage(im, ir);
im = im.ScaleSimple((int)r2.Width, (int)r2.Height, Gdk.InterpType.Hyper);
g.DrawPixbufRect(im, ir);
break;
case ImageSizingEnum.Clip:
// Region saveRegion = g.Clip;
g.Save();
// Region clipRegion = new Region(g.Clip.GetRegionData());
// clipRegion.Intersect(r2);
// g.Clip = clipRegion;
g.Rectangle(r2);
g.Clip();
// if (dpiX == im.HorizontalResolution &&
// dpiY == im.VerticalResolution)
ir = new Cairo.Rectangle(Convert.ToInt32(r2.X), Convert.ToInt32(r2.Y),
im.Width, im.Height);
// else
// ir = new Cairo.Rectangle(Convert.ToInt32(r2.X), Convert.ToInt32(r2.Y),
// Convert.ToInt32(r2.Width), Convert.ToInt32(r2.Height));
// g.DrawImage(im, ir);
g.DrawPixbufRect(im, ir);
// g.Clip = saveRegion;
g.Restore();
break;
case ImageSizingEnum.FitProportional:
double ratioIm = (float)im.Height / (float)im.Width;
double ratioR = r2.Height / r2.Width;
height = r2.Height;
width = r2.Width;
if (ratioIm > ratioR)
{
// this means the rectangle width must be corrected
width = height * (1 / ratioIm);
}
else if (ratioIm < ratioR)
{
// this means the ractangle height must be corrected
height = width * ratioIm;
}
r2 = new Cairo.Rectangle(r2.X, r2.Y, width, height);
g.DrawPixbufRect(im, r2);
break;
case ImageSizingEnum.Fit:
default:
g.DrawPixbufRect(im, r2);
break;
}
}
开发者ID:myersBR, 项目名称:My-FyiReporting, 代码行数:81, 代码来源:RenderCairo.cs
示例11: DrawString
private void DrawString(PageText pt, Cairo.Context g, Cairo.Rectangle r)
{
StyleInfo si = pt.SI;
string s = pt.Text;
g.Save();
layout = Pango.CairoHelper.CreateLayout(g);
// Font drawFont = null;
// StringFormat drawFormat = null;
// Brush drawBrush = null;
// STYLE
// System.Drawing.FontStyle fs = 0;
// if (si.FontStyle == FontStyleEnum.Italic)
// fs |= System.Drawing.FontStyle.Italic;
//Pango fonts are scaled to 72dpi, Windows fonts uses 96dpi
float fontsize = (si.FontSize * 72 / 96);
var font = Pango.FontDescription.FromString(string.Format("{0} {1}", si.GetFontFamily().Name,
fontsize * PixelsX(1)));
if (si.FontStyle == FontStyleEnum.Italic)
font.Style = Pango.Style.Italic;
//
// switch (si.TextDecoration)
// {
// case TextDecorationEnum.Underline:
// fs |= System.Drawing.FontStyle.Underline;
// break;
// case TextDecorationEnum.LineThrough:
// fs |= System.Drawing.FontStyle.Strikeout;
// break;
// case TextDecorationEnum.Overline:
// case TextDecorationEnum.None:
// break;
// }
// WEIGHT
// switch (si.FontWeight)
// {
// case FontWeightEnum.Bold:
// case FontWeightEnum.Bolder:
// case FontWeightEnum.W500:
// case FontWeightEnum.W600:
// case FontWeightEnum.W700:
// case FontWeightEnum.W800:
// case FontWeightEnum.W900:
// fs |= System.Drawing.FontStyle.Bold;
// break;
// default:
// break;
// }
// try
// {
// drawFont = new Font(si.GetFontFamily(), si.FontSize, fs); // si.FontSize already in points
// }
// catch (ArgumentException)
// {
// drawFont = new Font("Arial", si.FontSize, fs); // if this fails we'll let the error pass thru
// }
//font.AbsoluteSize = (int)(PixelsX (si.FontSize));
switch (si.FontWeight)
{
case FontWeightEnum.Bold:
case FontWeightEnum.Bolder:
case FontWeightEnum.W500:
case FontWeightEnum.W600:
case FontWeightEnum.W700:
case FontWeightEnum.W800:
case FontWeightEnum.W900:
font.Weight = Pango.Weight.Bold;
break;
}
Pango.FontDescription oldfont = layout.FontDescription;
layout.FontDescription = font;
// ALIGNMENT
// drawFormat = new StringFormat();
// switch (si.TextAlign)
// {
// case TextAlignEnum.Right:
// drawFormat.Alignment = StringAlignment.Far;
// break;
// case TextAlignEnum.Center:
// drawFormat.Alignment = StringAlignment.Center;
// break;
// case TextAlignEnum.Left:
// default:
// drawFormat.Alignment = StringAlignment.Near;
// break;
// }
switch (si.TextAlign)
{
case TextAlignEnum.Right:
layout.Alignment = Pango.Alignment.Right;
break;
//.........这里部分代码省略.........
开发者ID:myersBR, 项目名称:My-FyiReporting, 代码行数:101, 代码来源:RenderCairo.cs
示例12: GetNextRect
public Cairo.Rectangle GetNextRect()
{
Cairo.Rectangle rectangle;
rect = rfx_message_get_rect(msg, irects++);
rectangle = new Cairo.Rectangle((double) rect->x, (double) rect->y,
(double) rect->width, (double) rect->height);
return rectangle;
}
开发者ID:hlnguyen21, 项目名称:Screenary, 代码行数:11, 代码来源:RemoteFX.cs
示例13: OnSizeAllocated
protected override void OnSizeAllocated(Gdk.Rectangle allocation)
{
base.OnSizeAllocated (allocation);
// Insert layout code here.
this.graphRect = new Cairo.Rectangle(20, 4,
allocation.Width - 24, allocation.Height - 24);
this.scaleRectX = new Cairo.Rectangle(20, allocation.Height - 20,
allocation.Width - 24, 16);
this.scaleRectY = new Cairo.Rectangle(4, 4,
16, allocation.Height - 24);
}
开发者ID:madrang, 项目名称:FmodSharp, 代码行数:14, 代码来源:FFTDraw.cs
示例14: Draw
// public double Width
// {
// get { return this.width; }
// set { this.width = value; }
// }
//
// public double Height
// {
// get { return this.height; }
// set { this.height = value; }
// }
//
// public double X
// {
// get { return this.x; }
// set { this.x = value; }
// }
//
// public double Y
// {
// get { return this.y; }
// set { this.y = value; }
// }
//
// public double LineWidth
// {
// get { return this.lineWidth; }
// set { this.lineWidth = value; }
// }
//
// public double[] FillColor
// {
// get { return this.fillColor; }
// set { this.fillColor = value; }
// }
//
// public double FillOpacity
// {
// get { return this.fillOpacity; }
// set { this.fillOpacity = value; }
// }
//
// public double[] StrokeColor
// {
// get { return this.strokeColor; }
// set { this.strokeColor = value; }
// }
//
// public double StrokeOpacity
// {
// get { return this.strokeOpacity; }
// set { this.strokeOpacity = value; }
// }
public void Draw(Gtk.PrintContext context)
{
Cairo.Context con = context.CairoContext;
Cairo.Rectangle cairoRectangle =
new Cairo.Rectangle(new Cairo.Point((int)this.x,
(int)this.y),
this.width,
this.height);
con.Rectangle(cairoRectangle);
con.Color = new Cairo.Color(this.fillColor[0],
this.fillColor[1],
this.fillColor[2],
this.fillOpacity);
con.FillPreserve();
con.LineWidth = this.lineWidth;
con.Color = new Cairo.Color(this.strokeColor[0],
this.strokeColor[1],
this.strokeColor[2],
this.strokeOpacity);
con.Stroke();
}
开发者ID:TheProjecter, 项目名称:zaspe-sharp, 代码行数:77, 代码来源:Rectangle.cs
示例15: DrawFoldSegment
void DrawFoldSegment (Cairo.Context ctx, double x, double y, bool isOpen, bool isSelected)
{
var drawArea = new Cairo.Rectangle (System.Math.Floor (x + (Width - foldSegmentSize) / 2) + 0.5,
System.Math.Floor (y + (editor.LineHeight - foldSegmentSize) / 2) + 0.5, foldSegmentSize, foldSegmentSize);
ctx.Rectangle (drawArea);
ctx.SetSourceColor (isOpen ? foldBgGC : foldToggleMarkerBackground);
ctx.FillPreserve ();
ctx.SetSourceColor (isSelected ? foldLineHighlightedGC : foldLineGC);
ctx.Stroke ();
ctx.DrawLine (isSelected ? foldLineHighlightedGC : foldToggleMarkerGC,
drawArea.X + drawArea.Width * 2 / 10,
drawArea.Y + drawArea.Height / 2,
drawArea.X + drawArea.Width - drawArea.Width * 2 / 10,
drawArea.Y + drawArea.Height / 2);
if (!isOpen)
ctx.DrawLine (isSelected ? foldLineHighlightedGC : foldToggleMarkerGC,
drawArea.X + drawArea.Width / 2,
drawArea.Y + drawArea.Height * 2 / 10,
drawArea.X + drawArea.Width / 2,
drawArea.Y + drawArea.Height - drawArea.Height * 2 / 10);
}
开发者ID:pabloescribanoloza, 项目名称:monodevelop, 代码行数:23, 代码来源:FoldMarkerMargin.cs
示例16: Draw
public void Draw (Cairo.Context cr, Cairo.Rectangle area)
{
TextViewMargin textViewMargin = editor.TextViewMargin;
ISyntaxMode mode = Document.SyntaxMode != null && editor.Options.EnableSyntaxHighlighting ? Document.SyntaxMode : new SyntaxMode (Document);
TextViewMargin.LayoutWrapper lineLayout = null;
double brightness = HslColor.Brightness (editor.ColorStyle.PlainText.Background);
int colorCount = foldSegments.Count + 2;
cr.SetSourceColor (GetColor (-1, brightness, colorCount));
cr.Rectangle (area);
cr.Fill ();
var rectangles = new Cairo.Rectangle[foldSegments.Count];
const int xPadding = 4;
const int yPadding = 2;
const int rightMarginPadding = 16;
for (int i = foldSegments.Count - 1; i >= 0 ; i--) {
var segment = foldSegments [i];
if (segment.IsInvalid)
continue;
var segmentStartLine = segment.StartLine;
var segmentEndLine = segment.EndLine;
int curWidth = 0;
var endLine = segmentEndLine.NextLine;
var y = editor.LineToY (segmentStartLine.LineNumber);
if (y < editor.VAdjustment.Value) {
segmentStartLine = editor.GetLine (editor.YToLine (editor.VAdjustment.Value));
y = editor.LineToY (segmentStartLine.LineNumber);
}
for (var curLine = segmentStartLine; curLine != endLine && y < editor.VAdjustment.Value + editor.Allocation.Height; curLine = curLine.NextLine) {
var curLayout = textViewMargin.CreateLinePartLayout (mode, curLine, curLine.Offset, curLine.Length, -1, -1);
var width = (int)(curLayout.Width);
curWidth = System.Math.Max (curWidth, width);
y += editor.GetLineHeight (curLine);
}
double xPos = textViewMargin.XOffset;
double rectangleWidth = 0, rectangleHeight = 0;
lineLayout = textViewMargin.CreateLinePartLayout (mode, segmentStartLine, segmentStartLine.Offset, segmentStartLine.Length, -1, -1);
var rectangleStart = lineLayout.Layout.IndexToPos (GetFirstNonWsIdx (lineLayout.Layout.Text));
xPos = System.Math.Max (textViewMargin.XOffset, (textViewMargin.XOffset + textViewMargin.TextStartPosition + rectangleStart.X / Pango.Scale.PangoScale) - xPadding);
lineLayout = textViewMargin.CreateLinePartLayout (mode, segmentEndLine, segmentEndLine.Offset, segmentEndLine.Length, -1, -1);
var rectangleEnd = lineLayout.Layout.IndexToPos (GetFirstNonWsIdx (lineLayout.Layout.Text));
xPos = System.Math.Min (xPos, System.Math.Max (textViewMargin.XOffset, (textViewMargin.XOffset + textViewMargin.TextStartPosition + rectangleEnd.X / Pango.Scale.PangoScale) - xPadding));
rectangleWidth = textViewMargin.XOffset + textViewMargin.TextStartPosition + curWidth - xPos + xPadding * 2;
if (i < foldSegments.Count - 1) {
rectangleWidth = System.Math.Max ((rectangles [i + 1].X + rectangles[i + 1].Width + rightMarginPadding) - xPos, rectangleWidth);
}
y = editor.LineToY (segment.StartLine.LineNumber);
var yEnd = editor.LineToY (segment.EndLine.LineNumber + 1) + (segment.EndLine.LineNumber == editor.LineCount ? editor.LineHeight : 0);
if (yEnd == 0)
yEnd = editor.VAdjustment.Upper;
rectangleHeight = yEnd - y;
rectangles[i] = new Cairo.Rectangle (xPos, y - yPadding, rectangleWidth, rectangleHeight + yPadding * 2);
}
for (int i = 0; i < foldSegments.Count; i++) {
Cairo.Rectangle clampedRect;
var rect = rectangles[i];
if (i == foldSegments.Count - 1) {
/* var radius = (int)(editor.Options.Zoom * 2);
int w = 2 * radius;
using (var shadow = new Blur (
System.Math.Min ((int)rect.Width + w * 2, editor.Allocation.Width),
System.Math.Min ((int)rect.Height + w * 2, editor.Allocation.Height),
radius)) {
using (var gctx = shadow.GetContext ()) {
gctx.Color = new Cairo.Color (0, 0, 0, 0);
gctx.Fill ();
var a = 0;
var b = 0;
DrawRoundRectangle (gctx, true, true, w - a, w - b, editor.LineHeight / 4, rect.Width + a * 2, rect.Height + a * 2);
var bg = editor.ColorStyle.Default.CairoColor;
gctx.Color = new Cairo.Color (bg.R, bg.G, bg.B, 0.6);
gctx.Fill ();
}
cr.Save ();
cr.Translate (rect.X - w - editor.HAdjustment.Value, rect.Y - editor.VAdjustment.Value - w);
shadow.Draw (cr);
cr.Restore ();
}*/
var curPadSize = 1;
var age = (DateTime.Now - startTime).TotalMilliseconds;
var alpha = 0.1;
if (age < animationLength) {
var animationState = age / (double)animationLength;
//.........这里部分代码省略.........
开发者ID:riverans, 项目名称:monodevelop, 代码行数:101, 代码来源:FoldingScreenbackgroundRenderer.cs
示例17: Draw
internal protected override void Draw (Cairo.Context cr, Cairo.Rectangle area, DocumentLine lineSegment, int line, double x, double y, double lineHeight)
{
var marker = lineSegment != null ? (MarginMarker)lineSegment.Markers.FirstOrDefault (m => m is MarginMarker && ((MarginMarker)m).CanDraw (this)) : null;
if (marker != null) {
bool hasDrawn = marker.DrawBackground (editor, cr, new MarginDrawMetrics (this, area, lineSegment, line, x, y, lineHeight));
if (!hasDrawn)
marker = null;
}
foldSegmentSize = marginWidth * 4 / 6;
foldSegmentSize -= (foldSegmentSize) % 2;
Cairo.Rectangle drawArea = new Cairo.Rectangle (x, y, marginWidth, lineHeight);
var state = editor.Document.GetLineState (lineSegment);
bool isFoldStart = false;
bool isContaining = false;
bool isFoldEnd = false;
bool isStartSelected = false;
bool isContainingSelected = false;
bool isEndSelected = false;
if (editor.Options.ShowFoldMargin && line <= editor.Document.LineCount) {
startFoldings.Clear ();
containingFoldings.Clear ();
endFoldings.Clear ();
foreach (FoldSegment segment in editor.Document.GetFoldingContaining (lineSegment)) {
if (segment.StartLine.Offset == lineSegment.Offset) {
startFoldings.Add (segment);
} else if (segment.EndLine.Offset == lineSegment.Offset) {
endFoldings.Add (segment);
} else {
containingFoldings.Add (segment);
}
}
isFoldStart = startFoldings.Count > 0;
isContaining = containingFoldings.Count > 0;
isFoldEnd = endFoldings.Count > 0;
isStartSelected = this.lineHover != null && IsMouseHover (startFoldings);
isContainingSelected = this.lineHover != null && IsMouseHover (containingFoldings);
isEndSelected = this.lineHover != null && IsMouseHover (endFoldings);
}
if (marker == null) {
if (editor.GetTextEditorData ().HighlightCaretLine && editor.Caret.Line == line) {
editor.TextViewMargin.DrawCaretLineMarker (cr, x, y, Width, lineHeight);
} else {
var bgGC = foldBgGC;
if (editor.TextViewMargin.BackgroundRenderer != null) {
if (isContainingSelected || isStartSelected || isEndSelected) {
bgGC = foldBgGC;
} else {
bgGC = foldLineHighlightedGCBg;
}
}
cr.Rectangle (drawArea);
cr.SetSourceColor (bgGC);
cr.Fill ();
}
}
if (editor.Options.EnableQuickDiff) {
if (state == TextDocument.LineState.Changed) {
cr.SetSourceColor (lineStateChangedGC);
cr.Rectangle (x + 1, y, marginWidth / 3, lineHeight);
cr.Fill ();
} else if (state == TextDocument.LineState.Dirty) {
cr.SetSourceColor (lineStateDirtyGC);
cr.Rectangle (x + 1, y, marginWidth / 3, lineHeight);
cr.Fill ();
}
}
if (editor.Options.ShowFoldMargin && line <= editor.Document.LineCount) {
double foldSegmentYPos = y + System.Math.Floor (editor.LineHeight - foldSegmentSize) / 2;
double xPos = x + System.Math.Floor (marginWidth / 2) + 0.5;
if (isFoldStart) {
bool isVisible = true;
bool moreLinedOpenFold = false;
foreach (FoldSegment foldSegment in startFoldings) {
if (foldSegment.IsFolded) {
isVisible = false;
} else {
moreLinedOpenFold = foldSegment.EndLine.Offset > foldSegment.StartLine.Offset;
}
}
bool isFoldEndFromUpperFold = false;
foreach (FoldSegment foldSegment in endFoldings) {
if (foldSegment.EndLine.Offset > foldSegment.StartLine.Offset && !foldSegment.IsFolded)
isFoldEndFromUpperFold = true;
}
DrawFoldSegment (cr, x, y, isVisible, isStartSelected);
if (isContaining || isFoldEndFromUpperFold)
cr.DrawLine (isContainingSelected ? foldLineHighlightedGC : foldLineGC, xPos, drawArea.Y, xPos, foldSegmentYPos - 2);
//.........这里部分代码省略.........
开发者ID:pabloescribanoloza, 项目名称:monodevelop, 代码行数:101, 代码来源:FoldMarkerMargin.cs
六六分期app的软件客服如何联系?不知道吗?加qq群【895510560】即可!标题:六六分期
阅读:19188| 2023-10-27
今天小编告诉大家如何处理win10系统火狐flash插件总是崩溃的问题,可能很多用户都不知
阅读:9988| 2022-11-06
今天小编告诉大家如何对win10系统删除桌面回收站图标进行设置,可能很多用户都不知道
阅读:8326| 2022-11-06
今天小编告诉大家如何对win10系统电脑设置节能降温的设置方法,想必大家都遇到过需要
阅读:8695| 2022-11-06
我们在使用xp系统的过程中,经常需要对xp系统无线网络安装向导设置进行设置,可能很多
阅读:8639| 2022-11-06
今天小编告诉大家如何处理win7系统玩cf老是与主机连接不稳定的问题,可能很多用户都不
阅读:9657| 2022-11-06
电脑对日常生活的重要性小编就不多说了,可是一旦碰到win7系统设置cf烟雾头的问题,很
阅读:8624| 2022-11-06
我们在日常使用电脑的时候,有的小伙伴们可能在打开应用的时候会遇见提示应用程序无法
阅读:7998| 2022-11-06
今天小编告诉大家如何对win7系统打开vcf文件进行设置,可能很多用户都不知道怎么对win
阅读:8656| 2022-11-06
今天小编告诉大家如何对win10系统s4开启USB调试模式进行设置,可能很多用户都不知道怎
阅读:7535| 2022-11-06
请发表评论