Some fixes for palette drawing. Added Colors column.

This commit is contained in:
Vladimir Kryvian
2015-08-11 15:52:38 +03:00
parent dc9b830e22
commit 6d808f08f8
10 changed files with 24 additions and 41 deletions

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

View File

@@ -27,7 +27,7 @@
<AutoIncrementBuild Value="True"/>
<MajorVersionNr Value="1"/>
<RevisionNr Value="90"/>
<BuildNr Value="84"/>
<BuildNr Value="85"/>
<StringTable CompanyName="Lab 313" FileDescription="The best TIMs tool ever!:)" ProductVersion=""/>
</VersionInfo>
<BuildModes Count="6">

View File

@@ -14,7 +14,7 @@ type
procedure Tim2Png(TIM: PTIM; CLUT_NUM: Integer; Image: PDrawSurf; TranspMode: Byte);
procedure Png2Tim(Image: PDrawSurf; Dest: PTIM);
procedure DrawClutCell(TIM: PTIM; CLUT_NUM: Integer; Grid: PDrawGrid; X, Y: Integer);
procedure DrawClut(TIM: PTIM; CLUT_NUM: Integer; Grid: PDrawGrid);
procedure SetupCLUT(TIM: PTIM; CLUT_NUM: Integer; Grid: PDrawGrid);
procedure ClearCanvas(ACanvas: PCanvas; Rect: TRect);
procedure ClearGrid(Grid: PDrawGrid);
@@ -365,7 +365,7 @@ begin
Dispose(CLUT_COLOR);
end;
procedure DrawCLUT(TIM: PTIM; CLUT_NUM: Integer; Grid: PDrawGrid);
procedure SetupCLUT(TIM: PTIM; CLUT_NUM: Integer; Grid: PDrawGrid);
var
X, Y, ROWS, COLS, COLORS: Integer;
begin
@@ -375,17 +375,6 @@ begin
ROWS := Ceil(COLORS / COLS);
Grid^.RowCount := ROWS;
(*
//Grid^.BeginUpdate;
for Y := 1 to ROWS do
for X := 1 to COLS do
begin
//ClearCanvas(@Grid^.Canvas, Grid^.CellRect(X - 1, Y - 1));
DrawClutCell(TIM, CLUT_NUM, Grid, X - 1, Y - 1);
end;
//Grid^.EndUpdate(true); *)
//Grid^.Repaint;
end;
end.

View File

@@ -644,47 +644,37 @@ object frmMain: TfrmMain
ColumnClickSorts = True
Columns = <
item
MinSize = 10
MaxSize = 200
Title.Caption = '#'
Width = 60
end
item
Alignment = taCenter
MinSize = 10
MaxSize = 200
Title.Alignment = taCenter
Title.Caption = 'BPP'
Width = 40
end
item
Alignment = taCenter
MinSize = 10
MaxSize = 200
Title.Alignment = taCenter
Title.Caption = 'CLUTs'
Width = 40
end
item
Title.Alignment = taCenter
Title.Caption = 'Colors'
Width = 40
end
item
Alignment = taCenter
MinSize = 10
MaxSize = 200
Title.Alignment = taCenter
Title.Caption = 'Type'
Width = 40
end
item
Alignment = taCenter
MinSize = 10
MaxSize = 200
Title.Alignment = taCenter
Title.Caption = 'W x H'
Width = 60
end
item
Title.Alignment = taCenter
Title.Caption = 'File Name'
Width = 56
end>
FixedCols = 0
Flat = True
@@ -709,8 +699,8 @@ object frmMain: TfrmMain
40
40
40
40
60
56
)
end
end
@@ -843,6 +833,7 @@ object frmMain: TfrmMain
TitleFont.Color = clWindowText
TitleFont.Height = -11
TitleFont.Name = 'Tahoma'
UseXORFeatures = True
OnDblClick = grdClutDblClick
OnDrawCell = grdClutDrawCell
OnKeyUp = grdClutKeyUp

