예제 #1
0
        public BitmapSource GetTileBitmap(SymbolID symbolID, int size)
        {
            if (m_symbolSet.Symbols.Contains(symbolID) == false)
            {
                symbolID = SymbolID.Unknown;
            }

            var symbol = m_symbolSet.Symbols[symbolID];

            var gfx = DecideTileGfx(symbol, size);

            if (gfx is VectorGfxBase)
            {
                var g = (VectorGfxBase)gfx;

                var drawing = GetVectorGfx(g);

                return(TileSetLoaderHelpers.DrawingToBitmap(drawing, size));
            }
            else if (gfx is BitmapGfx)
            {
                var g = (BitmapGfx)gfx;
                return(GetBitmapGfx(g, size));
            }
            else
            {
                throw new Exception();
            }
        }
예제 #2
0
        Drawing CreateVectorDrawing(DrawingGfx gfx)
        {
            var drawing = m_drawingResources[gfx.DrawingName].Clone();

            drawing = TileSetLoaderHelpers.NormalizeDrawing(drawing, new Point(gfx.X, gfx.Y), new Size(gfx.W, gfx.H),
                                                            gfx.Rotate, !gfx.Opaque, gfx.Opacity);

            RenderOptions.SetBitmapScalingMode(drawing, BitmapScalingMode.Fant);

            drawing.Freeze();

            return(drawing);
        }
예제 #3
0
        Drawing CreateCharDrawing(CharGfx gfx)
        {
            var fontFamily       = gfx.FontFamily != null ? gfx.FontFamily : m_symbolSet.FontFamily;
            var typeface         = new Typeface(fontFamily, FontStyles.Normal, FontWeights.Normal, FontStretches.Normal);
            var fontSize         = gfx.FontSize.HasValue ? gfx.FontSize.Value : m_symbolSet.FontSize;
            var outline          = gfx.Outline.HasValue ? gfx.Outline.Value : m_symbolSet.Outline;
            var outlineThickness = gfx.OutlineThickness.HasValue ? gfx.OutlineThickness.Value : m_symbolSet.OutlineThickness;

            var drawing = TileSetLoaderHelpers.DrawCharacter(gfx.Char, typeface, fontSize, gfx.Color, gfx.Background, outline,
                                                             outlineThickness, gfx.Reverse, gfx.Mode);

            drawing = TileSetLoaderHelpers.NormalizeDrawing(drawing, new Point(gfx.X, gfx.Y), new Size(gfx.W, gfx.H),
                                                            gfx.Rotate, !gfx.Opaque, gfx.Opacity);

            drawing.Freeze();

            return(drawing);
        }