Beispiel #1
0
        private SceneNode createNode(SceneShape shape, ScenicColor color, SceneNode brush)
        {
            if (color != null)
            {
                shape.Color = color;

                return(shape);
            }
            else
            {
                SceneClip sc = new SceneClip(shape);

                sc.add(brush);

                return(sc);
            }
        }
Beispiel #2
0
 public virtual void set_Renamed(State state)
 {
     this.scene = state.scene;
     //UPGRADE_ISSUE: Method 'java.awt.geom.AffineTransform.setTransform' was not converted. 'ms-help://MS.VSCC.2003/commoner/redir/redirect.htm?keyword="jlca1000_javaawtgeomAffineTransformsetTransform_javaawtgeomAffineTransform_3"'
     //TODO PENDING this.transform.setTransform(state.transform);
     this.font                      = state.font;
     this.strokeColor               = state.strokeColor;
     this.fillColor                 = state.fillColor;
     this.fillBrush                 = state.fillBrush;
     this.lineWidth                 = state.lineWidth;
     this.lineCap                   = state.lineCap;
     this.lineJoin                  = state.lineJoin;
     this.miterLimit                = state.miterLimit;
     this.lineDashLengths           = state.lineDashLengths;
     this.lineDashPhase             = state.lineDashPhase;
     this.fillRule                  = state.fillRule;
     this.textPosition              = state.textPosition;
     this.usesFractionalFontMetrics = state.usesFractionalFontMetrics;
 }
Beispiel #3
0
 internal override int getDrawType(DrawContext context, System.Drawing.Drawing2D.Matrix transform, ScenicColor color)
 {
     return((context.AAFilter != null) ? DRAW_SURFACE4X : DRAW_SIMPLE);
 }
Beispiel #4
0
        internal override void draw(DrawContext context, System.Drawing.Drawing2D.Matrix transform, ScenicColor color)
        {
            if (tesselator == null)
            {
                tesselator = new Tesselator(path);
            }

            context.renderer.setTransform(context.context, transform);
            context.renderer.color(context.context, color);
            //PENDING context.renderer.setPolygonAntialiasingFilter(context.context, context.AAFilter);
            tesselator.draw(context, transform);
        }
Beispiel #5
0
 public void color(int contextId, ScenicColor pcolor)
 {
     Render.Context context = getContext(contextId);
     context.color = pcolor;
 }
Beispiel #6
0
        /// <summary> Interpolates between the given colors. The v parameter should
        /// be in the range [0, 1].
        ///
        /// </summary>
        /// <param name="a">the first color to be interpolated.
        /// </param>
        /// <param name="b">the second color to be interpolated.
        /// </param>
        /// <param name="v">selects the position between the colors.
        /// </param>
        /// <returns> the interpolated color.
        /// </returns>
        public static ScenicColor interpolate(ScenicColor a, ScenicColor b, float v)
        {
            float v2 = 1.0f - v;

            return(new ScenicColor(a.red * v2 + b.red * v, a.green * v2 + b.green * v, a.blue * v2 + b.blue * v, a.alpha * v2 + b.alpha * v));
        }
Beispiel #7
0
 internal abstract void draw(DrawContext context, System.Drawing.Drawing2D.Matrix transform, ScenicColor color);
