Beispiel #1
0
        public void PushAxisAlignedClip(NoForms.Common.Rectangle clipRect, bool ignoreRenderOffset)
        {
            // This probabbly pushes an empty clip...
            if (PushedClips.Count == 0)
            {
                PushedClips.Push(realRenderer.graphics.Clip);
            }

            var cr = clipRect;

            if (ignoreRenderOffset)
            {
                cr -= new NoForms.Common.Point(realRenderer.graphics.Transform.OffsetX, realRenderer.graphics.Transform.OffsetY);
            }
            var cr2 = new System.Drawing.Region(SDGTr.trF(clipRect));

            realRenderer.graphics.Clip = cr2;
            PushedClips.Push(cr2);
        }
Beispiel #2
0
        public void DrawBitmap(UBitmap bitmap, float opacity, UInterp interp, NoForms.Common.Rectangle source, NoForms.Common.Rectangle destination)
        {
            var bm = CreateBitmap(bitmap);

            if (opacity < 1.0f)
            {
                for (int x = 0; x < bm.Width; x++)
                {
                    for (int y = 0; y < bm.Height; y++)
                    {
                        bm.SetPixel(x, y, System.Drawing.Color.FromArgb((int)(opacity * 255), bm.GetPixel(x, y)));
                    }
                }
            }

            var previousInterp = realRenderer.graphics.CompositingQuality;

            realRenderer.graphics.CompositingQuality = Translate(interp);
            realRenderer.graphics.DrawImage(bm, SDGTr.trF(destination), SDGTr.trF(source), GraphicsUnit.Pixel);
            realRenderer.graphics.CompositingQuality = previousInterp;
        }
Beispiel #3
0
            public static GraphicsPath RoundedRectangle(NoForms.Common.Rectangle r, float rx, float ry)
            {
                // FIXME surely this is slow? we need some special caching for GDI?
                var gp = new GraphicsPath();

                gp.StartFigure();
                float x = r.left;
                float y = r.top;
                float w = r.width;
                float h = r.height;

                gp.AddLine(x + rx, y, x + w - rx, y);                             // top line
                gp.AddArc(x + w - 2 * rx, y, 2 * rx, 2 * ry, 270, 90);            // top-right corner
                gp.AddLine(x + w, y + ry, x + w, y + h - ry);                     // right line
                gp.AddArc(x + w - 2 * rx, y + h - 2 * ry, 2 * rx, 2 * ry, 0, 90); // bottom-right corner
                gp.AddLine(x + w - rx, y + h, x + rx, y + h);                     // bottom line
                gp.AddArc(x, y + h - 2 * ry, 2 * rx, 2 * ry, 90, 90);             // bottom-left corner
                gp.AddLine(x, y + h - ry, x, y + ry);                             // left line
                gp.AddArc(x, y, 2 * rx, 2 * ry, 180, 90);                         // top-left corner
                gp.CloseFigure();
                return(gp);
            }
Beispiel #4
0
        public void FillRoundedRectangle(NoForms.Common.Rectangle rect, float radX, float radY, UBrush brush)
        {
            var rr = ShapeHelpers.RoundedRectangle(rect, radX, radY);

            realRenderer.graphics.FillPath(CreateBrush(brush), rr);
        }
Beispiel #5
0
        public void DrawRoundedRectangle(NoForms.Common.Rectangle rect, float radX, float radY, UBrush brush, UStroke stroke)
        {
            var rr = ShapeHelpers.RoundedRectangle(rect, radX, radY);

            realRenderer.graphics.DrawPath(CreatePen(brush, stroke), rr);
        }
Beispiel #6
0
 public void FillRectangle(NoForms.Common.Rectangle rect, UBrush brush)
 {
     realRenderer.graphics.FillRectangle(CreateBrush(brush), rect.left, rect.top, rect.width, rect.height);
 }
Beispiel #7
0
 public void DrawRectangle(NoForms.Common.Rectangle rect, UBrush brush, UStroke stroke)
 {
     realRenderer.graphics.DrawRectangle(CreatePen(brush, stroke), rect.left, rect.top, rect.width, rect.height);
 }