コード例 #1
0
        private void DrawSelectorNub(IDrawingContext dc, double theta, double radius)
        {
            PointDouble   center   = new PointDouble((radius * this.wheelRadius) * Math.Cos(theta), (radius * this.wheelRadius) * Math.Sin(theta));
            double        num2     = this.selectorWidth / 2;
            Int32HsvColor hsvColor = this.hsvColor;

            hsvColor.Value = 100;
            this.selectorNubBrush.Color = base.Enabled ? hsvColor.ToGdipColor() : Color.Silver;
            dc.FillCircle(center, num2, this.selectorNubBrush);
            dc.DrawCircle(center, num2 - 1.0, whiteBrush, 1.0);
            dc.DrawCircle(center, num2, base.Enabled ? nubOutlineBrush : grayBrush, 1.0);
        }
コード例 #2
0
        private void DrawRadiusGuide(IDrawingContext dc, double radius)
        {
            double num = this.wheelRadius * radius;

            dc.DrawCircle(PointDouble.Zero, this.lockRadius ? num : this.lastRadiusGuideRadius, this.lockRadiusGuideBrush, 1.0);
            if (this.lockRadius)
            {
                this.lastRadiusGuideRadius = num;
            }
        }
コード例 #3
0
ファイル: RollControl.cs プロジェクト: ykafia/Paint.Net4
        private void DrawToDrawingContext(IDrawingContext dc)
        {
            RectInt32 rect = base.ClientRectangle.ToRectInt32();

            dc.Clear(new ColorRgba128Float?(this.BackColor));
            using (dc.UseTranslateTransform(0.5f, 0.5f, MatrixMultiplyOrder.Append))
            {
                using (dc.UseAntialiasMode(AntialiasMode.PerPrimitive))
                {
                    RectInt32  num2      = RectInt32.Inflate(rect, -2, -2);
                    int        num3      = Math.Min(num2.Width, num2.Height);
                    PointInt32 center    = new PointInt32(num2.X + (num3 / 2), num2.Y + (num3 / 2));
                    double     radius    = ((double)num3) / 2.0;
                    double     scale     = ((double)num3) / 3.0;
                    double     num7      = ((double)num3) / 2.0;
                    double     d         = -MathUtil.DegreesToRadians(this.angle);
                    double     num9      = Math.Cos(d);
                    double     num10     = Math.Sin(d);
                    double     rx        = (this.rollAmount * Math.Cos(MathUtil.DegreesToRadians(this.rollDirection))) / 90.0;
                    double     num12     = (this.rollAmount * Math.Sin(MathUtil.DegreesToRadians(this.rollDirection))) / 90.0;
                    double     num13     = rx / (((num12 * num12) < 0.99) ? Math.Sqrt(1.0 - (num12 * num12)) : 1.0);
                    double     num14     = num12 / (((rx * rx) < 0.99) ? Math.Sqrt(1.0 - (rx * rx)) : 1.0);
                    double     thickness = (this.mouseEntered && !this.onSphere) ? 2.0 : 1.0;
                    if (this.ringOuterEllipseGeometry == null)
                    {
                        this.ringOuterEllipseGeometry = new EllipseGeometry();
                    }
                    if (this.ringInnerEllipseGeometry == null)
                    {
                        this.ringInnerEllipseGeometry = new EllipseGeometry();
                    }
                    if (this.ringFillGeometry == null)
                    {
                        this.ringFillGeometry = new CombinedGeometry(GeometryCombineMode.Exclude, this.ringOuterEllipseGeometry, this.ringInnerEllipseGeometry);
                    }
                    this.ringOuterEllipseGeometry.Center  = center;
                    this.ringOuterEllipseGeometry.RadiusX = radius - 0.5;
                    this.ringOuterEllipseGeometry.RadiusY = radius - 0.5;
                    this.ringInnerEllipseGeometry.Center  = center;
                    this.ringInnerEllipseGeometry.RadiusX = radius;
                    this.ringInnerEllipseGeometry.RadiusY = radius;
                    dc.FillGeometry(this.ringFillGeometry, ringFillBrush, null);
                    if (this.ringOutlinePen == null)
                    {
                        this.ringOutlinePen = new PaintDotNet.UI.Media.Pen();
                    }
                    this.ringOutlinePen.Brush     = ringOutlineBrush;
                    this.ringOutlinePen.Thickness = thickness;
                    dc.DrawCircle(center, radius, this.ringOutlinePen);
                    double num16 = (this.mouseEntered && !this.onSphere) ? ((double)2) : ((double)1);
                    dc.DrawLine(center.X + (scale * num9), center.Y + (scale * num10), center.X + (num7 * num9), center.Y + (num7 * num10), thetaLineBrush, num16);
                    using (dc.UseTranslateTransform((float)center.X, (float)center.Y, MatrixMultiplyOrder.Prepend))
                    {
                        double num17 = (this.angle * 3.1415926535897931) / 180.0;
                        float  num18 = (this.mouseEntered && this.onSphere) ? 1.5f : 1f;
                        int    num19 = 0x18;
                        for (int i = 0; i >= (-num19 / 2); i--)
                        {
                            double num22 = (i * 3.1415926535897931) / ((double)num19);
                            double num23 = -num17 - 3.1415926535897931;
                            double xs    = Math.Cos(num23) * Math.Cos(num22);
                            double ys    = Math.Sin(num23) * Math.Cos(num22);
                            double zs    = Math.Sin(num22);
                            double num30 = ((double)(i + (num19 / 2))) / ((double)(num19 / 2));
                            byte   index = Int32Util.ClampToByte((int)(num30 * 255.0));
                            if (this.latBrushCache[index] == null)
                            {
                                ColorBgra bgra = ColorBgra.Blend(latGradStart, latGradEnd, index);
                                this.latBrushCache[index] = SolidColorBrushCache.Get((ColorRgba128Float)bgra);
                            }
                            SolidColorBrush brush = this.latBrushCache[index];
                            for (int k = -num19 * 6; k <= (num19 * 6); k++)
                            {
                                num23 = -num17 + ((k * 3.1415926535897931) / ((double)(num19 * 6)));
                                double num33 = Math.Cos(num22);
                                double num34 = Math.Sin(num22);
                                double xe    = Math.Cos(num23) * Math.Cos(num22);
                                double ye    = Math.Sin(num23) * Math.Cos(num22);
                                double ze    = Math.Sin(num22);
                                double num35 = (this.mouseEntered && this.onSphere) ? 1.5 : 1.0;
                                this.Draw3DLine(dc, rx, -num12, scale, xs, ys, zs, xe, ye, ze, brush, num35);
                                xs = xe;
                                ys = ye;
                                zs = ze;
                            }
                        }
                        int num20 = 4;
                        for (int j = -num20; j < num20; j++)
                        {
                            double num37 = -num17 + ((j * 3.1415926535897931) / ((double)num20));
                            double num38 = -1.5707963267948966;
                            double num39 = Math.Cos(num37) * Math.Cos(num38);
                            double num40 = Math.Sin(num37) * Math.Cos(num38);
                            double num41 = Math.Sin(num38);
                            for (int m = -num20 * 4; m <= 0; m++)
                            {
                                num38 = (m * 3.1415926535897931) / ((double)(num20 * 8));
                                double num42 = Math.Cos(num37) * Math.Cos(num38);
                                double num43 = Math.Sin(num37) * Math.Cos(num38);
                                double num44 = Math.Sin(num38);
                                double num46 = (this.mouseEntered && this.onSphere) ? 2.0 : 1.0;
                                this.Draw3DLine(dc, rx, -num12, scale, num39, num40, num41, num42, num43, num44, lightBrush, num46);
                                num39 = num42;
                                num40 = num43;
                                num41 = num44;
                            }
                        }
                    }
                    dc.DrawCircle(center, scale, ringInlineBrush, thickness);
                }
            }
        }