Exemplo n.º 1
0
        public Atlas(SmartTexture tx)
        {
            this.tx  = tx;
            tx.Atlas = this;

            namedFrames = new Dictionary <object, RectF>();
        }
Exemplo n.º 2
0
 public static void Add(object key, SmartTexture tx)
 {
     if (All.ContainsKey(key))
     {
         All[key] = tx;
     }
     else
     {
         All.Add(key, tx);
     }
 }
Exemplo n.º 3
0
        public static SmartTexture Get(object src)
        {
            if (All.ContainsKey(src))
            {
                return(All[src]);
            }

            var texture = src as SmartTexture;

            if (texture != null)
            {
                return(texture);
            }

            var tx = new SmartTexture(GetBitmap(src));

            All.Add(src, tx);
            return(tx);
        }
Exemplo n.º 4
0
        public static SmartTexture CreateSolid(Color color)
        {
            var key = "1x1:" + color;

            if (All.ContainsKey(key))
            {
                return(All[key]);
            }

            var bmp = Bitmap.CreateBitmap(1, 1, Bitmap.Config.Argb8888);

            bmp.EraseColor(color);

            var tx = new SmartTexture(bmp);

            All.Add(key, tx);

            return(tx);
        }
Exemplo n.º 5
0
        public static SmartTexture CreateGradient(int Width, int Height, params int[] colors)
        {
            var key = "" + Width + "x" + Height + ":" + colors;

            if (All.ContainsKey(key))
            {
                return(All[key]);
            }

            var bmp    = Bitmap.CreateBitmap(Width, Height, Bitmap.Config.Argb8888);
            var canvas = new Canvas(bmp);
            var paint  = new Paint();

            paint.SetShader(new LinearGradient(0, 0, 0, Height, colors, null, Shader.TileMode.Clamp));
            canvas.DrawPaint(paint);

            var tx = new SmartTexture(bmp);

            All.Add(key, tx);
            return(tx);
        }
Exemplo n.º 6
0
		public virtual void Reload()
		{
			Id = new SmartTexture(bitmap).Id;
			Filter(FModeMin, FModeMax);
			Wrap(WModeH, WModeV);
		}
Exemplo n.º 7
0
 public static RectF UvRect(SmartTexture tx, int left, int top, int right, int bottom)
 {
     return(new RectF((float)left / tx.Width, (float)top / tx.Height, (float)right / tx.Width, (float)bottom / tx.Height));
 }