本文整理汇总了C#中Cairo.Color类的典型用法代码示例。如果您正苦于以下问题:C# Cairo.Color类的具体用法?C# Cairo.Color怎么用?C# Cairo.Color使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
Cairo.Color类属于命名空间,在下文中一共展示了Cairo.Color类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。
示例1: ClassFigure
public ClassFigure()
: base()
{
// TODO: de-duplicate this stuff...
hideInheritance = false;
FillColor = new Cairo.Color (0.6367, 0.6367, 0.9570);
}
开发者ID:erbriones,项目名称:monodevelop-classdesigner,代码行数:7,代码来源:ClassFigure.cs
示例2: ContainerCanvas
public ContainerCanvas(): base () {
_children = new Dictionary<Widget,ContainerCanvasChild>();
CanFocus = true;
Color = new Cairo.Color (1, 1, 1);
Hadjustment = NewDefaultAdjustment();
Vadjustment = NewDefaultAdjustment();
}
开发者ID:CoEST,项目名称:TraceLab,代码行数:8,代码来源:ContainerCanvas.cs
示例3: BoxCanvasElement
public BoxCanvasElement (Cairo.Color color, int width = 1, int height = 1)
{
this.color = color;
AnchorX = width / 2.0;
AnchorY = height / 2.0;
SetPreferedSize (width, height);
}
开发者ID:jassmith,项目名称:Xamarin.Canvas,代码行数:8,代码来源:BoxCanvasElement.cs
示例4: 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);
}
开发者ID:Kalnor,项目名称:monodevelop,代码行数:56,代码来源:Placeholder.cs
示例5: ProjectDetails
public ProjectDetails()
{
buttons_back_color = new Cairo.Color (44d / 255d, 56d / 255d, 119d / 255d, 0.5);
buttons_fore_color = new Cairo.Color (1, 1, 1, 1);
buttons_fontname = "sans 12";
slideshows_back_color = new Cairo.Color (44d / 255d, 56d / 255d, 119d / 255d, 0.5);
slideshows_fore_color = new Cairo.Color (1, 1, 1, 1);
slideshows_fontname = "sans 12";
}
开发者ID:GNOME,项目名称:mistelix,代码行数:10,代码来源:ProjectDetails.cs
示例6: CustomColorProvider
public CustomColorProvider()
{
whiteSqColor = new Cairo.Color (1, 1, 1, 1);
blackSqColor = new Cairo.Color (0.9, 0.8, 0.95, 1);
backgroundColor = new Cairo.Color (1, 0.95, 0.95, 1);
coordColor = new Cairo.Color (0.3, 0.1, 0.1, 1);
highlightSqColor = new Cairo.Color (1, 0, 0, 0.7);
moveHintColor = new Cairo.Color (1, 0, 0, 0.2);
arrowColor = new Cairo.Color (0.5, 0.5, 0.8, 0.5);
foregroundColor = new Cairo.Color (0, 0, 0, 1);
}
开发者ID:BackupTheBerlios,项目名称:csboard-svn,代码行数:11,代码来源:ColorProvider.cs
示例7: OptionsChanged
internal protected override void OptionsChanged ()
{
backgroundColor = editor.ColorStyle.IndicatorMargin.Color;
separatorColor = editor.ColorStyle.IndicatorMarginSeparator.Color;
layout.FontDescription = editor.Options.Font;
layout.SetText ("!");
int tmp;
layout.GetPixelSize (out tmp, out this.marginWidth);
marginWidth *= 12;
marginWidth /= 10;
}
开发者ID:OnorioCatenacci,项目名称:monodevelop,代码行数:12,代码来源:IconMargin.cs
示例8: DrawFrame
protected override void DrawFrame (Cairo.Context context, double lineWidth, Cairo.Color lineColor, Cairo.Color fillColor)
{
// base.DrawFrame (context, lineWidth, lineColor, fillColor);
rect = DisplayBox;
rect.OffsetDot5();
// HERZUM SPRINT 1.2
// CairoFigures.CurvedRectangle(context, rect, 30);
CairoFigures.AngleFrame(context, rect, 0,0,0,0);
// END HERZUM SPRINT 1.2
Cairo.Color fillColorOrigin;
fillColorOrigin = fillColor;
lineWidth = 1;
fillColor = new Cairo.Color (1.0, 1.0, 1.0, 1.0);
context.Color = fillColor;
context.FillPreserve();
context.Color = lineColor;
context.LineWidth = lineWidth;
double[] dash = {2, 0, 2};
context.SetDash (dash, 0);
context.Stroke();
rect2 = DisplayBox;
rect2.Width = DisplayBox.Width;
rect2.Height = 30;
rect2.OffsetDot5();
CairoFigures.CurvedRectangle(context, rect2, 30);
fillColor = fillColorOrigin;
context.Color = fillColor;
context.FillPreserve();
context.Color = lineColor;
context.LineWidth = lineWidth;
context.Stroke();
// HERZUM SPRINT 2.1
// m_applicationContext.MainWindow.ExperimentCanvasPad.LoopNodeControlCurrent = this;
// END HERZUM SPRINT 2.1
// HERZUM SPRINT 5.0: TLAB-235
// DrawScope ();
DrawScope ("Enter","Exit");
// END HERZUM SPRINT 5.0: TLAB-235
}
开发者ID:CoEST,项目名称:TraceLab,代码行数:50,代码来源:LoopNodeControl.cs
示例9:
void IChunkMarker.ChangeForeColor (MonoTextEditor editor, Chunk chunk, ref Cairo.Color color)
{
if (Debugger.DebuggingService.IsDebugging)
return;
int markerStart = Segment.Offset;
int markerEnd = Segment.EndOffset;
if (chunk.EndOffset <= markerStart || markerEnd <= chunk.Offset)
return;
var bgc = editor.ColorStyle.PlainText.Background;
double alpha = 0.6;
color = new Cairo.Color (
color.R * alpha + bgc.R * (1.0 - alpha),
color.G * alpha + bgc.G * (1.0 - alpha),
color.B * alpha + bgc.B * (1.0 - alpha)
);
}
开发者ID:pabloescribanoloza,项目名称:monodevelop,代码行数:16,代码来源:GrayOutMarker.cs
示例10: DecorateTabsAndSpaces
void DecorateTabsAndSpaces (Cairo.Context ctx, LayoutWrapper layout, int offset, int length, double xPos, double y, int selectionStart, int selectionEnd)
{
uint curIndex = 0, byteIndex = 0;
bool first = true, oldSelected = false;
int index, trailing;
layout.Layout.XyToIndex ((int)textEditor.HAdjustment.Value, 0, out index, out trailing);
var curchunk = layout.Chunks != null ? layout.Chunks.FirstOrDefault () : null;
for (int i = index; i < layout.LineChars.Length; i++) {
char ch = layout.LineChars [i];
if (ch != ' ' && ch != '\t')
continue;
if (ch == ' ' && !textEditor.Options.IncludeWhitespaces.HasFlag (IncludeWhitespaces.Space))
continue;
if (ch == '\t' && !textEditor.Options.IncludeWhitespaces.HasFlag (IncludeWhitespaces.Tab))
continue;
bool selected = selectionStart <= offset + i && offset + i < selectionEnd;
if (first || oldSelected != selected) {
first = false;
oldSelected = selected;
}
if (!selected && textEditor.Options.ShowWhitespaces != ShowWhitespaces.Always)
continue;
Pango.Rectangle pos = layout.Layout.IndexToPos ((int)TranslateToUTF8Index (layout.LineChars, (uint)i, ref curIndex, ref byteIndex));
double xpos = xPos + pos.X / Pango.Scale.PangoScale;
if (xpos > textEditor.Allocation.Width)
break;
Pango.Rectangle pos2 = layout.Layout.IndexToPos ((int)TranslateToUTF8Index (layout.LineChars, (uint)i + 1, ref curIndex, ref byteIndex));
double xpos2 = xPos + pos2.X / Pango.Scale.PangoScale;
Cairo.Color col = new Cairo.Color (0, 0, 0);
if (SelectionColor.TransparentForeground) {
while (curchunk != null && curchunk.EndOffset < offset + i)
curchunk = curchunk.Next;
if (curchunk != null && curchunk.SpanStack.Count > 0 && curchunk.SpanStack.Peek ().Color != "Plain Text") {
var chunkStyle = ColorStyle.GetChunkStyle (curchunk.SpanStack.Peek ().Color);
if (chunkStyle != null)
col = ColorStyle.GetForeground (chunkStyle);
} else {
col = ColorStyle.PlainText.Foreground;
}
} else {
col = selected ? SelectionColor.Foreground : col = ColorStyle.PlainText.Foreground;
}
ctx.Color = new Cairo.Color (col.R, col.G, col.B, whitespaceMarkerAlpha);
if (ch == '\t') {
DrawTabMarker (ctx, selected, xpos, xpos2, y);
} else {
DrawSpaceMarker (ctx, selected, xpos, xpos2, y);
}
}
}
开发者ID:OnorioCatenacci,项目名称:monodevelop,代码行数:51,代码来源:TextViewMargin.cs
示例11: BackgroundColor
public BackgroundColor (Cairo.Color color, int fromIdx, int toIdx)
{
this.Color = color;
this.FromIdx = fromIdx;
this.ToIdx = toIdx;
}
开发者ID:OnorioCatenacci,项目名称:monodevelop,代码行数:6,代码来源:TextViewMargin.cs
示例12: InnerDecorateTabsAndSpaces
void InnerDecorateTabsAndSpaces (Cairo.Context ctx, LayoutWrapper layout, int offset, double x, double y, int selectionStart, int selectionEnd, char spaceOrTab)
{
var chars = layout.LineChars;
if (Array.IndexOf (chars, spaceOrTab) == -1)
return;
uint curIndex = 0, byteIndex = 0;
bool first = true, oldSelected = false;
var curchunk = layout.Chunks != null ? layout.Chunks.FirstOrDefault () : null;
var dotThickness = textEditor.Options.Zoom * 2;
var textEditorWidth = textEditor.Allocation.Width;
//Get 1st visible character index from left based on HAdjustment
int index, trailing;
layout.Layout.XyToIndex ((int)textEditor.HAdjustment.Value, 0, out index, out trailing);
double ypos;
if (spaceOrTab == ' ') {
ypos = System.Math.Floor (y + (LineHeight - dotThickness) / 2);
} else {
ypos = 0.5 + System.Math.Floor (y + LineHeight / 2);
}
var showOnlySelected = textEditor.Options.ShowWhitespaces != ShowWhitespaces.Always;
var lastColor = new Cairo.Color ();
bool firstDraw = true;
var foregroundColor = ColorStyle.PlainText.Foreground;
int lastIndex = -1;
int lastPosX = 0;
for (int i = index; i < chars.Length; i++) {
if (spaceOrTab != chars [i])
continue;
bool selected = selectionStart <= offset + i && offset + i < selectionEnd;
if (first || oldSelected != selected) {
first = false;
oldSelected = selected;
}
if (showOnlySelected && !selected)
continue;
int line, posX;
if (lastIndex == i) {
posX = lastPosX;
} else {
layout.Layout.IndexToLineX ((int)TranslateToUTF8Index (chars, (uint)i, ref curIndex, ref byteIndex), false, out line, out posX);
}
double xpos = x + posX / Pango.Scale.PangoScale;
if (xpos > textEditorWidth)
break;
layout.Layout.IndexToLineX ((int)TranslateToUTF8Index (chars, (uint)i + 1, ref curIndex, ref byteIndex), false, out line, out posX);
lastPosX = posX;
lastIndex = i + 1;
double xpos2 = x + posX / Pango.Scale.PangoScale;
var col = new Cairo.Color (0, 0, 0);
if (SelectionColor.TransparentForeground) {
while (curchunk != null && curchunk.EndOffset < offset + i)
curchunk = curchunk.Next;
if (curchunk != null && curchunk.SpanStack.Count > 0 && curchunk.SpanStack.Peek ().Color != "Plain Text") {
var chunkStyle = ColorStyle.GetChunkStyle (curchunk.SpanStack.Peek ().Color);
if (chunkStyle != null)
col = ColorStyle.GetForeground (chunkStyle);
} else {
col = foregroundColor;
}
} else {
col = selected ? SelectionColor.Foreground : foregroundColor;
}
if (firstDraw || (lastColor.R != col.R && lastColor.G != col.G && lastColor.B != col.B)) {
ctx.SetSourceRGBA (col.R, col.G, col.B, whitespaceMarkerAlpha);
lastColor = col;
firstDraw = false;
}
if (spaceOrTab == ' ') {
ctx.Rectangle (xpos + (xpos2 - xpos - dotThickness) / 2, ypos, dotThickness, dotThickness);
} else {
ctx.MoveTo (0.5 + xpos, ypos);
ctx.LineTo (0.5 + xpos2 - charWidth / 2, ypos);
}
}
if (!firstDraw) {//Atleast one draw was called
if (spaceOrTab == ' ') {
ctx.Fill ();
} else {
ctx.Stroke ();
}
}
}
开发者ID:powerumc,项目名称:monodevelop_korean,代码行数:94,代码来源:TextViewMargin.cs
示例13: CreateColorMatrix
static Cairo.Color[,,,,] CreateColorMatrix (TextEditor editor, bool isError)
{
string typeString = isError ? "error" : "warning";
Cairo.Color[,,,,] colorMatrix = new Cairo.Color[2, 2, 3, 2, 2];
ColorSheme style = editor.ColorStyle;
if (style == null)
style = new DefaultStyle (editor.Style);
var baseColor = style.GetChunkStyle ("bubble." + typeString + "").CairoBackgroundColor;
AdjustColorMatrix (colorMatrix, 0, baseColor);
var hsl = (HslColor)baseColor;
hsl.S *= 0.6;
baseColor = hsl;
AdjustColorMatrix (colorMatrix, 1, hsl);
double factor = 1.03;
for (int i = 0; i < 2; i++) {
for (int j = 0; j < 2; j++) {
for (int k = 0; k < 3; k++) {
HslColor color = colorMatrix [i, j, k, 0, 0];
color.L *= factor;
colorMatrix [i, j, k, 1, 0] = color;
}
}
}
var selectionColor = ColorSheme.ToCairoColor (style.Selection.BackgroundColor);
for (int i = 0; i < 2; i++) {
for (int j = 0; j < 2; j++) {
for (int k = 0; k < 3; k++) {
for (int l = 0; l < 2; l++) {
var color = colorMatrix [i, j, k, l, 0];
colorMatrix [i, j, k, l, 1] = new Cairo.Color ((color.R + selectionColor.R * 1.5) / 2.5, (color.G + selectionColor.G * 1.5) / 2.5, (color.B + selectionColor.B * 1.5) / 2.5);
}
}
}
}
return colorMatrix;
}
开发者ID:yayanyang,项目名称:monodevelop,代码行数:41,代码来源:MessageBubbleCache.cs
示例14: OnExposeEvent
protected override bool OnExposeEvent (Gdk.EventExpose e)
{
using (Cairo.Context cr = Gdk.CairoHelper.Create (e.Window)) {
cr.LineWidth = Math.Max (1.0, widget.Editor.Options.Zoom);
cr.Rectangle (leftSpacer, 0, Allocation.Width, Allocation.Height);
cr.Color = new Cairo.Color (0.95, 0.95, 0.95);
cr.Fill ();
int startLine = widget.Editor.YToLine ((int)widget.Editor.VAdjustment.Value);
double startY = widget.Editor.LineToY (startLine);
while (startLine > 1 && startLine < annotations.Count && annotations[startLine - 1] != null && annotations[startLine] != null && annotations[startLine - 1].Revision == annotations[startLine].Revision) {
startLine--;
startY -= widget.Editor.GetLineHeight (widget.Editor.Document.GetLine (startLine));
}
double curY = startY - widget.Editor.VAdjustment.Value;
int line = startLine;
while (curY < Allocation.Bottom) {
double curStart = curY;
// widget.JumpOverFoldings (ref line);
int lineStart = line;
int w = 0, w2 = 0, h = 16;
Annotation ann = line <= annotations.Count ? annotations[line - 1] : null;
if (ann != null) {
do {
widget.JumpOverFoldings (ref line);
line++;
} while (line + 1 <= annotations.Count && annotations[line - 1] != null && annotations[line - 1].Revision == ann.Revision);
double nextY = widget.editor.LineToY (line) - widget.editor.VAdjustment.Value;
if (highlightAnnotation != null && highlightAnnotation.Revision == ann.Revision && curStart <= highlightPositon && highlightPositon < nextY) {
cr.Rectangle (leftSpacer, curStart + cr.LineWidth, Allocation.Width - leftSpacer, nextY - curStart - cr.LineWidth);
cr.Color = new Cairo.Color (1, 1, 1);
cr.Fill ();
}
layout.SetText (ann.Author);
layout.GetPixelSize (out w, out h);
e.Window.DrawLayout (Style.BlackGC, leftSpacer + margin, (int)(curY + (widget.Editor.LineHeight - h) / 2), layout);
layout.SetText (TruncRevision (ann.Revision));
layout.GetPixelSize (out w2, out h);
e.Window.DrawLayout (Style.BlackGC, Allocation.Width - w2 - margin, (int)(curY + (widget.Editor.LineHeight - h) / 2), layout);
if (ann.HasDate) {
string dateTime = ann.Date.ToShortDateString ();
int middle = w + (Allocation.Width - margin * 2 - leftSpacer - w - w2) / 2;
layout.SetText (dateTime);
layout.GetPixelSize (out w, out h);
e.Window.DrawLayout (Style.BlackGC, leftSpacer + margin + middle - w / 2, (int)(curY + (widget.Editor.LineHeight - h) / 2), layout);
}
curY = nextY;
} else {
curY += widget.Editor.GetLineHeight (line);
line++;
widget.JumpOverFoldings (ref line);
}
if (ann != null && line - lineStart > 1) {
string msg = GetCommitMessage (lineStart);
if (!string.IsNullOrEmpty (msg)) {
msg = FormatMessage (msg);
layout.SetText (msg);
layout.Width = (int)(Allocation.Width * Pango.Scale.PangoScale);
using (var gc = new Gdk.GC (e.Window)) {
gc.RgbFgColor = Style.Dark (State);
gc.ClipRectangle = new Rectangle (0, (int)curStart, Allocation.Width, (int)(curY - curStart));
e.Window.DrawLayout (gc, (int)(leftSpacer + margin), (int)(curStart + h), layout);
}
}
}
cr.Rectangle (0, curStart, leftSpacer, curY - curStart);
if (ann != null && ann != locallyModified && !string.IsNullOrEmpty (ann.Author)) {
double a;
if (ann != null && (maxDate - minDate).TotalHours > 0) {
a = 1 - (ann.Date - minDate).TotalHours / (maxDate - minDate).TotalHours;
} else {
a = 1;
}
HslColor color = new Cairo.Color (0.90, 0.90, 1);
color.L = 0.4 + a / 2;
color.S = 1 - a / 2;
cr.Color = color;
} else {
cr.Color = ann != null ? new Cairo.Color (1, 1, 0) : new Cairo.Color (0.95, 0.95, 0.95);
}
cr.Fill ();
if (ann != null) {
cr.MoveTo (0, curY + 0.5);
cr.LineTo (Allocation.Width, curY + 0.5);
cr.Color = new Cairo.Color (0.6, 0.6, 0.6);
cr.Stroke ();
}
}
}
return true;
}
开发者ID:trustme,项目名称:monodevelop,代码行数:100,代码来源:BlameWidget.cs
示例15: RedrawText
/// <summary>
/// Draws the text.
/// </summary>
/// <param name="showCursor">Whether or not to show the mouse cursor in the drawing.</param>
/// <param name="useTextLayer">Whether or not to use the TextLayer (as opposed to the Userlayer).</param>
private void RedrawText(bool showCursor, bool useTextLayer)
{
Rectangle r = CurrentTextEngine.GetLayoutBounds();
r.Inflate(10 + OutlineWidth, 10 + OutlineWidth);
CurrentTextBounds = r;
Rectangle cursorBounds = Rectangle.Zero;
Cairo.ImageSurface surf;
if (!useTextLayer)
{
//Draw text on the current UserLayer's surface as finalized text.
surf = PintaCore.Workspace.ActiveDocument.CurrentUserLayer.Surface;
}
else
{
//Draw text on the current UserLayer's TextLayer's surface as re-editable text.
surf = PintaCore.Workspace.ActiveDocument.CurrentUserLayer.TextLayer.Surface;
ClearTextLayer();
}
using (var g = new Cairo.Context (surf)) {
g.Save ();
// Show selection if on text layer
if (useTextLayer) {
// Selected Text
Cairo.Color c = new Cairo.Color (0.7, 0.8, 0.9, 0.5);
foreach (Rectangle rect in CurrentTextEngine.SelectionRectangles)
g.FillRectangle (rect.ToCairoRectangle (), c);
}
g.AppendPath (PintaCore.Workspace.ActiveDocument.Selection.SelectionPath);
g.FillRule = Cairo.FillRule.EvenOdd;
g.Clip ();
g.MoveTo (new Cairo.PointD (CurrentTextEngine.Origin.X, CurrentTextEngine.Origin.Y));
g.Color = PintaCore.Palette.PrimaryColor;
//Fill in background
if (BackgroundFill) {
using (var g2 = new Cairo.Context (surf)) {
g2.FillRectangle(CurrentTextEngine.GetLayoutBounds().ToCairoRectangle(), PintaCore.Palette.SecondaryColor);
}
}
// Draw the text
if (FillText)
Pango.CairoHelper.ShowLayout (g, CurrentTextEngine.Layout);
if (FillText && StrokeText) {
g.Color = PintaCore.Palette.SecondaryColor;
g.LineWidth = OutlineWidth;
Pango.CairoHelper.LayoutPath (g, CurrentTextEngine.Layout);
g.Stroke ();
} else if (StrokeText) {
g.Color = PintaCore.Palette.PrimaryColor;
g.LineWidth = OutlineWidth;
Pango.CairoHelper.LayoutPath (g, CurrentTextEngine.Layout);
g.Stroke ();
}
if (showCursor) {
var loc = CurrentTextEngine.GetCursorLocation ();
g.Antialias = Cairo.Antialias.None;
g.DrawLine (new Cairo.PointD (loc.X, loc.Y), new Cairo.PointD (loc.X, loc.Y + loc.Height), new Cairo.Color (0, 0, 0, 1), 1);
cursorBounds = Rectangle.Inflate (loc, 2, 10);
}
g.Restore ();
if (useTextLayer && (is_editing || ctrlKey) && !CurrentTextEngine.IsEmpty())
{
//Draw the text edit rectangle.
g.Save();
g.Translate(.5, .5);
using (Cairo.Path p = g.CreateRectanglePath(new Cairo.Rectangle(CurrentTextBounds.Left, CurrentTextBounds.Top,
CurrentTextBounds.Width, CurrentTextBounds.Height - FontSize)))
{
g.AppendPath(p);
}
g.LineWidth = 1;
g.Color = new Cairo.Color(1, 1, 1);
g.StrokePreserve();
//.........这里部分代码省略.........
开发者ID:Kharevich,项目名称:Pinta,代码行数:101,代码来源:TextTool.cs
示例16: OptionsChanged
internal protected override void OptionsChanged ()
{
CalculateWidth ();
lineNumberBgGC = editor.ColorStyle.LineNumber.CairoBackgroundColor;
lineNumberGC = editor.ColorStyle.LineNumber.CairoColor;
lineNumberHighlightGC = editor.ColorStyle.LineNumberFgHighlighted;
}
开发者ID:nieve,项目名称:monodevelop,代码行数:8,代码来源:GutterMargin.cs
示例17: SearchPopupWindow
public SearchPopupWindow ()
{
headerColor = Styles.GlobalSearch.HeaderTextColor.ToCairoColor ();
separatorLine = Styles.GlobalSearch.SeparatorLineColor.ToCairoColor ();
lightSearchBackground = Styles.GlobalSearch.HeaderBackgroundColor.ToCairoColor ();
darkSearchBackground = Styles.GlobalSearch.BackgroundColor.ToCairoColor ();
selectionBackgroundColor = Styles.GlobalSearch.SelectionBackgroundColor.ToCairoColor ();
TypeHint = Gdk.WindowTypeHint.Combo;
this.SkipTaskbarHint = true;
this.SkipPagerHint = true;
this.TransientFor = IdeApp.Workbench.RootWindow;
this.AllowShrink = false;
this.AllowGrow = false;
categories.Add (new FileSearchCategory ());
categories.Add (new CommandSearchCategory ());
categories.Add (new SearchInSolutionSearchCategory ());
foreach (var cat in AddinManager.GetExtensionObjects<SearchCategory> ("/MonoDevelop/Ide/SearchCategories")) {
categories.Add (cat);
cat.Initialize (this);
}
categories.Sort ();
layout = new Pango.Layout (PangoContext);
headerLayout = new Pango.Layout (PangoContext);
layout.Ellipsize = Pango.EllipsizeMode.End;
headerLayout.Ellipsize = Pango.EllipsizeMode.End;
Events = Gdk.EventMask.ButtonPressMask | Gdk.EventMask.ButtonMotionMask | Gdk.EventMask.ButtonReleaseMask | Gdk.EventMask.ExposureMask | Gdk.EventMask.PointerMotionMask;
ItemActivated += (sender, e) => OpenFile ();
}
开发者ID:kdubau,项目名称:monodevelop,代码行数:33,代码来源:SearchPopupWindow.cs
示例18: OnExposeEvent
protected override bool OnExposeEvent(Gdk.EventExpose args)
{
Gdk.Window win = GdkWindow;
int rwidth, rheight;
Cairo.Context ctx = CairoHelper.Create (win);
win.GetSize (out rwidth, out rheight);
if (autoStartY || autoEndY) {
double nstartY = double.MaxValue;
double nendY = double.MinValue;
GetValueRange (AxisDimension.Y, out nstartY, out nendY);
if (!autoStartY) nstartY = startY;
if (!autoEndY) nendY = endY;
if (nendY < nstartY) nendY = nstartY;
if (nstartY != startY || nendY != endY) {
yrangeChanged = true;
startY = nstartY;
endY = nendY;
}
}
if (autoStartX || autoEndX) {
double nstartX = double.MaxValue;
double nendX = double.MinValue;
GetValueRange (AxisDimension.X, out nstartX, out nendX);
if (!autoStartX) nstartX = startX;
if (!autoEndX) nendX = endX;
if (nendX < nstartX) nendX = nstartX;
if (nstartX != startX || nendX != endX) {
xrangeChanged = true;
startX = nstartX;
endX = nendX;
}
}
if (yrangeChanged) {
FixOrigins ();
int right = rwidth - 2 - AreaBorderWidth;
left = AreaBorderWidth;
left += MeasureAxisSize (AxisPosition.Left) + 1;
right -= MeasureAxisSize (AxisPosition.Right) + 1;
yrangeChanged = false;
width = right - left + 1;
if (width <= 0) width = 1;
}
if (xrangeChanged) {
FixOrigins ();
int bottom = rheight - 2 - AreaBorderWidth;
top = AreaBorderWidth;
bottom -= MeasureAxisSize (AxisPosition.Bottom);
top += MeasureAxisSize (AxisPosition.Top);
// Make room for cursor handles
foreach (ChartCursor cursor in cursors) {
if (cursor.Dimension == AxisDimension.X && top - AreaBorderWidth < cursor.HandleSize)
top = cursor.HandleSize + AreaBorderWidth;
}
xrangeChanged = false;
height = bottom - top + 1;
if (height <= 0) height = 1;
}
if (AutoScaleMargin != 0 && height > 0) {
double margin = (double)AutoScaleMargin * (endY - startY) / (double) height;
if (autoStartY) startY -= margin;
if (autoEndY) endY += margin;
}
// Console.WriteLine ("L:" + left + " T:" + top + " W:" + width + " H:" + height);
// Draw the background
if (backgroundDisplay == BackgroundDisplay.Gradient) {
ctx.Rectangle (left - 1, top - 1, width + 2, height + 2);
using (var pat = new Cairo.LinearGradient (left - 1, top - 1, left - 1, height + 2)) {
pat.AddColorStop (0, backroundColor);
Cairo.Color endc = new Cairo.Color (1,1,1);
pat.AddColorStop (1, endc);
ctx.SetSource (pat);
ctx.Fill ();
}
} else {
ctx.Rectangle (left - 1, top - 1, width + 2, height + 2);
ctx.SetSourceColor (backroundColor);
ctx.Fill ();
}
// win.DrawRectangle (Style.WhiteGC, true, left - 1, top - 1, width + 2, height + 2);
win.DrawRectangle (Style.BlackGC, false, left - AreaBorderWidth, top - AreaBorderWidth, width + AreaBorderWidth*2, height + AreaBorderWidth*2);
// Draw selected area
if (enableSelection) {
//.........这里部分代码省略.........
开发者ID:Kalnor,项目名称:monodevelop,代码行数:101,代码来源:BasicChart.cs
示例19: DrawBar
protected virtual void DrawBar (Cairo.Context cr)
{
if (vadjustment == null || vadjustment.Upper <= vadjustment.PageSize)
return;
double x, y, w, h;
GetBarDimensions (out x, out y, out w, out h);
if (Platform.IsWindows) {
cr.Rectangle (x, y, w, h);
} else {
MonoDevelop.Components.CairoExtensions.RoundedRectangle (cr, x, y, w, h, 4);
}
bool prelight = State == StateType.Prelight;
Cairo.Color c;
if (Platform.IsWindows) {
c = prelight ? win81SliderPrelight : win81Slider;
//compute new color such that it will produce same color when blended with bg
c = AddAlpha (win81Background, c, 0.5d);
} else {
c = new Cairo.Color (0, 0, 0, (prelight ? 50.0 : 22.0) / 255);
}
cr.SetSourceColor (c);
cr.Fill ();
}
开发者ID:GroM,项目名称:monodevelop,代码行数:27,代码来源:QuickTaskOverviewMode.cs
示例20: Draw
protected internal override void Draw (Cairo.Context cr, Cairo.Rectangle area, LineSegment line, int lineNr, double x, double y, double _lineHeight)
{
// double xStart = System.Math.Max (area.X, XOffset);
// xStart = System.Math.Max (0, xStart);
var lineArea = new Cairo.Rectangle (XOffset - 1, y, textEditor.Allocation.Width - XOffset + 1, _lineHeight);
int width, height;
double pangoPosition = (x - textEditor.HAdjustment.Value + TextStartPosition) * Pango.Scale.PangoScale;
defaultBgColor = Document.ReadOnly ? ColorStyle.ReadOnlyTextBg : ColorStyle.Default.CairoBackgroundColor;
// Draw the default back color for the whole line. Colors other than the default
// background will be drawn when rendering the text chunks.
DrawRectangleWithRuler (cr, x, lineArea, defaultBgColor, true);
bool isSelectionDrawn = false;
if (BackgroundRenderer != null)
BackgroundRenderer.Draw (cr, area, line, x, y, _lineHeight);
// Check if line is beyond the document length
if (line == null) {
if (textEditor.Options.ShowInvalidLines)
DrawInvalidLineMarker (cr, pangoPosition / Pango.Scale.PangoScale, y);
var marker = Document.GetExtendingTextMarker (lineNr);
if (marker != null)
marker.Draw (textEditor, cr, lineNr, lineArea);
return;
}
IEnumerable<FoldSegment> foldings = Document.GetStartFoldings (line);
int offset = line.Offset;
int caretOffset = Caret.Offset;
bool isEolFolded = false;
restart:
int logicalRulerColumn = line.GetLogicalColumn (textEditor.GetTextEditorData (), textEditor.Options.RulerColumn);
foreach (FoldSegment folding in foldings) {
int foldOffset = folding.StartLine.Offset + folding.Column - 1;
if (foldOffset < offset)
continue;
if (folding.IsFolded) {
DrawLinePart (cr, line, lineNr, logicalRulerColumn, offset, foldOffset - offset, ref pangoPosition, ref isSelectionDrawn, y, area.X + area.Width);
offset = folding.EndLine.Offset + folding.EndColumn;
markerLayout.SetText (folding.Description);
markerLayout.GetSize (out width, out height);
bool isFoldingSelected = !this.HideSelection && textEditor.IsSomethingSelected && textEditor.SelectionRange.Contains (folding.Segment);
double pixelX = pangoPosition / Pango.Scale.PangoScale;
double pixelWidth = (pangoPosition + width) / Pango.Scale.PangoScale - pixelX;
var foldingRectangle = new Cairo.Rectangle (pixelX + 0.5, y + 0.5, pixelWidth - cr.LineWidth, this.LineHeight - cr.LineWidth);
if (BackgroundRenderer == null) {
cr.Color = isFoldingSelected ? SelectionColor.CairoBackgroundColor : defaultBgColor;
cr.Rectangle (foldingRectangle);
cr.Fill ();
}
cr.Color = isFoldingSelected ? SelectionColor.CairoColor : ColorStyle.FoldLine.CairoColor;
cr.Rectangle (foldingRectangle);
cr.Stroke ();
cr.Save ();
cr.Translate (pangoPosition / Pango.Scale.PangoScale, y);
cr.Color = isFoldingSelected ? SelectionColor.CairoColor : ColorStyle.FoldLine.CairoColor;
cr.ShowLayout (markerLayout);
cr.Restore ();
if (caretOffset == foldOffset && !string.IsNullOrEmpty (folding.Description))
SetVisibleCaretPosition ((int)(pangoPosition / Pango.Scale.PangoScale), y);
pangoPosition += width;
if (caretOffset == foldOffset + folding.Length && !string.IsNullOrEmpty (folding.Description))
SetVisibleCaretPosition ((int)(pangoPosition / Pango.Scale.PangoScale), y);
if (folding.EndLine != line) {
line = folding.EndLine;
lineNr = Document.OffsetToLineNumber (line.Offset);
foldings = Document.GetStartFoldings (line);
isEolFolded = line.Length <= folding.EndColumn;
goto restart;
}
isEolFolded = line.Length <= folding.EndColumn;
}
}
// Draw remaining line - must be called for empty line parts as well because the caret may be at this positon
// and the caret position is calculated in DrawLinePart.
if (line.EndOffsetIncludingDelimiter - offset >= 0)
DrawLinePart (cr, line, lineNr, logicalRulerColumn, offset, line.Offset + line.Length - offset, ref pangoPosition, ref isSelectionDrawn, y, area.X + area.Width);
bool isEolSelected = !this.HideSelection && textEditor.IsSomethingSelected && textEditor.SelectionMode == SelectionMode.Normal && textEditor.SelectionRange.Contains (line.Offset + line.Length);
lineArea = new Cairo.Rectangle (pangoPosition / Pango.Scale.PangoScale,
lineArea.Y,
textEditor.Allocation.Width - pangoPosition / Pango.Scale.PangoScale,
lineArea.Height);
if (textEditor.SelectionMode == SelectionMode.Block && textEditor.IsSomethingSelected && textEditor.SelectionRange.Contains (line.Offset + line.Length)) {
DocumentLocation start = textEditor.MainSelection.Anchor;
DocumentLocation end = textEditor.MainSelection.Lead;
//.........这里部分代码省略.........
开发者ID:txdv,项目名称:monodevelop,代码行数:101,代码来源:TextViewMargin.cs
注:本文中的Cairo.Color类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论