public bool ExtractLight(out RawImage exported) { byte[] res = new byte[ImageData.Length]; bool success = false; for(int i = 0; i < res.Length; i++) { byte b = ImageData[i]; if(b >= 192) { res[i] = b; success = true; } } exported = new RawImage(res, GetWidth(), GetHeight()); return success; }
/// <summary> /// Loads all images. /// </summary> public static void Load() { images = new RawImage[infos.Length]; using(FileStream stream = new FileStream(Paths.Main, FileMode.Open)) { for(int i = 0; i < infos.Length; i++) { ImageLocationInfo info = infos[i]; if(stream.Position != info.Position) { stream.Seek(info.Position, SeekOrigin.Begin); } images[i] = new RawImage(stream, info.Width, info.Height); } } }
/// <summary> /// Creates graphic plane with predefined background. /// </summary> /// <param name="width"> /// Width of graphic plane. /// </param> /// <param name="height"> /// Height of graphic plane. /// </param> public GraphicPlane(int width, int height) : this() { Background = new RawImage(new byte[width*height], width, height); }
private static RawImage[] LoadTileset(int index) { int fx, tx; if(!Common.E(index, out fx, out tx))return null; using(FileStream stream = new FileStream(Paths.IconGraphicsN.Format(fx), FileMode.Open)) { XLDNavigator nav = XLDNavigator.ReadToIndex(stream, (short)tx); int len = nav.SubfileLength; RawImage[] tileset = new RawImage[len/256]; for(int i = 0; i < len/256; i++) { tileset[i] = new RawImage(nav, 16, 16); } return tileset; } }