Beispiel #8
0
        private void drawUsingTexture(DrawContext context, System.Drawing.Drawing2D.Matrix transform, ScenicColor color)
        {
#if PENDING
            System.Drawing.Drawing2D.Matrix at = Util.linearTransform(transform);

            GlyphCache.CachedFont drawFont = new GlyphCache.CachedFont(font, at);
            GlyphCache            cache    = Device.GlyphCache;
            Image  img  = (Image)cache.Image;
            double texm = 1.0 / img.getWidth();

            context.renderer.color(context.context, color);
            context.renderer.beginText(context.context);
            context.renderer.setTextTexture(context.context, img.Id);

            for (int i = 0; i < glyphCodes.Length; i++)
            {
                GlyphImage g = cache.getGlyph(drawFont, glyphCodes[i]);

                if (g == null)
                {
                    context.renderer.endText(context.context);
                    g = cache.renderGlyph(drawFont, glyphCodes[i]);
                    context.renderer.beginText(context.context);
                    context.renderer.setTextTexture(context.context, img.Id);
                }
                if (g != null && !g.cache.IsEmpty && g.width > 0 && g.height > 0)
                {
                    System.Drawing.Rectangle r = g.cache;
                    double px  = positions[i * 2];
                    double py  = positions[i * 2 + 1];
                    double tpx = (float)transform.Elements.GetValue(0) * px + (float)transform.Elements.GetValue(2) * py + (System.Single)transform.OffsetX;
                    double tpy = (float)transform.Elements.GetValue(1) * px + (float)transform.Elements.GetValue(3) * py + (System.Single)transform.OffsetY;
                    double ix  = System.Math.Floor(tpx + 0.5001) - g.x;
                    double iy  = System.Math.Floor(tpy + 0.5001) - g.y;

                    //UPGRADE_WARNING: Data types in Visual C# might be different.  Verify the accuracy of narrowing conversions. 'ms-help://MS.VSCC.2003/commoner/redir/redirect.htm?keyword="jlca1042_3"'
                    context.renderer.drawGlyph(context.context, (float)(r.X * texm), (float)(r.Y * texm), (float)(r.Width * texm), (float)(r.Height * texm), (int)ix, (int)iy, g.width, g.height);
                }
            }
            context.renderer.endText(context.context);
#endif
        }
Beispiel #9
0
        internal override void draw(DrawContext context, System.Drawing.Drawing2D.Matrix transform, ScenicColor color)
        {
            if (font == null)
            {
                return;
            }

            if (usePolygon(context, transform))
            {
                drawUsingPolygon(context, transform, color);
            }
            else
            {
                drawUsingTexture(context, transform, color);
            }
        }
Beispiel #10
0
 internal abstract void draw(DrawContext context, System.Drawing.Drawing2D.Matrix transform, ScenicColor color);
Beispiel #11
0
 internal virtual int getDrawType(DrawContext context, System.Drawing.Drawing2D.Matrix transform, ScenicColor color)
 {
     return DRAW_SIMPLE;
 }
Beispiel #12
0
        /// <summary> Interpolates between the given colors. The v parameter should
        /// be in the range [0, 1].
        /// 
        /// </summary>
        /// <param name="a">the first color to be interpolated.
        /// </param>
        /// <param name="b">the second color to be interpolated.
        /// </param>
        /// <param name="v">selects the position between the colors.
        /// </param>
        /// <returns> the interpolated color.
        /// </returns>
        public static ScenicColor interpolate(ScenicColor a, ScenicColor b, float v)
        {
            float v2 = 1.0f - v;

            return new ScenicColor(a.red * v2 + b.red * v, a.green * v2 + b.green * v, a.blue * v2 + b.blue * v, a.alpha * v2 + b.alpha * v);
        }
Beispiel #13
0
        private void drawUsingTexture(DrawContext context, System.Drawing.Drawing2D.Matrix transform, ScenicColor color)
        {
            #if PENDING
            System.Drawing.Drawing2D.Matrix at = Util.linearTransform(transform);

            GlyphCache.CachedFont drawFont = new GlyphCache.CachedFont(font, at);
            GlyphCache cache = Device.GlyphCache;
            Image img = (Image)cache.Image;
            double texm = 1.0 / img.getWidth();

            context.renderer.color(context.context, color);
            context.renderer.beginText(context.context);
            context.renderer.setTextTexture(context.context, img.Id);

            for (int i = 0; i < glyphCodes.Length; i++)
            {
                GlyphImage g = cache.getGlyph(drawFont, glyphCodes[i]);

                if (g == null)
                {
                    context.renderer.endText(context.context);
                    g = cache.renderGlyph(drawFont, glyphCodes[i]);
                    context.renderer.beginText(context.context);
                    context.renderer.setTextTexture(context.context, img.Id);
                }
                if (g != null && !g.cache.IsEmpty && g.width > 0 && g.height > 0)
                {
                    System.Drawing.Rectangle r = g.cache;
                    double px = positions[i * 2];
                    double py = positions[i * 2 + 1];
                    double tpx = (float)transform.Elements.GetValue(0) * px + (float)transform.Elements.GetValue(2) * py + (System.Single)transform.OffsetX;
                    double tpy = (float)transform.Elements.GetValue(1) * px + (float)transform.Elements.GetValue(3) * py + (System.Single)transform.OffsetY;
                    double ix = System.Math.Floor(tpx + 0.5001) - g.x;
                    double iy = System.Math.Floor(tpy + 0.5001) - g.y;

                    //UPGRADE_WARNING: Data types in Visual C# might be different.  Verify the accuracy of narrowing conversions. 'ms-help://MS.VSCC.2003/commoner/redir/redirect.htm?keyword="jlca1042_3"'
                    context.renderer.drawGlyph(context.context, (float)(r.X * texm), (float)(r.Y * texm), (float)(r.Width * texm), (float)(r.Height * texm), (int)ix, (int)iy, g.width, g.height);
                }
            }
            context.renderer.endText(context.context);
            #endif
        }
