Esempio n. 1
0
File: VRTF.cs Progetto: yakoder/s3pi
        public static int ByteSizeFromFormat(ElementFormat f)
        {
            switch (f)
            {
            case ElementFormat.Float1:
            case ElementFormat.UByte4:
            case ElementFormat.ColorUByte4:
            case ElementFormat.UByte4N:
            case ElementFormat.UShort2N:
            case ElementFormat.Short2:
                return(4);

            case ElementFormat.UShort4N:
            case ElementFormat.Float2:
            case ElementFormat.Short4:
            case ElementFormat.Short4N:
            case ElementFormat.Short4_DropShadow:
                return(8);

            case ElementFormat.Float3:
                return(12);

            case ElementFormat.Float4:
                return(16);

            default:
                throw new NotImplementedException();
            }
        }
Esempio n. 2
0
File: VRTF.cs Progetto: yakoder/s3pi
 public ElementLayout(int APIversion, EventHandler handler, ElementFormat format, byte offset, ElementUsage usage, byte usageIndex) : base(APIversion, handler)
 {
     mFormat     = format;
     mOffset     = offset;
     mUsage      = usage;
     mUsageIndex = usageIndex;
 }
Esempio n. 3
0
    private void createContent()
    {
        FontDescription font = new FontDescription();

        if (Capabilities.os.search("Mac OS") > -1)
        {
            font.fontName = "\u5C0F\u585A\u660E\u671D" + " Pro R"; // "Kozuka Mincho Pro R"
        }
        //koFont.fontName = "Adobe " + "\uBA85\uC870" + " Std M"; // "Adobe Myungjo Std M"
        else
        {
            font.fontName = "Kozuka Mincho Pro R";
        }

        ElementFormat format = new ElementFormat();

        format.fontDescription = font;
        format.fontSize        = 12;
        format.locale          = "ja";
        format.color           = 0x000000;
        if (!vertical)
        {
            format.textRotation = TextRotation.ROTATE_0;
        }

        textBlocks = new Vector <TextBlock>();
        textBlocks.push(
            paragraph1(format),
            paragraph2(format),
            paragraph3(format)
            );
    }
Esempio n. 4
0
File: VRTF.cs Progetto: yakoder/s3pi
            private void Parse(Stream s)
            {
                BinaryReader br = new BinaryReader(s);

                mUsage      = (ElementUsage)br.ReadByte();
                mUsageIndex = br.ReadByte();
                mFormat     = (ElementFormat)br.ReadByte();
                mOffset     = br.ReadByte();
            }
Esempio n. 5
0
    private TextBlock paragraph3(ElementFormat format)
    {
        string p = "\u3010" + "2007"
                   + "\u5E74" + "2" + "\u6708" + "21"
                   + "\u65E5\u3011";
        TextBlock textBlock = createEmptyBlock();

        textBlock.content = new TextElement(p, format);
        return(textBlock);
    }
Esempio n. 6
0
    private TextBlock paragraph1(ElementFormat format)
    {
        string p = "\u5185\u95A3\u5E9C\u304C\u300C\u653F\u5E9C\u30A4"
                   + "\u30F3\u30BF\u30FC\u30CD\u30C3\u30C8\u30C6\u30EC"
                   + "\u30D3\u300D\u306E\u52D5\u753B\u914D\u4FE1\u5411"
                   + "\u3051\u306B\u30A2\u30C9\u30D3\u30B7\u30B9\u30C6"
                   + "\u30E0\u30BA\u793E\u306E"
                   + "FMS 2"
                   + "\u3092\u63A1\u7528\u3059\u308B\u3068"
                   + "\u767a\u8868\u3057\u307e\u3057\u305F\u3002";

        TextBlock textBlock = createEmptyBlock();

        textBlock.content = new TextElement(p, format);
        return(textBlock);
    }
Esempio n. 7
0
    private TextBlock paragraph2(ElementFormat format)
    {
        string p = "\u30AF\u30ED\u30B9\u30D7\u30E9\u30C3\u30C8\u30D5"
                   + "\u30A9\u30FC\u30E0\u4E0A\u3067\u518D\u751F\u53EF"
                   + "\u80FD\u306A"
                   + "Flash Video"
                   + "\u3092\u914D\u4FE1\u3001\u653F\u5E9C\u6700\u65B0"
                   + "\u60C5\u5831\u3092\u3088\u308A\u591A\u304F\u306E"
                   + "\u56FD\u6C11\u306B\u9AD8\u54C1\u8CEA\u306A\u753B"
                   + "\u50CF\u3067\u7C21\u5358\u304B\u3064\u30EA\u30A2"
                   + "\u30EB\u30BF\u30A4\u30E0\u306B\u63D0\u4F9B\u3059"
                   + "\u308B\u3053\u3068\u304C\u53EF\u80FD\u306B\u306A"
                   + "\u308A\u307e\u3057\u305F\u3002";

        TextBlock textBlock = createEmptyBlock();

        textBlock.content = new TextElement(p, format);
        return(textBlock);
    }
Esempio n. 8
0
        public void DrawString(Graphics g, string s, Font font, Brush brush, RectangleF rect, StringFormat format)
        {
            if (format == null)
            {
                format = StringFormat.GenericDefault;
            }

            //case 128101
            flash.text.TextRenderer.antiAliasType = AntiAliasType.ADVANCED;
            flash.text.TextRenderer.maxLevel      = 7;

            _font   = font;
            _format = format;

            _nowrap = format.NoWrap;
            //_noclip = format.NoClip;
            _vertical = format.IsVertical;
            _rtl      = format.IsRightToLeft;

            var fd = font.FontDescription;

            double fontSize = font.SizeInPixels;

            //double scale = 1;
            //while (fontSize > 127)
            //{
            //    fontSize /= 2;
            //    scale *= 2;
            //}

            var ef = new ElementFormat(fd)
            {
                fontSize = fontSize
            };

            //var solidBrush = brush as SolidBrush;
            //_color = solidBrush != null ? solidBrush.Color : Color.FromArgb(0xff, 0xff, 0xff, 0xff);

            _color   = GetColor(brush);
            ef.color = ColorHelper.ToFlash(_color);
            ef.alpha = _color.A / 255.0;

            var textElem  = new TextElement(s, ef);
            var textBlock = new TextBlock(textElem);

            bool addContainer = true;

            if (g.NoTextContainer)
            {
                _container   = g._container;
                addContainer = false;
            }
            else
            {
                _container = new Sprite {
                    x = rect.X, y = rect.Y
                };
            }

            _x = 0;
            _y = 0;

            if (_vertical)
            {
                textBlock.lineRotation = TextRotation.ROTATE_90;
                _availWidth            = rect.Height;
                _availHeight           = rect.Width;
                if (_rtl)
                {
                    _x = _availHeight;
                }
            }
            else
            {
                _availWidth  = rect.Width;
                _availHeight = rect.Height;
            }

            _ph = 0;
            Layout(textBlock);

            VAlign(_availHeight - _ph);

            //if (scale != 1)
            //{
            //    _container.scaleX = scale;
            //    _container.scaleY = scale;
            //}

            if (addContainer)
            {
                g.AddChild(_container, true);
            }

            //if (solidBrush != null)
            //{
            //    g.AddChild(_container, true);
            //}
            //else
            //{
            //    var sprite = g.BeginSprite(brush, null);
            //    sprite.graphics.drawRect(rect.X, rect.Y, rect.Width, rect.Height);
            //    g.EndObject(sprite, true);
            //    _container.x = 0;
            //    _container.y = 0;
            //    sprite.addChild(_container);
            //    sprite.mask = _container;
            //}
        }