| 27 |  | procedure btn_saveClick(Sender: TObject); | 
 
 
 
 
 
 
 
 
 
 
 
 
 | 28 |  | procedure btn_loadClick(Sender: TObject); | 
 
 
 
 
 
 
 
 
 
 
 
 
 | 29 |  | procedure btn_replaceClick(Sender: TObject); | 
 
 
 
 
 
 
 
 | 30 | + | procedure Splitter1Moved(Sender: TObject); | 
 
 
 
 
 
 
 
 
 
 
 
 
 | 31 |  | private | 
 
 
 
 
 
 
 
 
 
 
 
 
 | 32 |  | OniImage_Old: TOniImage; | 
 
 
 
 
 
 
 
 
 
 
 
 
 | 33 |  | OniImage_New: TOniImage; | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 57 |  |  | 
 
 
 
 
 
 
 
 
 
 
 
 
 | 58 |  | OniImage_Old.LoadFromTXMP(ConnectionID, fileid); | 
 
 
 
 
 
 
 
 
 
 
 
 
 | 59 |  | old_size := OniImage_Old.GetImageSize(True); | 
 
 
 
 
 
 
 
 
 
 
 | 60 | < | OniImage_Old.DrawOnCanvas(image_txmppreview.Canvas, 2); | 
 
 
 
 
 
 
 
 
 | 60 | > | OniImage_Old.DrawOnCanvas(image_txmppreview.Canvas, 1); | 
 
 
 
 
 
 
 
 
 
 
 | 61 |  |  | 
 
 
 
 
 
 
 
 
 
 
 
 
 | 62 |  | check_fading.Checked := OniImage_Old.HasMipMaps; | 
 
 
 
 
 
 
 
 
 
 
 
 
 | 63 |  | //  check_transparency.Checked := (depthbyte and $04) > 0; | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 67 |  | end; | 
 
 
 
 
 
 
 
 
 
 
 
 
 | 68 |  |  | 
 
 
 
 
 
 
 
 
 
 
 
 
 | 69 |  |  | 
 
 
 
 
 
 
 
 | 70 | + | procedure TForm_TxmpReplace.Splitter1Moved(Sender: TObject); | 
 
 
 
 
 
 
 
 | 71 | + | begin | 
 
 
 
 
 
 
 
 | 72 | + | inherited; | 
 
 
 
 
 
 
 
 | 73 | + | image_txmppreview.Picture.Assign(nil); | 
 
 
 
 
 
 
 
 | 74 | + | image_bmppreview.Picture.Assign(nil); | 
 
 
 
 
 
 
 
 | 75 | + | if Length(OniImage_Old.Images) > 0 then | 
 
 
 
 
 
 
 
 | 76 | + | OniImage_Old.DrawOnCanvas(image_txmppreview.Canvas, 1); | 
 
 
 
 
 
 
 
 | 77 | + | if Length(OniImage_New.Images) > 0 then | 
 
 
 
 
 
 
 
 | 78 | + | OniImage_New.DrawOnCanvas(image_bmppreview.Canvas, 1); | 
 
 
 
 
 
 
 
 | 79 | + | end; | 
 
 
 
 
 
 
 
 | 80 | + |  | 
 
 
 
 
 
 
 
 
 
 
 
 
 | 81 |  | procedure TForm_TxmpReplace.btn_loadClick(Sender: TObject); | 
 
 
 
 
 
 
 
 
 
 
 
 
 | 82 |  | var | 
 
 
 
 
 
 
 
 
 
 
 
 
 | 83 |  | mem:   TMemoryStream; | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 101 |  | datbyte: Word; | 
 
 
 
 
 
 
 
 
 
 
 
 
 | 102 |  | mem: TMemoryStream; | 
 
 
 
 
 
 
 
 
 
 
 
 
 | 103 |  | new_storetype: Byte; | 
 
 
 
 
 
 
 
 | 104 | + | formatinfo: TImageFormatInfo; | 
 
 
 
 
 
 
 
 
 
 
 
 
 | 105 |  | begin | 
 
 
 
 
 
 
 
 
 
 
 
 
 | 106 |  | if filelist.ItemIndex >= 0 then | 
 
 
 
 
 
 
 
 
 
 
 
 
 | 107 |  | begin | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 139 |  | ifX8R8G8B8: new_storetype := 8; | 
 
 
 
 
 
 
 
 
 
 
 
 
 | 140 |  | ifDXT1: new_storetype := 9; | 
 
 
 
 
 
 
 
 
 
 
 
 
 | 141 |  | else | 
 
 
 
 
 
 
 
 | 142 | + | if OniImage_New.FormatInfo.HasAlphaChannel then | 
 
 
 
 
 
 
 
 | 143 | + | ShowMessage('Loaded image has an alpha-channel.' + #13#10 + | 
 
 
 
 
 
 
 
 | 144 | + | 'Because the format is neither ARGB1555' +#13#10 + | 
 
 
 
 
 
 
 
 | 145 | + | 'nor ARGB4444 it can not be imported without conversion.' + #13#10 + | 
 
 
 
 
 
 
 
 | 146 | + | 'It is converted to RGB888, so alpha gets dropped.' + #13#10 + | 
 
 
 
 
 
 
 
 | 147 | + | 'If you need alpha you have to save your image in' + #13#10 + | 
 
 
 
 
 
 
 
 | 148 | + | 'one of the previously named formats.'); | 
 
 
 
 
 
 
 
 
 
 
 
 
 | 149 |  | OniImage_New.Format := ifX8R8G8B8; | 
 
 
 
 
 
 
 
 
 
 
 
 
 | 150 |  | new_storetype := 8; | 
 
 
 
 
 
 
 
 
 
 
 
 
 | 151 |  | end; | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 183 |  | ConManager.Connection[ConnectionID].UpdateDatFilePart(fileid, $9C, 4, @new_rawaddr); | 
 
 
 
 
 
 
 
 
 
 
 
 
 | 184 |  |  | 
 
 
 
 
 
 
 
 
 
 
 
 
 | 185 |  | ShowMessage('TXMP-image replaced'); | 
 
 
 
 
 
 
 
 | 186 | + | Self.listClick(Self); | 
 
 
 
 
 
 
 
 
 
 
 
 
 | 187 |  | end; | 
 
 
 
 
 
 
 
 
 
 
 
 
 | 188 |  | end; | 
 
 
 
 
 
 
 
 
 
 
 
 
 | 189 |  |  |