public override void Highlight(Graphics g, Matrix xformWorldToPixel, Brush brush, bool erasing) { SymPath path1, path2; float thickness; GDIPlus_GraphicsTarget grTarget = new GDIPlus_GraphicsTarget(g); object brushKey = new object(); grTarget.CreateGdiPlusBrush(brushKey, brush, false); // Get line thickness. thickness = TransformDistance(NormalCourseAppearance.lineThickness * scaleRatio * appearance.lineWidth, xformWorldToPixel); // Get the paths. GetPaths(out path1, out path2); // Move and rotate the paths to the correct position. Matrix moveAndRotate = new Matrix(); moveAndRotate.Rotate(orientation); moveAndRotate.Translate(location.X, location.Y, MatrixOrder.Append); path1 = path1.Transform(moveAndRotate); path2 = path2.Transform(moveAndRotate); object penKey = new object(); grTarget.CreatePen(penKey, brushKey, thickness, LineCap.Flat, LineJoin.Miter, 5); // Draw it. path1.DrawTransformed(grTarget, penKey, xformWorldToPixel); path2.DrawTransformed(grTarget, penKey, xformWorldToPixel); grTarget.Dispose(); }
public override void Highlight(Graphics g, Matrix xformWorldToPixel, Brush brush, bool erasing) { SymPath path1, path2, path3, path4; float thickness; GDIPlus_GraphicsTarget grTarget = new GDIPlus_GraphicsTarget(g); object brushKey = new object(); grTarget.CreateGdiPlusBrush(brushKey, brush, false); // Get line thickness. thickness = TransformDistance(NormalCourseAppearance.lineThickness * scaleRatio * appearance.lineWidth, xformWorldToPixel); // Get the paths. path1 = new SymPath(OffsetCoords(ScaleCoords((PointF[]) coords1.Clone()), location.X, location.Y), kinds1); path2 = new SymPath(OffsetCoords(ScaleCoords((PointF[]) coords2.Clone()), location.X, location.Y), kinds2); path3 = new SymPath(OffsetCoords(ScaleCoords((PointF[]) coords3.Clone()), location.X, location.Y), kinds3); path4 = new SymPath(OffsetCoords(ScaleCoords((PointF[]) coords4.Clone()), location.X, location.Y), kinds4); object penKey = new object(); grTarget.CreatePen(penKey, brushKey, thickness, LineCap.Round, LineJoin.Miter, 5); // Draw the paths path1.DrawTransformed(grTarget, penKey, xformWorldToPixel); path2.DrawTransformed(grTarget, penKey, xformWorldToPixel); path3.DrawTransformed(grTarget, penKey, xformWorldToPixel); path4.DrawTransformed(grTarget, penKey, xformWorldToPixel); grTarget.Dispose(); }
// Draw the highlight. Everything must be drawn in pixel coords so fast erase works correctly. public override void Highlight(Graphics g, Matrix xformWorldToPixel, Brush brush, bool erasing) { GDIPlus_GraphicsTarget grTarget = new GDIPlus_GraphicsTarget(g); object brushKey = new object(); grTarget.CreateGdiPlusBrush(brushKey, brush, false); // Get thickness of line. float pixelThickness = TransformDistance(thickness * scaleRatio, xformWorldToPixel); SymPath[] gappedPaths = LegGap.SplitPathWithGaps(path, gaps); // Draw it. object penKey = new object(); grTarget.CreatePen(penKey, brushKey, pixelThickness, LineCap.Flat, LineJoin.Miter, 5); try { foreach (SymPath p in gappedPaths) { p.DrawTransformed(grTarget, penKey, xformWorldToPixel); } } catch (ExternalException) { // Ignore this exeption. Not sure what causes it. } grTarget.Dispose(); }
public override void Highlight(Graphics g, Matrix xformWorldToPixel, Brush brush, bool erasing) { object brushKey = new object(); object penKey = new object(); using (GDIPlus_GraphicsTarget graphicsTarget = new GDIPlus_GraphicsTarget(g)) { graphicsTarget.CreateGdiPlusBrush(brushKey, brush, false); graphicsTarget.CreatePen(penKey, brushKey, Geometry.TransformDistance(FullWidth, xformWorldToPixel), LineCap.Flat, LineJoin.Miter, 10); SymPath path = CreateSymPath(); path = path.Transform(xformWorldToPixel); path.Draw(graphicsTarget, penKey); } }
// Draw the highlight. Everything must be draw in pixel coords so fast erase works correctly. public override void Highlight(Graphics g, Matrix xformWorldToPixel, Brush brush, bool erasing) { GDIPlus_GraphicsTarget grTarget = new GDIPlus_GraphicsTarget(g); object brushKey = new object(); grTarget.CreateGdiPlusBrush(brushKey, brush, false); // Draw the boundary. object penKey = new object(); grTarget.CreatePen(penKey, brushKey, 2, LineCap.Round, LineJoin.Round, 5); path.DrawTransformed(grTarget, penKey, xformWorldToPixel); // Get a brush to fill the interior with. object fillBrushKey; if (erasing) fillBrushKey = brushKey; else { fillBrushKey = new object(); grTarget.CreateGdiPlusBrush(fillBrushKey, NormalCourseAppearance.areaHighlight, false); } // Draw the interior path.FillTransformed(grTarget, fillBrushKey, xformWorldToPixel); grTarget.Dispose(); }