private void CreateObjects() { brSolid = new SolidBrushPlus(Color.CornflowerBlue); penSolid = new PenPlus(Color.Red, 10); penSolid.SetEndCap(LineCap.LineCapRound); penSolid.SetStartCap(LineCap.LineCapArrowAnchor); brHatch = new HatchBrush(HatchStyle.HatchStyle25Percent, Color.Black, Color.White); penHatch = new PenPlus(brHatch, 10); penSolidTrans = new PenPlus(Color.FromArgb(-0x5f7f7f7f), 10); penSolidCustomCap = new PenPlus(Color.Black, 20); GraphicsPath path = new GraphicsPath(FillMode.FillModeAlternate); path.AddEllipse(-0.5f, -1.5f, 1, 3); CustomLineCap cap = new CustomLineCap(null, path, LineCap.LineCapFlat, 0); penSolidCustomCap.SetCustomEndCap(cap); penDash = new PenPlus(Color.Black, 5); penDash.SetDashStyle(DashStyle.DashStyleDot); brGrad = new LinearGradientBrush( new GpPointF(0, 0), new GpPointF(100, 100), Color.Black, Color.White); penGradient = new PenPlus(brGrad, 30); }
private void CreateObjects() { brSolid = new SolidBrushPlus(Color.CornflowerBlue); brHatch = new HatchBrush(HatchStyle.HatchStyle25Percent, Color.Black, Color.White); string bitmapPath = System.IO.Path.GetDirectoryName(GetType().Assembly.GetModules()[0].FullyQualifiedName); bitmapPath = System.IO.Path.Combine(bitmapPath, "brushPattern.bmp"); StreamOnFile sf = new StreamOnFile(bitmapPath); ImagePlus img = new ImagePlus(sf, false); brTexture = new TextureBrushPlus(img, WrapMode.WrapModeTile); brLinGrad = new LinearGradientBrush(new GpPointF(0, 0), new GpPointF(50, 50), Color.Black, Color.White); // Create rectangular path GraphicsPath path = new GraphicsPath(FillMode.FillModeAlternate); path.AddRectangle(new GpRectF( 0, 0, ClientRectangle.Width, ClientRectangle.Height / 5)); // Create rectangular gradient brush // with red in center and black in the corners brPathGrad = new PathGradientBrush(path); brPathGrad.SetCenterColor(Color.Red); int count = 2; brPathGrad.SetSurroundColors(new Color[] { Color.Black, Color.Black }, ref count); }
RegionPlus(GraphicsPath path) { GpRegion region = new GpRegion(); lastResult = NativeMethods.GdipCreateRegionPath(path.nativePath, out region); SetNativeRegion(region); }
protected override void OnMouseUp(MouseEventArgs e) { base.OnMouseUp(e); Capture = false; path.Clear(); path.AddBeziers(allPoints.ToArray()); allPaths.Add(path); allPoints.Clear(); path = new GraphicsPath(); }
public CustomLineCap( GraphicsPath fillPath, GraphicsPath strokePath, LineCap baseCap, float baseInset ) { nativeCap = new GpCustomLineCap(); GpPath nativeFillPath = null; GpPath nativeStrokePath = null; if (fillPath != null) nativeFillPath = fillPath.nativePath; if (strokePath != null) nativeStrokePath = strokePath.nativePath; lastResult = NativeMethods.GdipCreateCustomLineCap( nativeFillPath, nativeStrokePath, baseCap, baseInset, out nativeCap); }
Exclude(GraphicsPath path) { return SetStatus(NativeMethods.GdipCombineRegionPath(nativeRegion, path.nativePath, CombineMode.CombineModeExclude)); }
public GpStatus FillPath(BrushPlus brush, GraphicsPath path) { return SetStatus(NativeMethods.GdipFillPath(nativeGraphics, brush.nativeBrush, path.nativePath)); }
public GpStatus DrawPath(PenPlus pen, GraphicsPath path) { return SetStatus(NativeMethods.GdipDrawPath(nativeGraphics, pen != null ? pen.nativePen : null, path != null ? path.nativePath : null)); }
public GraphicsPath(GraphicsPath path) { GpPath clonepath = null; SetStatus(NativeMethods.GdipClonePath(path.nativePath, out clonepath)); SetNativePath(clonepath); }
public GpStatus SetGraphicsPath(GraphicsPath path) { if (path == null) return SetStatus(GpStatus.InvalidParameter); return SetStatus(NativeMethods.GdipSetPathGradientPath( (GpPathGradient)nativeBrush, path.nativePath)); }
public GpStatus GetGraphicsPath(out GraphicsPath path) { path = new GraphicsPath(); return SetStatus(NativeMethods.GdipGetPathGradientPath( (GpPathGradient)nativeBrush, out path.nativePath)); }
public PathGradientBrush( GraphicsPath path ) { GpPathGradient brush = new GpPathGradient(); lastResult = NativeMethods.GdipCreatePathGradientFromPath( path.nativePath, out brush); SetNativeBrush(brush); }
GpStatus Union(GraphicsPath path) { return SetStatus(NativeMethods.GdipCombineRegionPath(nativeRegion, path.nativePath, CombineMode.CombineModeUnion)); }
GpStatus Intersect(GraphicsPath path) { return SetStatus(NativeMethods.GdipCombineRegionPath(nativeRegion, path.nativePath, CombineMode.CombineModeIntersect)); }
Complement(GraphicsPath path) { return SetStatus(NativeMethods.GdipCombineRegionPath(nativeRegion, path.nativePath, CombineMode.CombineModeComplement)); }
public GpStatus AddPath(GraphicsPath addingPath, bool connect) { GpPath nativePath2 = null; if (addingPath != null) nativePath2 = addingPath.nativePath; return SetStatus(NativeMethods.GdipAddPathPath(nativePath, nativePath2, connect)); }
private void MainForm_Load(object sender, EventArgs e) { GpStatusPlus stat = NativeMethods.GdiplusStartup(out token, input, out output); string bitmapPath = System.IO.Path.GetDirectoryName(GetType().Assembly.GetModules()[0].FullyQualifiedName); bitmapPath = System.IO.Path.Combine(bitmapPath, "test.jpg"); StreamOnFile sf = new StreamOnFile(bitmapPath); bmp = new BitmapPlus(sf); penWrite = new PenPlus(Color.Blue, 3); path = new GraphicsPath(FillMode.FillModeAlternate); }