View File

@@ -185,7 +185,7 @@ type
procedure SetTimsListCount(Count: Integer);
procedure UpdateCLUTInfo;
procedure DrawSelTim;
procedure DrawSelClut;
procedure SetupSelClut;
procedure SetCLUTListToNoCLUT;
function FormatFileName(const FileName: string; ListIdx_, BitMode: Integer; Magic: Byte): string;
function FormatPngName(const FileName: string; ListIdx_, BitMode, Clut: Integer): string;
@@ -284,7 +284,7 @@ end;
procedure TfrmMain.btnShowClutClick(Sender: TObject);
begin
pnlClut.Visible := not pnlClut.Visible;
UpdateTim(False, True, False);
SetupSelClut;
actReturnFocus.Execute;
end;
@@ -329,9 +329,9 @@ begin
grdTimsList.Cells[0, I] := Format('%.6d', [I]);
grdTimsList.Cells[1, I] := Format('%.2d', [TimInfoByIdx[I - 1].BitMode]);
grdTimsList.Cells[2, I] := Format('%.2d', [TimInfoByIdx[I - 1].Cluts]);
grdTimsList.Cells[3, I] := AnsiUpperCase(TIMTypeStr(TimInfoByIdx[I - 1].Magic));
grdTimsList.Cells[4, I] := Format('%.3dx%.3d', [W, H]);
grdTimsList.Cells[5, I] := SelectedScanResult.ScanFile;
grdTimsList.Cells[3, I] := Format('%.2d', [TimInfoByIdx[I - 1].Colors]);
grdTimsList.Cells[4, I] := AnsiUpperCase(TIMTypeStr(TimInfoByIdx[I - 1].Magic));
grdTimsList.Cells[5, I] := Format('%.3dx%.3d', [W, H]);
end;
grdTimsList.EndUpdate;
@@ -842,7 +842,7 @@ var
AWxH, BWxH: string;
begin
case ACol of
0, 1, 2:
0, 1, 2, 3:
begin
AIdx := StrToIntDef(grdTimsList.Cells[ACol, ARow], 0);
BIdx := StrToIntDef(grdTimsList.Cells[BCol, BRow], 0);
@@ -850,7 +850,7 @@ begin
// Result will be either <0, =0, or >0 for normal order.
Result := AIdx - BIdx;
end;
4:
5:
begin
AWxH := grdTimsList.Cells[ACol, ARow];
BWxH := grdTimsList.Cells[BCol, BRow];
@@ -1145,13 +1145,13 @@ begin
imgTim.Stretch := actStretch.Checked;
end;
procedure TfrmMain.DrawSelClut;
procedure TfrmMain.SetupSelClut;
var
TIM: PTIM;
begin
if not pnlClut.Visible then Exit;
ClearGrid(@grdClut);
//ClearGrid(@grdClut);
TIM := SelectedTimInMode;
if TIM = nil then
@@ -1164,7 +1164,7 @@ begin
grdClut.Enabled := TIMHasCLUT(TIM);
if TIMHasCLUT(TIM) then
DrawCLUT(TIM, cbbCLUT.ItemIndex, @grdClut)
SetupCLUT(TIM, cbbCLUT.ItemIndex, @grdClut)
else
begin
grdClut.ColCount := 1;
@@ -1257,7 +1257,7 @@ begin
if Tim then DrawSelTim;
if Clut then
begin
DrawSelClut;
SetupSelClut;
grdClut.Repaint;
end;
end;

View File

@@ -13,6 +13,7 @@ type
Height: Integer;
BitMode: Byte;
Cluts: Integer;
Colors: Integer;
Good: Boolean;
end;

View File

@@ -77,6 +77,8 @@ begin
else
ScanTim.Cluts := 0;
ScanTim.Colors := GetTimColorsCount(TIM);
ScanTim.Good := TIMIsGood(TIM);
pScanResult.Count := TIM^.dwTimNumber;