Changeset 194 for oup/current


Ignore:
Timestamp:
May 26, 2007, 8:26:48 PM (18 years ago)
Author:
alloc
Message:
 
Location:
oup/current
Files:
6 edited

Legend:

Unmodified
Added
Removed
  • oup/current/Global/OniImgClass.pas

    r193 r194  
    1616    function GetImageFormat: TImageFormat;
    1717    procedure SetImageFormat(Format: TImageFormat);
     18    function pGetImageFormatInfo: TImageFormatInfo;
    1819    function GetHasMipMaps: Boolean;
    1920  protected
     
    2425    property Height[MipGen: Integer]: Integer   read GetHeight;
    2526    property Format: TImageFormat read GetImageFormat write SetImageFormat;
     27    property FormatInfo: TImageFormatInfo read pGetImageFormatInfo;
    2628    property HasMipMaps: Boolean read GetHasMipMaps;
    2729
     
    128130    for i := 0 to High(FImages) do
    129131      ConvertImage(FImages[i], Format);
     132end;
     133
     134
     135function TOniImage.pGetImageFormatInfo: TImageFormatInfo;
     136begin
     137  if Length(FImages) > 0 then
     138    GetImageFormatInfo(FImages[0].Format, Result);
    130139end;
    131140
  • oup/current/Tools/Preview.dfm

    r101 r194  
    66  PixelsPerInch = 96
    77  TextHeight = 13
     8  inherited Splitter1: TSplitter
     9    OnMoved = Splitter1Moved
     10  end
    811  inherited content: TPanel
    912    object lbl_notpossible: TLabel
  • oup/current/Tools/Preview.pas

    r193 r194  
    2929    procedure SetBitmapCount(Count: Integer);
    3030    procedure LoadImage(fileid, index: Integer);
     31    procedure Splitter1Moved(Sender: TObject);
    3132  private
    3233    bitmaps:   array of TOniImage;
     
    4142implementation
    4243{$R *.dfm}
    43 uses Imaging, ImagingComponents, ImagingTypes;
     44uses Imaging, ImagingComponents, ImagingTypes, jpeg;
    4445
    4546
     
    4849  inherited;
    4950  Self.OnNewFileSelected := NewFile;
     51  SetBitmapCount(0);
    5052end;
    5153
     
    5658begin
    5759  _fileid := fileinfo.ID;
     60  SetBitmapCount(0);
    5861  if _fileid >= 0 then
    5962  begin
     
    115118
    116119
     120procedure TForm_Preview.Splitter1Moved(Sender: TObject);
     121begin
     122  inherited;
     123  img.Picture.Assign(nil);
     124  if Length(bitmaps) > 0 then
     125    DrawImage(0);
     126end;
     127
    117128procedure TForm_Preview.PreviewImage;
    118129begin
     
    160171  Self.btn_dec.Enabled := not Self.timer.Enabled;
    161172  Self.btn_inc.Enabled := not Self.timer.Enabled;
     173  if self.timer.Enabled then
     174    timerTimer(Self);
    162175  if Self.timer.Enabled then
    163176    Self.btn_startstop.Caption := 'Stop automatic'
  • oup/current/Tools/TxmpReplace.dfm

    r192 r194  
    88  inherited Splitter1: TSplitter
    99    Height = 344
     10    OnMoved = Splitter1Moved
    1011    ExplicitHeight = 344
    1112  end
     
    104105          Width = 121
    105106          Height = 25
    106           Caption = 'Load BMP ...'
     107          Caption = 'Load image...'
    107108          TabOrder = 0
    108109          OnClick = btn_loadClick
     
    154155    DefaultExt = 'bmp'
    155156    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 (*.*)|*'
    159161    Options = [ofOverwritePrompt, ofHideReadOnly, ofPathMustExist, ofEnableSizing]
    160162    Left = 104
  • oup/current/Tools/TxmpReplace.pas

    r193 r194  
    2828    procedure btn_loadClick(Sender: TObject);
    2929    procedure btn_replaceClick(Sender: TObject);
     30    procedure Splitter1Moved(Sender: TObject);
    3031  private
    3132    OniImage_Old: TOniImage;
     
    5758  OniImage_Old.LoadFromTXMP(ConnectionID, fileid);
    5859  old_size := OniImage_Old.GetImageSize(True);
    59   OniImage_Old.DrawOnCanvas(image_txmppreview.Canvas, 2);
     60  OniImage_Old.DrawOnCanvas(image_txmppreview.Canvas, 1);
    6061
    6162  check_fading.Checked := OniImage_Old.HasMipMaps;
     
    6667end;
    6768
     69
     70procedure TForm_TxmpReplace.Splitter1Moved(Sender: TObject);
     71begin
     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);
     79end;
    6880
    6981procedure TForm_TxmpReplace.btn_loadClick(Sender: TObject);
     
    90102  mem: TMemoryStream;
    91103  new_storetype: Byte;
     104  formatinfo: TImageFormatInfo;
    92105begin
    93106  if filelist.ItemIndex >= 0 then
     
    127140      ifDXT1: new_storetype := 9;
    128141    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.'); 
    129149      OniImage_New.Format := ifX8R8G8B8;
    130150      new_storetype := 8;
     
    164184
    165185    ShowMessage('TXMP-image replaced');
     186    Self.listClick(Self);
    166187  end;
    167188end;
Note: See TracChangeset for help on using the changeset viewer.