当前位置: 首页>>代码示例>>C#>>正文


C# Cairo.Color类代码示例

本文整理汇总了C#中Cairo.Color的典型用法代码示例。如果您正苦于以下问题:C# Cairo.Color类的具体用法?C# Cairo.Color怎么用?C# Cairo.Color使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


Cairo.Color类属于命名空间,在下文中一共展示了Cairo.Color类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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


注:本文中的Cairo.Color类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。