⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 scharacterparser.java

📁 j2me 上面flash播放器。非常值得研究。就是版本只到2.0
💻 JAVA
📖 第 1 页 / 共 3 页
字号:
                    depth--;                    return;                }        }        if(((Curve) (redge)).anchor1y == ((Curve) (redge)).anchor2y)            return;        if(flag)        {            redge.fillRule = 2;            redge.color1 = strokeColor;        } else        {            redge.fillRule = fillRule;            redge.color1 = color1;            redge.color2 = color2;        }        redge.nextObj = obj.edges;        obj.edges = redge;    }    void BuildEdges(boolean flag)    {        depth = 0;        layer = obj.depth; //id << 16;        if(flag)        {            if(!GetStyles())                return;        } else        {            super.bitPos = 0;            super.bitBuf = 0;            nFillBits = GetBits(4);            nLineBits = GetBits(4);        }        boolean flag1 = false;        boolean flag2 = false;        Curve curve = new Curve();        color1 = color2 = null;        do        {            int i = GetEdge(curve);            if(i != 0)            {                if(i == 128)                    if(flag2)                    {                        EndStroke();                        return;                    } else                    {                        return;                    }                if((i & 6) != 0)                {                    color1 = fillIndex[fill0];                    color2 = fillIndex[fill1];                    if(color1 == null && color2 != null)                    {                        color1 = color2;                        color2 = null;                    }                    fillRule = color2 == null ? useWinding ? 2 : 1 : 0;                    flag1 = color1 != null;                }                if((i & 9) != 0)                {                    if(flag2)                        EndStroke();                    if(line != 0)                    {                        BeginStroke(lineIndexThick[line], lineIndexColor[line]);                        flag2 = true;                    } else                    {                        flag2 = false;                    }                }            } else            {                if(flag2)                    AddStrokeCurve(curve);                if(flag1)                    AddCurve(curve, false);            }        } while(true);    }    final void AddEdge(Point point, Point point1)    {        if(point.y == point1.y)            return;        REdge redge = new REdge();        if(point.y > point1.y)        {            redge.dir = -1;            redge.set(point1, point);        } else        {            redge.dir = 1;            redge.set(point, point1);        }        redge.fillRule = 2;        redge.color1 = strokeColor;        redge.nextObj = obj.edges;        obj.edges = redge;    }/*    final void strokeJoin(Point point, Point point1, Point point2)    {        int i = Matrix.fastLength(point.x - point1.x, point.y - point1.y);        if(i > 3)        {            double d = Math.atan2(point.y - point2.y, point.x - point2.x);            double d1;            for(d1 = Math.atan2(point1.y - point2.y, point1.x - point2.x); d < d1; d += 6.2831853071795862D);            double d2 = d - d1;            if(d2 > 0.10000000000000001D && d2 <= 3.1415926535897931D)            {                double d3 = lineThickness / 2;                int j = (int)(d3 * d2) / 3;                Point point3 = new Point(point.x, point.y);                Point point4 = new Point(0, 0);                if(j > 1)                {                    if(j > 16)                        j = 16;                    double d4 = -d2 /j;                    double d5 = d + d4;                    for(j--; j-- > 0;)                    {                        point4.x = (int)(d3 * Math.cos(d5)) + point2.x;                        point4.y = (int)(d3 * Math.sin(d5)) + point2.y;                        AddEdge(point3, point4);                        point3.x = point4.x;                        point3.y = point4.y;                        d5 += d4;                    }                }                AddEdge(point3, point1);                return;            }        }        AddEdge(point, point1);    }*/    static final Curve CurveAdjust(Curve curve, Point point, Point point1)    {        int i = Matrix.length(curve.anchor1x - curve.anchor2x, curve.anchor1y - curve.anchor2y);        int j;        if(i > 0)        {            int k = Matrix.length(point.x - point1.x, point.y - point1.y);            j = (int)(((long)k << 16) /i);        } else        {            j = 0x10000;        }        int l = curve.controlx - curve.anchor1x;        int i1 = curve.controly - curve.anchor1y;        int j1 = curve.controlx - curve.anchor2x;        int k1 = curve.controly - curve.anchor2y;        Curve curve1 = new Curve();        curve1.anchor1x = point.x;        curve1.anchor1y = point.y;        curve1.anchor2x = point1.x;        curve1.anchor2y = point1.y;        if(Matrix.fastLength(l, i1) > Matrix.fastLength(j1, k1))        {            curve1.controlx = (int)((long)j * (long)l + 32768L >> 16) + point.x;            curve1.controly = (int)((long)j * (long)i1 + 32768L >> 16) + point.y;        } else        {            curve1.controlx = (int)((long)j * (long)j1 + 32768L >> 16) + point1.x;            curve1.controly = (int)((long)j * (long)k1 + 32768L >> 16) + point1.y;        }        return curve1;    }    static final Curve CurveReverse(Curve curve)    {        Curve curve1 = new Curve();        curve1.isLine = curve.isLine;        curve1.anchor1x = curve.anchor2x;        curve1.anchor1y = curve.anchor2y;        curve1.controlx = curve.controlx;        curve1.controly = curve.controly;        curve1.anchor2x = curve.anchor1x;        curve1.anchor2y = curve.anchor1y;        return curve1;    }/*    final void strokeThickCurve(Curve curve)    {        if(!curve.isLine && strokeDepth < 5)        {            int i = curve.flatness();            if(i > 6)            {                int k = Matrix.fastLength(curve.anchor1x - curve.anchor2x, curve.anchor1y - curve.anchor2y);                if(2 * i > k)                {                    Curve curve1 = new Curve(curve);                    Curve curve2 = curve1.divide(32768);                    strokeDepth++;                    StrokeThickCurve(curve1);                    StrokeThickCurve(curve2);                    strokeDepth--;                    return;                }            }        }        int j = lineThickness / 2;        int l = curve.controly - curve.anchor1y;        int i1 = curve.anchor1x - curve.controlx;        if(l == 0 && i1 == 0)        {            l = curve.anchor2y - curve.anchor1y;            i1 = curve.anchor1x - curve.anchor2x;        }        int j1 = Matrix.length(l, i1);        if(j1 > 0)        {            j1 = (int)(((long)j << 16) /j1);            l = (int)((long)j1 * (long)l + 32768L >> 16);            i1 = (int)((long)j1 * (long)i1 + 32768L >> 16);        }        int l1;        int i2;        if(curve.isLine)        {            l1 = l;            i2 = i1;        } else        {            l1 = curve.anchor2y - curve.controly;            i2 = curve.controlx - curve.anchor2x;            if(l1 == 0 && i2 == 0)            {                l1 = curve.anchor2y - curve.anchor1y;                i2 = curve.anchor1x - curve.anchor2x;            }            int k1 = Matrix.length(l1, i2);            if(k1 > 0)            {                k1 = (int)(((long)j << 16) /k1);                l1 = (int)((long)k1 * (long)l1 + 32768L >> 16);                i2 = (int)((long)k1 * (long)i2 + 32768L >> 16);            }        }        Point point = new Point(curve.anchor1x + l, curve.anchor1y + i1);        Point point1 = new Point(curve.anchor2x + l1, curve.anchor2y + i2);        Point point2 = new Point(curve.anchor1x - l, curve.anchor1y - i1);        Point point3 = new Point(curve.anchor2x - l1, curve.anchor2y - i2);        if(curve.isLine)        {            AddEdge(point1, point);            AddEdge(point2, point3);        } else        {            AddCurve(CurveReverse(CurveAdjust(curve, point, point1)), true);            AddCurve(CurveAdjust(curve, point2, point3), true);        }        if(!strokeInited)        {            lStartPt.x = point.x;            lStartPt.y = point.y;            startOrigin.x = curve.anchor1x;            startOrigin.y = curve.anchor1y;            rStartPt.x = point2.x;            rStartPt.y = point2.y;            strokeInited = true;        } else        {            StrokeJoin(point, lCurPt, curOrigin);            StrokeJoin(rCurPt, point2, curOrigin);        }        lCurPt.x = point1.x;        lCurPt.y = point1.y;        curOrigin.x = curve.anchor2x;        curOrigin.y = curve.anchor2y;        rCurPt.x = point3.x;        rCurPt.y = point3.y;    }*/    static final int Sign(int i)    {        if(i < 0)            return -1;        return i <= 0 ? 0 : 1;    }    final void strokeThinLine(Curve curve)    {        int i = curve.anchor2y - curve.anchor1y;        int j = curve.anchor1x - curve.anchor2x;        Point point = new Point(curve.anchor1x, curve.anchor1y);        Point point1 = new Point(curve.anchor1x, curve.anchor1y);        Point point2 = new Point(curve.anchor2x, curve.anchor2y);        Point point3 = new Point(curve.anchor2x, curve.anchor2y);        boolean flag = (i <= 0 ? -i : i) > (j <= 0 ? -j : j);        switch(lineThickness)        {        default:            break;        case 1: // '\001'            if(flag)            {                byte byte0 = i >= 0 ? ((byte) (((byte)(i <= 0 ? 0 : 1)))) : -1;                if(byte0 > 0)                {                    point.x += byte0;                    point2.x += byte0;                } else                {                    point1.x -= byte0;                    point3.x -= byte0;                }                break;            }            byte byte1 = j >= 0 ? ((byte) (((byte)(j <= 0 ? 0 : 1)))) : -1;            if(byte1 > 0)            {                point.y += byte1;                point2.y += byte1;            } else            {                point1.y -= byte1;                point3.y -= byte1;            }            break;        case 2: // '\002'            if(flag)            {                byte byte2 = i >= 0 ? ((byte) (((byte)(i <= 0 ? 0 : 1)))) : -1;                point.x += byte2;                point2.x += byte2;                point1.x -= byte2;                point3.x -= byte2;            } else            {                byte byte3 = j >= 0 ? ((byte) (((byte)(j <= 0 ? 0 : 1)))) : -1;                point.y += byte3;                point2.y += byte3;

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -