internal PictureCel(Picture picture, int celIndex, AssetLoader loader) : base(loader) { Name = "Cel " + celIndex; BinaryReader reader = loader.Reader; reader.BaseStream.Position = 0x0E + celIndex * 0x2A; Vector2i dimensions = new Vector2i(reader.ReadUInt16(), reader.ReadUInt16()); Displacement = new Vector2i(reader.ReadUInt16(), reader.ReadUInt16()); MaskIndex = reader.ReadByte(); loader.ExpectZeroes(1, 3); Unknowns.ReadInt32s(reader, 2, "Data offsets?"); loader.ExpectZeroes(4, 1); int dataOffset = reader.ReadInt32(); loader.ExpectZeroes(4, 2); Priority = reader.ReadUInt16(); Offset = new Vector2i(reader.ReadUInt16(), reader.ReadUInt16()) * 2; if (Offset.Y > 0) Offset = new Vector2i(Offset.X, Offset.Y * 6 / 5); reader.BaseStream.Position = dataOffset; int[] indices = reader.ReadBytesAsInt32(dimensions.Product); Setup(picture.Palette.PaletteAsset, dimensions.X, dimensions.Y, indices); }
/// <summary> /// Initialise the browser. /// </summary> /// <param name="picture"></param> public PictureBrowser(Picture picture) { Picture = picture; Canvas = new PictureCanvas(picture); Canvas.Visual.DitherBlend = BlendColorsDefault; InitializeComponent(); SetStipplingSpitButtonImage(); instructionTrackBar.Width = Math.Max(picture.Instructions.Count, 200); instructionTrackBar.Maximum = picture.Instructions.Count; instructionTrackBar.Value = picture.Instructions.Count; this.picture.Width = (int)(Canvas.Resolution.X * 4 / 1.333); this.picture.Height = Canvas.Resolution.Y * 4; Layer = PictureLayer.Visual; }
/// <summary>Create a new <see cref="PictureCanvas"/> using the <see cref="Picture"/>'s dimensions, and using the <see cref="Picture"/>'s <see cref="Palette"/>, if any.</summary> public PictureCanvas(Picture picture) : this(picture.Dimensions, picture.Palette) { }