Added changing of STP bit for any color. Changed some defaults.

This commit is contained in:
meffi@lab313.ru
2014-04-30 11:54:24 +00:00
parent 29ba53143e
commit 2525e8a802
8 changed files with 109 additions and 59 deletions

View File

@@ -23,8 +23,8 @@
<UseVersionInfo Value="True"/> <UseVersionInfo Value="True"/>
<AutoIncrementBuild Value="True"/> <AutoIncrementBuild Value="True"/>
<MajorVersionNr Value="1"/> <MajorVersionNr Value="1"/>
<RevisionNr Value="79"/> <RevisionNr Value="80"/>
<BuildNr Value="5"/> <BuildNr Value="6"/>
<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">
@@ -365,8 +365,6 @@
<OverflowChecks Value="True"/> <OverflowChecks Value="True"/>
<StackChecks Value="True"/> <StackChecks Value="True"/>
</Checks> </Checks>
<TargetCPU Value="x86_64"/>
<TargetOS Value="win64"/>
</CodeGeneration> </CodeGeneration>
<Linking> <Linking>
<Debugging> <Debugging>

View File

@@ -3,7 +3,7 @@
<ProjectSession> <ProjectSession>
<PathDelim Value="\"/> <PathDelim Value="\"/>
<Version Value="9"/> <Version Value="9"/>
<BuildModes Active="Win Release x86"/> <BuildModes Active="Debug"/>
<Units Count="15"> <Units Count="15">
<Unit0> <Unit0>
<Filename Value="tim2view.lpr"/> <Filename Value="tim2view.lpr"/>
@@ -23,11 +23,10 @@
<HasResources Value="True"/> <HasResources Value="True"/>
<ResourceBaseClass Value="Form"/> <ResourceBaseClass Value="Form"/>
<UnitName Value="umain"/> <UnitName Value="umain"/>
<IsVisibleTab Value="True"/>
<EditorIndex Value="0"/> <EditorIndex Value="0"/>
<WindowIndex Value="0"/> <WindowIndex Value="0"/>
<TopLine Value="288"/> <TopLine Value="677"/>
<CursorPos X="36" Y="297"/> <CursorPos X="41" Y="684"/>
<UsageCount Value="816"/> <UsageCount Value="816"/>
<Loaded Value="True"/> <Loaded Value="True"/>
<LoadedDesigner Value="True"/> <LoadedDesigner Value="True"/>
@@ -51,10 +50,11 @@
<Filename Value="ucommon.pas"/> <Filename Value="ucommon.pas"/>
<IsPartOfProject Value="True"/> <IsPartOfProject Value="True"/>
<UnitName Value="ucommon"/> <UnitName Value="ucommon"/>
<IsVisibleTab Value="True"/>
<EditorIndex Value="3"/> <EditorIndex Value="3"/>
<WindowIndex Value="0"/> <WindowIndex Value="0"/>
<TopLine Value="1"/> <TopLine Value="1"/>
<CursorPos X="56" Y="8"/> <CursorPos X="35" Y="6"/>
<UsageCount Value="816"/> <UsageCount Value="816"/>
<Loaded Value="True"/> <Loaded Value="True"/>
</Unit4> </Unit4>
@@ -86,8 +86,8 @@
<UnitName Value="usettings"/> <UnitName Value="usettings"/>
<EditorIndex Value="9"/> <EditorIndex Value="9"/>
<WindowIndex Value="0"/> <WindowIndex Value="0"/>
<TopLine Value="80"/> <TopLine Value="41"/>
<CursorPos X="67" Y="88"/> <CursorPos X="60" Y="56"/>
<UsageCount Value="816"/> <UsageCount Value="816"/>
<Loaded Value="True"/> <Loaded Value="True"/>
</Unit7> </Unit7>
@@ -108,8 +108,8 @@
<UnitName Value="uscanthread"/> <UnitName Value="uscanthread"/>
<EditorIndex Value="8"/> <EditorIndex Value="8"/>
<WindowIndex Value="0"/> <WindowIndex Value="0"/>
<TopLine Value="1"/> <TopLine Value="169"/>
<CursorPos X="43" Y="6"/> <CursorPos X="64" Y="197"/>
<UsageCount Value="816"/> <UsageCount Value="816"/>
<Loaded Value="True"/> <Loaded Value="True"/>
</Unit9> </Unit9>
@@ -130,8 +130,8 @@
<UnitName Value="udrawtim"/> <UnitName Value="udrawtim"/>
<EditorIndex Value="5"/> <EditorIndex Value="5"/>
<WindowIndex Value="0"/> <WindowIndex Value="0"/>
<TopLine Value="222"/> <TopLine Value="333"/>
<CursorPos X="72" Y="238"/> <CursorPos X="43" Y="357"/>
<UsageCount Value="816"/> <UsageCount Value="816"/>
<Loaded Value="True"/> <Loaded Value="True"/>
</Unit11> </Unit11>
@@ -160,7 +160,7 @@
<WindowIndex Value="0"/> <WindowIndex Value="0"/>
<TopLine Value="7"/> <TopLine Value="7"/>
<CursorPos X="20" Y="16"/> <CursorPos X="20" Y="16"/>
<UsageCount Value="67"/> <UsageCount Value="69"/>
<Loaded Value="True"/> <Loaded Value="True"/>
</Unit14> </Unit14>
</Units> </Units>

