Esempio n. 1
0
        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);
        }
Esempio n. 2
0
        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);
        }
Esempio n. 3
0
        RegionPlus(GraphicsPath path)
        {
            GpRegion region = new GpRegion();

            lastResult = NativeMethods.GdipCreateRegionPath(path.nativePath, out region);

            SetNativeRegion(region);
        }
Esempio n. 4
0
 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();
 }
Esempio n. 5
0
        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);
        }
Esempio n. 6
0
 Exclude(GraphicsPath path)
  {
      return SetStatus(NativeMethods.GdipCombineRegionPath(nativeRegion,
                                                         path.nativePath,
                                                         CombineMode.CombineModeExclude));
  }
Esempio n. 7
0
 public GpStatus FillPath(BrushPlus brush,
                  GraphicsPath path)
 {
     return SetStatus(NativeMethods.GdipFillPath(nativeGraphics,
                                               brush.nativeBrush,
                                               path.nativePath));
 }
Esempio n. 8
0
 public GpStatus DrawPath(PenPlus pen,
                  GraphicsPath path)
 {
     return SetStatus(NativeMethods.GdipDrawPath(nativeGraphics,
                                               pen != null ? pen.nativePen : null,
                                               path != null ? path.nativePath : null));
 }
Esempio n. 9
0
 public GraphicsPath(GraphicsPath path)
 {
     GpPath clonepath = null;
     SetStatus(NativeMethods.GdipClonePath(path.nativePath, out clonepath));
     SetNativePath(clonepath);
 }
Esempio n. 10
0
        public GpStatus SetGraphicsPath(GraphicsPath path)
        {
            if (path == null)
                return SetStatus(GpStatus.InvalidParameter);

            return SetStatus(NativeMethods.GdipSetPathGradientPath(
                        (GpPathGradient)nativeBrush, path.nativePath));
        }
Esempio n. 11
0
 public GpStatus GetGraphicsPath(out GraphicsPath path)
 {
     path = new GraphicsPath();
     return SetStatus(NativeMethods.GdipGetPathGradientPath(
                 (GpPathGradient)nativeBrush, out path.nativePath));
 }
Esempio n. 12
0
        public PathGradientBrush(
        GraphicsPath path
        )
        {
            GpPathGradient brush = new GpPathGradient();

            lastResult = NativeMethods.GdipCreatePathGradientFromPath(
                                            path.nativePath, out brush);
            SetNativeBrush(brush);
        }
Esempio n. 13
0
 GpStatus Union(GraphicsPath path)
 {
     return SetStatus(NativeMethods.GdipCombineRegionPath(nativeRegion,
                                                        path.nativePath,
                                                        CombineMode.CombineModeUnion));
 }
Esempio n. 14
0
 GpStatus Intersect(GraphicsPath path)
 {
     return SetStatus(NativeMethods.GdipCombineRegionPath(nativeRegion,
                                                        path.nativePath,
                                                        CombineMode.CombineModeIntersect));
 }
Esempio n. 15
0
 Complement(GraphicsPath path)
  {
      return SetStatus(NativeMethods.GdipCombineRegionPath(nativeRegion,
                                                  path.nativePath,
                                                  CombineMode.CombineModeComplement));
  }
Esempio n. 16
0
        public GpStatus AddPath(GraphicsPath addingPath,
                   bool connect)
        {
            GpPath nativePath2 = null;
            if (addingPath != null)
                nativePath2 = addingPath.nativePath;

            return SetStatus(NativeMethods.GdipAddPathPath(nativePath, nativePath2,
                                                         connect));
        }
Esempio n. 17
0
        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);
        }