示例#1
0
        /// <summary>
        /// Pakuje sadržaj po lejerima u IHasCursor target objekat koristeći njegov kursor
        /// </summary>
        /// <param name="target">Objekat čijim kursorom pakuje sadržaj</param>
        private void render(ITextLayoutContentProvider source, IHasCursor target)
        {
            textCursor cursor;

            cursor = target.cursor;
            cursor.switchToZone(textCursorZone.innerZone);

            if (source != null)
            {
                List <String> lns = source.getContent().ToList();

                switch (source.blending)
                {
                case layerBlending.background:
                    cursor.switchToZone(textCursorZone.outterZone);
                    cursor.moveToCorner(textCursorZoneCorner.UpLeft);
                    foreach (String ln in lns)
                    {
                        target.write(cursor, ln, -1, true);
                        //target.write(ln, cursor.x, true, layer.target.width, true);
                    }
                    break;

                case layerBlending.semitransparent:
                    lns = lns.GetRange(source.innerBoxedTopPosition, source.innerBoxedHeight);

                    cursor.switchToZone(textCursorZone.innerBoxedZone);
                    cursor.moveToCorner(textCursorZoneCorner.UpLeft);
                    foreach (String ln in lns)
                    {
                        target.write(cursor, ln, -1, true);
                        // target.write(cursor, ln, -1, true); //ln, 0, true, source.width, true);
                    }
                    break;

                case layerBlending.transparent:
                    // lns = lns.GetRange(source.innerBoxedTopPosition, source.innerBoxedHeight);

                    cursor.switchToZone(textCursorZone.innerBoxedZone);
                    cursor.moveToCorner(textCursorZoneCorner.UpLeft);
                    for (Int32 i = source.innerBoxedTopPosition; i < source.innerBoxedBottomPosition; i++)
                    {
                        String cur = source.select(cursor, target.innerWidth, false);
                        target.write(cursor, cur);
                    }

                    break;

                case layerBlending.hidden:

                    break;
                }
            }

            cursor.switchToMainZone();
        }
示例#2
0
        /// <summary>
        /// #1 Generise sadrzaj
        /// </summary>
        private void render(ITextLayoutContentProvider source, IPlatform platform)
        {
            platform.setColors(source.foreColor, source.backColor, source.doInverseColors);

            List <String> lns = source.getContent().ToList();

            textCursor cursor = new textCursor(platform, textCursorMode.fixedZone, textCursorZone.outterZone);

            if (source is smartInfoLineSection)
            {
                string[] cnt = source.getContent();
                platform.render(cnt[0], 0, source.margin.top);
                return;
            }

            switch (source.blending)
            {
            case layerBlending.background:
                cursor.switchToZone(textCursorZone.outterZone);
                cursor.moveToCorner(textCursorZoneCorner.UpLeft);

                foreach (String ln in lns)
                {
                    platform.render(ln, 0, cursor.y);
                    cursor.nextLine();
                    //target.write(cursor, ln, -1, true);
                    //target.write(ln, cursor.x, true, layer.target.width, true);
                }
                break;

            case layerBlending.semitransparent:

                cursor = new textCursor(source, textCursorMode.fixedZone, textCursorZone.outterZone);
                cursor.switchToZone(textCursorZone.innerBoxedZone);
                cursor.moveToCorner(textCursorZoneCorner.UpLeft);
                for (Int32 i = 0; i < source.innerBoxedHeight; i++)
                {
                    cursor.moveLineTo(i);
                    String cur = source.select(cursor, source.innerBoxedHeight, true);
                    platform.render(cur, 0, cursor.y);
                }
                //lns = lns.GetRange(source.innerBoxedTopPosition, source.innerBoxedHeight);
                //cursor.moveLineTo(source.innerBoxedTopPosition);
                //cursor.switchToZone(enums.textCursorZone.innerBoxedZone);
                //cursor.moveToCorner(textCursorZoneCorner.UpLeft);
                foreach (String ln in lns)
                {
                    platform.render(ln, 0, cursor.y);
                    //target.write(cursor, ln, -1, true);
                    // target.write(cursor, ln, -1, true); //ln, 0, true, source.width, true);
                }
                break;

            case layerBlending.transparent:
                // lns = lns.GetRange(source.innerBoxedTopPosition, source.innerBoxedHeight);
                cursor = new textCursor(source, textCursorMode.fixedZone, textCursorZone.innerBoxedZone);
                cursor.switchToZone(textCursorZone.innerBoxedZone);
                cursor.moveToCorner(textCursorZoneCorner.UpLeft);
                for (Int32 i = source.innerBoxedTopPosition; i < source.innerBoxedBottomPosition; i++)
                {
                    cursor.y = i;
                    //cursor.x =
                    String cur = source.select(cursor, source.innerBoxedWidth, false);

                    platform.render(cur, cursor.x, cursor.y);
                }

                break;

            case layerBlending.hidden:

                break;
            }

            platform.setColorsBack();

            //platform.setColors(platformColorName.none);
        }