コード例 #1
0
        internal void DrawRect(RectangleF rect, Paint paint)
        {
            UpdateDrawingSessionWithFlags(paint.Flags);
            CurrentRenderTarget.Transform = GetCurrentTransform();

            using (var brush = new SolidColorBrush(CurrentRenderTarget, paint.Color.ToRaw()))
            {
                if (paint.Style == Paint.PaintStyle.Stroke)
                {
                    CurrentRenderTarget.DrawRectangle(rect.ToRaw(), brush, paint.StrokeWidth, GetStrokeStyle(paint));
                }
                else
                {
                    CurrentRenderTarget.FillRectangle(rect.ToRaw(), brush);
                }
            }
        }
コード例 #2
0
        public void DrawRect(double x1, double y1, double x2, double y2, Paint paint)
        {
            UpdateDrawingSessionWithFlags(paint.Flags);
            CurrentRenderTarget.Transform = GetCurrentTransform();
            using (var brush = new SolidColorBrush(CurrentRenderTarget, paint.Color))
            {
                if (paint.Style == Paint.PaintStyle.Stroke)
                {
                    CurrentRenderTarget.DrawRectangle(new RectangleF((float)x1, (float)y1, (float)(x2 - x1), (float)(y2 - y1)), brush, paint.StrokeWidth, GetStrokeStyle(paint));
                }
                else
                {
                    CurrentRenderTarget.FillRectangle(new RectangleF((float)x1, (float)y1, (float)(x2 - x1), (float)(y2 - y1)), brush);
                }
            }

            if (paint.Xfermode.Mode == PorterDuff.Mode.Clear)
            {
                CurrentRenderTarget.Flush();
            }
        }