Beispiel #14
0
        private void drawUsingPolygon(DrawContext context, System.Drawing.Drawing2D.Matrix transform, ScenicColor color)
        {
            #if PENDING
            if (glyphPolygons == null)
            {
                glyphPolygons = new FilledPath[glyphCodes.Length];
                for (int i = 0; i < glyphCodes.Length; i++)
                {
                    System.Drawing.Drawing2D.Matrix temp_Matrix;
                    temp_Matrix = new System.Drawing.Drawing2D.Matrix();
                    temp_Matrix.Translate((float) positions[i * 2], (float) positions[i * 2 + 1]);
                    System.Drawing.Drawing2D.Matrix at = temp_Matrix;
                    //UPGRADE_TODO: Interface 'java.awt.Shape' was converted to 'System.Drawing.Drawing2D.GraphicsPath' which has a different behavior. 'ms-help://MS.VSCC.2003/commoner/redir/redirect.htm?keyword="jlca1073_3"'
                    System.Drawing.Drawing2D.GraphicsPath shape = TextRenderer.getGlyphOutline(font, at, glyphCodes[i]);
                    Path path = new AWTShapePath(shape);

                    glyphPolygons[i] = new FilledPath(path);
                }
            }

            System.Drawing.Drawing2D.Matrix temp = new System.Drawing.Drawing2D.Matrix();

            for (int i = 0; i < glyphPolygons.Length; i++)
            {
                System.Drawing.Drawing2D.Matrix temp_Matrix2;
                temp_Matrix2 = new System.Drawing.Drawing2D.Matrix();
                temp_Matrix2.Translate((float) positions[i * 2], (float) positions[i * 2 + 1]);
                System.Drawing.Drawing2D.Matrix at = temp_Matrix2;

                //UPGRADE_ISSUE: Method 'java.awt.geom.AffineTransform.setTransform' was not converted. 'ms-help://MS.VSCC.2003/commoner/redir/redirect.htm?keyword="jlca1000_javaawtgeomAffineTransformsetTransform_javaawtgeomAffineTransform_3"'
                temp.setTransform(transform);
                //UPGRADE_TODO: Method 'java.awt.geom.AffineTransform.concatenate' was converted to 'System.Drawing.Drawing2D.Matrix.Multiply' which has a different behavior. 'ms-help://MS.VSCC.2003/commoner/redir/redirect.htm?keyword="jlca1073_javaawtgeomAffineTransformconcatenate_javaawtgeomAffineTransform_3"'
                temp.Multiply(at, System.Drawing.Drawing2D.MatrixOrder.Append);
                glyphPolygons[i].draw(context, temp, color);
            }
            #endif
        }
Beispiel #15
0
 internal override int getDrawType(DrawContext context, System.Drawing.Drawing2D.Matrix transform, ScenicColor color)
 {
     if (usePolygon(context, transform))
         return DRAW_SURFACE4X;
     else
         return DRAW_SIMPLE;
 }
Beispiel #16
0
        internal override void draw(DrawContext context, System.Drawing.Drawing2D.Matrix transform, ScenicColor color)
        {
            if (font == null)
                return;

            if (usePolygon(context, transform))
                drawUsingPolygon(context, transform, color);
            else
                drawUsingTexture(context, transform, color);
        }
Beispiel #17
0
 internal override void draw(DrawContext context, System.Drawing.Drawing2D.Matrix transform, ScenicColor color)
 {
     context.renderer.color(context.context, color);
     context.renderer.setTransform(context.context, transform);
     context.renderer.polylineSetStyle(context.context, (float)lineWidth, endCap, lineJoin, (float)miterLimit, dashArray, dashPhase);
     path.walk(new Walker(this, context), transform, context.pathError);
 }
