public Bitmap Decode(RoomBlock roomBlock, int objectIndex, int imageIndex) { ObjectImage obj = roomBlock.GetOBIMs()[objectIndex]; if (obj.GetIMxx()[imageIndex].GetBOMP() == null) { return(new Bitmap(1, 1)); } var IMHD = obj.GetIMHD(); _width = IMHD.Width; _height = IMHD.Height; _imageData = obj.GetIMxx()[imageIndex].GetBOMP(); if (PaletteIndex == 0) { _pallete = roomBlock.GetDefaultPalette(); } else { _pallete = roomBlock.GetPALS().GetWRAP().GetAPALs()[PaletteIndex]; } Decode(); return(_resultBitmap); }
public Bitmap Decode(RoomBlock roomBlock, int objectIndex, int imageIndex) { var obj = roomBlock.GetOBIMs()[objectIndex]; if (obj.GetIMxx()[imageIndex].GetSMAP() == null) { return(new Bitmap(1, 1)); } var IMHD = obj.GetIMHD(); _width = IMHD.Width; _height = IMHD.Height; _transparency = roomBlock.GetTRNS().Value; _strips = obj.GetIMxx()[imageIndex].GetSMAP().Strips; if (PaletteIndex == 0) { _pallete = roomBlock.GetDefaultPalette(); } else { _pallete = roomBlock.GetPALS().GetWRAP().GetAPALs()[PaletteIndex]; } Decode(); return(_resultBitmap); }
private void SaveToDisk_Click(object sender, EventArgs e) { var dlg = new SaveFileDialog() { Filter = "PNG Files|*.png" }; var result = dlg.ShowDialog(); if (result == DialogResult.Cancel) { return; } int[] usedPalleteIndexes; Bitmap background = GenericDecodeImage(out usedPalleteIndexes); //EncoderParameters parameters = new EncoderParameters(); //var x = new System.Drawing.Imaging.Encoder(new Guid("66087055-ad66-4c7c-9a18-38a2310b8337")); //parameters.Param[0] = new EncoderParameter(x, 8); if (Export8Bits.Checked) { var convert = new ImageDepthConversor(); if (_imageType == ImageType.Costume) { var c = new List <Color>(); for (int i = 0; i < 256; i++) { c.Add(Color.Black); } PaletteData defaultPallete = _roomBlock.GetDefaultPalette(); for (int i = 0; i < _costume.Palette.Count; i++) { c[i] = defaultPallete.Colors[_costume.Palette[i]]; } background = convert.CopyToBpp(background, 8, c.ToArray()); } else { background = convert.CopyToBpp(background, 8, _roomBlock.GetDefaultPalette().Colors); } } background.Save(dlg.FileName, ImageFormat.Png); File.WriteAllText(dlg.FileName + ".idx", string.Join(";", usedPalleteIndexes)); }
public void Encode(RoomBlock roomBlock, Costume costume, int frameIndex, Bitmap imageToEncode) { _costume = costume; _pictureData = costume.Pictures[frameIndex]; _imageToEncode = imageToEncode; if (PaletteIndex == 0) { _palette = roomBlock.GetDefaultPalette(); } else { _palette = roomBlock.GetPALS().GetWRAP().GetAPALs()[PaletteIndex]; } Encode(); }
public Bitmap Decode(RoomBlock roomBlock, Costume costume, int frameIndex) { _pictureData = costume.Pictures[frameIndex]; _costume = costume; if (PaletteIndex == 0) { _palette = roomBlock.GetDefaultPalette(); } else { _palette = roomBlock.GetPALS().GetWRAP().GetAPALs()[PaletteIndex]; } Decode(); return(_resultBitmap); }
public void Encode(RoomBlock blockToEncode, Bitmap imageToEncode) { _imageToEncode = imageToEncode; RoomHeader RMHD = blockToEncode.GetRMHD(); _width = RMHD.Width; _height = RMHD.Height; _imageBomp = blockToEncode.GetRMIM().GetIM00().GetBOMP(); if (PaletteIndex == 0) { _pallete = blockToEncode.GetDefaultPalette(); } else { _pallete = blockToEncode.GetPALS().GetWRAP().GetAPALs()[PaletteIndex]; } Encode(); }
public void Encode(RoomBlock blockToEncode, Bitmap imageToEncode) { _imageToEncode = imageToEncode; var RMHD = blockToEncode.GetRMHD(); _width = RMHD.Width; _height = RMHD.Height; _transparency = blockToEncode.GetTRNS().Value; _strips = blockToEncode.GetRMIM().GetIM00().GetSMAP(); if (PaletteIndex == 0) { _pallete = blockToEncode.GetDefaultPalette(); } else { _pallete = blockToEncode.GetPALS().GetWRAP().GetAPALs()[PaletteIndex]; } Encode(); }
public void Encode(RoomBlock blockToEncode, int objectIndex, int imageIndex, Bitmap imageToEncode) { ObjectImage obj = blockToEncode.GetOBIMs()[objectIndex]; _imageToEncode = imageToEncode; var IMHD = obj.GetIMHD(); _width = IMHD.Width; _height = IMHD.Height; _imageBomp = obj.GetIMxx()[imageIndex].GetBOMP(); if (PaletteIndex == 0) { _pallete = blockToEncode.GetDefaultPalette(); } else { _pallete = blockToEncode.GetPALS().GetWRAP().GetAPALs()[PaletteIndex]; } Encode(); }
public Bitmap Decode(RoomBlock roomBlock) { var RMHD = roomBlock.GetRMHD(); _width = RMHD.Width; _height = RMHD.Height; _transparency = roomBlock.GetTRNS().Value; _strips = roomBlock.GetRMIM().GetIM00().GetSMAP().Strips; if (PaletteIndex == 0) { _pallete = roomBlock.GetDefaultPalette(); } else { _pallete = roomBlock.GetPALS().GetWRAP().GetAPALs()[PaletteIndex]; } Decode(); return(_resultBitmap); }
public void Encode(RoomBlock blockToEncode, int objectIndex, int imageIndex, Bitmap imageToEncode) { var obj = blockToEncode.GetOBIMs()[objectIndex]; _imageToEncode = imageToEncode; ObjectImageHeader IMHD = obj.GetIMHD(); _width = IMHD.Width; _height = IMHD.Height; _transparency = blockToEncode.GetTRNS().Value; _strips = obj.GetIMxx()[imageIndex].GetSMAP(); if (PaletteIndex == 0) { _pallete = blockToEncode.GetDefaultPalette(); } else { _pallete = blockToEncode.GetPALS().GetWRAP().GetAPALs()[PaletteIndex]; } Encode(); }