private void SetGraphicsFPPenAttribute(Pen pen) { if (pen != null) { _defaultPen = pen; PenFP penFP = _graphicsFP.GetPen(); penFP.EndCap = pen._cap; penFP.StartCap = pen._cap; penFP.LineJoin = pen._join; penFP.Width = pen._width << SingleFP.DECIMAL_BITS; if (pen._brush != null) { penFP.Brush = pen._brush._wrappedBrushFP; } else { penFP.Brush = new SolidBrushFP(pen._color._value); } if (pen._dash != null) { penFP.DashArray = new int[pen._dash.Length - pen._dashPhase]; for (int i = 0; i < pen._dash.Length - pen._dashPhase; i++) { penFP.DashArray[i] = pen._dash[i - pen._dashPhase] << SingleFP.DECIMAL_BITS; } } } }
//////////////////////////////////////////////////////////////////////////// //--------------------------------- REVISIONS ------------------------------ // Date Name Tracking # Description // --------- ------------------- ------------- ---------------------- // 13JUN2009 James Shen Initial Creation //////////////////////////////////////////////////////////////////////////// /** * * @param pathFP * @param outline * @param lineStyle */ public GraphicsPathOutlineFP(GraphicsPathFP outline, PenFP lineStyle) { _outline = outline; _ffRad = lineStyle.Width / 2; _startLineCap = lineStyle.StartCap; _endLineCap = lineStyle.EndCap; _lineJoin = lineStyle.LineJoin; }
//////////////////////////////////////////////////////////////////////////// //--------------------------------- REVISIONS ------------------------------ // Date Name Tracking # Description // --------- ------------------- ------------- ---------------------- // 13JUN2009 James Shen Initial Creation //////////////////////////////////////////////////////////////////////////// /** * draw a path. * @param path */ public void DrawPath(GraphicsPathFP path) { if (_lineStyle.DashArray != null) { var newlineStyle = new PenFP(_lineStyle.Brush, _lineStyle.Width, PenFP.LINECAP_BUTT, PenFP.LINECAP_BUTT, PenFP.LINEJOIN_MITER) { DashArray = _lineStyle.DashArray }; var dasher = new GraphicsPathDasherFP(path, newlineStyle.DashArray, 0); var newPath = dasher.GetDashedGraphicsPath(); _renderer.DrawPath(newPath.CalcOutline(newlineStyle), _matrix, _lineStyle.Brush, GraphicsPathRendererFP.MODE_ZERO); } else { _renderer.DrawPath(path.CalcOutline(_lineStyle), _matrix, _lineStyle.Brush, GraphicsPathRendererFP.MODE_ZERO); } }
private void InitBlock() { _lineStyle = new PenFP(0x0, SingleFP.ONE); _fillStyle = new SolidBrushFP(0x0); _paintMode = MODE_XOR; }
//////////////////////////////////////////////////////////////////////////// //--------------------------------- REVISIONS ------------------------------ // Date Name Tracking # Description // --------- ------------------- ------------- ---------------------- // 13JUN2009 James Shen Initial Creation //////////////////////////////////////////////////////////////////////////// /** * set the new pen for this graphics object. * @param Value a new pen object. */ public void SetPen(PenFP value) { _lineStyle = value; }
//////////////////////////////////////////////////////////////////////////// //--------------------------------- REVISIONS ------------------------------ // Date Name Tracking # Description // --------- ------------------- ------------- ---------------------- // 13JUN2009 James Shen Initial Creation //////////////////////////////////////////////////////////////////////////// /** * draw a path. * @param path */ public void DrawPath(GraphicsPathFP path) { if (_lineStyle.DashArray != null) { var newlineStyle = new PenFP(_lineStyle.Brush, _lineStyle.Width, PenFP.LINECAP_BUTT, PenFP.LINECAP_BUTT, PenFP.LINEJOIN_MITER) {DashArray = _lineStyle.DashArray}; var dasher = new GraphicsPathDasherFP(path, newlineStyle.DashArray, 0); var newPath = dasher.GetDashedGraphicsPath(); _renderer.DrawPath(newPath.CalcOutline(newlineStyle), _matrix, _lineStyle.Brush, GraphicsPathRendererFP.MODE_ZERO); } else { _renderer.DrawPath(path.CalcOutline(_lineStyle), _matrix, _lineStyle.Brush, GraphicsPathRendererFP.MODE_ZERO); } }
//////////////////////////////////////////////////////////////////////////// //--------------------------------- REVISIONS ------------------------------ // Date Name Tracking # Description // --------- ------------------- ------------- ---------------------- // 15JUN2009 James Shen Initial Creation //////////////////////////////////////////////////////////////////////////// /** * Constructs a new <code>Pen</code> with the specified * attributes. * @param color the color of the pen. * @param width the width of this <code>Pen</code>. The * width must be greater than or equal to 0. If width is * set to 0, the stroke is rendered as the thinnest * possible line for the target device and the antialias * hint setting. * @param cap the decoration of the ends of a <code>Pen</code> * @param join the decoration applied where path segments meet * @param dash the array representing the dashing pattern * @param dash_phase the offset to start the dashing pattern * @throws IllegalArgumentException if <code>width</code> is negative */ public Pen(Color color, int width, int cap, int join, int[] dash, int dashPhase) { if (width < 0) { throw new ArgumentException("negative width"); } if (cap != CAP_BUTT && cap != CAP_ROUND && cap != CAP_SQUARE) { throw new ArgumentException("illegal end cap Value"); } if (join != JOIN_ROUND && join != JOIN_BEVEL && join != JOIN_MITER) { throw new ArgumentException("illegal line join Value"); } if (dash != null) { if (dashPhase < 0) { throw new ArgumentException("negative dash phase"); } bool allzero = true; for (int i = 0; i < dash.Length; i++) { int d = dash[i]; if (d > 0) { allzero = false; } else if (d < 0) { throw new ArgumentException("negative dash length"); } } if (allzero) { throw new ArgumentException("dash lengths all zero"); } } _width = width; _cap = cap; _join = join; _color = color; if (dash != null) { _dash = dash; } _dashPhase = dashPhase; _wrappedPenFP = new PenFP(color._value, width << SingleFP.DECIMAL_BITS, cap, cap, join); if (dash != null) { int[] newDash = new int[dash.Length]; for (int i = 0; i < newDash.Length; i++) { newDash[i] = dash[i] << SingleFP.DECIMAL_BITS; } _wrappedPenFP.SetDashArray(newDash, dashPhase); } }
public static PenX FromPenFP(PenFP pen) { return(new PenX(pen)); }
private PenX(PenFP aPen) { pen = aPen; }
public PenX(Color color, float width) { pen = new PenFP(color.ToArgb(), SingleFP.FromFloat(width), PenFP.LINEJOIN_MITER, PenFP.LINEJOIN_MITER); }
public PenX(BrushX brush, float width) { pen = new PenFP(brush.WrappedBrush, SingleFP.FromFloat(width), PenFP.LINEJOIN_MITER, PenFP.LINEJOIN_MITER); }