Beispiel #18
0
 internal override int getDrawType(DrawContext context, System.Drawing.Drawing2D.Matrix transform, ScenicColor color)
 {
     if (color.alpha != 1.0f)
         return SceneShape.DRAW_SURFACE;
     return SceneShape.DRAW_SIMPLE;
 }
Beispiel #19
0
        private void drawUsingPolygon(DrawContext context, System.Drawing.Drawing2D.Matrix transform, ScenicColor color)
        {
#if PENDING
            if (glyphPolygons == null)
            {
                glyphPolygons = new FilledPath[glyphCodes.Length];
                for (int i = 0; i < glyphCodes.Length; i++)
                {
                    System.Drawing.Drawing2D.Matrix temp_Matrix;
                    temp_Matrix = new System.Drawing.Drawing2D.Matrix();
                    temp_Matrix.Translate((float)positions[i * 2], (float)positions[i * 2 + 1]);
                    System.Drawing.Drawing2D.Matrix at = temp_Matrix;
                    //UPGRADE_TODO: Interface 'java.awt.Shape' was converted to 'System.Drawing.Drawing2D.GraphicsPath' which has a different behavior. 'ms-help://MS.VSCC.2003/commoner/redir/redirect.htm?keyword="jlca1073_3"'
                    System.Drawing.Drawing2D.GraphicsPath shape = TextRenderer.getGlyphOutline(font, at, glyphCodes[i]);
                    Path path = new AWTShapePath(shape);

                    glyphPolygons[i] = new FilledPath(path);
                }
            }

            System.Drawing.Drawing2D.Matrix temp = new System.Drawing.Drawing2D.Matrix();

            for (int i = 0; i < glyphPolygons.Length; i++)
            {
                System.Drawing.Drawing2D.Matrix temp_Matrix2;
                temp_Matrix2 = new System.Drawing.Drawing2D.Matrix();
                temp_Matrix2.Translate((float)positions[i * 2], (float)positions[i * 2 + 1]);
                System.Drawing.Drawing2D.Matrix at = temp_Matrix2;

                //UPGRADE_ISSUE: Method 'java.awt.geom.AffineTransform.setTransform' was not converted. 'ms-help://MS.VSCC.2003/commoner/redir/redirect.htm?keyword="jlca1000_javaawtgeomAffineTransformsetTransform_javaawtgeomAffineTransform_3"'
                temp.setTransform(transform);
                //UPGRADE_TODO: Method 'java.awt.geom.AffineTransform.concatenate' was converted to 'System.Drawing.Drawing2D.Matrix.Multiply' which has a different behavior. 'ms-help://MS.VSCC.2003/commoner/redir/redirect.htm?keyword="jlca1073_javaawtgeomAffineTransformconcatenate_javaawtgeomAffineTransform_3"'
                temp.Multiply(at, System.Drawing.Drawing2D.MatrixOrder.Append);
                glyphPolygons[i].draw(context, temp, color);
            }
#endif
        }
Beispiel #20
0
 internal override void draw(DrawContext context, System.Drawing.Drawing2D.Matrix transform, ScenicColor color)
 {
     context.renderer.color(context.context, color);
     context.renderer.setTransform(context.context, transform);
     context.renderer.polylineSetStyle(context.context, (float)lineWidth, endCap, lineJoin, (float)miterLimit, dashArray, dashPhase);
     path.walk(new Walker(this, context), transform, context.pathError);
 }
Beispiel #21
0
 internal override int getDrawType(DrawContext context, System.Drawing.Drawing2D.Matrix transform, ScenicColor color)
 {
     if (usePolygon(context, transform))
     {
         return(DRAW_SURFACE4X);
     }
     else
     {
         return(DRAW_SIMPLE);
     }
 }
Beispiel #22
0
 internal override int getDrawType(DrawContext context, System.Drawing.Drawing2D.Matrix transform, ScenicColor color)
 {
     if (color.alpha != 1.0f)
     {
         return(SceneShape.DRAW_SURFACE);
     }
     return(SceneShape.DRAW_SIMPLE);
 }
Beispiel #23
0
 internal virtual int getDrawType(DrawContext context, System.Drawing.Drawing2D.Matrix transform, ScenicColor color)
 {
     return(DRAW_SIMPLE);
 }
Beispiel #24
0
 public void color(int contextId, ScenicColor pcolor)
 {
     Render.Context context = getContext(contextId);
     context.color = pcolor;
 }