Ejemplo n.º 1
0
        /// <summary>
        /// Constructs a new instance.
        /// </summary>
        /// <param name="width">The width of the backing store in pixels.</param>
        /// <param name="height">The height of the backing store in pixels.</param>
        /// <param name="renderer">GWEN renderer.</param>
        public TextRenderer(int width, int height, FreezingArcherGwenRenderer renderer)
        {
            if (width <= 0)
                throw new ArgumentOutOfRangeException("width");
            if (height <= 0)
                throw new ArgumentOutOfRangeException("height");

            bmp = new Bitmap(width, height, System.Drawing.Imaging.PixelFormat.Format32bppArgb);
            gfx = Graphics.FromImage(bmp);
            gfx.CompositingQuality = System.Drawing.Drawing2D.CompositingQuality.HighQuality;
            gfx.SmoothingMode = System.Drawing.Drawing2D.SmoothingMode.HighQuality;
            gfx.InterpolationMode = System.Drawing.Drawing2D.InterpolationMode.HighQualityBicubic;

            // NOTE:    TextRenderingHint.AntiAliasGridFit looks sharper and in most cases better
            //          but it comes with a some problems.
            //
            //          1.  Graphic.MeasureString and format.MeasureCharacterRanges 
            //              seem to return wrong values because of this.
            //
            //          2.  While typing the kerning changes in random places in the sentence.
            // 
            //          Until 1st problem is fixed we should use TextRenderingHint.AntiAlias...  :-(

            gfx.TextRenderingHint = TextRenderingHint.AntiAlias;
            gfx.Clear(Color.Transparent);
            texture = new Texture(renderer) {Width = width, Height = height};
        }
Ejemplo n.º 2
0
        public override bool Init(FreezingArcher.Core.Application app)
        {
            base.Init(app);

            SimpleMaterial = new SimpleMaterial();
            SimpleMaterial.Init(this);

            GwenRenderer = new Gwen.Renderer.FreezingArcherGwenRenderer(this);
            Skin = new Gwen.Skin.TexturedBase(GwenRenderer, "lib/UI/Skins/NoWayOutSkin.png");
            Canvas = new Gwen.Control.Canvas(Skin);
            _PrivateCanvas = Canvas;

            return true;
        }