private void ImportButton_Click(object sender, EventArgs e) { Bitmap bitmap = ImageFormRef.ImportFilenameDialog(this); if (bitmap == null) { return; } int width = 2 * 8; int height = 2 * 8; if (bitmap.Width != width || bitmap.Height != height) { R.ShowStopError("画像サイズが正しくありません。\r\nWidth:{2} Height:{3} でなければなりません。\r\n\r\n選択された画像のサイズ Width:{0} Height:{1}", bitmap.Width, bitmap.Height, width, height); return; } uint skillPaletteAddress = GetSkillPaletteAddress((uint)W2.Value); //check palette { string palette_error = ImageUtil.CheckPalette(bitmap.Palette , Program.ROM.Data , skillPaletteAddress , U.NOT_FOUND ); if (palette_error != "") { ErrorPaletteShowForm f = (ErrorPaletteShowForm)InputFormRef.JumpFormLow <ErrorPaletteShowForm>(); f.SetErrorMessage(palette_error); f.SetOrignalImage(ImageUtil.OverraidePalette(bitmap, Program.ROM.Data, skillPaletteAddress)); f.SetReOrderImage1(ImageUtil.ReOrderPalette(bitmap, Program.ROM.Data, skillPaletteAddress)); f.ShowForceButton(); f.ShowDialog(); bitmap = f.GetResultBitmap(); if (bitmap == null) { return; } } } uint index = (uint)this.AddressList.SelectedIndex; uint iconbaseaddr = Program.ROM.p32(Program.ROM.RomInfo.icon_pointer()); uint size = 16 * 16 / 2; // /2しているのは16色のため uint addr = iconbaseaddr + (size * (0x100 + index)); byte[] image = ImageUtil.ImageToByte16Tile(bitmap, width, height); //画像等データの書き込み Undo.UndoData undodata = Program.Undo.NewUndoData(this); Program.ROM.write_range(U.toOffset(addr), image, undodata); Program.Undo.Push(undodata); InputFormRef.ReloadAddressList(); InputFormRef.ShowWriteNotifyAnimation(this, addr); }
private void ImportButton_Click(object sender, EventArgs e) { Bitmap bitmap = ImageFormRef.ImportFilenameDialog(this); if (bitmap == null) { return; } int width = 4 * 8; int height = 60 * 8; if (width != bitmap.Width || height > bitmap.Height) { Bitmap newbitmap = ImageUtil.ConvertSizeFormat(bitmap, width, height); if (newbitmap == null) { R.ShowStopError("画像サイズが正しくありません。\r\nWidth:{2} Height:{3} でなければなりません。\r\n\r\n選択された画像のサイズ Width:{0} Height:{1}", bitmap.Width, bitmap.Height, width, height); return; } bitmap.Dispose(); bitmap = newbitmap; } //check palette { string palette_error = ImageUtil.CheckPalette(bitmap.Palette , Program.ROM.Data , (Program.ROM.RomInfo.unit_icon_palette_address()) , (Program.ROM.RomInfo.unit_icon_enemey_palette_address()) ); if (palette_error != "") { ErrorPaletteShowForm f = (ErrorPaletteShowForm)InputFormRef.JumpFormLow <ErrorPaletteShowForm>(); f.SetErrorMessage(palette_error); f.SetOrignalImage(ImageUtil.OverraidePalette(bitmap, Program.ROM.Data, (Program.ROM.RomInfo.unit_icon_palette_address()))); f.SetReOrderImage1(ImageUtil.ReOrderPalette(bitmap, Program.ROM.Data, (Program.ROM.RomInfo.unit_icon_palette_address()))); f.SetReOrderImage2(ImageUtil.ReOrderPalette(bitmap, Program.ROM.Data, (Program.ROM.RomInfo.unit_icon_enemey_palette_address()))); f.ShowForceButton(); f.ShowDialog(); bitmap = f.GetResultBitmap(); if (bitmap == null) { return; } } } byte[] image = ImageUtil.ImageToByte16Tile(bitmap, bitmap.Width, bitmap.Height); //画像等データの書き込み Undo.UndoData undodata = Program.Undo.NewUndoData(this); this.InputFormRef.WriteImageData(this.P0, image, true, undodata); Program.Undo.Push(undodata); //ポインタの書き込み this.WriteButton.PerformClick(); }
private void ImportButton3_Click(object sender, EventArgs e) { Bitmap bitmap = ImageFormRef.ImportFilenameDialog(this); if (bitmap == null) { return; } int width = 18 * 8; int height = 2 * 8; if (bitmap.Width != width || bitmap.Height != height) { R.ShowStopError("画像サイズが正しくありません。\r\nWidth:{2} Height:{3} でなければなりません。\r\n\r\n選択された画像のサイズ Width:{0} Height:{1}", bitmap.Width, bitmap.Height, width, height); return; } //check palette { string palette_error = ImageUtil.CheckPalette(bitmap.Palette , Program.ROM.Data , Program.ROM.RomInfo.image_chapter_title_palette() , U.NOT_FOUND ); if (palette_error != "") { ErrorPaletteShowForm f = (ErrorPaletteShowForm)InputFormRef.JumpFormLow <ErrorPaletteShowForm>(); f.SetErrorMessage(palette_error); f.SetOrignalImage(ImageUtil.OverraidePalette(bitmap, Program.ROM.Data, Program.ROM.RomInfo.image_chapter_title_palette())); f.SetReOrderImage1(ImageUtil.ReOrderPalette(bitmap, Program.ROM.Data, Program.ROM.RomInfo.image_chapter_title_palette())); f.ShowForceButton(); f.ShowDialog(); bitmap = f.GetResultBitmap(); if (bitmap == null) { return; } } } byte[] image = ImageUtil.ImageToByte16Tile(bitmap, width, height); using (InputFormRef.AutoPleaseWait pleaseWait = new InputFormRef.AutoPleaseWait(this)) { //画像等データの書き込み Undo.UndoData undodata = Program.Undo.NewUndoData(this); this.InputFormRef.WriteImageData(this.P8, image, true, undodata); Program.Undo.Push(undodata); } //ポインタの書き込み this.WriteButton.PerformClick(); }
private void BORDER_ImportButton_Click(object sender, EventArgs e) { int width = 8 * 32; //256 int height = 8 * 4; //32 int palette_count = 1; if (BORDER_AddressList.SelectedIndex == 1) {//グラドだけ //256x40 height = 8 * 5; } Bitmap bitmap = ImageUtil.LoadAndConvertDecolorUI(this, null, width, height, true, palette_count); if (bitmap == null) { return; } byte[] image = ImageUtil.ImageToByte16Tile(bitmap, width, height); //check palette { uint pal = Program.ROM.p32(Program.ROM.RomInfo.worldmap_county_border_palette_pointer()); string palette_error = ImageUtil.CheckPalette(bitmap.Palette , Program.ROM.Data , (pal) , U.NOT_FOUND ); if (palette_error != "") { ErrorPaletteShowForm f = (ErrorPaletteShowForm)InputFormRef.JumpFormLow <ErrorPaletteShowForm>(); f.SetErrorMessage(palette_error); f.SetOrignalImage(ImageUtil.OverraidePalette(bitmap, Program.ROM.Data, pal)); f.ShowForceButton(); f.ShowDialog(); bitmap = f.GetResultBitmap(); if (bitmap == null) { return; } } } //画像等データの書き込み Undo.UndoData undodata = Program.Undo.NewUndoData(this); this.Border_InputFormRef.WriteImageData(this.BORDER_P0, image, true, undodata); Program.Undo.Push(undodata); //ポインタの書き込み this.BORDER_WriteButton.PerformClick(); }
private void ImportButton_Click(object sender, EventArgs e) { Bitmap bitmap = ImageFormRef.ImportFilenameDialog(this); if (bitmap == null) { return; } uint b2 = U.NOT_FOUND; if (bitmap.Width == 16) { if (bitmap.Height == 48) { b2 = 0; } else if (bitmap.Height == 96) { b2 = 1; } } else if (bitmap.Width == 32) { if (bitmap.Height == 96) { b2 = 2; } } if (b2 == U.NOT_FOUND) { R.ShowStopError("画像サイズが正しくありません。\r\n以下のどれかにする必要があります。\r\n16x48\r\n16x96\r\n32x96\r\n\r\n選択された画像のサイズ Width:{0} Height:{1}", bitmap.Width, bitmap.Height); return; } //check palette { string palette_error = ImageUtil.CheckPalette(bitmap.Palette , Program.ROM.Data , (Program.ROM.RomInfo.unit_icon_palette_address()) , (Program.ROM.RomInfo.unit_icon_enemey_palette_address()) ); if (palette_error != "") { ErrorPaletteShowForm f = (ErrorPaletteShowForm)InputFormRef.JumpFormLow <ErrorPaletteShowForm>(); f.SetErrorMessage(palette_error); f.SetOrignalImage(ImageUtil.OverraidePalette(bitmap, Program.ROM.Data, (Program.ROM.RomInfo.unit_icon_palette_address()))); f.SetReOrderImage1(ImageUtil.ReOrderPalette(bitmap, Program.ROM.Data, (Program.ROM.RomInfo.unit_icon_palette_address()))); f.SetReOrderImage2(ImageUtil.ReOrderPalette(bitmap, Program.ROM.Data, (Program.ROM.RomInfo.unit_icon_enemey_palette_address()))); f.ShowForceButton(); f.ShowDialog(); bitmap = f.GetResultBitmap(); if (bitmap == null) { return; } } } byte[] image = ImageUtil.ImageToByte16Tile(bitmap, bitmap.Width, bitmap.Height); //画像等データの書き込み Undo.UndoData undodata = Program.Undo.NewUndoData(this); this.InputFormRef.WriteImageData(this.P4, image, true, undodata); Program.Undo.Push(undodata); this.W2.Value = b2; //ポインタの書き込み this.WriteButton.PerformClick(); }