Exemplo n.º 1
0
        public DrawContextPrinter(DrawContext currentDC, Graphics g, CadSize2D pageSize, CadSize2D deviceSize)
        {
            GdiGraphics = g;

            GdiGraphics.PixelOffsetMode = PixelOffsetMode.HighQuality;
            GdiGraphics.SmoothingMode   = SmoothingMode.HighQuality;

            if (currentDC.GetType() == typeof(DrawContextGLPers))
            {
                WorldScale    = currentDC.WorldScale;
                mUnitPerMilli = deviceSize.Width / pageSize.Width;
                CopyCamera(currentDC);
                CopyProjectionMatrix(currentDC);

                DeviceScaleX = currentDC.ViewWidth / 4;
                DeviceScaleY = -(currentDC.ViewHeight / 4);
            }
            else
            {
                CopyProjectionMetrics(currentDC);
                CopyCamera(currentDC);
                WorldScale   = currentDC.WorldScale;
                UnitPerMilli = deviceSize.Width / pageSize.Width;
                SetViewSize(deviceSize.Width, deviceSize.Height);
            }

            Vector3d org = default;

            org.X = deviceSize.Width / 2.0;
            org.Y = deviceSize.Height / 2.0;

            SetViewOrg(org);

            SetupDrawing();
        }
Exemplo n.º 2
0
        public override DrawContext CreatePrinterContext(CadSize2D pageSize, CadSize2D deviceSize)
        {
            DrawContextGL dc = new DrawContextGLPers();

            dc.CopyProjectionMetrics(this);
            dc.WorldScale = WorldScale;

            dc.CopyCamera(this);
            dc.SetViewSize(deviceSize.Width, deviceSize.Height);

            Vector3d org = default;

            org.X = deviceSize.Width / 2.0;
            org.Y = deviceSize.Height / 2.0;

            dc.SetViewOrg(org);

            dc.UnitPerMilli = deviceSize.Width / pageSize.Width;

            return(dc);
        }