Binary file not shown.

View File

@@ -3,7 +3,7 @@ unit ucommon;
interface interface
const const
cProgramName = 'Tim2View SVN.r79 by [Lab 313] (for ' + cProgramName = 'Tim2View SVN.r80 by [Lab 313] (for ' +
{$IFDEF Linux}'Linux' + {$IFEND} {$IFDEF Linux}'Linux' + {$IFEND}
{$IFDEF Darwin}'Mac OS X' + {$IFEND} {$IFDEF Darwin}'Mac OS X' + {$IFEND}
{$IFDEF Windows}'Windows' + {$IFEND} {$IFDEF Windows}'Windows' + {$IFEND}

View File

@@ -351,7 +351,11 @@ begin
if (FC.alpha = 0) or (FC.alpha = $8080) then if (FC.alpha = 0) or (FC.alpha = $8080) then
begin begin
if (R + G + B)/3 > 128 then
Grid^.Canvas.Brush.COLOR := clBlack
else
Grid^.Canvas.Brush.COLOR := clWhite; Grid^.Canvas.Brush.COLOR := clWhite;
if FC.ALPHA = 0 then if FC.ALPHA = 0 then
Rect.Bottom := Rect.Top + ((Rect.Bottom - Rect.Top) div 2) Rect.Bottom := Rect.Top + ((Rect.Bottom - Rect.Top) div 2)
else else

View File

