Beispiel #1
0
        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);
        }
Beispiel #2
0
        public IRenderResult Render(IRenderSpecification specification, IDrawingContext context, CancellationToken cancellationToken)
        {
            var shadingSpecification = (ShadingOnlyRenderSpecification)specification;
            var fractalPart          = shadingSpecification.CalculatedFractalPart;

            using (var fastBitmap = this.renderer.CreateBitmap(fractalPart, specification.Settings, specification.Shader))
            {
                var scalableFractalPart = fractalPart as ScalableFractalPart;
                if (scalableFractalPart != null && !scalableFractalPart.ScaledScreenPosition.Equals(scalableFractalPart.ScreenPosition))
                {
                    var targetRect = new Rectangle(
                        scalableFractalPart.ScaledScreenPosition.Left,
                        scalableFractalPart.ScaledScreenPosition.Top,
                        scalableFractalPart.ScaledScreenPosition.Right - scalableFractalPart.ScaledScreenPosition.Left + 1,
                        scalableFractalPart.ScaledScreenPosition.Bottom - scalableFractalPart.ScaledScreenPosition.Top + 1);

                    context.DrawBitmap(fastBitmap.Bitmap, targetRect);
                }
                else
                {
                    var targetPoint = new Point(fractalPart.ScreenPosition.Left, fractalPart.ScreenPosition.Top);
                    context.DrawBitmapUnscaled(fastBitmap.Bitmap, targetPoint);
                }
            }

            return(new RenderResult(shadingSpecification.CalculatedFractalPart));
        }
 protected override void OnRender(IDrawingContext dc)
 {
     PaintDotNet.UI.Media.DeviceBitmap deviceBitmap = this.DeviceBitmap;
     if (deviceBitmap != null)
     {
         SizeDouble size = deviceBitmap.Size;
         RectDouble num2 = new RectDouble(PointDouble.Zero, size);
         dc.DrawBitmap(deviceBitmap, new RectDouble?(num2), 1.0, BitmapInterpolationMode.Linear, new RectDouble?(num2));
     }
 }
Beispiel #4
0
        public override void Render(IDrawingContext drawingContext)
        {
            var viewPort   = new Rect(VisualBounds.Point, VisualBounds.Size);
            var sourceSize = new Size(Source.Width, Source.Height);
            var scale      = Stretch.CalculateScaling(Bounds.Size, sourceSize);
            var scaledSize = sourceSize * scale;
            var destRect   = viewPort
                             .CenterIn(new Rect(scaledSize))
                             .Intersect(viewPort);
            var sourceRect = new Rect(sourceSize)
                             .CenterIn(new Rect(destRect.Size / scale));

            drawingContext.DrawBitmap(Source, sourceRect, destRect);
        }
Beispiel #5
0
        protected sealed override void OnRender(IDrawingContext dc)
        {
            SizeInt32 size = this.Size;

            if (size.HasPositiveArea)
            {
                if (this.deviceBitmap.BitmapSource == null)
                {
                    this.deviceBitmap.BitmapSource = this.CreateBitmap();
                }
                if (this.deviceBitmap.BitmapSource != null)
                {
                    RectDouble num2 = new RectDouble(0.0, 0.0, (double)size.Width, (double)size.Height);
                    dc.DrawBitmap(this.deviceBitmap, new RectDouble?(num2), 1.0, BitmapInterpolationMode.Linear, new RectDouble?(num2));
                }
            }
        }
Beispiel #6
0
 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);
         }
     }
 }
