public LLMarkerRotated LLShape(DrawStyle style, ref LineSegment<Coord> toArrow) { Coord frac = Width * Scale / toArrow.Length(); var markerPoint = toArrow.PointAlong(1 - frac * 0.5f); toArrow = toArrow.A.To(toArrow.PointAlong(1 - Math.Min(frac, 1))); return new LLMarkerRotated(style, markerPoint, Scale, Geometry, (Coord)toArrow.Vector().AngleDeg()); }
public TimeSeriesViewer() { Type = typeof(TimeSeries); Color = Color.Black; DrawWidth = 1; DrawStyle = DrawStyle.Line; }
/// <summary> /// Initializes a new instance of the <see cref="ColorBoxGradient"/> class. /// </summary> /// <param name="name">The name.</param> public ColorBoxGradient(string name) : base(name) { this.hsl = new HSL { H = 0.3, S = 0.6, L = 0.8 }; this.rgba = AdobeColors.HSLToRGB(this.hsl); this.drawStyle = DrawStyle.Hue; Config.Width = Theme.ControlWidth; Config.Height = Theme.ControlWidth; this.redrawControlFlag = true; }
internal override void Draw(System.Drawing.Graphics g, DrawStyle style) { List<Point> points = new List<Point>(); for (int i = 0; i < GraphArea.Width; i++) { double xValue = ValueDimension.MinimumX + (ValueDimension.XDifference / GraphArea.Width) * i; double yValue = Function(xValue); int yPixel = (int)Math.Abs( (ValueDimension.MinimumY + yValue) * GraphArea.Height / ValueDimension.YDifference); if (ValueDimension.IsBetweenYBorders(yValue)) { //Add point to list points.Add(new Point(GraphArea.Left + i, GraphArea.Top + yPixel)); } else if (yValue < ValueDimension.MinimumY) { points.Add(new Point(GraphArea.Left + i, GraphArea.Bottom)); } else if (yValue > ValueDimension.MaximumY) { points.Add(new Point(GraphArea.Left + i, GraphArea.Top)); } //else if (points.Count > 0) //{ // //Draw all points... // g.DrawLines(LineStyle, points.ToArray()); // //...and clear list for next draw point in list // points.Clear(); //} } if ((style == DrawStyle.Both) || (style == DrawStyle.Lines)) { if (points.Count > 0) g.DrawLines(LineStyle, points.ToArray()); } //**************************************************************** points.Add(GraphArea.GetBottomRight()); points.Add(new Point(GraphArea.Left, GraphArea.Bottom)); byte[] types = new byte[points.Count]; for (int i = 0; i < types.Length; i++) types[i] = (byte)PathPointType.Line; GraphicsPath path = new GraphicsPath(points.ToArray(), types); path.CloseAllFigures(); if ((style == DrawStyle.Both) || (style == DrawStyle.Faces)) { g.FillPath(FillStyle, path); } }
public Sphere(float radius, int slices, int stacks, DrawStyle drawStyle = DrawStyle.GLU_FILL) { this.radius = radius; this.slices = slices; this.stacks = stacks; this.drawStyle = drawStyle; //this.transform = new Transform(); //transform.position = position; }
/// <summary> /// 在原有波形上添加一条线 /// 不可动态循环 /// </summary> /// <param name="listX">X轴</param> /// <param name="listY">Y轴</param> /// <param name="listColor">线条颜色</param> /// <param name="listWidth">线条宽度</param> /// <param name="listLineJoin">线条连接点</param> /// <param name="listLineCap">线条起始线帽</param> /// <param name="listDrawStyle">线条样式</param> public void f_AddPix(ref List<float> listX, ref List<float> listY, Color listColor, int listWidth, LineJoin listLineJoin, LineCap listLineCap, DrawStyle listDrawStyle) { //装载 _listX.Add(listX); _listY.Add(listY); _listColor.Add(listColor); _listWidth.Add(listWidth); _listLineJoin.Add(listLineJoin); _listLineCap.Add(listLineCap); _listDrawStyle.Add(listDrawStyle); }
internal override void Draw(Graphics g, DrawStyle style) { if ((style == DrawStyle.Faces) || (style == DrawStyle.Both)) { DrawFaces(g); } if ((style == DrawStyle.Lines) || (style == DrawStyle.Both)) { DrawLines(g); } }
/// <summary> /// 清空原有数据并加载一条波形数据 /// </summary> /// <param name="listX">X轴</param> /// <param name="listY">Y轴</param> /// <param name="listColor">线条颜色</param> /// <param name="listWidth">线条宽度</param> /// <param name="listLineJoin">线条连接点</param> /// <param name="listLineCap">线条起始线帽</param> /// <param name="listDrawStyle">线条样式</param> public void f_LoadOnePix(ref List<float> listX, ref List<float> listY, Color listColor, int listWidth, LineJoin listLineJoin, LineCap listLineCap,DrawStyle listDrawStyle) { //重新初始化 f_ClearAllPix(); //装载 _listX.Add(listX); _listY.Add(listY); _listColor.Add(listColor); _listWidth.Add(listWidth); _listLineJoin.Add(listLineJoin); _listLineCap.Add(listLineCap); _listDrawStyle.Add(listDrawStyle); }
public RangeImageViewer(Robot Robot) { m_Robot = Robot; m_DrawStyle = DrawStyle.TrianglesColorByDistance; scanParams = new ScanParameters(); // these should probably be read in from a file or something... scanParams.HRange = 0; scanParams.HRes = 0; scanParams.scanBottom = -45; scanParams.scanLines = 360; scanParams.scanRes = (float).25; InitializeComponent(); }
/// <summary> /// Initializes a new instance of the <see cref="ColorSliderVertical"/> class. /// </summary> /// <param name="name">The name.</param> public ColorSliderVertical(string name) : base(name) { // Initialize Colors this.hsl = new HSL { H = 1.0, S = 1.0, L = 1.0 }; this.rgba = AdobeColors.HSLToRGB(this.hsl); // pick a format to show this.drawStyle = DrawStyle.Hue; this.Padding = 9; Config.Width = Theme.ControlHeight; Config.Height = Theme.ControlWidth; }
protected override void LoadContent() { spriteBatch = new SpriteBatch(GraphicsDevice); FileStream stream; XmlSerializer serializer; if (reloadLevel) { currentLevel = LoadLevel(gameState.Number); currentDrawStyle = currentLevel.DrawStyle; colorPalette = currentLevel.ColorPalette; whiteTexture = SquareTexture(Color.White); colorTextures = LoadColorTextures(colorPalette); goalPosition = currentLevel.Goal; data = currentLevel.Data; reloadLevel = false; return; } int levelIndex = 1; /* stream = File.Open("level" + levelIndex.ToString() + ".xml", FileMode.Open, FileAccess.Read); serializer = new XmlSerializer(typeof(Level)); currentLevel = (Level)serializer.Deserialize(stream); stream.Close(); for (int i = 0; i < currentLevel.Data.Length; i++) { for (int j = 0; j < currentLevel.Data[i].Length; j++) { if(currentLevel.Data[i][j].ColorIndex == 2) { currentLevel.Data[i][j].IsPersistent = true; } } } stream = File.Open("level1.xml", FileMode.Create); serializer = new XmlSerializer(typeof(Level)); serializer.Serialize(stream, currentLevel); stream.Close(); return;*/ if (File.Exists("gamestate.xml")) { stream = File.Open("gamestate.xml", FileMode.Open, FileAccess.Read); serializer = new XmlSerializer(typeof(GameState)); gameState = (GameState)serializer.Deserialize(stream); stream.Close(); levelIndex = gameState == null ? 1 : gameState.Number; } stream = File.Open("level" + levelIndex.ToString() + ".xml", FileMode.Open, FileAccess.Read); serializer = new XmlSerializer(typeof(Level)); currentLevel = (Level)serializer.Deserialize(stream); stream.Close(); levelLastModified = File.GetLastWriteTime("level" + levelIndex.ToString() + ".xml"); if (gameState != null) { data = gameState.Data; backgroundColorIndex = gameState.BackgroundColorIndex; playerColorIndex = gameState.PlayerColorIndex; playerPosition = gameState.PlayerPosition; } else { data = currentLevel.Data; backgroundColorIndex = currentLevel.BackgroundColorIndex; playerColorIndex = currentLevel.PlayerColorIndex; playerPosition = currentLevel.PlayerStart; gameState = new GameState() { Number = levelIndex, Data = data, BackgroundColorIndex = backgroundColorIndex, PlayerColorIndex = playerColorIndex, PlayerPosition = playerPosition }; } colorPalette = currentLevel.ColorPalette; goalPosition = currentLevel.Goal; currentDrawStyle = currentLevel.DrawStyle; whiteTexture = SquareTexture(Color.White); colorTextures = LoadColorTextures(colorPalette); }
public ColorEventArgs(MyColor color, DrawStyle drawStyle) { Color = color; DrawStyle = drawStyle; }
protected virtual void Initialize() { SuspendLayout(); DoubleBuffered = true; clientWidth = ClientRectangle.Width; clientHeight = ClientRectangle.Height; bmp = new Bitmap(clientWidth, clientHeight, PixelFormat.Format32bppArgb); SelectedColor = Color.Red; DrawStyle = DrawStyle.Hue; mouseMoveTimer = new Timer(); mouseMoveTimer.Interval = 10; mouseMoveTimer.Tick += new EventHandler(MouseMoveTimer_Tick); ClientSizeChanged += new EventHandler(EventClientSizeChanged); MouseDown += new MouseEventHandler(EventMouseDown); MouseEnter += new EventHandler(EventMouseEnter); MouseUp += new MouseEventHandler(EventMouseUp); Paint += new PaintEventHandler(EventPaint); ResumeLayout(false); }
//////////////////////////////////////////////////////////////////// /// <summary> /// Draw web link with one line of text /// </summary> /// <param name="Page">Current page</param> /// <param name="Font">Font</param> /// <param name="FontSize">Font size</param> /// <param name="TextAbsPosX">Text absolute position X</param> /// <param name="TextAbsPosY">Text absolute position Y</param> /// <param name="Justify">Text justify enumeration.</param> /// <param name="DrawStyle">Draw style enumeration</param> /// <param name="TextColor">Color</param> /// <param name="Text">Text</param> /// <param name="WebLink">Web link</param> /// <returns>Text width</returns> /// <remarks> /// The position arguments are in relation to the /// bottom left corner of the paper. /// </remarks> //////////////////////////////////////////////////////////////////// public Double DrawWebLink( PdfPage Page, PdfFont Font, Double FontSize, // in points Double TextAbsPosX, Double TextAbsPosY, TextJustify Justify, DrawStyle DrawStyle, Color TextColor, String Text, String WebLink ) { Double Width = DrawText(Font, FontSize, TextAbsPosX, TextAbsPosY, Justify, DrawStyle, TextColor, Text); if(Width == 0.0) return(0.0); // adjust position switch(Justify) { // right case TextJustify.Right: TextAbsPosX -= Width; break; // center case TextJustify.Center: TextAbsPosX -= 0.5 * Width; break; } Page.AddWebLink(TextAbsPosX, TextAbsPosY - Font.DescentPlusLeading(FontSize), TextAbsPosX + Width, TextAbsPosY + Font.AscentPlusLeading(FontSize), WebLink); return(Width); }
private void Draw(DoubleSeries series, int padNumber, DrawStyle stype) { Dictionary<SmartQuant.Instruments.Instrument, Dictionary<DoubleSeries, Tuple<int, DrawStyle>>> dictionary; if (Map.DrawTable.ContainsKey(this.strategyName)) { dictionary = (Map.DrawTable[this.strategyName] as Dictionary<SmartQuant.Instruments.Instrument, Dictionary<DoubleSeries, Tuple<int, DrawStyle>>>); } else { dictionary = new Dictionary<SmartQuant.Instruments.Instrument, Dictionary<DoubleSeries, Tuple<int, DrawStyle>>>(); Map.DrawTable[this.strategyName] = dictionary; } Dictionary<DoubleSeries, Tuple<int, DrawStyle>> dictionary2; if (dictionary.ContainsKey(this.sq_Instrument)) { dictionary2 = dictionary[this.sq_Instrument]; } else { dictionary2 = new Dictionary<DoubleSeries, Tuple<int, DrawStyle>>(); dictionary[this.sq_Instrument] = dictionary2; } dictionary2[series] = new Tuple<int, DrawStyle>(padNumber, stype); this.maxPadNumber = Math.Max(this.maxPadNumber, padNumber); }
public void Draw(Indicator indicator, int padNumber, DrawStyle style) { if (indicator is UserIndicator) { (indicator as UserIndicator).Init(); } this.Draw(indicator.indicator, padNumber, style); }
/// <summary> /// Add text to text box. /// </summary> /// <param name="Font">Font</param> /// <param name="FontSize">Font size</param> /// <param name="DrawStyle">Drawing style</param> /// <param name="Text">Text</param> public void AddText( PdfFont Font, Double FontSize, DrawStyle DrawStyle, String Text ) { AddText(Font, FontSize, DrawStyle, Color.Empty, Text, null); return; }
/// <summary> /// TextBox segment constructor. /// </summary> /// <param name="Font">Segment font.</param> /// <param name="FontSize">Segment font size.</param> /// <param name="DrawStyle">Segment drawing style.</param> /// <param name="FontColor">Segment color.</param> /// <param name="WebLink">Segment web link.</param> public TextBoxSeg( PdfFont Font, Double FontSize, DrawStyle DrawStyle, Color FontColor, String WebLink ) { this.Font = Font; this.FontSize = FontSize; this.DrawStyle = DrawStyle; this.FontColor = FontColor; Text = String.Empty; this.WebLink = String.IsNullOrWhiteSpace(WebLink) ? null : WebLink; return; }
//////////////////////////////////////////////////////////////////// /// <summary> /// Draw one line of text width draw style /// </summary> /// <param name="Font">Font</param> /// <param name="FontSize">Font size</param> /// <param name="PosX">Position X</param> /// <param name="PosY">Position Y</param> /// <param name="DrawStyle">Drawing style enumeration</param> /// <param name="Text">Text</param> /// <returns>Text width</returns> //////////////////////////////////////////////////////////////////// public Double DrawText( PdfFont Font, Double FontSize, // in points Double PosX, Double PosY, DrawStyle DrawStyle, String Text ) { return(DrawText(Font, FontSize, PosX, PosY, TextJustify.Left, DrawStyle, Color.Empty, Text)); }
private void pointCloudToolStripMenuItem_Click(object sender, EventArgs e) { m_DrawStyle = DrawStyle.PointCloud; InitRangeImage(); Render(); }
private void flatImageToolStripMenuItem_Click(object sender, EventArgs e) { m_DrawStyle = DrawStyle.Flat; GenerateFlatImage(); }
private void depthMapToolStripMenuItem_Click(object sender, EventArgs e) { m_DrawStyle = DrawStyle.TrianglesColorByDistance; InitRangeImage(); Render(); }
public void ResetDrawStyle() { ResetItemState(); _drawStyle = DrawStyle.None; }
public void Draw(TimeSeries series, DrawStyle style) { this.Draw(series.series, this.maxPadNumber + 1, style); }
private void ToolStripItemClicked( object sender, ToolStripItemClickedEventArgs e) { switch (e.ClickedItem.Name) { case "toolStripButtonRectangular": if (_drawStyle != DrawStyle.Rectangle) { _drawStyle = DrawStyle.Rectangle; CheckButton = toolStripButtonRectangular; } else { _drawStyle = DrawStyle.None; CheckButton = null; } OnButtonDrawStyleClick(e); break; case "toolStripButtonEllipse": ResetItemState(); if (_drawStyle != DrawStyle.Ellipse) { _drawStyle = DrawStyle.Ellipse; CheckButton = toolStripButtonEllipse; } else { _drawStyle = DrawStyle.None; CheckButton = null; } OnButtonDrawStyleClick(e); break; case "toolStripButtonText": ResetItemState(); if (_drawStyle != DrawStyle.Text) { _drawStyle = DrawStyle.Text; CheckButton = toolStripButtonText; } else { _drawStyle = DrawStyle.None; CheckButton = null; } OnButtonDrawStyleClick(e); break; case "toolStripButtonArrow": ResetItemState(); if (_drawStyle != DrawStyle.Arrow) { _drawStyle = DrawStyle.Arrow; CheckButton = toolStripButtonArrow; } else { _drawStyle = DrawStyle.None; CheckButton = null; } OnButtonDrawStyleClick(e); break; case "toolStripButtonLine": ResetItemState(); if (_drawStyle != DrawStyle.Line) { _drawStyle = DrawStyle.Line; CheckButton = toolStripButtonLine; } else { _drawStyle = DrawStyle.None; CheckButton = null; } OnButtonDrawStyleClick(e); break; case "toolStripButtonRedo": OnButtonRedoClick(e); break; case "toolStripButtonSave": OnButtonSaveClick(e); break; case "toolStripButtonExit": OnButtonExitClick(e); break; case "toolStripButtonAccept": OnButtonAcceptClick(e); break; } }
public void Draw(TimeSeries series, int padNumber, DrawStyle style) { this.Draw(series.series, padNumber, style); }
/// <summary> /// Add text to text box. /// </summary> /// <param name="Font">Font</param> /// <param name="FontSize">Font size</param> /// <param name="DrawStyle">Drawing style</param> /// <param name="FontColor">Text color</param> /// <param name="Text">Text</param> /// <param name="WebLink">Web link</param> public void AddText( PdfFont Font, Double FontSize, DrawStyle DrawStyle, Color FontColor, String Text, String WebLink = null ) { // text is null or empty if(String.IsNullOrEmpty(Text)) return; // create new text segment TextBoxSeg Seg; // segment array is empty or new segment is different than last one if(SegArray.Count == 0 || !SegArray[SegArray.Count - 1].IsEqual(Font, FontSize, DrawStyle, FontColor, WebLink)) { Seg = new TextBoxSeg(Font, FontSize, DrawStyle, FontColor, WebLink); SegArray.Add(Seg); } // add new text to most recent text segment else { Seg = SegArray[SegArray.Count - 1]; } // save text start pointer Int32 TextStart = 0; // loop for characters for(Int32 TextPtr = 0; TextPtr < Text.Length; TextPtr++) { // shortcut to current character Char CurChar = Text[TextPtr]; // end of paragraph if(CurChar == '\n' || CurChar == '\r') { // append text to current segemnt Seg.Text += Text.Substring(TextStart, TextPtr - TextStart); // test for new line after carriage return if(CurChar == '\r' && TextPtr + 1 < Text.Length && Text[TextPtr + 1] == '\n') TextPtr++; // move pointer to one after the eol TextStart = TextPtr + 1; // add line AddLine(true); // update last character PrevChar = ' '; // end of text if(TextPtr + 1 == Text.Length) return; // add new empty segment Seg = new TextBoxSeg(Font, FontSize, DrawStyle, FontColor, WebLink); SegArray.Add(Seg); continue; } // validate character Font.ValidateChar(CurChar); // character width Double CharWidth = Font.CharWidth(FontSize, Seg.DrawStyle, CurChar); // space if(CurChar == ' ') { // test for transition from non space to space // this is a potential line break point if(PrevChar != ' ') { // save potential line break information LineBreakWidth = LineWidth; BreakSegIndex = SegArray.Count - 1; BreakPtr = Seg.Text.Length + TextPtr - TextStart; BreakWidth = Seg.SegWidth; } // add to line width LineWidth += CharWidth; Seg.SegWidth += CharWidth; // update last character PrevChar = CurChar; continue; } // add current segment width and to overall line width Seg.SegWidth += CharWidth; LineWidth += CharWidth; // for next loop set last character PrevChar = CurChar; Double Width = BoxWidth; if(FirstLineIndent != 0 && (LineArray.Count == 0 || LineArray[LineArray.Count - 1].EndOfParagraph)) Width -= FirstLineIndent; // current line width is less than or equal box width if(LineWidth <= Width) continue; // append text to current segemnt Seg.Text += Text.Substring(TextStart, TextPtr - TextStart + 1); TextStart = TextPtr + 1; // there are no breaks in this line or last segment is too long if(LineBreakWidth < LineBreakFactor * Width) { BreakSegIndex = SegArray.Count - 1; BreakPtr = Seg.Text.Length - 1; BreakWidth = Seg.SegWidth - CharWidth; } // break line BreakLine(); // add line up to break point AddLine(false); } // save text Seg.Text += Text.Substring(TextStart); // exit return; }
//////////////////////////////////////////////////////////////////// // Draw text width draw style //////////////////////////////////////////////////////////////////// /// <summary> /// Draw one line of text with text justification, drawing style and color /// </summary> /// <param name="Font">Font</param> /// <param name="FontSize">Font size</param> /// <param name="PosX">Position X</param> /// <param name="PosY">Position Y</param> /// <param name="Justify">Text justify enumeration</param> /// <param name="DrawStyle">Drawing style enumeration</param> /// <param name="TextColor">Color</param> /// <param name="Text">Text</param> /// <returns>Text width</returns> public Double DrawText( PdfFont Font, Double FontSize, // in points Double PosX, Double PosY, TextJustify Justify, DrawStyle DrawStyle, Color TextColor, String Text ) { // text is null or empty if(String.IsNullOrEmpty(Text)) return(0); // text width Double TextWidth = 0; // we have color if(TextColor != Color.Empty) { // save graphics state SaveGraphicsState(); // change non stroking color SetColorNonStroking(TextColor); } // not subscript or superscript if((DrawStyle & (DrawStyle.Subscript | DrawStyle.Superscript)) == 0) { // draw text string TextWidth = DrawText(Font, FontSize, PosX, PosY, Justify, Text); // not regular style if(DrawStyle != DrawStyle.Normal) { // change stroking color if(TextColor != Color.Empty) SetColorStroking(TextColor); // adjust position switch(Justify) { // right case TextJustify.Right: PosX -= TextWidth; break; // center case TextJustify.Center: PosX -= 0.5 * TextWidth; break; } // underline if((DrawStyle & DrawStyle.Underline) != 0) { Double UnderlinePos = PosY + Font.UnderlinePosition(FontSize); DrawLine(PosX, UnderlinePos, PosX + TextWidth, UnderlinePos, Font.UnderlineWidth(FontSize)); } // strikeout if((DrawStyle & DrawStyle.Strikeout) != 0) { Double StrikeoutPos = PosY + Font.StrikeoutPosition(FontSize); DrawLine(PosX, StrikeoutPos, PosX + TextWidth, StrikeoutPos, Font.StrikeoutWidth(FontSize)); } } } // subscript or superscript else { // subscript if((DrawStyle & (DrawStyle.Subscript | DrawStyle.Superscript)) == DrawStyle.Subscript) { // subscript font size and location PosY -= Font.SubscriptPosition(FontSize); FontSize = Font.SubscriptSize(FontSize); // draw text string TextWidth = DrawText(Font, FontSize, PosX, PosY, Justify, Text); } // superscript if((DrawStyle & (DrawStyle.Subscript | DrawStyle.Superscript)) == DrawStyle.Superscript) { // superscript font size and location PosY += Font.SuperscriptPosition(FontSize); FontSize = Font.SuperscriptSize(FontSize); // draw text string TextWidth = DrawText(Font, FontSize, PosX, PosY, Justify, Text); } } // we have color if(TextColor != Color.Empty) { // save graphics state RestoreGraphicsState(); } // return text width return(TextWidth); }
/// <summary> /// Compare two TextBox segments. /// </summary> /// <param name="Font">Segment font.</param> /// <param name="FontSize">Segment font size.</param> /// <param name="DrawStyle">Segment drawing style.</param> /// <param name="FontColor">Segment color.</param> /// <param name="WebLink">Segment web link.</param> /// <returns>Result</returns> public Boolean IsEqual( PdfFont Font, Double FontSize, DrawStyle DrawStyle, Color FontColor, String WebLink ) { // test all but weblink if(this.Font != Font || this.FontSize != FontSize || this.DrawStyle != DrawStyle || this.FontColor != FontColor) return(false); // weblink argument is null. return true if local weblink is null. return false otherwise if(String.IsNullOrWhiteSpace(WebLink)) return(this.WebLink == null); // weblink argument is not null. return true if local weblink is not null and both are equal. return false otherwise return(this.WebLink != null && this.WebLink.Equals(WebLink)); }
public void Draw(Indicator indicator, DrawStyle style) { int padNumber = -1; switch (indicator.indicator.Type) { case EIndicatorType.Oscillator: case EIndicatorType.Volume: padNumber = this.maxPadNumber + 1; break; case EIndicatorType.Price: padNumber = 0; break; } if (indicator is UserIndicator) { (indicator as UserIndicator).Init(); } this.Draw(indicator.indicator, padNumber, style); }