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"/>
<AutoIncrementBuild Value="True"/>
<MajorVersionNr Value="1"/>
<RevisionNr Value="79"/>
<BuildNr Value="5"/>
<RevisionNr Value="80"/>
<BuildNr Value="6"/>
<StringTable CompanyName="Lab 313" FileDescription="The best TIMs tool ever!:)" ProductVersion=""/>
</VersionInfo>
<BuildModes Count="6">
@@ -365,8 +365,6 @@
<OverflowChecks Value="True"/>
<StackChecks Value="True"/>
</Checks>
<TargetCPU Value="x86_64"/>
<TargetOS Value="win64"/>
</CodeGeneration>
<Linking>
<Debugging>

View File

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

Binary file not shown.

View File

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

View File

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

View File

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

View File

@@ -8,7 +8,7 @@ uses
Classes, SysUtils, FileUtil, Forms, Dialogs, ActnList,
Menus, StdCtrls, ExtCtrls, ComCtrls, Grids, ExtDlgs,
uscanresult, uscanthread, usettings, utim, udrawtim, types;
uscanresult, uscanthread, usettings, utim, udrawtim, types, Controls;
{$INCLUDE todos.inc}
@@ -54,6 +54,7 @@ type
ExtractTIM1: TMenuItem;
grdClut: TDrawGrid;
imgTim: TImage;
lblClutHint: TLabel;
lblStatus: TLabel;
lvList: TListView;
MenuItem1: TMenuItem;
@@ -133,6 +134,7 @@ type
procedure FormDropFiles(Sender: TObject; const FileNames: array of string);
procedure grdClutDblClick(Sender: TObject);
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 lvListSelectItem(Sender: TObject; Item: TListItem; Selected: Boolean);
private
@@ -674,6 +676,39 @@ begin
FreeTIM(TIM);
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);
var
W, H: Word;

View File

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