Changeset 194
- Timestamp:
- May 26, 2007, 8:26:48 PM (18 years ago)
- Location:
- oup/current
- Files:
-
- 6 edited
Legend:
- Unmodified
- Added
- Removed
-
oup/current/Global/OniImgClass.pas
r193 r194 16 16 function GetImageFormat: TImageFormat; 17 17 procedure SetImageFormat(Format: TImageFormat); 18 function pGetImageFormatInfo: TImageFormatInfo; 18 19 function GetHasMipMaps: Boolean; 19 20 protected … … 24 25 property Height[MipGen: Integer]: Integer read GetHeight; 25 26 property Format: TImageFormat read GetImageFormat write SetImageFormat; 27 property FormatInfo: TImageFormatInfo read pGetImageFormatInfo; 26 28 property HasMipMaps: Boolean read GetHasMipMaps; 27 29 … … 128 130 for i := 0 to High(FImages) do 129 131 ConvertImage(FImages[i], Format); 132 end; 133 134 135 function TOniImage.pGetImageFormatInfo: TImageFormatInfo; 136 begin 137 if Length(FImages) > 0 then 138 GetImageFormatInfo(FImages[0].Format, Result); 130 139 end; 131 140 -
oup/current/Tools/Preview.dfm
r101 r194 6 6 PixelsPerInch = 96 7 7 TextHeight = 13 8 inherited Splitter1: TSplitter 9 OnMoved = Splitter1Moved 10 end 8 11 inherited content: TPanel 9 12 object lbl_notpossible: TLabel -
oup/current/Tools/Preview.pas
r193 r194 29 29 procedure SetBitmapCount(Count: Integer); 30 30 procedure LoadImage(fileid, index: Integer); 31 procedure Splitter1Moved(Sender: TObject); 31 32 private 32 33 bitmaps: array of TOniImage; … … 41 42 implementation 42 43 {$R *.dfm} 43 uses Imaging, ImagingComponents, ImagingTypes ;44 uses Imaging, ImagingComponents, ImagingTypes, jpeg; 44 45 45 46 … … 48 49 inherited; 49 50 Self.OnNewFileSelected := NewFile; 51 SetBitmapCount(0); 50 52 end; 51 53 … … 56 58 begin 57 59 _fileid := fileinfo.ID; 60 SetBitmapCount(0); 58 61 if _fileid >= 0 then 59 62 begin … … 115 118 116 119 120 procedure TForm_Preview.Splitter1Moved(Sender: TObject); 121 begin 122 inherited; 123 img.Picture.Assign(nil); 124 if Length(bitmaps) > 0 then 125 DrawImage(0); 126 end; 127 117 128 procedure TForm_Preview.PreviewImage; 118 129 begin … … 160 171 Self.btn_dec.Enabled := not Self.timer.Enabled; 161 172 Self.btn_inc.Enabled := not Self.timer.Enabled; 173 if self.timer.Enabled then 174 timerTimer(Self); 162 175 if Self.timer.Enabled then 163 176 Self.btn_startstop.Caption := 'Stop automatic' -
oup/current/Tools/TxmpReplace.dfm
r192 r194 8 8 inherited Splitter1: TSplitter 9 9 Height = 344 10 OnMoved = Splitter1Moved 10 11 ExplicitHeight = 344 11 12 end … … 104 105 Width = 121 105 106 Height = 25 106 Caption = 'Load BMP...'107 Caption = 'Load image...' 107 108 TabOrder = 0 108 109 OnClick = btn_loadClick … … 154 155 DefaultExt = 'bmp' 155 156 Filter = 156 'All supported files (*.bmp, *.dds)|*.bmp;*.dds|Windows Bitmap (*' + 157 '.bmp)|*.bmp|DirectDraw Surface (*.dds)|*.dds|Targa (*.tga)|*.tga' + 158 '|JPEG (*.jpg, *.jpeg)|*.jpg;*.jpeg|All files (*.*)|*' 157 'All supported files (*.bmp, *.dds, *.tga, *.jpg, *.jpeg)|*.bmp;*' + 158 '.dds;*.tga;*.jpg;*.jpeg;*.png|Windows Bitmap (*.bmp)|*.bmp|Direc' + 159 'tDraw Surface (*.dds)|*.dds|Targa (*.tga)|*.tga|JPEG (*.jpg, *.j' + 160 'peg)|*.jpg;*.jpeg|PNG (*.png)|*.png|All files (*.*)|*' 159 161 Options = [ofOverwritePrompt, ofHideReadOnly, ofPathMustExist, ofEnableSizing] 160 162 Left = 104 -
oup/current/Tools/TxmpReplace.pas
r193 r194 28 28 procedure btn_loadClick(Sender: TObject); 29 29 procedure btn_replaceClick(Sender: TObject); 30 procedure Splitter1Moved(Sender: TObject); 30 31 private 31 32 OniImage_Old: TOniImage; … … 57 58 OniImage_Old.LoadFromTXMP(ConnectionID, fileid); 58 59 old_size := OniImage_Old.GetImageSize(True); 59 OniImage_Old.DrawOnCanvas(image_txmppreview.Canvas, 2);60 OniImage_Old.DrawOnCanvas(image_txmppreview.Canvas, 1); 60 61 61 62 check_fading.Checked := OniImage_Old.HasMipMaps; … … 66 67 end; 67 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; 68 80 69 81 procedure TForm_TxmpReplace.btn_loadClick(Sender: TObject); … … 90 102 mem: TMemoryStream; 91 103 new_storetype: Byte; 104 formatinfo: TImageFormatInfo; 92 105 begin 93 106 if filelist.ItemIndex >= 0 then … … 127 140 ifDXT1: new_storetype := 9; 128 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.'); 129 149 OniImage_New.Format := ifX8R8G8B8; 130 150 new_storetype := 8; … … 164 184 165 185 ShowMessage('TXMP-image replaced'); 186 Self.listClick(Self); 166 187 end; 167 188 end;
Note:
See TracChangeset
for help on using the changeset viewer.