Example #1
0
        public override void Render(IVertexSource <T> vertexSource, uint pathIndexToRender, RGBA_Bytes colorBytes)
        {
#if use_timers
            OpenGLRenderTimer.Start();
#endif
            PushOrthoProjection();

            vertexSource.Rewind(pathIndexToRender);

            RGBA_Doubles color = colorBytes.GetAsRGBA_Doubles();

            Gl.glColor4d(color.R, color.G, color.B, color.A);

            IAffineTransformMatrix <T> transform = GetTransform();
            if (!transform.Equals(MatrixFactory <T> .NewIdentity(VectorDimension.Two)))
            {
                vertexSource = new ConvTransform <T>(vertexSource, transform);
            }

            if (m_ForceTexturedEdgeAntiAliasing)
            {
                DrawAAShape(vertexSource);
            }
            else
            {
                SendShapeToTeselator(m_RenderNowTesselator, vertexSource);
            }

            PopOrthoProjection();
#if use_timers
            OpenGLRenderTimer.Stop();
#endif
        }
Example #2
0
        public override void Render(IVertexSource vertexSource, int pathIndexToRender, RGBA_Bytes colorBytes)
        {
#if use_timers
            OpenGLRenderTimer.Start();
#endif
            PushOrthoProjection();

            vertexSource.rewind(pathIndexToRender);

            RGBA_Doubles color = colorBytes.GetAsRGBA_Doubles();

            Gl.glColor4d(color.m_r, color.m_g, color.m_b, color.m_a);

            Affine transform = GetTransform();
            if (!transform.is_identity())
            {
                vertexSource = new conv_transform(vertexSource, transform);
            }

            if (m_ForceTexturedEdgeAntiAliasing)
            {
                DrawAAShape(vertexSource);
            }
            else
            {
                SendShapeToTeselator(m_RenderNowTesselator, vertexSource);
            }

            PopOrthoProjection();
#if use_timers
            OpenGLRenderTimer.Stop();
#endif
        }
Example #3
0
        public override void Render(IVertexSource vertexSource, uint pathIndexToRender, RGBA_Bytes colorBytes)
        {
#if use_timers
            OpenGLRenderTimer.Start();
#endif
            PushOrthoProjection();

            vertexSource.rewind(pathIndexToRender);

            RGBA_Doubles color = colorBytes.GetAsRGBA_Doubles();

            Gl.glColor4d(color.m_r, color.m_g, color.m_b, color.m_a);

            m_Tesselator.BeginPolygon();

            uint   PathAndFlags = 0;
            double x, y;
            bool   haveBegunContour = false;
            while (!Path.is_stop(PathAndFlags = vertexSource.vertex(out x, out y)))
            {
                if (Path.is_close(PathAndFlags) ||
                    (haveBegunContour && Path.is_move_to(PathAndFlags)))
                {
                    m_Tesselator.EndContour();
                    haveBegunContour = false;
                }

                if (!Path.is_close(PathAndFlags))
                {
                    if (!haveBegunContour)
                    {
                        m_Tesselator.BeginContour();
                        haveBegunContour = true;
                    }

                    m_Tesselator.AddVertex(x, y);
                }
            }

            if (haveBegunContour)
            {
                m_Tesselator.EndContour();
            }

#if use_timers
            OpenGLEndPolygonTimer.Start();
#endif
            m_Tesselator.EndPolygon();
#if use_timers
            OpenGLEndPolygonTimer.Stop();
#endif

            PopOrthoProjection();
#if use_timers
            OpenGLRenderTimer.Stop();
#endif
        }
Example #4
0
        //--------------------------------------------------------------------
        public RGBA_Bytes Gradient(RGBA_Bytes c_8, double k)
        {
            RGBA_Doubles c = c_8.GetAsRGBA_Doubles();
            RGBA_Doubles ret;

            ret.m_r = m_r + (c.m_r - m_r) * k;
            ret.m_g = m_g + (c.m_g - m_g) * k;
            ret.m_b = m_b + (c.m_b - m_b) * k;
            ret.m_a = m_a + (c.m_a - m_a) * k;
            return(ret.GetAsRGBA_Bytes());
        }
Example #5
0
        public override void Render(IVertexSource vertexSource, int pathIndexToRender, RGBA_Bytes colorBytes)
        {
#if use_timers
            OpenGLRenderTimer.Start();
#endif
            PushOrthoProjection();

            vertexSource.rewind(pathIndexToRender);

            RGBA_Doubles color = colorBytes.GetAsRGBA_Doubles();

            Gl.glColor4d(color.m_r, color.m_g, color.m_b, color.m_a);

            Affine transform = GetTransform();
            if (!transform.is_identity())
            {
                vertexSource = new conv_transform(vertexSource, transform);
            }

            if (m_ForceTexturedEdgeAntiAliasing)
            {
                DrawAAShape(vertexSource);
            }
            else
            {
                SendShapeToTeselator(m_RenderNowTesselator, vertexSource);
            }

            PopOrthoProjection();
#if use_timers
            OpenGLRenderTimer.Stop();
#endif
        }
        public override void Render(IVertexSource vertexSource, uint pathIndexToRender, RGBA_Bytes colorBytes)
        {
#if use_timers
            OpenGLRenderTimer.Start();
#endif
            PushOrthoProjection();

            vertexSource.rewind(pathIndexToRender);

            RGBA_Doubles color = colorBytes.GetAsRGBA_Doubles();

            Gl.glColor4d(color.m_r, color.m_g, color.m_b, color.m_a);

            m_Tesselator.BeginPolygon();

            uint PathAndFlags = 0;
            double x, y;
            bool haveBegunContour = false;
            while (!Path.is_stop(PathAndFlags = vertexSource.vertex(out x, out y)))
            {
                if (Path.is_close(PathAndFlags)
                    || (haveBegunContour && Path.is_move_to(PathAndFlags)))
                {
                    m_Tesselator.EndContour();
                    haveBegunContour = false;
                }

                if(!Path.is_close(PathAndFlags))
                {
                    if (!haveBegunContour)
                    {
                        m_Tesselator.BeginContour();
                        haveBegunContour = true;
                    }

                    m_Tesselator.AddVertex(x, y);
                }
            }

            if (haveBegunContour)
            {
                m_Tesselator.EndContour();
            }

#if use_timers
            OpenGLEndPolygonTimer.Start();
#endif
            m_Tesselator.EndPolygon();
#if use_timers
            OpenGLEndPolygonTimer.Stop();
#endif

            PopOrthoProjection();
#if use_timers
            OpenGLRenderTimer.Stop();
#endif
        }
 //--------------------------------------------------------------------
 public RGBA_Bytes Gradient(RGBA_Bytes c_8, double k)
 {
     RGBA_Doubles c = c_8.GetAsRGBA_Doubles();
     RGBA_Doubles ret;
     ret.m_r = m_r + (c.m_r - m_r) * k;
     ret.m_g = m_g + (c.m_g - m_g) * k;
     ret.m_b = m_b + (c.m_b - m_b) * k;
     ret.m_a = m_a + (c.m_a - m_a) * k;
     return ret.GetAsRGBA_Bytes();
 }