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

View File

@@ -14,7 +14,7 @@ type
procedure Tim2Png(TIM: PTIM; CLUT_NUM: Integer; Image: PDrawSurf; TranspMode: Byte); procedure Tim2Png(TIM: PTIM; CLUT_NUM: Integer; Image: PDrawSurf; TranspMode: Byte);
procedure Png2Tim(Image: PDrawSurf; Dest: PTIM); procedure Png2Tim(Image: PDrawSurf; Dest: PTIM);
procedure DrawClutCell(TIM: PTIM; CLUT_NUM: Integer; Grid: PDrawGrid; X, Y: Integer); 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 ClearCanvas(ACanvas: PCanvas; Rect: TRect);
procedure ClearGrid(Grid: PDrawGrid); procedure ClearGrid(Grid: PDrawGrid);
@@ -365,7 +365,7 @@ begin
Dispose(CLUT_COLOR); Dispose(CLUT_COLOR);
end; end;
procedure DrawCLUT(TIM: PTIM; CLUT_NUM: Integer; Grid: PDrawGrid); procedure SetupCLUT(TIM: PTIM; CLUT_NUM: Integer; Grid: PDrawGrid);
var var
X, Y, ROWS, COLS, COLORS: Integer; X, Y, ROWS, COLS, COLORS: Integer;
begin begin
@@ -375,17 +375,6 @@ begin
ROWS := Ceil(COLORS / COLS); ROWS := Ceil(COLORS / COLS);
Grid^.RowCount := ROWS; 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;
end. end.

View File

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

View File

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

View File

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

View File

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