protected override void OnRender(IDrawingContext dc, RectFloat clipRect, CanvasView canvasView) { SizeDouble canvasSize = canvasView.CanvasSize; RectDouble num2 = RectDouble.FromEdges(-131072.0, 0.0, 0.0, canvasSize.Height); RectDouble num3 = RectDouble.FromEdges(-131072.0, -131072.0, 131072.0, 0.0); RectDouble num4 = RectDouble.FromEdges(canvasSize.Width, 0.0, 131072.0, canvasSize.Height); RectDouble num5 = RectDouble.FromEdges(-131072.0, canvasSize.Height, 131072.0, 131072.0); ColorRgba128Float num6 = (ThemeConfig.EffectiveTheme == PdnTheme.Aero) ? AeroColors.CanvasBackFillColor : ClassicColors.CanvasBackFillColor; dc.Clear((RectFloat)num2, AntialiasMode.Aliased, new ColorRgba128Float?(num6)); dc.Clear((RectFloat)num3, AntialiasMode.Aliased, new ColorRgba128Float?(num6)); dc.Clear((RectFloat)num4, AntialiasMode.Aliased, new ColorRgba128Float?(num6)); dc.Clear((RectFloat)num5, AntialiasMode.Aliased, new ColorRgba128Float?(num6)); base.OnRender(dc, clipRect, canvasView); }
protected override void OnRender(IDrawingContext dc, RectFloat clipRect) { if (this.wheelBackgroundDeviceBitmap == null) { this.CreateBitmapResources(); } double num = this.wheelCenterOffset + 0.5; double theta = this.hsvColor.Hue * 0.017453292519943295; double radius = Math.Pow(this.hsvColor.Saturation * 0.01, 0.7142857142857143); dc.Clear(new ColorRgba128Float?(this.BackColor)); RectDouble?dstRect = null; dc.DrawBitmap(this.wheelBackgroundDeviceBitmap, dstRect, 1.0, BitmapInterpolationMode.Linear, null); using (dc.UseTranslateTransform((float)num, (float)num, MatrixMultiplyOrder.Prepend)) { if (this.snap || (this.snapOpacity.Value > 0.0)) { this.DrawSnapIndicators(dc, radius); } if (this.lockRadius || (this.lockRadiusOpacity.Value > 0.0)) { this.DrawRadiusGuide(dc, radius); } if (this.lockHue || (this.lockHueOpacity.Value > 0.0)) { this.DrawHueGuide(dc, theta); } this.DrawSelectorNub(dc, theta, radius); } base.OnRender(dc, clipRect); }
protected override void OnRender(IDrawingContext dc, RectFloat clipRect) { dc.Clear(new ColorRgba128Float?(this.BackColor)); using (dc.UseTranslateTransform(0.5f, 0.5f, MatrixMultiplyOrder.Append)) { RectDouble num = RectDouble.Inflate(base.ClientRectangle.ToRectInt32(), -1.0, -1.0); double num3 = Math.Min(num.Width, num.Height) / 2.0; PointDouble center = new PointDouble(num.X + num3, num.Y + num3); double d = MathUtil.DegreesToRadians(this.value); EllipseDouble ellipse = new EllipseDouble(center, num3 - 0.5, num3 - 0.5); double thickness = this.hover ? 2.0 : 1.0; double num8 = this.maxValue - this.minValue; if (num8 >= 360.0) { dc.FillEllipse(ellipse, validAnglesFillBrush); dc.DrawEllipse(ellipse, outlineBrush, thickness); } else { dc.FillEllipse(ellipse, invalidAnglesFillBrush); double width = num3; PointDouble num14 = new PointDouble(center.X + (width * Math.Cos(MathUtil.DegreesToRadians(this.minValue))), center.Y - (width * Math.Sin(MathUtil.DegreesToRadians(this.minValue)))); PointDouble num15 = new PointDouble(center.X + (width * Math.Cos(MathUtil.DegreesToRadians(this.maxValue))), center.Y - (width * Math.Sin(MathUtil.DegreesToRadians(this.maxValue)))); SizeDouble num16 = new SizeDouble(width, width); if (this.validRangeGeometry == null) { this.validRangeGeometry = new PathGeometry(); this.validRangeFigure = new PathFigure(); this.validRangeFigure.IsFilled = true; this.validRangeFigure.IsClosed = true; this.validRangeGeometry.Figures.Add(this.validRangeFigure); this.validRangeLineSegment1 = new LineSegment(); this.validRangeFigure.Segments.Add(this.validRangeLineSegment1); this.validRangeArcSegment = new ArcSegment(); this.validRangeArcSegment.SweepDirection = SweepDirection.Counterclockwise; this.validRangeFigure.Segments.Add(this.validRangeArcSegment); this.validRangeLineSegment2 = new LineSegment(); this.validRangeFigure.Segments.Add(this.validRangeLineSegment2); } this.validRangeFigure.StartPoint = center; this.validRangeLineSegment1.Point = num14; this.validRangeArcSegment.Point = num15; this.validRangeArcSegment.IsLargeArc = num8 >= 180.0; this.validRangeArcSegment.Size = num16; this.validRangeLineSegment2.Point = num15; dc.FillGeometry(this.validRangeGeometry, validAnglesFillBrush, null); dc.DrawEllipse(ellipse, outlineBrush, thickness); dc.DrawLine(center, num14, outlineBrush, 0.5); dc.DrawLine(center, num15, outlineBrush, 0.5); } double num9 = num3 - 2.0; PointDouble num10 = new PointDouble(center.X + (num9 * Math.Cos(d)), center.Y - (num9 * Math.Sin(d))); double radius = 2.5; EllipseDouble num12 = new EllipseDouble(center, radius); dc.FillEllipse(num12, gripFillBrush); dc.DrawLine(center, num10, gripBrush, this.hover ? 2.0 : 1.5); } base.OnRender(dc, clipRect); }
protected override void OnRender(IDrawingContext dc, RectFloat clipRect) { if (this.clearTopInset.HasValue) { RectFloat num = new RectFloat(0f, 0f, (float)base.Width, (float)this.clearTopInset.Value); using (dc.UseAxisAlignedClip(num, AntialiasMode.Aliased)) { dc.Clear(null); } } base.OnRender(dc, clipRect); }
private PlacedBitmap CreateFontPreview(string gdiFontName, float fontSize, PaintDotNet.UI.Media.Brush textBrush) { FontProperties fontProperties; TextMetrics metrics; OverhangMetrics overhangMetrics; try { fontProperties = this.fontMap.GetFontProperties(gdiFontName); using (IDrawingContext context = DrawingContext.CreateNull(FactorySource.PerThread)) { TextLayoutAlgorithm?layoutAlgorithm = null; TextLayout resourceSource = UIText.CreateLayout(context, this.fontSampleText, fontProperties, (double)fontSize, layoutAlgorithm, HotkeyRenderMode.Ignore, 65535.0, 65535.0); ITextLayout cachedOrCreateResource = context.GetCachedOrCreateResource <ITextLayout>(resourceSource); metrics = cachedOrCreateResource.Metrics; overhangMetrics = cachedOrCreateResource.OverhangMetrics; } } catch (Exception exception) { if ((!(exception is NoFontException) && !(exception is FontFileAccessException)) && (!(exception is FontFileFormatException) && !(exception is FontFileNotFoundException))) { throw; } Surface cleanupObject = Surface.CopyFromGdipImage(PdnResources.GetImageResource("Icons.WarningIcon.png").Reference); BitmapProxy proxy = new BitmapProxy(cleanupObject.CreateAliasedImagingBitmap(), ObjectRefProxyOptions.AssumeOwnership); proxy.AddCleanupObject(cleanupObject); return(new PlacedBitmap(proxy, new RectDouble(0.0, 0.0, (double)proxy.Size.Width, (double)proxy.Size.Height), true)); } RectDouble a = new RectDouble((double)metrics.Left, (double)metrics.Top, (double)(metrics.Left + metrics.WidthMax), (double)(metrics.Top + metrics.Height)); RectDouble b = RectDouble.FromEdges((double)(metrics.Left - overhangMetrics.Left), (double)(metrics.Top - overhangMetrics.Top), (double)(metrics.LayoutWidth + overhangMetrics.Right), (double)(metrics.LayoutHeight + overhangMetrics.Bottom)); RectInt32 num4 = RectDouble.Union(a, b).Int32Bound; IBitmap bitmap = new PaintDotNet.Imaging.Bitmap(num4.Width, num4.Height, PixelFormats.Pbgra32, BitmapCreateCacheOption.CacheOnLoad); using (IDrawingContext context2 = DrawingContext.FromBitmap(bitmap, FactorySource.PerThread)) { context2.Clear(null); using (context2.UseTranslateTransform((float)-num4.X, (float)-num4.Y, MatrixMultiplyOrder.Prepend)) { using (context2.UseTextRenderingMode(TextRenderingMode.Outline)) { TextLayout textLayout = UIText.CreateLayout(context2, this.fontSampleText, fontProperties, (double)fontSize, null, HotkeyRenderMode.Ignore, 65535.0, 65535.0); context2.TextAntialiasMode = TextAntialiasMode.Grayscale; context2.DrawTextLayout(0.0, 0.0, textLayout, textBrush, DrawTextOptions.None); } } } return(new PlacedBitmap(bitmap, b, true)); }
private void OnComboBoxDrawItem(object sender, DrawItemEventArgs e) { if (e.Index != -1) { DeviceBitmap itemBitmap; object item = base.Items[e.Index]; string itemText = this.GetItemText(item); if (!this.itemBitmapCache.TryGetValue(item, out itemBitmap)) { itemBitmap = this.GetItemBitmap(item, 0x10); this.itemBitmapCache.Add(item, itemBitmap); } HighlightState state = ((e.State & DrawItemState.Selected) == DrawItemState.Selected) ? HighlightState.Hover : HighlightState.Default; if (((this.renderBuffer == null) || (this.renderBuffer.Width < e.Bounds.Width)) || (this.renderBuffer.Height < e.Bounds.Height)) { DisposableUtil.Free <ISurface <ColorBgra> >(ref this.renderBuffer); this.renderBuffer = SurfaceAllocator.Bgra.Allocate(e.Bounds.Width, e.Bounds.Height, AllocationOptions.ZeroFillNotRequired); } using (IDrawingContext context = DrawingContext.FromSurface(this.renderBuffer, AlphaMode.Ignore, FactorySource.PerThread)) { context.Clear(new ColorRgba128Float?(System.Drawing.SystemColors.Window)); this.selectionHighlightRenderer.HighlightState = state; this.selectionHighlightRenderer.RenderBackground(context, new RectFloat(0f, 0f, (float)e.Bounds.Width, (float)e.Bounds.Height)); double x = 2.0; if (itemBitmap != null) { double height = Math.Min((double)e.Bounds.Height, itemBitmap.Size.Height); double width = (itemBitmap.Size.Width * height) / itemBitmap.Size.Height; double y = (e.Bounds.Height - height) / 2.0; RectDouble num6 = new RectDouble(2.0, y, width, height); context.DrawBitmap(itemBitmap, new RectDouble?(num6), 1.0, BitmapInterpolationMode.Linear, null); x = num6.Right + 2.0; } RectDouble num2 = new RectDouble(x, 0.0, e.Bounds.Width - x, (double)e.Bounds.Height); TextLayout textLayout = UIText.CreateLayout(context, itemText, this.Font, null, HotkeyRenderMode.Ignore, num2.Width, num2.Height); textLayout.WordWrapping = WordWrapping.NoWrap; textLayout.TrimmingGranularity = TrimmingGranularity.Character; textLayout.TrimmingStyle = TextTrimmingStyle.Ellipsis; context.DrawTextLayout(num2.Location, textLayout, this.selectionHighlightRenderer.EmbeddedTextBrush, DrawTextOptions.None); } using (e.Graphics.UseCompositingMode(CompositingMode.SourceCopy)) { e.Graphics.DrawSurface(this.renderBuffer, false, e.Bounds, new Rectangle(0, 0, e.Bounds.Width, e.Bounds.Height), GraphicsUnit.Pixel); } } }
private void OnSectionsListBoxDrawItem(object sender, DrawItemEventArgs e) { SettingsDialogSection section = this.sectionsListBox.Items[e.Index] as SettingsDialogSection; int x = UIUtil.ScaleWidth(4); using (IDrawingContext context = DrawingContextUtil.FromGraphics(e.Graphics, e.Bounds, false, FactorySource.PerThread)) { HighlightState disabled; context.Clear(new ColorRgba128Float?(this.BackColor)); if (e.State.HasFlag(DrawItemState.Disabled) || e.State.HasFlag(DrawItemState.Grayed)) { disabled = HighlightState.Disabled; } else if (e.State.HasFlag(DrawItemState.Selected)) { disabled = HighlightState.Checked; } else if (e.State.HasFlag(DrawItemState.HotLight) || (e.Index == this.hotTrackIndex)) { disabled = HighlightState.Hover; } else { disabled = HighlightState.Default; } RectInt32 bounds = e.Bounds.ToRectInt32(); bounds.Inflate(-1, -1); this.selectionHighlightRenderer.HighlightState = disabled; this.selectionHighlightRenderer.RenderBackground(context, bounds); SizeInt32 num4 = UIUtil.ScaleSize(section.DeviceIcon.PixelSize); RectInt32 num5 = new RectInt32(x, e.Bounds.Top + ((e.Bounds.Height - num4.Height) / 2), num4.Width, num4.Height); context.DrawBitmap(section.DeviceIcon, new RectDouble?(num5), 1.0, BitmapInterpolationMode.Linear, null); HotkeyRenderMode hotkeyRenderMode = !e.State.HasFlag(DrawItemState.NoAccelerator) ? HotkeyRenderMode.Show : HotkeyRenderMode.Hide; TextLayout resourceSource = UIText.CreateLayout(context, section.DisplayName, e.Font, null, hotkeyRenderMode, 65535.0, 65535.0); ITextLayout cachedOrCreateResource = context.GetCachedOrCreateResource <ITextLayout>(resourceSource); int num6 = num5.Right + x; float num7 = e.Bounds.Top + ((e.Bounds.Height - cachedOrCreateResource.Metrics.Height) / 2f); context.DrawTextLayout((double)num6, (double)num7, resourceSource, this.selectionHighlightRenderer.EmbeddedTextBrush, DrawTextOptions.None); if (!e.State.HasFlag(DrawItemState.NoFocusRect)) { context.DrawFocusRectangle(e.Bounds.ToRectFloat()); } } }
protected override void OnRender(IDrawingContext dc, RectFloat clipRect) { using (dc.UseAntialiasMode(AntialiasMode.Aliased)) { SizeInt32 num; Size clientSize = base.ClientSize; if ((clientSize.Width < 2) || (clientSize.Height < 2)) { num = new SizeInt32(3, 3); } else { num = new SizeInt32(clientSize.Width, clientSize.Height); } dc.Clear(new ColorRgba128Float?((ColorRgba128Float)PaintDotNet.Imaging.SystemColors.Window)); int num2 = (int)(this.tolerance * 100f); string text = string.Format(percentageFormat, num2); if (this.textLayout == null) { this.textLayout = UIText.CreateLayout(dc, text, this.Font, null, HotkeyRenderMode.Ignore, 65535.0, 65535.0); this.textLayout.ParagraphAlignment = ParagraphAlignment.Center; this.textLayout.FontSize *= 0.9; } else { this.textLayout.Text = text; } this.textLayout.MaxWidth = num.Width - 6; this.textLayout.MaxHeight = num.Height - 6; PointDouble origin = new PointDouble(3.0, 3.0); dc.DrawTextLayout(origin, this.textLayout, SolidColorBrushCache.Get(base.Enabled ? ((ColorRgba128Float)PaintDotNet.Imaging.SystemColors.WindowText) : ((ColorRgba128Float)PaintDotNet.Imaging.SystemColors.GrayText)), DrawTextOptions.None); RectDouble rect = new RectDouble(0.0, 0.0, (double)num.Width, (double)num.Height); RectDouble num5 = RectDouble.Inflate(rect, -0.5, -0.5); dc.DrawRectangle(num5, SolidColorBrushCache.Get(base.Enabled ? ((ColorRgba128Float)PaintDotNet.Imaging.SystemColors.ControlDark) : ((ColorRgba128Float)PaintDotNet.Imaging.SystemColors.ControlDark)), 1.0); RectDouble num6 = new RectDouble(1.0, 1.0, (num.Width - 2.0) * this.tolerance, (double)(num.Height - 2)); PaintDotNet.UI.Media.Brush brush = SolidColorBrushCache.Get(base.Enabled ? (this.hovering ? ((ColorRgba128Float)PaintDotNet.Imaging.SystemColors.HotTrack) : ((ColorRgba128Float)PaintDotNet.Imaging.SystemColors.Highlight)) : ((ColorRgba128Float)PaintDotNet.Imaging.SystemColors.Control)); dc.FillRectangle(num6, brush); using (dc.UseAxisAlignedClip((RectFloat)num6, AntialiasMode.PerPrimitive)) { dc.DrawTextLayout(origin, this.textLayout, SolidColorBrushCache.Get(base.Enabled ? ((ColorRgba128Float)PaintDotNet.Imaging.SystemColors.HighlightText) : ((ColorRgba128Float)PaintDotNet.Imaging.SystemColors.GrayText)), DrawTextOptions.None); } } base.OnRender(dc, clipRect); }
private ImageResource CreateImageResource(int width, int height, double borderSize) { ImageResource resource2; double x = borderSize / 2.0; using (ISurface <ColorBgra> surface = SurfaceAllocator.Bgra.Allocate(width, height, AllocationOptions.ZeroFillNotRequired)) { using (IDrawingContext context = DrawingContext.FromSurface(surface, AlphaMode.Premultiplied, FactorySource.PerThread)) { RectDouble num4; context.Clear(null); RectDouble num2 = new RectDouble(x, x, width - borderSize, height - borderSize); double aspectRatio = this.AspectRatio; if (aspectRatio > 1.0) { double num5 = num2.Height / aspectRatio; num4 = new RectDouble(num2.X, num2.Y + ((num2.Height - num5) / 2.0), num2.Width, num5); } else if (aspectRatio < 1.0) { double num6 = num2.Width * aspectRatio; num4 = new RectDouble(num2.X + ((num2.Width - num6) / 2.0), num2.Y, num6, num2.Height); } else { num4 = num2; } IDictionary <string, object> settingValues = (from p in this.RenderSettingPaths select KeyValuePairUtil.Create <string, object>(p, AppSettings.Instance[ConvertToolsPathToToolDefaultsPath(p)].Value)).ToDictionary <string, object>(); ShapeRenderParameters renderParams = new ShapeRenderParameters(num4.TopLeft, num4.BottomRight, new VectorDouble(1.0, 1.0), settingValues, null); PropertyCollection properties = this.CreatePropertyCollection(renderParams); this.OnSetImagePropertyCollectionValues(renderParams, properties); IDictionary <object, object> propertyValues = (from p in properties select KeyValuePairUtil.Create <object, object>(p.GetOriginalNameValue(), p.Value)).ToDictionary <object, object>(); ShapeRenderParameters parameters2 = new ShapeRenderParameters(num4.TopLeft, num4.BottomRight, new VectorDouble(1.0, 1.0), settingValues, propertyValues); ShapeRenderData data = this.CreateImageRenderData(parameters2); PaintDotNet.UI.Media.Brush brush = SolidColorBrushCache.Get((ColorRgba128Float)ColorBgra.FromUInt32(0xff5894c1)); if (data.InteriorFill != null) { context.FillGeometry(data.InteriorFill.Geometry, SolidColorBrushCache.Get((ColorRgba128Float)Colors.White), null); LinearGradientBrush brush2 = new LinearGradientBrush { StartPoint = num4.TopLeft, EndPoint = num4.BottomRight }; brush2.GradientStops.Add(new GradientStop((ColorRgba128Float)ColorBgra32.FromUInt32(0xffc0e1f3), 0.0)); brush2.GradientStops.Add(new GradientStop((ColorRgba128Float)ColorBgra32.FromUInt32(0xffe0eff8), 1.0)); context.FillGeometry(data.InteriorFill.Geometry, brush2, null); } if ((data.InteriorFill != null) && (data.OutlineDraw != null)) { RenderLayer layer = RenderLayerCache.Get(); using (context.UseLayer(layer, null, data.InteriorFill.Geometry, AntialiasMode.PerPrimitive, null, 1.0, null, LayerOptions.None)) { context.DrawGeometry(data.OutlineDraw.Geometry, SolidColorBrushCache.Get((ColorRgba128Float)Colors.White), 3.0); } RenderLayerCache.Return(layer); } if (data.OutlineDraw != null) { context.DrawGeometry(data.OutlineDraw.Geometry, brush, 1.0); } if (data.OutlineFill != null) { context.FillGeometry(data.OutlineFill.Geometry, brush, null); } string imageStringOverlay = this.ImageStringOverlay; if (imageStringOverlay != string.Empty) { double num7 = (width * 7.0) / 16.0; double fontSize = UIUtil.ScaleWidth(num7); TextLayout textLayout = new TextLayout(imageStringOverlay, "Arial", FontWeight.Normal, PaintDotNet.DirectWrite.FontStyle.Normal, FontStretch.Normal, fontSize) { ParagraphAlignment = ParagraphAlignment.Center, TextAlignment = PaintDotNet.DirectWrite.TextAlignment.Center, MaxWidth = width - 2, MaxHeight = height - 2 }; context.DrawTextLayout(new PointDouble(1.0, 1.0), textLayout, SolidColorBrushCache.Get((ColorRgba128Float)ColorBgra.FromUInt32(0xff5894c1)), DrawTextOptions.None); } } surface.ConvertFromPremultipliedAlpha(); using (System.Drawing.Bitmap bitmap = surface.CreateAliasedGdipBitmap()) { System.Drawing.Bitmap image = new System.Drawing.Bitmap(bitmap); resource2 = ImageResource.FromImage(image); } } return(resource2); }
protected override void OnRender(IDrawingContext dc, RectFloat clipRect) { if (this.historyStack != null) { dc.Clear(new ColorRgba128Float?(this.BackColor)); using (dc.UseTranslateTransform(0f, (float)-this.scrollOffset, MatrixMultiplyOrder.Prepend)) { int num7; int num8; int num11; int num12; RectDouble? nullable; TextLayoutAlgorithm?nullable2; int num = UIUtil.ScaleWidth(1); int num2 = (this.itemHeight - this.imageHeight) / 2; int num3 = UIUtil.ScaleWidth(2); RectInt32 a = this.ClientRectangleToViewRectangle(base.ClientRectangle.ToRectInt32()); RectInt32 undoViewRectangle = this.UndoViewRectangle; dc.FillRectangle(undoViewRectangle, PaintDotNet.UI.Media.SystemBrushes.Window); RectInt32 num6 = RectInt32.Intersect(a, undoViewRectangle); if ((num6.Width > 0) && (num6.Height > 0)) { ItemType type; this.ViewPointToStackIndex(num6.Location, out type, out num7); this.ViewPointToStackIndex(new PointInt32(num6.Left, num6.Bottom - 1), out type, out num8); } else { num7 = 0; num8 = -1; } for (int i = num7; i <= num8; i++) { DeviceBitmap deviceBitmap; int imageHeight; HighlightState hover; ImageResource image = this.historyStack.UndoStack[i].Image; if (image != null) { deviceBitmap = ImageResourceUtil.GetDeviceBitmap(image); } else { deviceBitmap = null; } if (deviceBitmap != null) { imageHeight = (deviceBitmap.PixelSize.Width * this.imageHeight) / deviceBitmap.PixelSize.Height; } else { imageHeight = this.imageHeight; } if (i == (this.historyStack.UndoStack.Count - 1)) { hover = HighlightState.Checked; } else if (i == this.undoItemHighlight) { hover = HighlightState.Hover; } else { hover = HighlightState.Default; } RectInt32 bounds = new RectInt32(0, i * this.itemHeight, this.ViewWidth, this.itemHeight); this.selectionHighlightRenderer.HighlightState = hover; this.selectionHighlightRenderer.RenderBackground(dc, bounds); PaintDotNet.UI.Media.Brush embeddedTextBrush = this.selectionHighlightRenderer.EmbeddedTextBrush; if (deviceBitmap != null) { nullable = null; dc.DrawBitmap(deviceBitmap, new RectDouble?(new RectInt32(bounds.X + num, bounds.Y + num2, imageHeight, this.imageHeight)), 1.0, BitmapInterpolationMode.Linear, nullable); } int x = (num + num3) + imageHeight; RectInt32 num17 = new RectInt32(x, bounds.Y, this.ViewWidth - x, this.itemHeight); nullable2 = null; TextLayout textLayout = UIText.CreateLayout(dc, this.historyStack.UndoStack[i].Name, this.Font, nullable2, HotkeyRenderMode.Hide, (double)num17.Width, (double)num17.Height); textLayout.WordWrapping = WordWrapping.Wrap; textLayout.ParagraphAlignment = ParagraphAlignment.Center; UIText.AdjustFontSizeToFitLayoutSize(dc, textLayout, (double)num17.Width, (double)num17.Height, 0.6); dc.DrawTextLayout(num17.Location, textLayout, embeddedTextBrush, DrawTextOptions.None); } RectInt32 redoViewRectangle = this.RedoViewRectangle; dc.FillRectangle(redoViewRectangle, slateGrayBrush); RectInt32 num10 = RectInt32.Intersect(a, redoViewRectangle); if ((num10.Width > 0) && (num10.Height > 0)) { ItemType type2; this.ViewPointToStackIndex(num10.Location, out type2, out num11); this.ViewPointToStackIndex(new PointInt32(num10.Left, num10.Bottom - 1), out type2, out num12); } else { num11 = 0; num12 = -1; } for (int j = num11; j <= num12; j++) { DeviceBitmap bitmap2; int num20; PaintDotNet.UI.Media.Brush inactiveCaptionText; ImageResource imageResource = this.historyStack.RedoStack[j].Image; if (imageResource != null) { bitmap2 = ImageResourceUtil.GetDeviceBitmap(imageResource); } else { bitmap2 = null; } if (bitmap2 != null) { num20 = (bitmap2.PixelSize.Width * this.imageHeight) / bitmap2.PixelSize.Height; } else { num20 = this.imageHeight; } RectInt32 num21 = new RectInt32(0, redoViewRectangle.Top + (j * this.itemHeight), this.ViewWidth, this.itemHeight); if (j == this.redoItemHighlight) { this.selectionHighlightRenderer.HighlightState = HighlightState.Hover; this.selectionHighlightRenderer.RenderBackground(dc, num21); inactiveCaptionText = this.selectionHighlightRenderer.EmbeddedTextBrush; } else { inactiveCaptionText = PaintDotNet.UI.Media.SystemBrushes.InactiveCaptionText; } if (bitmap2 != null) { nullable = null; dc.DrawBitmap(bitmap2, new RectDouble?(new RectInt32(num21.X + num, num21.Y + num2, num20, this.imageHeight)), 1.0, BitmapInterpolationMode.Linear, nullable); } int num22 = (num + num3) + num20; RectInt32 num23 = new RectInt32(num22, num21.Y, this.ViewWidth - num22, this.itemHeight); nullable2 = null; TextLayout layout2 = UIText.CreateLayout(dc, this.historyStack.RedoStack[j].Name, this.Font, nullable2, HotkeyRenderMode.Hide, (double)num23.Width, (double)num23.Height); layout2.WordWrapping = WordWrapping.NoWrap; layout2.ParagraphAlignment = ParagraphAlignment.Center; layout2.FontStyle = PaintDotNet.DirectWrite.FontStyle.Italic; UIText.AdjustFontSizeToFitLayoutSize(dc, layout2, (double)num23.Width, (double)num23.Height, 0.6); dc.DrawTextLayout(num23.Location, layout2, inactiveCaptionText, DrawTextOptions.None); } } } base.OnRender(dc, clipRect); }
private unsafe void RenderTileWorkItem(PointInt32 tileOffset) { IBitmap <ColorPbgra32> bitmap; bool isCancelled = false; bool flag = false; Exception error = null; isCancelled |= this.IsTileRenderingCancelled(tileOffset); if (isCancelled) { bitmap = null; } else { RectInt32 tileSourceRect = this.tileMathHelper.GetTileSourceRect(tileOffset); SizeInt32 tileBufferSize = this.GetTileBufferSize(tileOffset); bitmap = RetryManager.Eval <IBitmap <ColorPbgra32> >(3, () => BitmapAllocator.Pbgra32.Allocate(tileBufferSize, AllocationOptions.Default), delegate(Exception _) { CleanupManager.RequestCleanup(); Thread.Sleep(200); CleanupManager.WaitForPendingCleanup(); }, delegate(AggregateException ex) { throw new AggregateException($"could not allocate a bitmap of size {tileBufferSize.Width} x {tileBufferSize.Height}", ex).Flatten(); }); if (this.source != null) { try { isCancelled |= this.IsTileRenderingCancelled(tileOffset); if (!isCancelled) { using (IBitmapLock <ColorPbgra32> @lock = bitmap.Lock <ColorPbgra32>(BitmapLockOptions.ReadWrite)) { if (this.mipLevel == 0) { this.source.CopyPixels(new RectInt32?(tileSourceRect), @lock); RenderingKernels.ConvertBgra32ToPbgra32((uint *)@lock.Scan0, tileBufferSize.Width, tileBufferSize.Height, @lock.Stride); flag = true; } else { BitmapInterpolationMode linear; if (!this.isHighQuality) { linear = BitmapInterpolationMode.Linear; } else if (this.mipLevel == 1) { linear = BitmapInterpolationMode.Linear; } else { linear = BitmapInterpolationMode.Fant; } IImagingFactory instance = ImagingFactory.Instance; ICancellationToken cancelToken = CancellationTokenUtil.Create((Func <bool>)(() => (isCancelled | this.IsTileRenderingCancelled(tileOffset)))); int copyHeightLog2 = Math.Max(3, 7 - this.mipLevel); using (ClippedBitmapSource <ColorBgra32> source2 = new ClippedBitmapSource <ColorBgra32>(this.source, tileSourceRect)) { using (CancellableBitmapSource <ColorBgra32> source3 = new CancellableBitmapSource <ColorBgra32>(source2, r => this.tileMathHelper.EnumerateTilesClippedToSourceRect(r), null, cancelToken)) { using (IBitmapSource <ColorPbgra32> source4 = CreateBufferedTileScaler(instance, source3, tileBufferSize.Width, tileBufferSize.Height, linear)) { using (CancellableBitmapSource <ColorPbgra32> source5 = new CancellableBitmapSource <ColorPbgra32>(source4, r => TileRectSplitter(r, ((int)1) << copyHeightLog2), null, cancelToken)) { try { source5.CopyPixels <ColorPbgra32>(@lock); flag = true; } catch (OperationCanceledException exception2) { error = exception2; isCancelled = true; } catch (Exception exception3) { error = exception3; throw; } } } } } } isCancelled |= this.IsTileRenderingCancelled(tileOffset); if (isCancelled) { flag = false; } } if (!flag) { DisposableUtil.Free <IBitmap <ColorPbgra32> >(ref bitmap); } } } catch (OperationCanceledException exception4) { error = exception4; isCancelled = true; } catch (Exception exception5) { error = exception5; isCancelled |= this.IsTileRenderingCancelled(tileOffset); if (!isCancelled) { using (IDrawingContext context = DrawingContext.FromBitmap(bitmap, FactorySource.PerThread)) { context.Clear(new ColorRgba128Float?((ColorRgba128Float)Colors.White)); string text = exception5.ToString(); using (ISystemFonts fonts = new SystemFonts(true)) { TextLayout textLayout = UIText.CreateLayout(context, text, fonts.Caption, null, HotkeyRenderMode.Ignore, (double)bitmap.Size.Width, 65535.0); textLayout.FontSize *= 0.6; textLayout.WordWrapping = WordWrapping.Wrap; context.DrawTextLayout(PointDouble.Zero, textLayout, SolidColorBrushCache.Get((ColorRgba128Float)Colors.Black), DrawTextOptions.None); } } flag = true; } } } } isCancelled |= this.IsTileRenderingCancelled(tileOffset); if (isCancelled) { DisposableUtil.Free <IBitmap <ColorPbgra32> >(ref bitmap); } RenderedTileInfo info = new RenderedTileInfo(bitmap, !isCancelled && (bitmap > null), error); if (!this.tilesRenderedQueue.TryEnqueue(tileOffset, info)) { ExceptionUtil.ThrowInternalErrorException("Could not enqueue to this.tilesRenderedQueue"); } if (Interlocked.Exchange(ref this.isProcessTileRenderedQueueQueued, 1) == 0) { this.syncContext.Post(this.processTileRenderedQueueCallback); } }
private void RenderMask(ISurface <ColorAlpha8> dstMask, PointInt32 renderOffset) { int width = dstMask.Width; int height = dstMask.Height; bool flag = false; SizeInt32 size = new SizeInt32(width, height); RectInt32 rectangle = new RectInt32(renderOffset, size); if (!flag && this.matrix.HasInverse) { Matrix3x2Double inverse = this.matrix.Inverse; PointDouble pt = inverse.Transform(rectangle.TopLeft); PointDouble num7 = inverse.Transform(rectangle.TopRight); PointDouble num8 = inverse.Transform(rectangle.BottomLeft); PointDouble num9 = inverse.Transform(rectangle.BottomRight); RectDouble srcCoverageBounds = this.srcCoverageBounds; if ((srcCoverageBounds.Contains(pt) && srcCoverageBounds.Contains(num7)) && (srcCoverageBounds.Contains(num8) && srcCoverageBounds.Contains(num9))) { dstMask.Clear(ColorAlpha8.Opaque); flag = true; } } if (!flag) { GeometryRelation relation; IDirect2DFactory perThread = Direct2DFactory.PerThread; using (IRectangleGeometry geometry = perThread.CreateRectangleGeometry(rectangle)) { base.ThrowIfCancellationRequested(); using (IRectangleGeometry geometry2 = perThread.CreateRectangleGeometry(this.srcCoverageBounds)) { base.ThrowIfCancellationRequested(); relation = geometry.CompareWithGeometry(geometry2, new Matrix3x2Float?((Matrix3x2Float)this.matrix), null); base.ThrowIfCancellationRequested(); } } switch (relation) { case GeometryRelation.IsContained: dstMask.Clear(ColorAlpha8.Opaque); flag = true; break; case GeometryRelation.Disjoint: dstMask.Clear(ColorAlpha8.Transparent); flag = true; break; } } if (!flag) { using (IDrawingContext context = DrawingContext.FromSurface(dstMask, FactorySource.PerThread)) { base.ThrowIfCancellationRequested(); context.Clear(null); context.AntialiasMode = AntialiasMode.PerPrimitive; using (context.UseTranslateTransform((float)-renderOffset.X, (float)-renderOffset.Y, MatrixMultiplyOrder.Prepend)) { using (context.UseTransformMultiply((Matrix3x2Float)this.matrix, MatrixMultiplyOrder.Prepend)) { context.FillRectangle(this.srcCoverageBounds, whiteBrush); } } } } }
private void DrawComboBoxItem(DrawItemEventArgs e) { HighlightState hover; string fontName = (string)base.ComboBox.Items[e.Index]; bool flag = (e.State & DrawItemState.Selected) > DrawItemState.None; bool flag2 = this.hasBeenShown && (e.Bounds.Width >= (base.ComboBox.DropDownWidth / 2)); if (!flag2) { hover = HighlightState.Default; } else if (flag) { hover = HighlightState.Hover; } else { hover = HighlightState.Default; } Color selectionBackColor = SelectionHighlight.GetSelectionBackColor(hover); int num = UIUtil.ScaleWidth(3); int num2 = num; int num3 = -1; this.selectionHighlightRenderer.HighlightState = hover; using (IDrawingContext context = DrawingContextUtil.FromGraphics(e.Graphics, e.Bounds, false, FactorySource.PerThread)) { RenderLayer layer = new RenderLayer(); context.Clear(new ColorRgba128Float?((ColorRgba128Float)PaintDotNet.Imaging.SystemColors.Window)); this.selectionHighlightRenderer.RenderBackground(context, e.Bounds.ToRectFloat()); SizedFontProperties menu = this.systemFonts.Menu; PaintDotNet.UI.Media.Brush textBrush = this.selectionHighlightRenderer.EmbeddedTextBrush; TextLayout textLayout = UIText.CreateLayout(context, fontName, menu, null, HotkeyRenderMode.Ignore, (double)(e.Bounds.Width - num2), (double)e.Bounds.Height); textLayout.ParagraphAlignment = ParagraphAlignment.Center; textLayout.WordWrapping = WordWrapping.NoWrap; int num5 = num + e.Bounds.X; context.DrawTextLayout((double)num5, (double)(e.Bounds.Y + num3), textLayout, textBrush, DrawTextOptions.None); ITextLayout cachedOrCreateResource = context.GetCachedOrCreateResource <ITextLayout>(textLayout); int num4 = (int)Math.Ceiling((double)(num5 + cachedOrCreateResource.Metrics.WidthMax)); PlacedBitmap bitmap = this.TryGetFontPreview(fontName, 16f, textBrush); if (bitmap == null) { IntPtr listHwnd = UIUtil.GetListBoxHwnd(base.ComboBox); Action callback = delegate { try { PlacedBitmap bitmap = this.GetOrCreateFontPreview(fontName, 16f, textBrush); if (listHwnd != IntPtr.Zero) { this.ComboBox.BeginInvoke(() => UIUtil.InvalidateHwnd(listHwnd)); } } catch (Exception) { } }; if (this.backgroundThread == null) { this.backgroundThread = new ThreadDispatcher(ApartmentState.MTA); } this.backgroundThread.Enqueue(QueueSide.Front, callback).Observe(); } if (flag2 && (bitmap != null)) { PaintDotNet.UI.Media.Brush brush; RectFloat num7; RectFloat num6 = new RectFloat((float)((e.Bounds.Right - num) - bitmap.Bitmap.Size.Width), num3 + ((float)Math.Floor((double)((e.Bounds.Y + ((e.Bounds.Height - bitmap.LayoutRect.Height) / 2.0)) - bitmap.LayoutRect.Top))), (float)bitmap.Bitmap.Size.Width, (float)bitmap.Bitmap.Size.Height); if (num6.Left > num4) { num7 = num6; brush = null; } else { num7 = num6; num7.X += num4 - num6.X; num7.X = (float)Math.Ceiling((double)num7.X); LinearGradientBrush brush2 = new LinearGradientBrush { ColorInterpolationMode = ColorInterpolationMode.SRgbLinearInterpolation, SpreadMethod = GradientSpreadMethod.Pad }; brush2.GradientStops.Add(new GradientStop(Color.White, 0.0)); brush2.GradientStops.Add(new GradientStop(Color.White, ((double)(e.Bounds.Width - UIUtil.ScaleWidth(0x18))) / ((double)e.Bounds.Width))); brush2.GradientStops.Add(new GradientStop(Color.Transparent, 1.0)); brush2.EndPoint = new PointDouble((double)e.Bounds.Width, 0.0); brush = brush2; } using (context.CreateLayer(null)) { context.PushLayer(layer, new RectDouble?(num7), null, AntialiasMode.Aliased, new Matrix3x2Double?(Matrix3x2Float.Identity), 1.0, brush, LayerOptions.None); context.DrawBitmap(bitmap.DeviceBitmap, new RectDouble?(num7), 1.0, BitmapInterpolationMode.Linear, null); context.PopLayer(); } } } }
private void RedrawOnBackgroundThread() { if (base.CheckAccess()) { ExceptionUtil.ThrowInvalidOperationException(); } if (this.redrawThreadFactory == null) { this.redrawThreadFactory = new Direct2DFactory(Direct2DFactoryType.MultiThreaded, DebugLevel.None); } if ((this.redrawThreadGeometryCache == null) || (this.redrawThreadGeometryCache.SelectionSnapshot != this.redrawRenderParams.SelectionSnapshot)) { DisposableUtil.Free <SelectionGeometryCache>(ref this.redrawThreadGeometryCache); this.redrawThreadGeometryCache = new SelectionGeometryCache(this.redrawThreadFactory, this.redrawRenderParams.SelectionSnapshot); } double scaleRatio = this.redrawRenderParams.ScaleRatio; PointDouble location = this.redrawRenderParams.ViewportCanvasBounds.Location; SizeDouble viewportSize = this.redrawRenderParams.ViewportSize; SizeInt32 num5 = SizeDouble.Ceiling(viewportSize); RectDouble b = RectDouble.Inflate(CanvasCoordinateConversions.ConvertExtentToViewport(CanvasCoordinateConversions.ConvertCanvasToExtent(this.redrawRenderParams.SelectionSnapshot.GeometryList.Value.Bounds, scaleRatio), scaleRatio, location), (double)this.outlineStrokeWidthPx, (double)this.outlineStrokeWidthPx); RectDouble a = new RectDouble(PointDouble.Zero, viewportSize); RectDouble renderViewportBounds = RectDouble.Intersect(a, b); RectInt32 viewportRect = renderViewportBounds.Int32Bound; RectDouble extentRect = CanvasCoordinateConversions.ConvertViewportToExtent(viewportRect, scaleRatio, location); RectDouble renderCanvasBounds = CanvasCoordinateConversions.ConvertExtentToCanvas(extentRect, scaleRatio); if (!viewportRect.HasPositiveArea) { base.SyncContext.Post((SendOrPostCallback)(_ => this.EndRedraw(renderViewportBounds, RectFloat.Zero, null, null))); } else { IBitmap <ColorAlpha8> interiorMask; float scale; PointFloat offset; Result <IGeometry> lazyGeometry; IBitmap <ColorAlpha8>[] dashedOutlineMasks; RectFloat maskSourceRect; SelectionSnapshot selectionSnapshot = this.redrawRenderParams.SelectionSnapshot; SelectionGeometryCache redrawThreadGeometryCache = this.redrawThreadGeometryCache; bool flag = this.redrawRenderParams.SelectionRenderingQuality == SelectionRenderingQuality.Aliased; if (!flag) { lazyGeometry = redrawThreadGeometryCache.Geometry; } else { bool flag3 = selectionSnapshot.IsRectilinear.Value; bool flag4 = selectionSnapshot.IsPixelated.Value; if (flag3 & flag4) { lazyGeometry = redrawThreadGeometryCache.Geometry; } else { lazyGeometry = redrawThreadGeometryCache.PixelatedGeometry; } } bool flag2 = !flag && this.redrawRenderParams.IsOutlineAntialiased; AntialiasMode antialiasMode = ((flag || !flag2) || selectionSnapshot.IsRectilinear.Value) ? AntialiasMode.Aliased : AntialiasMode.PerPrimitive; if (this.CanContinueRedrawing(null, null)) { scale = (float)this.redrawRenderParams.ScaleRatio; float x = -((float)renderCanvasBounds.X); float y = -((float)renderCanvasBounds.Y); offset = new PointFloat(x, y); interiorMask = BitmapAllocator.Alpha8.Allocate(viewportRect.Size, AllocationOptions.ZeroFillNotRequired); try { RetryManager.RunMemorySensitiveOperation(delegate { using (IDrawingContext context = DrawingContext.FromBitmap(this.redrawThreadFactory, interiorMask)) { context.Clear(null); IBrush interiorBrush = context.GetCachedOrCreateResource <IBrush>(whiteBrush); this.RenderSelection(context, scale, offset, this.redrawRenderParams, lazyGeometry, interiorBrush, null, null, antialiasMode); } }); } catch (OutOfMemoryException) { } if (this.CanContinueRedrawing(interiorMask, null)) { int num15; dashedOutlineMasks = new IBitmap <ColorAlpha8> [SelectionCanvasLayer.DashLength]; for (int i = 0; i < dashedOutlineMasks.Length; i = num15) { if ((!this.redrawRenderParams.IsOutlineAnimated && (i != 0)) && (i != (SelectionCanvasLayer.DashLength / 2))) { dashedOutlineMasks[i] = null; } else { dashedOutlineMasks[i] = BitmapAllocator.Alpha8.Allocate(viewportRect.Size, AllocationOptions.ZeroFillNotRequired); try { RetryManager.RunMemorySensitiveOperation(delegate { using (IDrawingContext context = DrawingContext.FromBitmap(this.redrawThreadFactory, dashedOutlineMasks[i])) { context.Clear(null); StrokeStyle resourceSource = SelectionCanvasLayer.GetDashedStrokeStyle(i); IStrokeStyle outlineStrokeStyle = context.GetCachedOrCreateResource <IStrokeStyle>(resourceSource); IBrush cachedOrCreateResource = context.GetCachedOrCreateResource <IBrush>(whiteBrush); this.RenderSelection(context, scale, offset, this.redrawRenderParams, lazyGeometry, null, cachedOrCreateResource, outlineStrokeStyle, antialiasMode); } }); } catch (OutOfMemoryException) { } if (!this.CanContinueRedrawing(interiorMask, dashedOutlineMasks)) { return; } } num15 = i + 1; } maskSourceRect = new RectFloat(PointFloat.Zero, interiorMask.Size); base.SyncContext.Post(_ => this.EndRedraw(renderCanvasBounds, maskSourceRect, interiorMask, dashedOutlineMasks), null); } } } }
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); } } }