public rcode Load(string sFile, ResourcePack pack = null, bool filter = false, bool clamp = true) { pSprite = new Sprite(); if (pSprite.LoadFromFile(sFile, pack) == rcode.OK) { pDecal = new Decal(pSprite, filter, clamp); return(rcode.OK); } else { pSprite = null; return(rcode.NO_FILE); } }
public override Const.rcode LoadImageResource(Sprite spr, string sImageFile, ResourcePack pack) { var img = Image.FromFile(sImageFile); Bitmap bmp = new Bitmap(img); ImageConverter imageConverter = new ImageConverter(); byte[] xByte = (byte[])imageConverter.ConvertTo(img, typeof(byte[])); //Sprite spr = new Sprite(); spr.GetData().Clear(); for (int y = 0; y < bmp.Height; y++) { for (int x = 0; x < bmp.Width; x++) { var imgCol = bmp.GetPixel(x, y); spr.GetData().Add(new Pixel(imgCol.R, imgCol.G, imgCol.B, imgCol.A)); } } spr.height = bmp.Height; spr.width = bmp.Width; return(Const.rcode.OK); }
public abstract rcode LoadImageResource(Sprite spr, string sImageFile, ResourcePack pack);