Beispiel #1
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);
        }
Beispiel #2
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);
        }
Beispiel #3
0
 /// <summary>
 ///   Creates brushes used to render the pie slice.
 /// </summary>
 /// <param name="surfaceColor">
 ///   Color used for rendering.
 /// </param>
 /// <param name="shadowStyle">
 ///   Shadow style used for rendering.
 /// </param>
 protected virtual void CreateSurfaceBrushes(Color surfaceColor, ShadowStyle shadowStyle)
 {
     m_brushSurface = new SolidBrushPlus(surfaceColor);
     m_brushSurfaceHighlighted = new SolidBrushPlus(ColorUtil.CreateColorWithCorrectedLightness(surfaceColor, ColorUtil.BrightnessEnhancementFactor1));
     switch (shadowStyle)
     {
         case ShadowStyle.NoShadow:
             m_brushStartSide = m_brushEndSide = m_brushPeripherySurface = new SolidBrushPlus(surfaceColor);
             break;
         case ShadowStyle.UniformShadow:
             m_brushStartSide = m_brushEndSide = m_brushPeripherySurface = new SolidBrushPlus(ColorUtil.CreateColorWithCorrectedLightness(surfaceColor, -ColorUtil.BrightnessEnhancementFactor1));
             break;
         case ShadowStyle.GradualShadow:
             double angle = m_startAngle - 180 - s_shadowAngle;
             if (angle < 0)
                 angle += 360;
             m_brushStartSide = CreateBrushForSide(surfaceColor, angle);
             angle = m_startAngle + m_sweepAngle - s_shadowAngle;
             if (angle < 0)
                 angle += 360;
             m_brushEndSide = CreateBrushForSide(surfaceColor, angle);
             m_brushPeripherySurface = CreateBrushForPeriphery(surfaceColor);
             break;
     }
 }