@@ -1,16 +1,16 @@
object frmMain: TfrmMain object frmMain: TfrmMain
Left = 919 Left = 919
Height = 590 Height = 647
Top = 209 Top = 209
Width = 780 Width = 790
HorzScrollBar.Page = 780 HorzScrollBar.Page = 780
HorzScrollBar.Range = 489 HorzScrollBar.Range = 489
VertScrollBar.Page = 570 VertScrollBar.Page = 570
VertScrollBar.Range = 344 VertScrollBar.Range = 344
ActiveControl = pnlList ActiveControl = pnlList
AllowDropFiles = True AllowDropFiles = True
ClientHeight = 570 ClientHeight = 627
ClientWidth = 780 ClientWidth = 790
Color = clBtnFace Color = clBtnFace
Font.Color = clWindowText Font.Color = clWindowText
Font.Height = -11 Font.Height = -11
@@ -498,12 +498,12 @@ object frmMain: TfrmMain
object pnlStatus: TPanel object pnlStatus: TPanel
Left = 0 Left = 0
Height = 30 Height = 30
Top = 517 Top = 574
Width = 780 Width = 790
Align = alBottom Align = alBottom
BevelOuter = bvLowered BevelOuter = bvLowered
ClientHeight = 30 ClientHeight = 30
ClientWidth = 780 ClientWidth = 790
TabOrder = 2 TabOrder = 2
object lblStatus: TLabel object lblStatus: TLabel
Left = 76 Left = 76
@@ -519,7 +519,7 @@ object frmMain: TfrmMain
Left = 258 Left = 258
Height = 28 Height = 28
Top = 1 Top = 1
Width = 521 Width = 531
Align = alRight Align = alRight
Anchors = [akTop, akLeft, akRight, akBottom] Anchors = [akTop, akLeft, akRight, akBottom]
Smooth = True Smooth = True
@@ -540,7 +540,7 @@ object frmMain: TfrmMain
Left = 0 Left = 0
Height = 21 Height = 21
Top = 0 Top = 0
Width = 780 Width = 790
Align = alTop Align = alTop
DropDownCount = 30 DropDownCount = 30
Enabled = False Enabled = False
@@ -552,33 +552,33 @@ object frmMain: TfrmMain
end end
object pnlMain: TPanel object pnlMain: TPanel
Left = 0 Left = 0
Height = 496 Height = 553
Top = 21 Top = 21
Width = 780 Width = 790
Align = alClient Align = alClient
BevelOuter = bvNone BevelOuter = bvNone
ClientHeight = 496 ClientHeight = 553
ClientWidth = 780 ClientWidth = 790
TabOrder = 1 TabOrder = 1
object splMain: TSplitter object splMain: TSplitter
Left = 253 Left = 253
Height = 496 Height = 553
Top = 0 Top = 0
Width = 5 Width = 5
end end
object pnlList: TPanel object pnlList: TPanel
Left = 0 Left = 0
Height = 496 Height = 553
Top = 0 Top = 0
Width = 253 Width = 253
Align = alLeft Align = alLeft
BevelOuter = bvNone BevelOuter = bvNone
ClientHeight = 496 ClientHeight = 553
ClientWidth = 253 ClientWidth = 253
TabOrder = 0 TabOrder = 0
object lvList: TListView object lvList: TListView
Left = 0 Left = 0
Height = 468 Height = 525
Top = 28 Top = 28
Width = 253 Width = 253
Align = alClient Align = alClient
@@ -646,31 +646,31 @@ object frmMain: TfrmMain
end end
object pnlImage: TPanel object pnlImage: TPanel
Left = 258 Left = 258
Height = 496 Height = 553
Top = 0 Top = 0
Width = 522 Width = 532
Align = alClient Align = alClient
BevelOuter = bvLowered BevelOuter = bvLowered
ClientHeight = 496 ClientHeight = 553
ClientWidth = 522 ClientWidth = 532
Color = clBtnFace Color = clBtnFace
ParentColor = False ParentColor = False
TabOrder = 1 TabOrder = 1
object pnlImageOptions: TPanel object pnlImageOptions: TPanel
Left = 1 Left = 1
Height = 27 Height = 27
Top = 468 Top = 525
Width = 520 Width = 530
Align = alBottom Align = alBottom
AutoSize = True AutoSize = True
BevelOuter = bvLowered BevelOuter = bvLowered
ClientHeight = 27 ClientHeight = 27
ClientWidth = 520 ClientWidth = 530
Color = clBtnFace Color = clBtnFace
ParentColor = False ParentColor = False
TabOrder = 0 TabOrder = 0
object btnShowClut: TButton object btnShowClut: TButton
Left = 466 Left = 476
Height = 23 Height = 23
Top = 2 Top = 2
Width = 52 Width = 52
@@ -712,7 +712,7 @@ object frmMain: TfrmMain
Align = alLeft Align = alLeft
BorderSpacing.Around = 1 BorderSpacing.Around = 1
ItemHeight = 13 ItemHeight = 13
ItemIndex = 0 ItemIndex = 1
Items.Strings = ( Items.Strings = (
'Full transparence' 'Full transparence'
'Black Transparence' 'Black Transparence'
@@ -723,10 +723,10 @@ object frmMain: TfrmMain
OnCloseUp = actReturnFocusExecute OnCloseUp = actReturnFocusExecute
Style = csDropDownList Style = csDropDownList
TabOrder = 2 TabOrder = 2
Text = 'Full transparence' Text = 'Black Transparence'
end end
object cbbCLUT: TComboBox object cbbCLUT: TComboBox
Left = 356 Left = 366
Height = 21 Height = 21
Top = 2 Top = 2
Width = 109 Width = 109
@@ -741,22 +741,22 @@ object frmMain: TfrmMain
end end
object pnlClut: TPanel object pnlClut: TPanel
Left = 1 Left = 1
Height = 129 Height = 157
Top = 339 Top = 368
Width = 520 Width = 530
Align = alBottom Align = alBottom
BevelOuter = bvLowered BevelOuter = bvLowered
ClientHeight = 129 ClientHeight = 157
ClientWidth = 520 ClientWidth = 530
Color = clBtnFace Color = clBtnFace
ParentColor = False ParentColor = False
TabOrder = 1 TabOrder = 1
Visible = False Visible = False
object grdClut: TDrawGrid object grdClut: TDrawGrid
Left = 1 Left = 1
Height = 127 Height = 116
Top = 1 Top = 1
Width = 518 Width = 528
Align = alClient Align = alClient
AutoEdit = False AutoEdit = False
ColCount = 1 ColCount = 1
@@ -775,13 +775,26 @@ object frmMain: TfrmMain
TitleFont.Name = 'Tahoma' TitleFont.Name = 'Tahoma'
OnDblClick = grdClutDblClick OnDblClick = grdClutDblClick
OnDrawCell = grdClutDrawCell OnDrawCell = grdClutDrawCell
OnKeyUp = grdClutKeyUp
end
object lblClutHint: TLabel
Left = 1
Height = 39
Top = 117
Width = 528
Align = alBottom
Alignment = taCenter
Caption = 'Press "Space" key to invert Transparence bit.'#13#10'H-splitted color = black transparent.'#13#10'V-splitted color = non-black transparent.'
Layout = tlCenter
ParentColor = False
WordWrap = True
end end
end end
object imgTim: TImage object imgTim: TImage
Left = 1 Left = 1
Height = 338 Height = 367
Top = 1 Top = 1
Width = 520 Width = 530
AntialiasingMode = amOff AntialiasingMode = amOff
Align = alClient Align = alClient
Center = True Center = True
@@ -793,8 +806,8 @@ object frmMain: TfrmMain
object sbMain: TStatusBar object sbMain: TStatusBar
Left = 0 Left = 0
Height = 23 Height = 23
Top = 547 Top = 604
Width = 780 Width = 790
Panels = < Panels = <
item item
Width = 50 Width = 50

View File

@@ -8,7 +8,7 @@ uses
Classes, SysUtils, FileUtil, Forms, Dialogs, ActnList, Classes, SysUtils, FileUtil, Forms, Dialogs, ActnList,
Menus, StdCtrls, ExtCtrls, ComCtrls, Grids, ExtDlgs, Menus, StdCtrls, ExtCtrls, ComCtrls, Grids, ExtDlgs,
uscanresult, uscanthread, usettings, utim, udrawtim, types; uscanresult, uscanthread, usettings, utim, udrawtim, types, Controls;
{$INCLUDE todos.inc} {$INCLUDE todos.inc}
@@ -54,6 +54,7 @@ type
ExtractTIM1: TMenuItem; ExtractTIM1: TMenuItem;
grdClut: TDrawGrid; grdClut: TDrawGrid;
imgTim: TImage; imgTim: TImage;
lblClutHint: TLabel;
lblStatus: TLabel; lblStatus: TLabel;
lvList: TListView; lvList: TListView;
MenuItem1: TMenuItem; MenuItem1: TMenuItem;
@@ -133,6 +134,7 @@ type
procedure FormDropFiles(Sender: TObject; const FileNames: array of string); procedure FormDropFiles(Sender: TObject; const FileNames: array of string);
procedure grdClutDblClick(Sender: TObject); procedure grdClutDblClick(Sender: TObject);
procedure grdClutDrawCell(Sender: TObject; aCol, aRow: Integer; aRect: TRect; aState: TGridDrawState); procedure grdClutDrawCell(Sender: TObject; aCol, aRow: Integer; aRect: TRect; aState: TGridDrawState);
procedure grdClutKeyUp(Sender: TObject; var Key: Word; Shift: TShiftState);
procedure lvListData(Sender: TObject; Item: TListItem); procedure lvListData(Sender: TObject; Item: TListItem);
procedure lvListSelectItem(Sender: TObject; Item: TListItem; Selected: Boolean); procedure lvListSelectItem(Sender: TObject; Item: TListItem; Selected: Boolean);
private private
@@ -674,6 +676,39 @@ begin
FreeTIM(TIM); FreeTIM(TIM);
end; end;
procedure TfrmMain.grdClutKeyUp(Sender: TObject; var Key: Word;
Shift: TShiftState);
var
TIM: PTIM;
SELECTED_CELL, CLUT_NUM: Integer;
CLUT_COLOR: TCLUT_COLOR;
begin
if Key <> VK_SPACE then Exit;
TIM := SelectedTimInMode;
if TIM = nil then Exit;
SELECTED_CELL := grdClut.Row * grdClut.ColCount + grdClut.Col;
if SELECTED_CELL >= GetTimColorsCount(TIM) then
begin
FreeTIM(TIM);
Exit;
end;
CLUT_NUM := cbbCLUT.ItemIndex;
CLUT_COLOR := GetCLUTColor(TIM, CLUT_NUM, SELECTED_CELL);
CLUT_COLOR.STP := CLUT_COLOR.STP xor 1;
WriteCLUTColor(TIM, CLUT_NUM, SELECTED_CELL, CLUT_COLOR);
ReplaceTimInFileFromMemory(SelectedScanResult.ScanFile, TIM, SelectedTimInfo.Position, SelectedScanResult.IsImage);
FreeTIM(TIM);
UpdateTim(True, True, False);
end;
procedure TfrmMain.lvListData(Sender: TObject; Item: TListItem); procedure TfrmMain.lvListData(Sender: TObject; Item: TListItem);
var var
W, H: Word; W, H: Word;

View File

@@ -49,7 +49,7 @@ end;
function TSettings.FTranspModeRead: Integer; function TSettings.FTranspModeRead: Integer;
begin begin
Result := FIniFile.ReadInteger(sMain, 'TranspMode', 0); Result := FIniFile.ReadInteger(sMain, 'TranspMode', 1);
end; end;
procedure TSettings.FStretchModeWrite(Value: Boolean); procedure TSettings.FStretchModeWrite(Value: Boolean);