Beispiel #7
0
        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());
                }
            }
        }
        public void Render(IDrawingContext dc, RectFloat clipRect, float opacity, BitmapInterpolationMode interpolationMode)
        {
            if (!this.beforeRenderCalled || this.afterRenderCalled)
            {
                throw new PaintDotNet.InternalErrorException();
            }
            this.renderCalled = true;
            if (this.isRendering)
            {
                throw new InvalidOperationException("Render() is not reentrant");
            }
            RectInt32 sourceRect = RectInt32.Intersect(clipRect.Int32Bound, this.owner.Document.Bounds());

            if (sourceRect.HasPositiveArea)
            {
                this.isRendering = true;
                try
                {
                    bool flag = dc.IsSupported(RenderTargetType.Software, null, null, null);
                    foreach (PointInt32 num3 in this.tileMathHelper.EnumerateTileOffsets(sourceRect))
                    {
                        if (flag)
                        {
                            IBitmap <ColorPbgra32> bitmap2 = this.tileBuffers[num3.Y][num3.X];
                            if ((bitmap2 != null) && bitmap2.IsDisposed)
                            {
                                continue;
                            }
                        }
                        IDeviceBitmap bitmap = this.deviceBitmaps[num3.Y][num3.X];
                        if (bitmap != null)
                        {
                            RectInt32 tileSourceRect = this.tileMathHelper.GetTileSourceRect(num3.X, num3.Y);
                            RectFloat?srcRect        = null;
                            dc.DrawBitmap(bitmap, new RectFloat?(tileSourceRect), opacity, interpolationMode, srcRect);
                        }
                    }
                }
                finally
                {
                    this.isRendering = false;
                }
            }
        }
Beispiel #9
0
 private void OnComboBoxDrawItem(object sender, DrawItemEventArgs e)
 {
     if (e.Index != -1)
     {
         RectInt32 rect = e.Bounds.ToRectInt32();
         using (IDrawingContext context = DrawingContextUtil.FromGraphics(e.Graphics, rect, false, FactorySource.PerThread))
         {
             using (context.UseTranslateTransform((float)e.Bounds.X, (float)e.Bounds.Y, MatrixMultiplyOrder.Prepend))
             {
                 HighlightState hover;
                 RectInt32      num2 = new RectInt32(0, 0, rect.Width, rect.Height);
                 Item           item = (Item)this.comboBox.Items[e.Index];
                 if ((e.State & DrawItemState.Selected) > DrawItemState.None)
                 {
                     hover = HighlightState.Hover;
                 }
                 else
                 {
                     hover = HighlightState.Default;
                 }
                 Color embeddedTextColor = SelectionHighlight.GetEmbeddedTextColor(hover);
                 context.FillRectangle(num2, PaintDotNet.UI.Media.SystemBrushes.Window);
                 this.selectionHighlightRenderer.HighlightState = hover;
                 this.selectionHighlightRenderer.RenderBackground(context, num2);
                 int extent = 0;
                 if ((item.Image != null) && (item.Image.PixelFormat != System.Drawing.Imaging.PixelFormat.Undefined))
                 {
                     extent = this.dropShadowRenderer.GetRecommendedExtent(item.Image.Size.ToSizeInt32());
                     RectInt32 num4 = new RectInt32((this.imageXInset + extent) + ((this.maxImageSize.Width - item.Image.Width) / 2), (this.imageYInset + extent) + ((this.maxImageSize.Height - item.Image.Height) / 2), item.Image.Width, item.Image.Height);
                     context.DrawBitmap(item.DeviceImage, new RectDouble?(num4), 1.0, BitmapInterpolationMode.Linear, null);
                     this.dropShadowRenderer.RenderOutside(context, num4, extent);
                 }
                 TextLayout  resourceSource         = UIText.CreateLayout(context, item.Name, this.Font, null, HotkeyRenderMode.Ignore, (double)e.Bounds.Width, (double)e.Bounds.Height);
                 ITextLayout cachedOrCreateResource = context.GetCachedOrCreateResource <ITextLayout>(resourceSource);
                 int         num5 = ((((this.imageXInset + extent) + this.maxImageSize.Width) + extent) + this.imageXInset) + this.textLeftMargin;
                 int         num6 = (this.itemSize.Height - ((int)cachedOrCreateResource.Metrics.Height)) / 2;
                 context.DrawTextLayout((double)num5, (double)num6, resourceSource, this.selectionHighlightRenderer.EmbeddedTextBrush, DrawTextOptions.None);
             }
         }
     }
 }
Beispiel #10
0
 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);
 }
Beispiel #11
0
        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();
                    }
                }
            }
        }