Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
99749a5168 | ||
|
|
ca8a0afc3b | ||
|
|
2b6f684505 | ||
|
|
8f70a5cc98 | ||
|
|
e38a487d56 | ||
|
|
208ad57777 | ||
|
|
6df8df9a9b | ||
|
|
8731ec150c | ||
|
|
45386dcbaf | ||
|
|
5910178309 | ||
|
|
0d1c61364b | ||
|
|
b3a3b090b4 | ||
|
|
464c170e2d | ||
|
|
46aaec645c | ||
|
|
e12fe942b7 | ||
|
|
7acd461086 | ||
|
|
4a7f525937 | ||
|
|
e74065fd49 | ||
|
|
0a939d4f35 | ||
|
|
ef124eb495 | ||
|
|
b7235f8f93 | ||
|
|
74cf40118c | ||
|
|
bd60c99dc3 | ||
|
|
335cfc875c | ||
|
|
f8f56d6b2f | ||
|
|
aaaad354b2 | ||
|
|
4f6e034b5c | ||
|
|
9864157f33 | ||
|
|
818590ded0 | ||
|
|
75220f3dc4 | ||
|
|
fbfd8e627f | ||
|
|
0092f6893e | ||
|
|
b47292a4bc | ||
|
|
4d9e02aaef | ||
|
|
5f7e277721 | ||
|
|
481d6ac905 | ||
|
|
dd20f4962d | ||
|
|
1fbce3570d | ||
|
|
f09b8b7fbc | ||
|
|
fcb90dffbb | ||
|
|
71865facd8 | ||
|
|
93c2af9d9f | ||
|
|
043a5a1ccf | ||
|
|
3dd9ce1d68 | ||
|
|
b90fbdf190 | ||
|
|
1e44b51a06 | ||
|
|
78f945cee7 | ||
|
|
3e562ff03d | ||
|
|
992666583d | ||
|
|
63ca31805e | ||
|
|
c4c95b0156 | ||
|
|
d18e01c95c | ||
|
|
c4f043a236 | ||
|
|
ad38619b9b | ||
|
|
0222c01dc8 | ||
|
|
997aa4991a | ||
|
|
a1a40b6f61 | ||
|
|
ee0667aff3 | ||
|
|
c6e1a10d3b | ||
|
|
7c3c4d89c4 | ||
|
|
d56149a4c1 | ||
|
|
9903de9c24 | ||
|
|
6d0ae63be6 | ||
|
|
fa288fddf8 | ||
|
|
1335e3f40e | ||
|
|
1dc371ed27 | ||
|
|
3df6ab93f6 | ||
|
|
d9f7b126b6 | ||
|
|
2cc0be66c9 | ||
|
|
b4a14683cb | ||
|
|
3fed4cd5fc | ||
|
|
f4275217bb | ||
|
|
d5c41c0816 | ||
|
|
d3045de064 | ||
|
|
32b8d99f3e | ||
|
|
81f837a746 | ||
|
|
d41520eca4 | ||
|
|
13aae33a02 | ||
|
|
0c94cdb24b | ||
|
|
d2fb8a16ea | ||
|
|
2c0eb0cebd | ||
|
|
9ed3862b4a | ||
|
|
6229d296df | ||
|
|
ee8dfe5adf | ||
|
|
d129a1b94f | ||
|
|
c0121312ed | ||
|
|
dab5f85816 | ||
|
|
c8ef2ccf68 | ||
|
|
23f323bee1 | ||
|
|
ae9136d53a | ||
|
|
c1967a8a41 | ||
|
|
c1f5215fb4 | ||
|
|
e527149f63 | ||
|
|
39045b76c1 | ||
|
|
5e92d58a6e | ||
|
|
2bffd2204b | ||
|
|
1498437e26 | ||
|
|
a25c8296de | ||
|
|
585fd92611 | ||
|
|
f381647149 | ||
|
|
4108ed5900 | ||
|
|
98bfbd7b11 | ||
|
|
3f47eba2da | ||
|
|
4d92724f4e | ||
|
|
23b4ebe214 | ||
|
|
3b6b8b6eb3 | ||
|
|
27cf279503 | ||
|
|
955edf8a77 | ||
|
|
9638bb3fe2 | ||
|
|
7be5c8ca7f | ||
|
|
e0eee2c023 | ||
|
|
816017d4f1 | ||
|
|
d30b95f857 | ||
|
|
6aa6496429 | ||
|
|
9f66004c44 | ||
|
|
b83c5f4b2d | ||
|
|
54e7209c8d | ||
|
|
1753c38eea | ||
|
|
cd983844fa | ||
|
|
7a67e62398 | ||
|
|
0e5cb1b48b | ||
|
|
d75a85d269 | ||
|
|
dc36f0b09c | ||
|
|
97c8270b38 | ||
|
|
dfef4d3556 | ||
|
|
d30f01ac64 | ||
|
|
5e47564252 | ||
|
|
900603dd00 | ||
|
|
da7bf2e3c5 | ||
|
|
1bfbc2e11e | ||
|
|
39280f927b | ||
|
|
1ddaee39d5 | ||
|
|
d334728b6c | ||
|
|
609ff53253 | ||
|
|
ffd0cc1028 | ||
|
|
699fb78d72 | ||
|
|
484bd5523f | ||
|
|
f3f5d12c2f | ||
|
|
937cfb6323 | ||
|
|
e29f69a1a9 | ||
|
|
91f3aadb82 | ||
|
|
2e3dd53eeb | ||
|
|
8085639c30 | ||
|
|
7271fcbabc | ||
|
|
8f5c141705 | ||
|
|
d0557ab86f | ||
|
|
b9a45bf43b | ||
|
|
1791fd7494 | ||
|
|
829a604c30 | ||
|
|
9676549ac3 | ||
|
|
4a5a835afd | ||
|
|
5ac13430be | ||
|
|
940e81f123 | ||
|
|
aa37b1cf1d | ||
|
|
811d91cc8a | ||
|
|
88e18b7659 | ||
|
|
395c8fbe96 | ||
|
|
d2f7bdc54f | ||
|
|
5c3a8740c1 | ||
|
|
abe62e13b8 | ||
|
|
4c76aafe47 | ||
|
|
086e6dbb7b | ||
|
|
bfe71ae93f | ||
|
|
4b5cf332ca | ||
|
|
de33600726 | ||
|
|
977e53085a | ||
|
|
be11f61111 | ||
|
|
b1be3a22de | ||
|
|
8bebb92300 | ||
|
|
2a9598452b | ||
|
|
fd4155a45b | ||
|
|
ae720d1931 | ||
|
|
87e4edffa5 | ||
|
|
34e723db75 | ||
|
|
6317841c9c | ||
|
|
a309caa235 | ||
|
|
d158c28452 | ||
|
|
49599fdcf4 | ||
|
|
0d84ac4b5d | ||
|
|
6edee941ee | ||
|
|
5f76073b39 |
+75
@@ -0,0 +1,75 @@
|
|||||||
|
---
|
||||||
|
kind: pipeline
|
||||||
|
type: docker
|
||||||
|
name: default
|
||||||
|
|
||||||
|
steps:
|
||||||
|
- name: Build
|
||||||
|
image: git.aksdb.de/aksdb/centred:builder-221016
|
||||||
|
commands:
|
||||||
|
- ~/lazarus/lazbuild --lazarusdir=~/lazarus --build-mode="Release.win32" -B Client/CentrED.lpr
|
||||||
|
- ~/lazarus/lazbuild --lazarusdir=~/lazarus --build-mode="Release.Linux.x64" -B Client/CentrED.lpr
|
||||||
|
- ~/lazarus/lazbuild --lazarusdir=~/lazarus --build-mode="Release.win32" -B Server/cedserver.lpi
|
||||||
|
- ~/lazarus/lazbuild --lazarusdir=~/lazarus --build-mode="Release.Linux.x64" -B Server/cedserver.lpi
|
||||||
|
|
||||||
|
- name: Test
|
||||||
|
image: git.aksdb.de/aksdb/centred:builder-221016
|
||||||
|
commands:
|
||||||
|
- ~/lazarus/lazbuild --lazarusdir=~/lazarus -B tests/unittests.lpi
|
||||||
|
- tests/bin/unittests --all --format=plain
|
||||||
|
- ~/lazarus/lazbuild --lazarusdir=~/lazarus -B tests/unittests-server.lpi
|
||||||
|
- tests/bin/unittests-server --all --format=plain
|
||||||
|
- name: Package
|
||||||
|
image: git.aksdb.de/aksdb/centred:builder-221016
|
||||||
|
commands:
|
||||||
|
- mkdir -p dist/client.win32 dist/client.linux.x64 dist/server.win32 dist/server.linux.x64
|
||||||
|
- cp Client.bin/nodraw.txt Client.bin/ColorLight.xml dist/client.linux.x64/
|
||||||
|
- cp Client.bin/nodraw.txt Client.bin/ColorLight.xml dist/client.win32/
|
||||||
|
- cp Client.bin/CentrED.x64 dist/client.linux.x64/CentrED
|
||||||
|
- cp Client.bin/CentrED.exe dist/client.win32/CentrED.exe
|
||||||
|
- cp Server.bin/cedserver.x64 dist/server.linux.x64/cedserver
|
||||||
|
- cp Server.bin/cedserver.exe dist/server.win32/cedserver.exe
|
||||||
|
- cd dist/client.win32 && zip ../CentrED.win32.zip *
|
||||||
|
- cd ../client.linux.x64 && tar czf ../CentrED.linux.x64.tgz *
|
||||||
|
- cd ../server.win32 && zip ../Server.win32.zip *
|
||||||
|
- cd ../server.linux.x64 && tar czf ../Server.linux.x64.tgz *
|
||||||
|
|
||||||
|
- name: Upload Client (win32)
|
||||||
|
image: vividboarder/drone-webdav
|
||||||
|
settings:
|
||||||
|
file: dist/CentrED.win32.zip
|
||||||
|
destination: https://aksdb.de/snapshots/CentrED/
|
||||||
|
username: centred
|
||||||
|
password:
|
||||||
|
from_secret: snapshots_password
|
||||||
|
|
||||||
|
- name: Upload Client (linux x64)
|
||||||
|
image: vividboarder/drone-webdav
|
||||||
|
settings:
|
||||||
|
file: dist/CentrED.linux.x64.tgz
|
||||||
|
destination: https://aksdb.de/snapshots/CentrED/
|
||||||
|
username: centred
|
||||||
|
password:
|
||||||
|
from_secret: snapshots_password
|
||||||
|
|
||||||
|
- name: Upload Server (win32)
|
||||||
|
image: vividboarder/drone-webdav
|
||||||
|
settings:
|
||||||
|
file: dist/Server.win32.zip
|
||||||
|
destination: https://aksdb.de/snapshots/CentrED/
|
||||||
|
username: centred
|
||||||
|
password:
|
||||||
|
from_secret: snapshots_password
|
||||||
|
|
||||||
|
- name: Upload Server (linux x64)
|
||||||
|
image: vividboarder/drone-webdav
|
||||||
|
settings:
|
||||||
|
file: dist/Server.linux.x64.tgz
|
||||||
|
destination: https://aksdb.de/snapshots/CentrED/
|
||||||
|
username: centred
|
||||||
|
password:
|
||||||
|
from_secret: snapshots_password
|
||||||
|
|
||||||
|
trigger:
|
||||||
|
branch:
|
||||||
|
- master
|
||||||
@@ -1,8 +1,7 @@
|
|||||||
#syntax: regexp
|
|
||||||
#(?<!\.(pas|lfm|lpr|lpi))$
|
|
||||||
syntax: glob
|
|
||||||
obj/*
|
obj/*
|
||||||
bin/*
|
bin/*
|
||||||
|
Client.bin/*
|
||||||
|
Server.bin/*
|
||||||
doc/*
|
doc/*
|
||||||
pasdoc/*
|
pasdoc/*
|
||||||
Setup/*
|
Setup/*
|
||||||
@@ -23,3 +22,6 @@ Setup/*
|
|||||||
*.compiled
|
*.compiled
|
||||||
*.sh
|
*.sh
|
||||||
*.exe
|
*.exe
|
||||||
|
*.res
|
||||||
|
tests/bin/*
|
||||||
|
tests/obj-tests/*
|
||||||
+32
@@ -0,0 +1,32 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<CONFIG>
|
||||||
|
<ProjectGroup FileVersion="2">
|
||||||
|
<Targets>
|
||||||
|
<Target FileName="Tools/convertfontmap/ConvertFontMap.lpi"/>
|
||||||
|
<Target FileName="Client/CentrED.lpi">
|
||||||
|
<BuildModes>
|
||||||
|
<Mode Name="default" Compile="True"/>
|
||||||
|
<Mode Name="Release.Win32"/>
|
||||||
|
<Mode Name="Release.Win64"/>
|
||||||
|
<Mode Name="Release.Linux.x86"/>
|
||||||
|
<Mode Name="Release.Linux.x64"/>
|
||||||
|
<Mode Name="Debug.Win32"/>
|
||||||
|
<Mode Name="Debug.Linux.x86"/>
|
||||||
|
<Mode Name="Debug.Linux.x64"/>
|
||||||
|
</BuildModes>
|
||||||
|
</Target>
|
||||||
|
<Target FileName="Server/cedserver.lpi">
|
||||||
|
<BuildModes>
|
||||||
|
<Mode Name="default" Compile="True"/>
|
||||||
|
<Mode Name="Release.Win32"/>
|
||||||
|
<Mode Name="Release.Win64"/>
|
||||||
|
<Mode Name="Release.Linux.x86"/>
|
||||||
|
<Mode Name="Release.Linux.x64"/>
|
||||||
|
<Mode Name="Debug.Win32"/>
|
||||||
|
<Mode Name="Debug.Linux.x86"/>
|
||||||
|
<Mode Name="Debug.Linux.x64"/>
|
||||||
|
</BuildModes>
|
||||||
|
</Target>
|
||||||
|
</Targets>
|
||||||
|
</ProjectGroup>
|
||||||
|
</CONFIG>
|
||||||
@@ -0,0 +1,975 @@
|
|||||||
|
<?xml version="1.0" ?>
|
||||||
|
<ColorLight Version="1 (24.08.2014)" Server="uoquint.ru" Author="StaticZ">
|
||||||
|
|
||||||
|
<Colors> <!-- NOTE: ALLOWED ONLY COLORS WITH IDs FROM 1 TO 15 -->
|
||||||
|
<Color id="1" r="0xFF" g="0xFF" b="0xFF" name="Default"/>
|
||||||
|
<Color id="2" r="0xFF" g="0xFF" b="0xFF" name="Bright White"/>
|
||||||
|
<Color id="3" r="0xE0" g="0xE0" b="0xE0" name="White"/>
|
||||||
|
<Color id="4" r="0xFF" g="0x80" b="0x00" name="Bright Orange"/>
|
||||||
|
<Color id="5" r="0xB6" g="0x5C" b="0x00" name="Thin Orange"/>
|
||||||
|
<Color id="6" r="0xFF" g="0xFF" b="0x00" name="Bright Yellow"/>
|
||||||
|
<Color id="7" r="0x80" g="0x80" b="0x00" name="Thin Yellow"/>
|
||||||
|
<Color id="8" r="0xB6" g="0xB6" b="0x00" name="Yellow"/>
|
||||||
|
<Color id="9" r="0x80" g="0x80" b="0xFF" name="Bright Lilac"/>
|
||||||
|
<Color id="10" r="0x00" g="0x00" b="0xFF" name="Bright Blue"/>
|
||||||
|
<Color id="11" r="0x00" g="0x00" b="0x80" name="Thin Blue"/>
|
||||||
|
<Color id="12" r="0x00" g="0xFF" b="0x00" name="Bright Green"/>
|
||||||
|
<Color id="13" r="0x00" g="0x80" b="0x00" name="Thin Green"/>
|
||||||
|
<Color id="14" r="0xFF" g="0x00" b="0x00" name="Bright Red"/>
|
||||||
|
<Color id="15" r="0xFF" g="0x00" b="0xFF" name="Bright Pink"/>
|
||||||
|
</Colors>
|
||||||
|
|
||||||
|
<Sources>
|
||||||
|
|
||||||
|
<!-- Original Tiles -->
|
||||||
|
<Item ID="0x398C" color="2" />
|
||||||
|
<Item ID="0x398D" color="2" />
|
||||||
|
<Item ID="0x398E" color="2" />
|
||||||
|
<Item ID="0x398F" color="2" />
|
||||||
|
<Item ID="0x3990" color="2" />
|
||||||
|
<Item ID="0x3991" color="2" />
|
||||||
|
<Item ID="0x3992" color="2" />
|
||||||
|
<Item ID="0x3993" color="2" />
|
||||||
|
<Item ID="0x3994" color="2" />
|
||||||
|
<Item ID="0x3995" color="2" />
|
||||||
|
<Item ID="0x3996" color="2" />
|
||||||
|
<Item ID="0x3997" color="2" />
|
||||||
|
<Item ID="0x3998" color="2" />
|
||||||
|
<Item ID="0x3999" color="2" />
|
||||||
|
<Item ID="0x399A" color="2" />
|
||||||
|
<Item ID="0x399B" color="2" />
|
||||||
|
<Item ID="0x399C" color="2" />
|
||||||
|
<Item ID="0x399D" color="2" />
|
||||||
|
<Item ID="0x399E" color="2" />
|
||||||
|
<Item ID="0x399F" color="2" />
|
||||||
|
|
||||||
|
<Item ID="0x088C" color="5" />
|
||||||
|
<Item ID="0x0FAC" color="4" />
|
||||||
|
<Item ID="0x0FB1" color="8" />
|
||||||
|
<Item ID="0x1647" color="7" />
|
||||||
|
<Item ID="0x19BB" color="14" />
|
||||||
|
<Item ID="0x1F2B" color="14" />
|
||||||
|
|
||||||
|
<Item ID="0x1ECD" color="13" />
|
||||||
|
<Item ID="0x1ECE" color="13" />
|
||||||
|
<Item ID="0x1ECF" color="13" />
|
||||||
|
<Item ID="0x1ED0" color="13" />
|
||||||
|
<Item ID="0x1ED1" color="13" />
|
||||||
|
<Item ID="0x1ED2" color="13" />
|
||||||
|
|
||||||
|
<Item ID="0x19AB" color="8" />
|
||||||
|
<Item ID="0x19AC" color="8" />
|
||||||
|
<Item ID="0x19AD" color="8" />
|
||||||
|
<Item ID="0x19AE" color="8" />
|
||||||
|
<Item ID="0x19AF" color="8" />
|
||||||
|
<Item ID="0x19B0" color="8" />
|
||||||
|
<Item ID="0x19B1" color="8" />
|
||||||
|
<Item ID="0x19B2" color="8" />
|
||||||
|
<Item ID="0x19B3" color="8" />
|
||||||
|
<Item ID="0x19B4" color="8" />
|
||||||
|
<Item ID="0x19B5" color="8" />
|
||||||
|
<Item ID="0x19B6" color="8" />
|
||||||
|
|
||||||
|
<Item ID="0x197A" color="8" />
|
||||||
|
<Item ID="0x197B" color="8" />
|
||||||
|
<Item ID="0x197C" color="8" />
|
||||||
|
<Item ID="0x197D" color="8" />
|
||||||
|
<Item ID="0x197E" color="8" />
|
||||||
|
<Item ID="0x197F" color="8" />
|
||||||
|
<Item ID="0x1980" color="8" />
|
||||||
|
<Item ID="0x1981" color="8" />
|
||||||
|
<Item ID="0x1982" color="8" />
|
||||||
|
<Item ID="0x1983" color="8" />
|
||||||
|
<Item ID="0x1984" color="8" />
|
||||||
|
<Item ID="0x1985" color="8" />
|
||||||
|
<Item ID="0x1986" color="8" />
|
||||||
|
<Item ID="0x1987" color="8" />
|
||||||
|
<Item ID="0x1988" color="8" />
|
||||||
|
<Item ID="0x1989" color="8" />
|
||||||
|
<Item ID="0x198A" color="8" />
|
||||||
|
<Item ID="0x198B" color="8" />
|
||||||
|
<Item ID="0x198C" color="8" />
|
||||||
|
<Item ID="0x198D" color="8" />
|
||||||
|
<Item ID="0x198E" color="8" />
|
||||||
|
<Item ID="0x198F" color="8" />
|
||||||
|
<Item ID="0x1990" color="8" />
|
||||||
|
<Item ID="0x1991" color="8" />
|
||||||
|
<Item ID="0x1992" color="8" />
|
||||||
|
<Item ID="0x1993" color="8" />
|
||||||
|
<Item ID="0x1994" color="8" />
|
||||||
|
<Item ID="0x1995" color="8" />
|
||||||
|
<Item ID="0x1996" color="8" />
|
||||||
|
<Item ID="0x1997" color="8" />
|
||||||
|
<Item ID="0x1998" color="8" />
|
||||||
|
<Item ID="0x1999" color="8" />
|
||||||
|
<Item ID="0x199A" color="8" />
|
||||||
|
<Item ID="0x199B" color="8" />
|
||||||
|
<Item ID="0x199C" color="8" />
|
||||||
|
<Item ID="0x199D" color="8" />
|
||||||
|
<Item ID="0x199E" color="8" />
|
||||||
|
<Item ID="0x199F" color="8" />
|
||||||
|
<Item ID="0x19A0" color="8" />
|
||||||
|
<Item ID="0x19A1" color="8" />
|
||||||
|
<Item ID="0x19A2" color="8" />
|
||||||
|
<Item ID="0x19A3" color="8" />
|
||||||
|
<Item ID="0x19A4" color="8" />
|
||||||
|
<Item ID="0x19A5" color="8" />
|
||||||
|
<Item ID="0x19A6" color="8" />
|
||||||
|
<Item ID="0x19A7" color="8" />
|
||||||
|
<Item ID="0x19A8" color="8" />
|
||||||
|
<Item ID="0x19A9" color="8" />
|
||||||
|
|
||||||
|
<Item ID="0x1853" color="7" />
|
||||||
|
<Item ID="0x1854" color="7" />
|
||||||
|
<Item ID="0x1855" color="7" />
|
||||||
|
<Item ID="0x1856" color="7" />
|
||||||
|
<Item ID="0x1857" color="7" />
|
||||||
|
<Item ID="0x1858" color="7" />
|
||||||
|
<Item ID="0x1859" color="7" />
|
||||||
|
<Item ID="0x185A" color="7" />
|
||||||
|
|
||||||
|
<Item ID="0x1849" color="7" />
|
||||||
|
<Item ID="0x184A" color="7" />
|
||||||
|
<Item ID="0x184B" color="7" />
|
||||||
|
<Item ID="0x184C" color="7" />
|
||||||
|
<Item ID="0x184D" color="7" />
|
||||||
|
<Item ID="0x184E" color="7" />
|
||||||
|
<Item ID="0x184F" color="7" />
|
||||||
|
<Item ID="0x1850" color="7" />
|
||||||
|
|
||||||
|
<Item ID="0x0DE1" color="5" />
|
||||||
|
<Item ID="0x0DE2" color="5" />
|
||||||
|
<Item ID="0x0DE3" color="5" />
|
||||||
|
<Item ID="0x0DE4" color="5" />
|
||||||
|
<Item ID="0x0DE5" color="5" />
|
||||||
|
<Item ID="0x0DE6" color="5" />
|
||||||
|
<Item ID="0x0DE7" color="5" />
|
||||||
|
<Item ID="0x0DE8" color="5" />
|
||||||
|
<Item ID="0x0DE9" color="5" />
|
||||||
|
<Item ID="0x0DEA" color="5" />
|
||||||
|
|
||||||
|
|
||||||
|
<Item ID="0x0B26" color="2" />
|
||||||
|
<Item ID="0x0B27" color="2" />
|
||||||
|
<Item ID="0x0B28" color="2" />
|
||||||
|
<Item ID="0x0B20" color="2" />
|
||||||
|
<Item ID="0x0B21" color="2" />
|
||||||
|
<Item ID="0x0B22" color="2" />
|
||||||
|
<Item ID="0x0B23" color="2" />
|
||||||
|
<Item ID="0x0B24" color="2" />
|
||||||
|
<Item ID="0x0B25" color="2" />
|
||||||
|
<Item ID="0x0B1A" color="2" />
|
||||||
|
<Item ID="0x0B1B" color="2" />
|
||||||
|
<Item ID="0x0B1C" color="2" />
|
||||||
|
<Item ID="0x0B1D" color="2" />
|
||||||
|
<Item ID="0x0B1E" color="2" />
|
||||||
|
<Item ID="0x0B1F" color="2" />
|
||||||
|
|
||||||
|
<Item ID="0x0A15" color="2" />
|
||||||
|
<Item ID="0x0A16" color="2" />
|
||||||
|
<Item ID="0x0A17" color="2" />
|
||||||
|
<Item ID="0x0A18" color="2" />
|
||||||
|
<Item ID="0x0A19" color="2" />
|
||||||
|
<Item ID="0x0A1A" color="2" />
|
||||||
|
<Item ID="0x0A1B" color="2" />
|
||||||
|
<Item ID="0x0A1C" color="2" />
|
||||||
|
<Item ID="0x0A1D" color="2" />
|
||||||
|
<Item ID="0x0A1E" color="2" />
|
||||||
|
<Item ID="0x0A1F" color="2" />
|
||||||
|
<Item ID="0x0A20" color="2" />
|
||||||
|
<Item ID="0x0A21" color="2" />
|
||||||
|
<Item ID="0x0A22" color="2" />
|
||||||
|
<Item ID="0x0A23" color="2" />
|
||||||
|
<Item ID="0x0A24" color="2" />
|
||||||
|
<Item ID="0x0A25" color="2" />
|
||||||
|
<Item ID="0x0A26" color="2" />
|
||||||
|
<Item ID="0x0A27" color="2" />
|
||||||
|
<Item ID="0x0A28" color="2" />
|
||||||
|
<Item ID="0x0A29" color="2" />
|
||||||
|
|
||||||
|
<Item ID="0x09FB" color="4" />
|
||||||
|
<Item ID="0x09FC" color="4" />
|
||||||
|
<Item ID="0x09FD" color="4" />
|
||||||
|
<Item ID="0x09FE" color="4" />
|
||||||
|
<Item ID="0x09FF" color="4" />
|
||||||
|
<Item ID="0x0A00" color="4" />
|
||||||
|
<Item ID="0x0A01" color="4" />
|
||||||
|
<Item ID="0x0A02" color="4" />
|
||||||
|
<Item ID="0x0A03" color="4" />
|
||||||
|
<Item ID="0x0A04" color="4" />
|
||||||
|
<Item ID="0x0A05" color="4" />
|
||||||
|
<Item ID="0x0A06" color="4" />
|
||||||
|
<Item ID="0x0A07" color="4" />
|
||||||
|
<Item ID="0x0A08" color="4" />
|
||||||
|
<Item ID="0x0A09" color="4" />
|
||||||
|
<Item ID="0x0A0A" color="4" />
|
||||||
|
<Item ID="0x0A0B" color="4" />
|
||||||
|
<Item ID="0x0A0C" color="4" />
|
||||||
|
<Item ID="0x0A0D" color="4" />
|
||||||
|
<Item ID="0x0A0E" color="4" />
|
||||||
|
<Item ID="0x0A0F" color="4" />
|
||||||
|
<Item ID="0x0A10" color="4" />
|
||||||
|
<Item ID="0x0A11" color="4" />
|
||||||
|
<Item ID="0x0A12" color="4" />
|
||||||
|
<Item ID="0x0A13" color="4" />
|
||||||
|
<Item ID="0x0A14" color="4" />
|
||||||
|
|
||||||
|
<Item ID="0x1FD4" color="9" />
|
||||||
|
<Item ID="0x0F6C" color="9" />
|
||||||
|
|
||||||
|
<Item ID="0x40FE" color="14" />
|
||||||
|
<Item ID="0x40FF" color="10" />
|
||||||
|
<Item ID="0x4100" color="12" />
|
||||||
|
<Item ID="0x4101" color="15" />
|
||||||
|
|
||||||
|
<Item ID="0x3E27" color="5" />
|
||||||
|
<Item ID="0x3E28" color="5" />
|
||||||
|
<Item ID="0x3E29" color="5" />
|
||||||
|
<Item ID="0x3E2A" color="5" />
|
||||||
|
<Item ID="0x3E2B" color="5" />
|
||||||
|
<Item ID="0x3E2C" color="5" />
|
||||||
|
<Item ID="0x3E2D" color="5" />
|
||||||
|
<Item ID="0x3E2E" color="5" />
|
||||||
|
<Item ID="0x3E2F" color="5" />
|
||||||
|
<Item ID="0x3E30" color="5" />
|
||||||
|
<Item ID="0x3E31" color="5" />
|
||||||
|
<Item ID="0x3E32" color="5" />
|
||||||
|
<Item ID="0x3E33" color="5" />
|
||||||
|
<Item ID="0x3E34" color="5" />
|
||||||
|
<Item ID="0x3E35" color="5" />
|
||||||
|
<Item ID="0x3E36" color="5" />
|
||||||
|
<Item ID="0x3E37" color="5" />
|
||||||
|
<Item ID="0x3E38" color="5" />
|
||||||
|
<Item ID="0x3E39" color="5" />
|
||||||
|
<Item ID="0x3E3A" color="5" />
|
||||||
|
|
||||||
|
<Item ID="0x3E02" color="13" />
|
||||||
|
<Item ID="0x3E03" color="13" />
|
||||||
|
<Item ID="0x3E04" color="13" />
|
||||||
|
<Item ID="0x3E05" color="13" />
|
||||||
|
<Item ID="0x3E06" color="13" />
|
||||||
|
<Item ID="0x3E07" color="13" />
|
||||||
|
<Item ID="0x3E08" color="13" />
|
||||||
|
<Item ID="0x3E09" color="13" />
|
||||||
|
<Item ID="0x3E0A" color="13" />
|
||||||
|
<Item ID="0x3E0B" color="13" />
|
||||||
|
|
||||||
|
<Item ID="0x398C" color="5" />
|
||||||
|
<Item ID="0x398D" color="5" />
|
||||||
|
<Item ID="0x398E" color="5" />
|
||||||
|
<Item ID="0x398F" color="5" />
|
||||||
|
<Item ID="0x3990" color="5" />
|
||||||
|
<Item ID="0x3991" color="5" />
|
||||||
|
<Item ID="0x3992" color="5" />
|
||||||
|
<Item ID="0x3993" color="5" />
|
||||||
|
<Item ID="0x3994" color="5" />
|
||||||
|
<Item ID="0x3995" color="5" />
|
||||||
|
<Item ID="0x3996" color="5" />
|
||||||
|
<Item ID="0x3997" color="5" />
|
||||||
|
<Item ID="0x3998" color="5" />
|
||||||
|
<Item ID="0x3999" color="5" />
|
||||||
|
<Item ID="0x399A" color="5" />
|
||||||
|
<Item ID="0x399B" color="5" />
|
||||||
|
<Item ID="0x399C" color="5" />
|
||||||
|
<Item ID="0x399D" color="5" />
|
||||||
|
<Item ID="0x399E" color="5" />
|
||||||
|
<Item ID="0x399F" color="5" />
|
||||||
|
|
||||||
|
<Item ID="0x3967" color="11" />
|
||||||
|
<Item ID="0x3968" color="11" />
|
||||||
|
<Item ID="0x3969" color="11" />
|
||||||
|
<Item ID="0x396A" color="11" />
|
||||||
|
<Item ID="0x396B" color="11" />
|
||||||
|
<Item ID="0x396C" color="11" />
|
||||||
|
<Item ID="0x396D" color="11" />
|
||||||
|
<Item ID="0x396E" color="11" />
|
||||||
|
<Item ID="0x396F" color="11" />
|
||||||
|
<Item ID="0x3970" color="11" />
|
||||||
|
<Item ID="0x3971" color="11" />
|
||||||
|
<Item ID="0x3972" color="11" />
|
||||||
|
<Item ID="0x3973" color="11" />
|
||||||
|
<Item ID="0x3974" color="11" />
|
||||||
|
<Item ID="0x3975" color="11" />
|
||||||
|
<Item ID="0x3976" color="11" />
|
||||||
|
<Item ID="0x3977" color="11" />
|
||||||
|
<Item ID="0x3978" color="11" />
|
||||||
|
<Item ID="0x3979" color="11" />
|
||||||
|
<Item ID="0x397A" color="11" />
|
||||||
|
|
||||||
|
<Item ID="0x3946" color="11" />
|
||||||
|
<Item ID="0x3947" color="11" />
|
||||||
|
<Item ID="0x3948" color="11" />
|
||||||
|
<Item ID="0x3949" color="11" />
|
||||||
|
<Item ID="0x394A" color="11" />
|
||||||
|
<Item ID="0x394B" color="11" />
|
||||||
|
<Item ID="0x394C" color="11" />
|
||||||
|
<Item ID="0x394D" color="11" />
|
||||||
|
<Item ID="0x394E" color="11" />
|
||||||
|
<Item ID="0x394F" color="11" />
|
||||||
|
<Item ID="0x3950" color="11" />
|
||||||
|
<Item ID="0x3951" color="11" />
|
||||||
|
<Item ID="0x3952" color="11" />
|
||||||
|
<Item ID="0x3953" color="11" />
|
||||||
|
<Item ID="0x3954" color="11" />
|
||||||
|
<Item ID="0x3955" color="11" />
|
||||||
|
<Item ID="0x3956" color="11" />
|
||||||
|
<Item ID="0x3957" color="11" />
|
||||||
|
<Item ID="0x3958" color="11" />
|
||||||
|
<Item ID="0x3959" color="11" />
|
||||||
|
<Item ID="0x395A" color="11" />
|
||||||
|
<Item ID="0x395B" color="11" />
|
||||||
|
<Item ID="0x395C" color="11" />
|
||||||
|
<Item ID="0x395D" color="11" />
|
||||||
|
<Item ID="0x395E" color="11" />
|
||||||
|
<Item ID="0x395F" color="11" />
|
||||||
|
<Item ID="0x3960" color="11" />
|
||||||
|
<Item ID="0x3961" color="11" />
|
||||||
|
<Item ID="0x3962" color="11" />
|
||||||
|
<Item ID="0x3963" color="11" />
|
||||||
|
<Item ID="0x3964" color="11" />
|
||||||
|
|
||||||
|
<Item ID="0x3914" color="13" />
|
||||||
|
<Item ID="0x3915" color="13" />
|
||||||
|
<Item ID="0x3916" color="13" />
|
||||||
|
<Item ID="0x3917" color="13" />
|
||||||
|
<Item ID="0x3918" color="13" />
|
||||||
|
<Item ID="0x3919" color="13" />
|
||||||
|
<Item ID="0x391A" color="13" />
|
||||||
|
<Item ID="0x391B" color="13" />
|
||||||
|
<Item ID="0x391C" color="13" />
|
||||||
|
<Item ID="0x391D" color="13" />
|
||||||
|
<Item ID="0x391E" color="13" />
|
||||||
|
<Item ID="0x391F" color="13" />
|
||||||
|
<Item ID="0x3920" color="13" />
|
||||||
|
<Item ID="0x3921" color="13" />
|
||||||
|
<Item ID="0x3922" color="13" />
|
||||||
|
<Item ID="0x3923" color="13" />
|
||||||
|
<Item ID="0x3924" color="13" />
|
||||||
|
<Item ID="0x3925" color="13" />
|
||||||
|
<Item ID="0x3926" color="13" />
|
||||||
|
<Item ID="0x3927" color="13" />
|
||||||
|
<Item ID="0x3928" color="13" />
|
||||||
|
<Item ID="0x3929" color="13" />
|
||||||
|
|
||||||
|
<Item ID="0x3547" color="5" />
|
||||||
|
<Item ID="0x3548" color="5" />
|
||||||
|
<Item ID="0x3549" color="5" />
|
||||||
|
<Item ID="0x354A" color="5" />
|
||||||
|
<Item ID="0x354B" color="5" />
|
||||||
|
<Item ID="0x354C" color="5" />
|
||||||
|
|
||||||
|
<Item ID="0x343B" color="5" />
|
||||||
|
<Item ID="0x343C" color="5" />
|
||||||
|
<Item ID="0x343D" color="5" />
|
||||||
|
<Item ID="0x343E" color="5" />
|
||||||
|
<Item ID="0x343F" color="5" />
|
||||||
|
<Item ID="0x3440" color="5" />
|
||||||
|
<Item ID="0x3441" color="5" />
|
||||||
|
<Item ID="0x3442" color="5" />
|
||||||
|
<Item ID="0x3443" color="5" />
|
||||||
|
<Item ID="0x3444" color="5" />
|
||||||
|
<Item ID="0x3445" color="5" />
|
||||||
|
<Item ID="0x3446" color="5" />
|
||||||
|
<Item ID="0x3447" color="5" />
|
||||||
|
<Item ID="0x3448" color="5" />
|
||||||
|
<Item ID="0x3449" color="5" />
|
||||||
|
<Item ID="0x344A" color="5" />
|
||||||
|
<Item ID="0x344B" color="5" />
|
||||||
|
<Item ID="0x344C" color="5" />
|
||||||
|
<Item ID="0x344D" color="5" />
|
||||||
|
<Item ID="0x344E" color="5" />
|
||||||
|
<Item ID="0x344F" color="5" />
|
||||||
|
<Item ID="0x3450" color="5" />
|
||||||
|
<Item ID="0x3451" color="5" />
|
||||||
|
<Item ID="0x3452" color="5" />
|
||||||
|
<Item ID="0x3453" color="5" />
|
||||||
|
<Item ID="0x3454" color="5" />
|
||||||
|
<Item ID="0x3455" color="5" />
|
||||||
|
<Item ID="0x3456" color="5" />
|
||||||
|
<Item ID="0x3457" color="5" />
|
||||||
|
<Item ID="0x3458" color="5" />
|
||||||
|
<Item ID="0x3459" color="5" />
|
||||||
|
<Item ID="0x345A" color="5" />
|
||||||
|
<Item ID="0x345B" color="5" />
|
||||||
|
<Item ID="0x345C" color="5" />
|
||||||
|
<Item ID="0x345D" color="5" />
|
||||||
|
<Item ID="0x345E" color="5" />
|
||||||
|
<Item ID="0x345F" color="5" />
|
||||||
|
<Item ID="0x3460" color="5" />
|
||||||
|
<Item ID="0x3461" color="5" />
|
||||||
|
<Item ID="0x3462" color="5" />
|
||||||
|
<Item ID="0x3463" color="5" />
|
||||||
|
<Item ID="0x3464" color="5" />
|
||||||
|
<Item ID="0x3465" color="5" />
|
||||||
|
<Item ID="0x3466" color="5" />
|
||||||
|
<Item ID="0x3467" color="5" />
|
||||||
|
<Item ID="0x3468" color="5" />
|
||||||
|
<Item ID="0x3469" color="5" />
|
||||||
|
<Item ID="0x346A" color="5" />
|
||||||
|
<Item ID="0x346B" color="5" />
|
||||||
|
<Item ID="0x346C" color="5" />
|
||||||
|
|
||||||
|
<Item ID="0x306A" color="5" />
|
||||||
|
<Item ID="0x306B" color="5" />
|
||||||
|
<Item ID="0x306C" color="5" />
|
||||||
|
<Item ID="0x306D" color="5" />
|
||||||
|
<Item ID="0x306E" color="5" />
|
||||||
|
<Item ID="0x306F" color="5" />
|
||||||
|
<Item ID="0x3070" color="5" />
|
||||||
|
<Item ID="0x3071" color="5" />
|
||||||
|
<Item ID="0x3072" color="5" />
|
||||||
|
<Item ID="0x3073" color="5" />
|
||||||
|
<Item ID="0x3074" color="5" />
|
||||||
|
<Item ID="0x3075" color="5" />
|
||||||
|
<Item ID="0x3076" color="5" />
|
||||||
|
<Item ID="0x3077" color="5" />
|
||||||
|
<Item ID="0x3078" color="5" />
|
||||||
|
<Item ID="0x3079" color="5" />
|
||||||
|
<Item ID="0x307A" color="5" />
|
||||||
|
<Item ID="0x307B" color="5" />
|
||||||
|
<Item ID="0x307C" color="5" />
|
||||||
|
<Item ID="0x307D" color="5" />
|
||||||
|
<Item ID="0x307E" color="5" />
|
||||||
|
<Item ID="0x307F" color="5" />
|
||||||
|
<Item ID="0x3080" color="5" />
|
||||||
|
<Item ID="0x3081" color="5" />
|
||||||
|
<Item ID="0x3082" color="5" />
|
||||||
|
<Item ID="0x3083" color="5" />
|
||||||
|
<Item ID="0x3084" color="5" />
|
||||||
|
<Item ID="0x3085" color="5" />
|
||||||
|
<Item ID="0x3086" color="5" />
|
||||||
|
<Item ID="0x3087" color="5" />
|
||||||
|
<Item ID="0x3088" color="5" />
|
||||||
|
<Item ID="0x3089" color="5" />
|
||||||
|
<Item ID="0x308A" color="5" />
|
||||||
|
<Item ID="0x308B" color="5" />
|
||||||
|
<Item ID="0x308C" color="5" />
|
||||||
|
<Item ID="0x308D" color="5" />
|
||||||
|
<Item ID="0x308E" color="5" />
|
||||||
|
<Item ID="0x308F" color="5" />
|
||||||
|
<Item ID="0x3090" color="5" />
|
||||||
|
<Item ID="0x3091" color="5" />
|
||||||
|
<Item ID="0x3092" color="5" />
|
||||||
|
<Item ID="0x3093" color="5" />
|
||||||
|
<Item ID="0x3094" color="5" />
|
||||||
|
<Item ID="0x3095" color="5" />
|
||||||
|
<Item ID="0x3096" color="5" />
|
||||||
|
<Item ID="0x3097" color="5" />
|
||||||
|
<Item ID="0x3098" color="5" />
|
||||||
|
<Item ID="0x3099" color="5" />
|
||||||
|
<Item ID="0x309A" color="5" />
|
||||||
|
<Item ID="0x309B" color="5" />
|
||||||
|
<Item ID="0x309C" color="5" />
|
||||||
|
<Item ID="0x309D" color="5" />
|
||||||
|
<Item ID="0x309E" color="5" />
|
||||||
|
<Item ID="0x309F" color="5" />
|
||||||
|
<Item ID="0x30A0" color="5" />
|
||||||
|
<Item ID="0x30A1" color="5" />
|
||||||
|
<Item ID="0x30A2" color="5" />
|
||||||
|
<Item ID="0x30A3" color="5" />
|
||||||
|
<Item ID="0x30A4" color="5" />
|
||||||
|
<Item ID="0x30A5" color="5" />
|
||||||
|
<Item ID="0x30A6" color="5" />
|
||||||
|
<Item ID="0x30A7" color="5" />
|
||||||
|
<Item ID="0x30A8" color="5" />
|
||||||
|
<Item ID="0x30A9" color="5" />
|
||||||
|
<Item ID="0x30AA" color="5" />
|
||||||
|
<Item ID="0x30AB" color="5" />
|
||||||
|
<Item ID="0x30AC" color="5" />
|
||||||
|
<Item ID="0x30AD" color="5" />
|
||||||
|
<Item ID="0x30AE" color="5" />
|
||||||
|
<Item ID="0x30AF" color="5" />
|
||||||
|
<Item ID="0x30B0" color="5" />
|
||||||
|
<Item ID="0x30B1" color="5" />
|
||||||
|
<Item ID="0x30B2" color="5" />
|
||||||
|
<Item ID="0x30B3" color="5" />
|
||||||
|
<Item ID="0x30B4" color="5" />
|
||||||
|
<Item ID="0x30B5" color="5" />
|
||||||
|
<Item ID="0x30B6" color="5" />
|
||||||
|
<Item ID="0x30B7" color="5" />
|
||||||
|
<Item ID="0x30B8" color="5" />
|
||||||
|
<Item ID="0x30B9" color="5" />
|
||||||
|
<Item ID="0x30BA" color="5" />
|
||||||
|
<Item ID="0x30BB" color="5" />
|
||||||
|
<Item ID="0x30BC" color="5" />
|
||||||
|
<Item ID="0x30BD" color="5" />
|
||||||
|
<Item ID="0x30BE" color="5" />
|
||||||
|
<Item ID="0x30BF" color="5" />
|
||||||
|
<Item ID="0x30C0" color="5" />
|
||||||
|
<Item ID="0x30C1" color="5" />
|
||||||
|
<Item ID="0x30C2" color="5" />
|
||||||
|
<Item ID="0x30C3" color="5" />
|
||||||
|
<Item ID="0x30C4" color="5" />
|
||||||
|
<Item ID="0x30C5" color="5" />
|
||||||
|
<Item ID="0x30C6" color="5" />
|
||||||
|
<Item ID="0x30C7" color="5" />
|
||||||
|
<Item ID="0x30C8" color="5" />
|
||||||
|
<Item ID="0x30C9" color="5" />
|
||||||
|
<Item ID="0x30CA" color="5" />
|
||||||
|
<Item ID="0x30CB" color="5" />
|
||||||
|
<Item ID="0x30CC" color="5" />
|
||||||
|
<Item ID="0x30CD" color="5" />
|
||||||
|
<Item ID="0x30CE" color="5" />
|
||||||
|
<Item ID="0x30CF" color="5" />
|
||||||
|
<Item ID="0x30D0" color="5" />
|
||||||
|
<Item ID="0x30D1" color="5" />
|
||||||
|
<Item ID="0x30D2" color="5" />
|
||||||
|
<Item ID="0x30D3" color="5" />
|
||||||
|
<Item ID="0x30D4" color="5" />
|
||||||
|
<Item ID="0x30D5" color="5" />
|
||||||
|
<Item ID="0x30D6" color="5" />
|
||||||
|
<Item ID="0x30D7" color="5" />
|
||||||
|
<Item ID="0x30D8" color="5" />
|
||||||
|
<Item ID="0x30D9" color="5" />
|
||||||
|
<Item ID="0x30DA" color="5" />
|
||||||
|
<Item ID="0x30DB" color="5" />
|
||||||
|
<Item ID="0x30DC" color="5" />
|
||||||
|
<Item ID="0x30DD" color="5" />
|
||||||
|
<Item ID="0x30DE" color="5" />
|
||||||
|
<Item ID="0x30DF" color="5" />
|
||||||
|
<Item ID="0x30E0" color="5" />
|
||||||
|
<Item ID="0x30E1" color="5" />
|
||||||
|
<Item ID="0x30E2" color="5" />
|
||||||
|
<Item ID="0x30E3" color="5" />
|
||||||
|
<Item ID="0x30E4" color="5" />
|
||||||
|
<Item ID="0x30E5" color="5" />
|
||||||
|
<Item ID="0x30E6" color="5" />
|
||||||
|
<Item ID="0x30E7" color="5" />
|
||||||
|
<Item ID="0x30E8" color="5" />
|
||||||
|
<Item ID="0x30E9" color="5" />
|
||||||
|
<Item ID="0x30EA" color="5" />
|
||||||
|
<Item ID="0x30EB" color="5" />
|
||||||
|
<Item ID="0x30EC" color="5" />
|
||||||
|
<Item ID="0x30ED" color="5" />
|
||||||
|
<Item ID="0x30EE" color="5" />
|
||||||
|
<Item ID="0x30EF" color="5" />
|
||||||
|
<Item ID="0x30F0" color="5" />
|
||||||
|
<Item ID="0x30F1" color="5" />
|
||||||
|
<Item ID="0x30F2" color="5" />
|
||||||
|
<Item ID="0x30F3" color="5" />
|
||||||
|
<Item ID="0x30F4" color="5" />
|
||||||
|
<Item ID="0x30F5" color="5" />
|
||||||
|
<Item ID="0x30F6" color="5" />
|
||||||
|
<Item ID="0x30F7" color="5" />
|
||||||
|
<Item ID="0x30F8" color="5" />
|
||||||
|
<Item ID="0x30F9" color="5" />
|
||||||
|
<Item ID="0x30FA" color="5" />
|
||||||
|
<Item ID="0x30FB" color="5" />
|
||||||
|
<Item ID="0x30FC" color="5" />
|
||||||
|
<Item ID="0x30FD" color="5" />
|
||||||
|
<Item ID="0x30FE" color="5" />
|
||||||
|
<Item ID="0x30FF" color="5" />
|
||||||
|
<Item ID="0x3100" color="5" />
|
||||||
|
<Item ID="0x3101" color="5" />
|
||||||
|
<Item ID="0x3102" color="5" />
|
||||||
|
<Item ID="0x3103" color="5" />
|
||||||
|
<Item ID="0x3104" color="5" />
|
||||||
|
<Item ID="0x3105" color="5" />
|
||||||
|
<Item ID="0x3106" color="5" />
|
||||||
|
<Item ID="0x3107" color="5" />
|
||||||
|
<Item ID="0x3108" color="5" />
|
||||||
|
<Item ID="0x3109" color="5" />
|
||||||
|
<Item ID="0x310A" color="5" />
|
||||||
|
<Item ID="0x310B" color="5" />
|
||||||
|
<Item ID="0x310C" color="5" />
|
||||||
|
<Item ID="0x310D" color="5" />
|
||||||
|
<Item ID="0x310E" color="5" />
|
||||||
|
<Item ID="0x310F" color="5" />
|
||||||
|
<Item ID="0x3110" color="5" />
|
||||||
|
<Item ID="0x3111" color="5" />
|
||||||
|
<Item ID="0x3112" color="5" />
|
||||||
|
<Item ID="0x3113" color="5" />
|
||||||
|
<Item ID="0x3114" color="5" />
|
||||||
|
<Item ID="0x3115" color="5" />
|
||||||
|
<Item ID="0x3116" color="5" />
|
||||||
|
<Item ID="0x3117" color="5" />
|
||||||
|
<Item ID="0x3118" color="5" />
|
||||||
|
<Item ID="0x3119" color="5" />
|
||||||
|
<Item ID="0x311A" color="5" />
|
||||||
|
<Item ID="0x311B" color="5" />
|
||||||
|
<Item ID="0x311C" color="5" />
|
||||||
|
<Item ID="0x311D" color="5" />
|
||||||
|
<Item ID="0x311E" color="5" />
|
||||||
|
<Item ID="0x311F" color="5" />
|
||||||
|
<Item ID="0x3120" color="5" />
|
||||||
|
<Item ID="0x3121" color="5" />
|
||||||
|
<Item ID="0x3122" color="5" />
|
||||||
|
<Item ID="0x3123" color="5" />
|
||||||
|
<Item ID="0x3124" color="5" />
|
||||||
|
<Item ID="0x3127" color="5" />
|
||||||
|
<Item ID="0x3128" color="5" />
|
||||||
|
<Item ID="0x3129" color="5" />
|
||||||
|
<Item ID="0x312A" color="5" />
|
||||||
|
<Item ID="0x312D" color="5" />
|
||||||
|
<Item ID="0x312E" color="5" />
|
||||||
|
<Item ID="0x312F" color="5" />
|
||||||
|
<Item ID="0x3130" color="5" />
|
||||||
|
<Item ID="0x314C" color="5" />
|
||||||
|
<Item ID="0x314D" color="5" />
|
||||||
|
<Item ID="0x314E" color="5" />
|
||||||
|
<Item ID="0x314F" color="5" />
|
||||||
|
<Item ID="0x3150" color="5" />
|
||||||
|
<Item ID="0x3151" color="5" />
|
||||||
|
<Item ID="0x3152" color="5" />
|
||||||
|
<Item ID="0x3153" color="5" />
|
||||||
|
<Item ID="0x3154" color="5" />
|
||||||
|
<Item ID="0x3155" color="5" />
|
||||||
|
<Item ID="0x3156" color="5" />
|
||||||
|
<Item ID="0x3157" color="5" />
|
||||||
|
<Item ID="0x3158" color="5" />
|
||||||
|
<Item ID="0x3159" color="5" />
|
||||||
|
<Item ID="0x315A" color="5" />
|
||||||
|
<Item ID="0x315B" color="5" />
|
||||||
|
<Item ID="0x315C" color="5" />
|
||||||
|
<Item ID="0x315D" color="5" />
|
||||||
|
<Item ID="0x315E" color="5" />
|
||||||
|
<Item ID="0x315F" color="5" />
|
||||||
|
<Item ID="0x3160" color="5" />
|
||||||
|
<Item ID="0x3161" color="5" />
|
||||||
|
<Item ID="0x3162" color="5" />
|
||||||
|
<Item ID="0x3163" color="5" />
|
||||||
|
<Item ID="0x3164" color="5" />
|
||||||
|
<Item ID="0x3165" color="5" />
|
||||||
|
<Item ID="0x3166" color="5" />
|
||||||
|
<Item ID="0x3167" color="5" />
|
||||||
|
<Item ID="0x3168" color="5" />
|
||||||
|
<Item ID="0x3169" color="5" />
|
||||||
|
<Item ID="0x316A" color="5" />
|
||||||
|
<Item ID="0x316B" color="5" />
|
||||||
|
<Item ID="0x316C" color="5" />
|
||||||
|
<Item ID="0x316D" color="5" />
|
||||||
|
<Item ID="0x316E" color="5" />
|
||||||
|
<Item ID="0x316F" color="5" />
|
||||||
|
<Item ID="0x3170" color="5" />
|
||||||
|
<Item ID="0x3171" color="5" />
|
||||||
|
<Item ID="0x3172" color="5" />
|
||||||
|
<Item ID="0x3173" color="5" />
|
||||||
|
<Item ID="0x3174" color="5" />
|
||||||
|
<Item ID="0x3175" color="5" />
|
||||||
|
<Item ID="0x3176" color="5" />
|
||||||
|
<Item ID="0x3177" color="5" />
|
||||||
|
<Item ID="0x3178" color="5" />
|
||||||
|
<Item ID="0x3179" color="5" />
|
||||||
|
<Item ID="0x317A" color="5" />
|
||||||
|
<Item ID="0x317B" color="5" />
|
||||||
|
<Item ID="0x317C" color="5" />
|
||||||
|
<Item ID="0x317D" color="5" />
|
||||||
|
<Item ID="0x317E" color="5" />
|
||||||
|
<Item ID="0x317F" color="5" />
|
||||||
|
<Item ID="0x3180" color="5" />
|
||||||
|
<Item ID="0x3181" color="5" />
|
||||||
|
<Item ID="0x3183" color="5" />
|
||||||
|
<Item ID="0x3184" color="5" />
|
||||||
|
<Item ID="0x3185" color="5" />
|
||||||
|
<Item ID="0x3186" color="5" />
|
||||||
|
<Item ID="0x3187" color="5" />
|
||||||
|
<Item ID="0x3188" color="5" />
|
||||||
|
<Item ID="0x3189" color="5" />
|
||||||
|
<Item ID="0x318A" color="5" />
|
||||||
|
<Item ID="0x318B" color="5" />
|
||||||
|
<Item ID="0x318C" color="5" />
|
||||||
|
<Item ID="0x318D" color="5" />
|
||||||
|
<Item ID="0x318E" color="5" />
|
||||||
|
<Item ID="0x318F" color="5" />
|
||||||
|
<Item ID="0x3190" color="5" />
|
||||||
|
<Item ID="0x3191" color="5" />
|
||||||
|
<Item ID="0x3192" color="5" />
|
||||||
|
<Item ID="0x3193" color="5" />
|
||||||
|
<Item ID="0x3194" color="5" />
|
||||||
|
<Item ID="0x3195" color="5" />
|
||||||
|
<Item ID="0x3196" color="5" />
|
||||||
|
<Item ID="0x3197" color="5" />
|
||||||
|
<Item ID="0x3198" color="5" />
|
||||||
|
<Item ID="0x3199" color="5" />
|
||||||
|
<Item ID="0x319A" color="5" />
|
||||||
|
<Item ID="0x319B" color="5" />
|
||||||
|
<Item ID="0x319C" color="5" />
|
||||||
|
<Item ID="0x319D" color="5" />
|
||||||
|
<Item ID="0x319E" color="5" />
|
||||||
|
<Item ID="0x319F" color="5" />
|
||||||
|
<Item ID="0x31A0" color="5" />
|
||||||
|
<Item ID="0x31A1" color="5" />
|
||||||
|
<Item ID="0x31A2" color="5" />
|
||||||
|
<Item ID="0x31A3" color="5" />
|
||||||
|
<Item ID="0x31A4" color="5" />
|
||||||
|
<Item ID="0x31A5" color="5" />
|
||||||
|
<Item ID="0x31A6" color="5" />
|
||||||
|
<Item ID="0x31A7" color="5" />
|
||||||
|
<Item ID="0x31A8" color="5" />
|
||||||
|
<Item ID="0x31A9" color="5" />
|
||||||
|
<Item ID="0x31AA" color="5" />
|
||||||
|
<Item ID="0x31AB" color="5" />
|
||||||
|
<Item ID="0x31AC" color="5" />
|
||||||
|
<Item ID="0x31AD" color="5" />
|
||||||
|
<Item ID="0x31AE" color="5" />
|
||||||
|
<Item ID="0x31AF" color="5" />
|
||||||
|
<Item ID="0x31F4" color="5" />
|
||||||
|
<Item ID="0x31F5" color="5" />
|
||||||
|
<Item ID="0x31F6" color="5" />
|
||||||
|
<Item ID="0x31F7" color="5" />
|
||||||
|
<Item ID="0x31F8" color="5" />
|
||||||
|
<Item ID="0x31F9" color="5" />
|
||||||
|
<Item ID="0x31FA" color="5" />
|
||||||
|
<Item ID="0x31FB" color="5" />
|
||||||
|
<Item ID="0x3209" color="5" />
|
||||||
|
<Item ID="0x320A" color="5" />
|
||||||
|
<Item ID="0x320D" color="5" />
|
||||||
|
<Item ID="0x320E" color="5" />
|
||||||
|
<Item ID="0x320F" color="5" />
|
||||||
|
<Item ID="0x3210" color="5" />
|
||||||
|
<Item ID="0x3211" color="5" />
|
||||||
|
<Item ID="0x3213" color="5" />
|
||||||
|
<Item ID="0x3214" color="5" />
|
||||||
|
<Item ID="0x3215" color="5" />
|
||||||
|
<Item ID="0x3216" color="5" />
|
||||||
|
<Item ID="0x3217" color="5" />
|
||||||
|
<Item ID="0x3218" color="5" />
|
||||||
|
<Item ID="0x321A" color="5" />
|
||||||
|
<Item ID="0x321B" color="5" />
|
||||||
|
<Item ID="0x321C" color="5" />
|
||||||
|
<Item ID="0x321D" color="5" />
|
||||||
|
<Item ID="0x321E" color="5" />
|
||||||
|
<Item ID="0x3220" color="5" />
|
||||||
|
<Item ID="0x3221" color="5" />
|
||||||
|
<Item ID="0x3222" color="5" />
|
||||||
|
<Item ID="0x3223" color="5" />
|
||||||
|
<Item ID="0x3224" color="5" />
|
||||||
|
<Item ID="0x3226" color="5" />
|
||||||
|
<Item ID="0x3227" color="5" />
|
||||||
|
<Item ID="0x3228" color="5" />
|
||||||
|
<Item ID="0x3229" color="5" />
|
||||||
|
<Item ID="0x322A" color="5" />
|
||||||
|
<Item ID="0x322C" color="5" />
|
||||||
|
<Item ID="0x322D" color="5" />
|
||||||
|
<Item ID="0x322E" color="5" />
|
||||||
|
<Item ID="0x322F" color="5" />
|
||||||
|
<Item ID="0x3230" color="5" />
|
||||||
|
<Item ID="0x3231" color="5" />
|
||||||
|
<Item ID="0x3232" color="5" />
|
||||||
|
<Item ID="0x3233" color="5" />
|
||||||
|
<Item ID="0x3234" color="5" />
|
||||||
|
<Item ID="0x3236" color="5" />
|
||||||
|
<Item ID="0x3237" color="5" />
|
||||||
|
<Item ID="0x3238" color="5" />
|
||||||
|
<Item ID="0x3239" color="5" />
|
||||||
|
<Item ID="0x323A" color="5" />
|
||||||
|
<Item ID="0x323B" color="5" />
|
||||||
|
<Item ID="0x323C" color="5" />
|
||||||
|
<Item ID="0x323D" color="5" />
|
||||||
|
<Item ID="0x323E" color="5" />
|
||||||
|
<Item ID="0x323F" color="5" />
|
||||||
|
<Item ID="0x3241" color="5" />
|
||||||
|
<Item ID="0x3242" color="5" />
|
||||||
|
<Item ID="0x3243" color="5" />
|
||||||
|
<Item ID="0x3244" color="5" />
|
||||||
|
<Item ID="0x3245" color="5" />
|
||||||
|
<Item ID="0x3246" color="5" />
|
||||||
|
<Item ID="0x3247" color="5" />
|
||||||
|
<Item ID="0x3248" color="5" />
|
||||||
|
<Item ID="0x3249" color="5" />
|
||||||
|
<Item ID="0x324A" color="5" />
|
||||||
|
<Item ID="0x324B" color="5" />
|
||||||
|
<Item ID="0x324C" color="5" />
|
||||||
|
<Item ID="0x324D" color="5" />
|
||||||
|
<Item ID="0x324E" color="5" />
|
||||||
|
<Item ID="0x324F" color="5" />
|
||||||
|
<Item ID="0x3250" color="5" />
|
||||||
|
<Item ID="0x3251" color="5" />
|
||||||
|
<Item ID="0x3252" color="5" />
|
||||||
|
<Item ID="0x3253" color="5" />
|
||||||
|
<Item ID="0x3254" color="5" />
|
||||||
|
<Item ID="0x3255" color="5" />
|
||||||
|
<Item ID="0x3256" color="5" />
|
||||||
|
<Item ID="0x3257" color="5" />
|
||||||
|
<Item ID="0x3258" color="5" />
|
||||||
|
<Item ID="0x3259" color="5" />
|
||||||
|
<Item ID="0x325A" color="5" />
|
||||||
|
<Item ID="0x325B" color="5" />
|
||||||
|
<Item ID="0x325C" color="5" />
|
||||||
|
<Item ID="0x325D" color="5" />
|
||||||
|
<Item ID="0x325E" color="5" />
|
||||||
|
<Item ID="0x325F" color="5" />
|
||||||
|
<Item ID="0x3260" color="5" />
|
||||||
|
<Item ID="0x3261" color="5" />
|
||||||
|
<Item ID="0x3262" color="5" />
|
||||||
|
<Item ID="0x3263" color="5" />
|
||||||
|
<Item ID="0x3264" color="5" />
|
||||||
|
<Item ID="0x3265" color="5" />
|
||||||
|
<Item ID="0x3266" color="5" />
|
||||||
|
<Item ID="0x3267" color="5" />
|
||||||
|
<Item ID="0x3268" color="5" />
|
||||||
|
<Item ID="0x3269" color="5" />
|
||||||
|
<Item ID="0x326A" color="5" />
|
||||||
|
<Item ID="0x326B" color="5" />
|
||||||
|
<Item ID="0x326C" color="5" />
|
||||||
|
<Item ID="0x326D" color="5" />
|
||||||
|
<Item ID="0x326E" color="5" />
|
||||||
|
<Item ID="0x326F" color="5" />
|
||||||
|
<Item ID="0x3270" color="5" />
|
||||||
|
<Item ID="0x3271" color="5" />
|
||||||
|
<Item ID="0x3272" color="5" />
|
||||||
|
<Item ID="0x3273" color="5" />
|
||||||
|
<Item ID="0x3274" color="5" />
|
||||||
|
<Item ID="0x3275" color="5" />
|
||||||
|
<Item ID="0x3276" color="5" />
|
||||||
|
<Item ID="0x3277" color="5" />
|
||||||
|
<Item ID="0x3278" color="5" />
|
||||||
|
<Item ID="0x3279" color="5" />
|
||||||
|
<Item ID="0x327A" color="5" />
|
||||||
|
<Item ID="0x327B" color="5" />
|
||||||
|
<Item ID="0x327C" color="5" />
|
||||||
|
<Item ID="0x327D" color="5" />
|
||||||
|
<Item ID="0x327E" color="5" />
|
||||||
|
<Item ID="0x327F" color="5" />
|
||||||
|
<Item ID="0x3280" color="5" />
|
||||||
|
<Item ID="0x3281" color="5" />
|
||||||
|
<Item ID="0x3282" color="5" />
|
||||||
|
<Item ID="0x3283" color="5" />
|
||||||
|
<Item ID="0x3284" color="5" />
|
||||||
|
<Item ID="0x3285" color="5" />
|
||||||
|
<Item ID="0x3286" color="5" />
|
||||||
|
<Item ID="0x3287" color="5" />
|
||||||
|
<Item ID="0x3288" color="5" />
|
||||||
|
<Item ID="0x3289" color="5" />
|
||||||
|
<Item ID="0x328A" color="5" />
|
||||||
|
<Item ID="0x328B" color="5" />
|
||||||
|
<Item ID="0x328C" color="5" />
|
||||||
|
<Item ID="0x328D" color="5" />
|
||||||
|
<Item ID="0x328E" color="5" />
|
||||||
|
<Item ID="0x328F" color="5" />
|
||||||
|
<Item ID="0x3290" color="5" />
|
||||||
|
<Item ID="0x3291" color="5" />
|
||||||
|
<Item ID="0x3292" color="5" />
|
||||||
|
<Item ID="0x3293" color="5" />
|
||||||
|
<Item ID="0x3294" color="5" />
|
||||||
|
<Item ID="0x3295" color="5" />
|
||||||
|
<Item ID="0x3296" color="5" />
|
||||||
|
<Item ID="0x3297" color="5" />
|
||||||
|
<Item ID="0x3298" color="5" />
|
||||||
|
<Item ID="0x3299" color="5" />
|
||||||
|
<Item ID="0x329A" color="5" />
|
||||||
|
<Item ID="0x329B" color="5" />
|
||||||
|
|
||||||
|
<Item ID="0x12EE" color="5" />
|
||||||
|
<Item ID="0x12EF" color="5" />
|
||||||
|
<Item ID="0x12F0" color="5" />
|
||||||
|
<Item ID="0x12F1" color="5" />
|
||||||
|
<Item ID="0x12F2" color="5" />
|
||||||
|
<Item ID="0x12F4" color="5" />
|
||||||
|
<Item ID="0x12F5" color="5" />
|
||||||
|
<Item ID="0x12F6" color="5" />
|
||||||
|
<Item ID="0x12F7" color="5" />
|
||||||
|
<Item ID="0x12F8" color="5" />
|
||||||
|
<Item ID="0x12F9" color="5" />
|
||||||
|
<Item ID="0x12FA" color="5" />
|
||||||
|
<Item ID="0x12FB" color="5" />
|
||||||
|
<Item ID="0x12FC" color="5" />
|
||||||
|
<Item ID="0x12FD" color="5" />
|
||||||
|
<Item ID="0x12FE" color="5" />
|
||||||
|
<Item ID="0x1300" color="5" />
|
||||||
|
<Item ID="0x1301" color="5" />
|
||||||
|
<Item ID="0x1302" color="5" />
|
||||||
|
<Item ID="0x1303" color="5" />
|
||||||
|
<Item ID="0x1304" color="5" />
|
||||||
|
<Item ID="0x1306" color="5" />
|
||||||
|
<Item ID="0x1307" color="5" />
|
||||||
|
<Item ID="0x1308" color="5" />
|
||||||
|
<Item ID="0x1309" color="5" />
|
||||||
|
<Item ID="0x130A" color="5" />
|
||||||
|
<Item ID="0x130C" color="5" />
|
||||||
|
<Item ID="0x130D" color="5" />
|
||||||
|
<Item ID="0x130E" color="5" />
|
||||||
|
<Item ID="0x130F" color="5" />
|
||||||
|
<Item ID="0x1310" color="5" />
|
||||||
|
<Item ID="0x1312" color="5" />
|
||||||
|
<Item ID="0x1313" color="5" />
|
||||||
|
<Item ID="0x1314" color="5" />
|
||||||
|
<Item ID="0x1315" color="5" />
|
||||||
|
<Item ID="0x1316" color="5" />
|
||||||
|
<Item ID="0x1318" color="5" />
|
||||||
|
<Item ID="0x1319" color="5" />
|
||||||
|
<Item ID="0x131A" color="5" />
|
||||||
|
<Item ID="0x131B" color="5" />
|
||||||
|
<Item ID="0x131C" color="5" />
|
||||||
|
<Item ID="0x131E" color="5" />
|
||||||
|
<Item ID="0x131F" color="5" />
|
||||||
|
<Item ID="0x1320" color="5" />
|
||||||
|
<Item ID="0x1321" color="5" />
|
||||||
|
<Item ID="0x1322" color="5" />
|
||||||
|
<Item ID="0x1323" color="5" />
|
||||||
|
<Item ID="0x1324" color="5" />
|
||||||
|
<Item ID="0x1325" color="5" />
|
||||||
|
<Item ID="0x1326" color="5" />
|
||||||
|
<Item ID="0x1327" color="5" />
|
||||||
|
<Item ID="0x1328" color="5" />
|
||||||
|
<Item ID="0x1329" color="5" />
|
||||||
|
<Item ID="0x132A" color="5" />
|
||||||
|
<Item ID="0x132B" color="5" />
|
||||||
|
<Item ID="0x132C" color="5" />
|
||||||
|
<Item ID="0x132D" color="5" />
|
||||||
|
<Item ID="0x132E" color="5" />
|
||||||
|
<Item ID="0x132F" color="5" />
|
||||||
|
<Item ID="0x1330" color="5" />
|
||||||
|
<Item ID="0x1331" color="5" />
|
||||||
|
<Item ID="0x1332" color="5" />
|
||||||
|
<Item ID="0x1333" color="5" />
|
||||||
|
<Item ID="0x1334" color="5" />
|
||||||
|
<Item ID="0x1335" color="5" />
|
||||||
|
<Item ID="0x1336" color="5" />
|
||||||
|
<Item ID="0x1337" color="5" />
|
||||||
|
<Item ID="0x1338" color="5" />
|
||||||
|
<Item ID="0x1339" color="5" />
|
||||||
|
<Item ID="0x133A" color="5" />
|
||||||
|
<Item ID="0x133B" color="5" />
|
||||||
|
<Item ID="0x133C" color="5" />
|
||||||
|
<Item ID="0x133D" color="5" />
|
||||||
|
<Item ID="0x133E" color="5" />
|
||||||
|
<Item ID="0x133F" color="5" />
|
||||||
|
<Item ID="0x1340" color="5" />
|
||||||
|
<Item ID="0x1341" color="5" />
|
||||||
|
<Item ID="0x1342" color="5" />
|
||||||
|
<Item ID="0x1343" color="5" />
|
||||||
|
<Item ID="0x1344" color="5" />
|
||||||
|
<Item ID="0x1345" color="5" />
|
||||||
|
<Item ID="0x1346" color="5" />
|
||||||
|
<Item ID="0x1347" color="5" />
|
||||||
|
<Item ID="0x1348" color="5" />
|
||||||
|
<Item ID="0x1349" color="5" />
|
||||||
|
<Item ID="0x134A" color="5" />
|
||||||
|
<Item ID="0x134B" color="5" />
|
||||||
|
<Item ID="0x134C" color="5" />
|
||||||
|
<Item ID="0x134D" color="5" />
|
||||||
|
|
||||||
|
<Item ID="0x0E5C" color="11" />
|
||||||
|
<Item ID="0x0E5D" color="11" />
|
||||||
|
<Item ID="0x0E5E" color="11" />
|
||||||
|
<Item ID="0x0E5F" color="11" />
|
||||||
|
<Item ID="0x0E60" color="11" />
|
||||||
|
<Item ID="0x0E61" color="11" />
|
||||||
|
<Item ID="0x0E62" color="11" />
|
||||||
|
<Item ID="0x0E63" color="11" />
|
||||||
|
<Item ID="0x0E64" color="11" />
|
||||||
|
<Item ID="0x0E65" color="11" />
|
||||||
|
<Item ID="0x0E66" color="11" />
|
||||||
|
<Item ID="0x0E67" color="11" />
|
||||||
|
<Item ID="0x0E68" color="11" />
|
||||||
|
<Item ID="0x0E69" color="11" />
|
||||||
|
<Item ID="0x0E6A" color="11" />
|
||||||
|
|
||||||
|
<Item ID="0x0E31" color="14" />
|
||||||
|
<Item ID="0x0E32" color="14" />
|
||||||
|
<Item ID="0x0E33" color="14" />
|
||||||
|
|
||||||
|
<Item ID="0x0E2D" color="3" />
|
||||||
|
<Item ID="0x0E2E" color="3" />
|
||||||
|
<Item ID="0x0E2F" color="3" />
|
||||||
|
<Item ID="0x0E30" color="3" />
|
||||||
|
|
||||||
|
|
||||||
|
<!-- Original virtual sources -->
|
||||||
|
<Item ID="0x1646" color="2"/>
|
||||||
|
<Item ID="0x1647" color="2"/>
|
||||||
|
|
||||||
|
</Sources>
|
||||||
|
|
||||||
|
</ColorLight>
|
||||||
@@ -0,0 +1,5 @@
|
|||||||
|
LEFTTOPARROW RCDATA "Overlay/LeftTopArrow.tga"
|
||||||
|
TOPARROW RCDATA "Overlay/TopArrow.tga"
|
||||||
|
VIRTUALLAYER RCDATA "Overlay/VirtualLayer.tga"
|
||||||
|
DEJAVU RCDATA "GLFont/DejaVu.png"
|
||||||
|
DEJAVUDAT RCDATA "GLFont/DejaVu.fnt"
|
||||||
+457
-164
@@ -1,379 +1,672 @@
|
|||||||
<?xml version="1.0"?>
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
<CONFIG>
|
<CONFIG>
|
||||||
<ProjectOptions>
|
<ProjectOptions>
|
||||||
<Version Value="7"/>
|
<Version Value="12"/>
|
||||||
<General>
|
<General>
|
||||||
<Flags>
|
<Flags>
|
||||||
<MainUnitHasUsesSectionForAllUnits Value="False"/>
|
<MainUnitHasUsesSectionForAllUnits Value="False"/>
|
||||||
<AlwaysBuild Value="False"/>
|
<CompatibilityMode Value="True"/>
|
||||||
</Flags>
|
</Flags>
|
||||||
<SessionStorage Value="InProjectDir"/>
|
<SessionStorage Value="InProjectDir"/>
|
||||||
<MainUnit Value="0"/>
|
|
||||||
<TargetFileExt Value=".exe"/>
|
|
||||||
<Title Value="CentrED"/>
|
<Title Value="CentrED"/>
|
||||||
<LFMResourceType Value="res"/>
|
<Scaled Value="True"/>
|
||||||
|
<ResourceType Value="res"/>
|
||||||
|
<UseXPManifest Value="True"/>
|
||||||
|
<XPManifest>
|
||||||
|
<DpiAware Value="True"/>
|
||||||
|
</XPManifest>
|
||||||
<Icon Value="0"/>
|
<Icon Value="0"/>
|
||||||
</General>
|
</General>
|
||||||
<LazDoc Paths="../doc"/>
|
<LazDoc Paths="../doc"/>
|
||||||
<VersionInfo>
|
<VersionInfo>
|
||||||
<UseVersionInfo Value="True"/>
|
<UseVersionInfo Value="True"/>
|
||||||
<CurrentMajorRevNr Value="6"/>
|
<AutoIncrementBuild Value="True"/>
|
||||||
<CurrentMinorRevNr Value="1"/>
|
<MinorVersionNr Value="7"/>
|
||||||
<CurrentBuildNr Value="209"/>
|
<BuildNr Value="264"/>
|
||||||
<ProjectVersion Value="0.6.1.209"/>
|
<StringTable CompanyName="AKS DataBasis" FileDescription="UO CentrED" InternalName="CentrED" LegalCopyright="(c) 2022 Andreas Schneider and StaticZ" OriginalFilename="CentrED.exe" ProductName="CentrED" ProductVersion="0.7.0"/>
|
||||||
<CompanyName Value="AKS DataBasis"/>
|
|
||||||
<FileDescription Value="UO CentrED"/>
|
|
||||||
<InternalName Value="CentrED"/>
|
|
||||||
<LegalCopyright Value="Andreas Schneider"/>
|
|
||||||
<OriginalFilename Value="CentrED.exe"/>
|
|
||||||
<ProductName Value="CentrED"/>
|
|
||||||
</VersionInfo>
|
</VersionInfo>
|
||||||
|
<BuildModes Count="8">
|
||||||
|
<Item1 Name="default" Default="True"/>
|
||||||
|
<Item2 Name="Release.Win32">
|
||||||
|
<MacroValues Count="1">
|
||||||
|
<Macro1 Name="LCLWidgetType" Value="win32"/>
|
||||||
|
</MacroValues>
|
||||||
|
<CompilerOptions>
|
||||||
|
<Version Value="11"/>
|
||||||
|
<Target>
|
||||||
|
<Filename Value="../Client.bin/CentrED"/>
|
||||||
|
</Target>
|
||||||
|
<SearchPaths>
|
||||||
|
<IncludeFiles Value="$(ProjOutDir);../Imaging;.."/>
|
||||||
|
<OtherUnitFiles Value="..;../UOLib;../MulProvider;../Imaging;../Imaging/JpegLib;../Imaging/ZLib;Tools"/>
|
||||||
|
<UnitOutputDirectory Value="../obj/$(TargetCPU)-$(TargetOS)"/>
|
||||||
|
<SrcPath Value="$(LazarusDir)/lcl;$(LazarusDir)/lcl/interfaces/$(LCLWidgetType);..;../UOLib;../MulProvider;../Imaging;../Imaging/JpegLib;../Imaging/ZLib;Tools"/>
|
||||||
|
</SearchPaths>
|
||||||
|
<Parsing>
|
||||||
|
<SyntaxOptions>
|
||||||
|
<CStyleOperator Value="False"/>
|
||||||
|
</SyntaxOptions>
|
||||||
|
</Parsing>
|
||||||
|
<CodeGeneration>
|
||||||
|
<SmartLinkUnit Value="True"/>
|
||||||
|
<TargetCPU Value="i386"/>
|
||||||
|
<TargetOS Value="win32"/>
|
||||||
|
<Optimizations>
|
||||||
|
<OptimizationLevel Value="3"/>
|
||||||
|
</Optimizations>
|
||||||
|
</CodeGeneration>
|
||||||
|
<Linking>
|
||||||
|
<Debugging>
|
||||||
|
<GenerateDebugInfo Value="False"/>
|
||||||
|
<UseLineInfoUnit Value="False"/>
|
||||||
|
<StripSymbols Value="True"/>
|
||||||
|
</Debugging>
|
||||||
|
<LinkSmart Value="True"/>
|
||||||
|
<Options>
|
||||||
|
<Win32>
|
||||||
|
<GraphicApplication Value="True"/>
|
||||||
|
</Win32>
|
||||||
|
</Options>
|
||||||
|
</Linking>
|
||||||
|
<Other>
|
||||||
|
<CompilerMessages>
|
||||||
|
<IgnoredMessages idx5028="True" idx5024="True" idx4081="True" idx4080="True" idx4079="True"/>
|
||||||
|
</CompilerMessages>
|
||||||
|
<CustomOptions Value="-dNoLogging"/>
|
||||||
|
</Other>
|
||||||
|
</CompilerOptions>
|
||||||
|
</Item2>
|
||||||
|
<Item3 Name="Release.Win64">
|
||||||
|
<CompilerOptions>
|
||||||
|
<Version Value="11"/>
|
||||||
|
<Target>
|
||||||
|
<Filename Value="../Client.bin/CentrED"/>
|
||||||
|
</Target>
|
||||||
|
<SearchPaths>
|
||||||
|
<IncludeFiles Value="$(ProjOutDir);../Imaging;.."/>
|
||||||
|
<OtherUnitFiles Value="..;../UOLib;../MulProvider;../Imaging;../Imaging/JpegLib;../Imaging/ZLib;Tools"/>
|
||||||
|
<UnitOutputDirectory Value="../obj/$(TargetCPU)-$(TargetOS)"/>
|
||||||
|
<SrcPath Value="$(LazarusDir)/lcl;$(LazarusDir)/lcl/interfaces/$(LCLWidgetType);..;../UOLib;../MulProvider;../Imaging;../Imaging/JpegLib;../Imaging/ZLib;Tools"/>
|
||||||
|
</SearchPaths>
|
||||||
|
<Parsing>
|
||||||
|
<SyntaxOptions>
|
||||||
|
<CStyleOperator Value="False"/>
|
||||||
|
</SyntaxOptions>
|
||||||
|
</Parsing>
|
||||||
|
<CodeGeneration>
|
||||||
|
<SmartLinkUnit Value="True"/>
|
||||||
|
<TargetCPU Value="x86_64"/>
|
||||||
|
<TargetOS Value="win64"/>
|
||||||
|
<Optimizations>
|
||||||
|
<OptimizationLevel Value="3"/>
|
||||||
|
</Optimizations>
|
||||||
|
</CodeGeneration>
|
||||||
|
<Linking>
|
||||||
|
<Debugging>
|
||||||
|
<GenerateDebugInfo Value="False"/>
|
||||||
|
<DebugInfoType Value="dsDwarf3"/>
|
||||||
|
<UseLineInfoUnit Value="False"/>
|
||||||
|
<StripSymbols Value="True"/>
|
||||||
|
</Debugging>
|
||||||
|
<LinkSmart Value="True"/>
|
||||||
|
<Options>
|
||||||
|
<Win32>
|
||||||
|
<GraphicApplication Value="True"/>
|
||||||
|
</Win32>
|
||||||
|
</Options>
|
||||||
|
</Linking>
|
||||||
|
<Other>
|
||||||
|
<CompilerMessages>
|
||||||
|
<IgnoredMessages idx5028="True" idx5024="True" idx4081="True" idx4080="True" idx4079="True"/>
|
||||||
|
</CompilerMessages>
|
||||||
|
<CustomOptions Value="-dNoLogging"/>
|
||||||
|
</Other>
|
||||||
|
</CompilerOptions>
|
||||||
|
</Item3>
|
||||||
|
<Item4 Name="Release.Linux.x86">
|
||||||
|
<MacroValues Count="1">
|
||||||
|
<Macro2 Name="LCLWidgetType" Value="gtk2"/>
|
||||||
|
</MacroValues>
|
||||||
|
<CompilerOptions>
|
||||||
|
<Version Value="11"/>
|
||||||
|
<Target>
|
||||||
|
<Filename Value="../Client.bin/CentrED.x86"/>
|
||||||
|
</Target>
|
||||||
|
<SearchPaths>
|
||||||
|
<IncludeFiles Value="$(ProjOutDir);../Imaging;.."/>
|
||||||
|
<OtherUnitFiles Value="..;../UOLib;../MulProvider;../Imaging;../Imaging/JpegLib;../Imaging/ZLib;Tools"/>
|
||||||
|
<UnitOutputDirectory Value="../obj/$(TargetCPU)-$(TargetOS)"/>
|
||||||
|
<SrcPath Value="$(LazarusDir)/lcl;$(LazarusDir)/lcl/interfaces/$(LCLWidgetType);..;../UOLib;../MulProvider;../Imaging;../Imaging/JpegLib;../Imaging/ZLib;Tools"/>
|
||||||
|
</SearchPaths>
|
||||||
|
<Parsing>
|
||||||
|
<SyntaxOptions>
|
||||||
|
<CStyleOperator Value="False"/>
|
||||||
|
</SyntaxOptions>
|
||||||
|
</Parsing>
|
||||||
|
<CodeGeneration>
|
||||||
|
<SmartLinkUnit Value="True"/>
|
||||||
|
<TargetCPU Value="i386"/>
|
||||||
|
<TargetOS Value="linux"/>
|
||||||
|
<Optimizations>
|
||||||
|
<OptimizationLevel Value="3"/>
|
||||||
|
</Optimizations>
|
||||||
|
</CodeGeneration>
|
||||||
|
<Linking>
|
||||||
|
<Debugging>
|
||||||
|
<GenerateDebugInfo Value="False"/>
|
||||||
|
<UseLineInfoUnit Value="False"/>
|
||||||
|
<StripSymbols Value="True"/>
|
||||||
|
</Debugging>
|
||||||
|
<LinkSmart Value="True"/>
|
||||||
|
<Options>
|
||||||
|
<Win32>
|
||||||
|
<GraphicApplication Value="True"/>
|
||||||
|
</Win32>
|
||||||
|
</Options>
|
||||||
|
</Linking>
|
||||||
|
<Other>
|
||||||
|
<CompilerMessages>
|
||||||
|
<IgnoredMessages idx5028="True" idx5024="True" idx4081="True" idx4080="True" idx4079="True"/>
|
||||||
|
</CompilerMessages>
|
||||||
|
<CustomOptions Value="-dNoLogging"/>
|
||||||
|
</Other>
|
||||||
|
</CompilerOptions>
|
||||||
|
</Item4>
|
||||||
|
<Item5 Name="Release.Linux.x64">
|
||||||
|
<MacroValues Count="1">
|
||||||
|
<Macro2 Name="LCLWidgetType" Value="gtk2"/>
|
||||||
|
</MacroValues>
|
||||||
|
<CompilerOptions>
|
||||||
|
<Version Value="11"/>
|
||||||
|
<Target>
|
||||||
|
<Filename Value="../Client.bin/CentrED.x64"/>
|
||||||
|
</Target>
|
||||||
|
<SearchPaths>
|
||||||
|
<IncludeFiles Value="$(ProjOutDir);../Imaging;.."/>
|
||||||
|
<OtherUnitFiles Value="..;../UOLib;../MulProvider;../Imaging;../Imaging/JpegLib;../Imaging/ZLib;Tools"/>
|
||||||
|
<UnitOutputDirectory Value="../obj/$(TargetCPU)-$(TargetOS)"/>
|
||||||
|
<SrcPath Value="$(LazarusDir)/lcl;$(LazarusDir)/lcl/interfaces/$(LCLWidgetType);..;../UOLib;../MulProvider;../Imaging;../Imaging/JpegLib;../Imaging/ZLib;Tools"/>
|
||||||
|
</SearchPaths>
|
||||||
|
<Parsing>
|
||||||
|
<SyntaxOptions>
|
||||||
|
<CStyleOperator Value="False"/>
|
||||||
|
</SyntaxOptions>
|
||||||
|
</Parsing>
|
||||||
|
<CodeGeneration>
|
||||||
|
<SmartLinkUnit Value="True"/>
|
||||||
|
<TargetCPU Value="x86_64"/>
|
||||||
|
<TargetOS Value="linux"/>
|
||||||
|
<Optimizations>
|
||||||
|
<OptimizationLevel Value="3"/>
|
||||||
|
</Optimizations>
|
||||||
|
</CodeGeneration>
|
||||||
|
<Linking>
|
||||||
|
<Debugging>
|
||||||
|
<GenerateDebugInfo Value="False"/>
|
||||||
|
<UseLineInfoUnit Value="False"/>
|
||||||
|
<StripSymbols Value="True"/>
|
||||||
|
</Debugging>
|
||||||
|
<LinkSmart Value="True"/>
|
||||||
|
<Options>
|
||||||
|
<Win32>
|
||||||
|
<GraphicApplication Value="True"/>
|
||||||
|
</Win32>
|
||||||
|
</Options>
|
||||||
|
</Linking>
|
||||||
|
<Other>
|
||||||
|
<CompilerMessages>
|
||||||
|
<IgnoredMessages idx5028="True" idx5024="True" idx4081="True" idx4080="True" idx4079="True"/>
|
||||||
|
</CompilerMessages>
|
||||||
|
<CustomOptions Value="-dNoLogging"/>
|
||||||
|
</Other>
|
||||||
|
</CompilerOptions>
|
||||||
|
</Item5>
|
||||||
|
<Item6 Name="Debug.Win32">
|
||||||
|
<MacroValues Count="1">
|
||||||
|
<Macro1 Name="LCLWidgetType" Value="win32"/>
|
||||||
|
</MacroValues>
|
||||||
|
<CompilerOptions>
|
||||||
|
<Version Value="11"/>
|
||||||
|
<Target>
|
||||||
|
<Filename Value="../Client.bin/CentrED"/>
|
||||||
|
</Target>
|
||||||
|
<SearchPaths>
|
||||||
|
<IncludeFiles Value="$(ProjOutDir);../Imaging;.."/>
|
||||||
|
<OtherUnitFiles Value="..;../UOLib;../MulProvider;../Imaging;../Imaging/JpegLib;../Imaging/ZLib;Tools"/>
|
||||||
|
<UnitOutputDirectory Value="../obj/$(TargetCPU)-$(TargetOS)"/>
|
||||||
|
</SearchPaths>
|
||||||
|
<Parsing>
|
||||||
|
<SyntaxOptions>
|
||||||
|
<CStyleOperator Value="False"/>
|
||||||
|
</SyntaxOptions>
|
||||||
|
</Parsing>
|
||||||
|
<CodeGeneration>
|
||||||
|
<Checks>
|
||||||
|
<OverflowChecks Value="True"/>
|
||||||
|
</Checks>
|
||||||
|
<TargetCPU Value="i386"/>
|
||||||
|
<TargetOS Value="win32"/>
|
||||||
|
</CodeGeneration>
|
||||||
|
<Other>
|
||||||
|
<CompilerMessages>
|
||||||
|
<IgnoredMessages idx5028="True" idx5024="True" idx4081="True" idx4080="True" idx4079="True"/>
|
||||||
|
</CompilerMessages>
|
||||||
|
</Other>
|
||||||
|
</CompilerOptions>
|
||||||
|
</Item6>
|
||||||
|
<Item7 Name="Debug.Linux.x86">
|
||||||
|
<MacroValues Count="1">
|
||||||
|
<Macro2 Name="LCLWidgetType" Value="gtk2"/>
|
||||||
|
</MacroValues>
|
||||||
|
<CompilerOptions>
|
||||||
|
<Version Value="11"/>
|
||||||
|
<Target>
|
||||||
|
<Filename Value="../Client.bin/CentrED"/>
|
||||||
|
</Target>
|
||||||
|
<SearchPaths>
|
||||||
|
<IncludeFiles Value="$(ProjOutDir);../Imaging;.."/>
|
||||||
|
<OtherUnitFiles Value="..;../UOLib;../MulProvider;../Imaging;../Imaging/JpegLib;../Imaging/ZLib;Tools"/>
|
||||||
|
<UnitOutputDirectory Value="../obj/$(TargetCPU)-$(TargetOS)"/>
|
||||||
|
</SearchPaths>
|
||||||
|
<Parsing>
|
||||||
|
<SyntaxOptions>
|
||||||
|
<CStyleOperator Value="False"/>
|
||||||
|
</SyntaxOptions>
|
||||||
|
</Parsing>
|
||||||
|
<CodeGeneration>
|
||||||
|
<Checks>
|
||||||
|
<OverflowChecks Value="True"/>
|
||||||
|
</Checks>
|
||||||
|
<TargetCPU Value="i386"/>
|
||||||
|
<TargetOS Value="linux"/>
|
||||||
|
</CodeGeneration>
|
||||||
|
<Other>
|
||||||
|
<CompilerMessages>
|
||||||
|
<IgnoredMessages idx5028="True" idx5024="True" idx4081="True" idx4080="True" idx4079="True"/>
|
||||||
|
</CompilerMessages>
|
||||||
|
<CustomOptions Value="-dNoLogging"/>
|
||||||
|
</Other>
|
||||||
|
</CompilerOptions>
|
||||||
|
</Item7>
|
||||||
|
<Item8 Name="Debug.Linux.x64">
|
||||||
|
<MacroValues Count="1">
|
||||||
|
<Macro2 Name="LCLWidgetType" Value="gtk2"/>
|
||||||
|
</MacroValues>
|
||||||
|
<CompilerOptions>
|
||||||
|
<Version Value="11"/>
|
||||||
|
<Target>
|
||||||
|
<Filename Value="../Client.bin/CentrED"/>
|
||||||
|
</Target>
|
||||||
|
<SearchPaths>
|
||||||
|
<IncludeFiles Value="$(ProjOutDir);../Imaging;.."/>
|
||||||
|
<OtherUnitFiles Value="..;../UOLib;../MulProvider;../Imaging;../Imaging/JpegLib;../Imaging/ZLib;Tools"/>
|
||||||
|
<UnitOutputDirectory Value="../obj/$(TargetCPU)-$(TargetOS)"/>
|
||||||
|
</SearchPaths>
|
||||||
|
<Parsing>
|
||||||
|
<SyntaxOptions>
|
||||||
|
<CStyleOperator Value="False"/>
|
||||||
|
</SyntaxOptions>
|
||||||
|
</Parsing>
|
||||||
|
<CodeGeneration>
|
||||||
|
<Checks>
|
||||||
|
<OverflowChecks Value="True"/>
|
||||||
|
</Checks>
|
||||||
|
<TargetCPU Value="x86_64"/>
|
||||||
|
<TargetOS Value="linux"/>
|
||||||
|
</CodeGeneration>
|
||||||
|
<Other>
|
||||||
|
<CompilerMessages>
|
||||||
|
<IgnoredMessages idx5028="True" idx5024="True" idx4081="True" idx4080="True" idx4079="True"/>
|
||||||
|
</CompilerMessages>
|
||||||
|
<CustomOptions Value="-dNoLogging"/>
|
||||||
|
</Other>
|
||||||
|
</CompilerOptions>
|
||||||
|
</Item8>
|
||||||
|
<SharedMatrixOptions Count="3">
|
||||||
|
<Item1 ID="851019893220" Modes="Release.Win32,Debug.Win32" Type="IDEMacro" MacroName="LCLWidgetType" Value="win32"/>
|
||||||
|
<Item2 ID="521965364444" Modes="Release.Linux.x86,Release.Linux.x64,Debug.Linux.x86,Debug.Linux.x64" Type="IDEMacro" MacroName="LCLWidgetType" Value="gtk2"/>
|
||||||
|
<Item3 ID="241840553479" Type="IDEMacro" MacroName="LCLWidgetType" Value="qt5"/>
|
||||||
|
</SharedMatrixOptions>
|
||||||
|
</BuildModes>
|
||||||
<PublishOptions>
|
<PublishOptions>
|
||||||
<Version Value="2"/>
|
<Version Value="2"/>
|
||||||
<IncludeFileFilter Value="*.(pas|pp|inc|lfm|lpr|lrs|lpi|lpk|sh|xml)"/>
|
|
||||||
<ExcludeFileFilter Value="*.(bak|ppu|ppw|o|so);*~;backup"/>
|
|
||||||
</PublishOptions>
|
</PublishOptions>
|
||||||
<RunParams>
|
<RunParams>
|
||||||
<local>
|
<local>
|
||||||
<FormatVersion Value="1"/>
|
<LaunchingApplication PathPlusParams="/usr/X11R6/bin/xterm -T 'Lazarus Run Output' -e $(LazarusDir)/tools/runwait.sh $(TargetCmdLine)"/>
|
||||||
<LaunchingApplication PathPlusParams="/usr/X11R6/bin/xterm -T 'Lazarus Run Output' -e $(LazarusDir)/tools/runwait.sh $(TargetCmdLine)"/>
|
|
||||||
</local>
|
</local>
|
||||||
|
<FormatVersion Value="2"/>
|
||||||
|
<Modes Count="1">
|
||||||
|
<Mode0 Name="default">
|
||||||
|
<local>
|
||||||
|
<LaunchingApplication PathPlusParams="/usr/X11R6/bin/xterm -T 'Lazarus Run Output' -e $(LazarusDir)/tools/runwait.sh $(TargetCmdLine)"/>
|
||||||
|
</local>
|
||||||
|
<environment>
|
||||||
|
<UserOverrides Count="2">
|
||||||
|
<Variable0 Name="HEAPTRC" Value="log=CentrED.trc"/>
|
||||||
|
<Variable1 Name="WAYLAND_DISPLAY"/>
|
||||||
|
</UserOverrides>
|
||||||
|
</environment>
|
||||||
|
</Mode0>
|
||||||
|
</Modes>
|
||||||
</RunParams>
|
</RunParams>
|
||||||
<RequiredPackages Count="5">
|
<RequiredPackages Count="6">
|
||||||
<Item1>
|
<Item1>
|
||||||
<PackageName Value="multiloglaz"/>
|
<PackageName Value="laz.virtualtreeview_package"/>
|
||||||
</Item1>
|
</Item1>
|
||||||
<Item2>
|
<Item2>
|
||||||
<PackageName Value="LazOpenGLContext"/>
|
<PackageName Value="LCLBase"/>
|
||||||
<MinVersion Valid="True"/>
|
<MinVersion Major="1" Release="1" Valid="True"/>
|
||||||
</Item2>
|
</Item2>
|
||||||
<Item3>
|
<Item3>
|
||||||
<PackageName Value="LCL"/>
|
<PackageName Value="multiloglaz"/>
|
||||||
</Item3>
|
</Item3>
|
||||||
<Item4>
|
<Item4>
|
||||||
<PackageName Value="lnetvisual"/>
|
<PackageName Value="LazOpenGLContext"/>
|
||||||
<MinVersion Minor="5" Release="3" Valid="True"/>
|
|
||||||
</Item4>
|
</Item4>
|
||||||
<Item5>
|
<Item5>
|
||||||
<PackageName Value="virtualtreeview_package"/>
|
<PackageName Value="LCL"/>
|
||||||
<MinVersion Major="4" Minor="5" Release="1" Valid="True"/>
|
|
||||||
</Item5>
|
</Item5>
|
||||||
|
<Item6>
|
||||||
|
<PackageName Value="lnetvisual"/>
|
||||||
|
<MinVersion Minor="5" Release="3" Valid="True"/>
|
||||||
|
</Item6>
|
||||||
</RequiredPackages>
|
</RequiredPackages>
|
||||||
<Units Count="46">
|
<Units Count="49">
|
||||||
<Unit0>
|
<Unit0>
|
||||||
<Filename Value="CentrED.lpr"/>
|
<Filename Value="CentrED.lpr"/>
|
||||||
<IsPartOfProject Value="True"/>
|
<IsPartOfProject Value="True"/>
|
||||||
<UnitName Value="CentrED"/>
|
|
||||||
</Unit0>
|
</Unit0>
|
||||||
<Unit1>
|
<Unit1>
|
||||||
<Filename Value="UfrmMain.pas"/>
|
<Filename Value="UfrmMain.pas"/>
|
||||||
<IsPartOfProject Value="True"/>
|
<IsPartOfProject Value="True"/>
|
||||||
<ComponentName Value="frmMain"/>
|
<ComponentName Value="frmMain"/>
|
||||||
|
<HasResources Value="True"/>
|
||||||
<ResourceBaseClass Value="Form"/>
|
<ResourceBaseClass Value="Form"/>
|
||||||
<UnitName Value="UfrmMain"/>
|
|
||||||
</Unit1>
|
</Unit1>
|
||||||
<Unit2>
|
<Unit2>
|
||||||
<Filename Value="UdmNetwork.pas"/>
|
<Filename Value="UdmNetwork.pas"/>
|
||||||
<IsPartOfProject Value="True"/>
|
<IsPartOfProject Value="True"/>
|
||||||
<ComponentName Value="dmNetwork"/>
|
<ComponentName Value="dmNetwork"/>
|
||||||
|
<HasResources Value="True"/>
|
||||||
<ResourceBaseClass Value="DataModule"/>
|
<ResourceBaseClass Value="DataModule"/>
|
||||||
<UnitName Value="UdmNetwork"/>
|
|
||||||
</Unit2>
|
</Unit2>
|
||||||
<Unit3>
|
<Unit3>
|
||||||
<Filename Value="UfrmLogin.pas"/>
|
<Filename Value="UfrmLogin.pas"/>
|
||||||
<IsPartOfProject Value="True"/>
|
<IsPartOfProject Value="True"/>
|
||||||
<ComponentName Value="frmLogin"/>
|
<ComponentName Value="frmLogin"/>
|
||||||
|
<HasResources Value="True"/>
|
||||||
<ResourceBaseClass Value="Form"/>
|
<ResourceBaseClass Value="Form"/>
|
||||||
<UnitName Value="UfrmLogin"/>
|
|
||||||
</Unit3>
|
</Unit3>
|
||||||
<Unit4>
|
<Unit4>
|
||||||
<Filename Value="UfrmInitialize.pas"/>
|
<Filename Value="UfrmInitialize.pas"/>
|
||||||
<IsPartOfProject Value="True"/>
|
<IsPartOfProject Value="True"/>
|
||||||
<ComponentName Value="frmInitialize"/>
|
<ComponentName Value="frmInitialize"/>
|
||||||
|
<HasResources Value="True"/>
|
||||||
<ResourceBaseClass Value="Form"/>
|
<ResourceBaseClass Value="Form"/>
|
||||||
<UnitName Value="UfrmInitialize"/>
|
|
||||||
</Unit4>
|
</Unit4>
|
||||||
<Unit5>
|
<Unit5>
|
||||||
<Filename Value="UfrmAccountControl.pas"/>
|
<Filename Value="UfrmAccountControl.pas"/>
|
||||||
<IsPartOfProject Value="True"/>
|
<IsPartOfProject Value="True"/>
|
||||||
<ComponentName Value="frmAccountControl"/>
|
<ComponentName Value="frmAccountControl"/>
|
||||||
|
<HasResources Value="True"/>
|
||||||
<ResourceBaseClass Value="Form"/>
|
<ResourceBaseClass Value="Form"/>
|
||||||
<UnitName Value="UfrmAccountControl"/>
|
|
||||||
</Unit5>
|
</Unit5>
|
||||||
<Unit6>
|
<Unit6>
|
||||||
<Filename Value="UfrmEditAccount.pas"/>
|
<Filename Value="UfrmEditAccount.pas"/>
|
||||||
<IsPartOfProject Value="True"/>
|
<IsPartOfProject Value="True"/>
|
||||||
<ComponentName Value="frmEditAccount"/>
|
<ComponentName Value="frmEditAccount"/>
|
||||||
|
<HasResources Value="True"/>
|
||||||
<ResourceBaseClass Value="Form"/>
|
<ResourceBaseClass Value="Form"/>
|
||||||
<UnitName Value="UfrmEditAccount"/>
|
|
||||||
</Unit6>
|
</Unit6>
|
||||||
<Unit7>
|
<Unit7>
|
||||||
<Filename Value="Tools/UfrmDrawSettings.pas"/>
|
<Filename Value="Tools/UfrmDrawSettings.pas"/>
|
||||||
<IsPartOfProject Value="True"/>
|
<IsPartOfProject Value="True"/>
|
||||||
<ComponentName Value="frmDrawSettings"/>
|
<ComponentName Value="frmDrawSettings"/>
|
||||||
|
<HasResources Value="True"/>
|
||||||
<ResourceBaseClass Value="Form"/>
|
<ResourceBaseClass Value="Form"/>
|
||||||
<UnitName Value="UfrmDrawSettings"/>
|
|
||||||
</Unit7>
|
</Unit7>
|
||||||
<Unit8>
|
<Unit8>
|
||||||
<Filename Value="Tools/UfrmBoundaries.pas"/>
|
<Filename Value="Tools/UfrmBoundaries.pas"/>
|
||||||
<IsPartOfProject Value="True"/>
|
<IsPartOfProject Value="True"/>
|
||||||
<ComponentName Value="frmBoundaries"/>
|
<ComponentName Value="frmBoundaries"/>
|
||||||
|
<HasResources Value="True"/>
|
||||||
<ResourceBaseClass Value="Form"/>
|
<ResourceBaseClass Value="Form"/>
|
||||||
<UnitName Value="UfrmBoundaries"/>
|
|
||||||
</Unit8>
|
</Unit8>
|
||||||
<Unit9>
|
<Unit9>
|
||||||
<Filename Value="Tools/UfrmElevateSettings.pas"/>
|
<Filename Value="Tools/UfrmElevateSettings.pas"/>
|
||||||
<IsPartOfProject Value="True"/>
|
<IsPartOfProject Value="True"/>
|
||||||
<ComponentName Value="frmElevateSettings"/>
|
<ComponentName Value="frmElevateSettings"/>
|
||||||
|
<HasResources Value="True"/>
|
||||||
<ResourceBaseClass Value="Form"/>
|
<ResourceBaseClass Value="Form"/>
|
||||||
<UnitName Value="UfrmElevateSettings"/>
|
|
||||||
</Unit9>
|
</Unit9>
|
||||||
<Unit10>
|
<Unit10>
|
||||||
<Filename Value="UOverlayUI.pas"/>
|
<Filename Value="UOverlayUI.pas"/>
|
||||||
<IsPartOfProject Value="True"/>
|
<IsPartOfProject Value="True"/>
|
||||||
<UnitName Value="UOverlayUI"/>
|
|
||||||
</Unit10>
|
</Unit10>
|
||||||
<Unit11>
|
<Unit11>
|
||||||
<Filename Value="UResourceManager.pas"/>
|
|
||||||
<IsPartOfProject Value="True"/>
|
|
||||||
<UnitName Value="UResourceManager"/>
|
|
||||||
</Unit11>
|
|
||||||
<Unit12>
|
|
||||||
<Filename Value="Tools/UfrmConfirmation.pas"/>
|
<Filename Value="Tools/UfrmConfirmation.pas"/>
|
||||||
<IsPartOfProject Value="True"/>
|
<IsPartOfProject Value="True"/>
|
||||||
<ComponentName Value="frmConfirmation"/>
|
<ComponentName Value="frmConfirmation"/>
|
||||||
|
<HasResources Value="True"/>
|
||||||
<ResourceBaseClass Value="Form"/>
|
<ResourceBaseClass Value="Form"/>
|
||||||
<UnitName Value="UfrmConfirmation"/>
|
</Unit11>
|
||||||
</Unit12>
|
<Unit12>
|
||||||
<Unit13>
|
|
||||||
<Filename Value="Tools/UfrmMoveSettings.pas"/>
|
<Filename Value="Tools/UfrmMoveSettings.pas"/>
|
||||||
<IsPartOfProject Value="True"/>
|
<IsPartOfProject Value="True"/>
|
||||||
<ComponentName Value="frmMoveSettings"/>
|
<ComponentName Value="frmMoveSettings"/>
|
||||||
|
<HasResources Value="True"/>
|
||||||
<ResourceBaseClass Value="Form"/>
|
<ResourceBaseClass Value="Form"/>
|
||||||
<UnitName Value="UfrmMoveSettings"/>
|
</Unit12>
|
||||||
</Unit13>
|
<Unit13>
|
||||||
<Unit14>
|
|
||||||
<Filename Value="UfrmAbout.pas"/>
|
<Filename Value="UfrmAbout.pas"/>
|
||||||
<IsPartOfProject Value="True"/>
|
<IsPartOfProject Value="True"/>
|
||||||
<ComponentName Value="frmAbout"/>
|
<ComponentName Value="frmAbout"/>
|
||||||
|
<HasResources Value="True"/>
|
||||||
<ResourceBaseClass Value="Form"/>
|
<ResourceBaseClass Value="Form"/>
|
||||||
<UnitName Value="UfrmAbout"/>
|
</Unit13>
|
||||||
</Unit14>
|
<Unit14>
|
||||||
<Unit15>
|
|
||||||
<Filename Value="Tools/UfrmHueSettings.pas"/>
|
<Filename Value="Tools/UfrmHueSettings.pas"/>
|
||||||
<IsPartOfProject Value="True"/>
|
<IsPartOfProject Value="True"/>
|
||||||
<ComponentName Value="frmHueSettings"/>
|
<ComponentName Value="frmHueSettings"/>
|
||||||
|
<HasResources Value="True"/>
|
||||||
<ResourceBaseClass Value="Form"/>
|
<ResourceBaseClass Value="Form"/>
|
||||||
<UnitName Value="UfrmHueSettings"/>
|
</Unit14>
|
||||||
</Unit15>
|
<Unit15>
|
||||||
<Unit16>
|
|
||||||
<Filename Value="UfrmRadar.pas"/>
|
<Filename Value="UfrmRadar.pas"/>
|
||||||
<IsPartOfProject Value="True"/>
|
<IsPartOfProject Value="True"/>
|
||||||
<ComponentName Value="frmRadarMap"/>
|
<ComponentName Value="frmRadarMap"/>
|
||||||
|
<HasResources Value="True"/>
|
||||||
<ResourceBaseClass Value="Form"/>
|
<ResourceBaseClass Value="Form"/>
|
||||||
<UnitName Value="UfrmRadar"/>
|
</Unit15>
|
||||||
</Unit16>
|
<Unit16>
|
||||||
<Unit17>
|
|
||||||
<Filename Value="UfrmLargeScaleCommand.pas"/>
|
<Filename Value="UfrmLargeScaleCommand.pas"/>
|
||||||
<IsPartOfProject Value="True"/>
|
<IsPartOfProject Value="True"/>
|
||||||
<ComponentName Value="frmLargeScaleCommand"/>
|
<ComponentName Value="frmLargeScaleCommand"/>
|
||||||
|
<HasResources Value="True"/>
|
||||||
<ResourceBaseClass Value="Form"/>
|
<ResourceBaseClass Value="Form"/>
|
||||||
<UnitName Value="UfrmLargeScaleCommand"/>
|
</Unit16>
|
||||||
</Unit17>
|
<Unit17>
|
||||||
<Unit18>
|
|
||||||
<Filename Value="Tools/UfrmVirtualLayer.pas"/>
|
<Filename Value="Tools/UfrmVirtualLayer.pas"/>
|
||||||
<IsPartOfProject Value="True"/>
|
<IsPartOfProject Value="True"/>
|
||||||
<ComponentName Value="frmVirtualLayer"/>
|
<ComponentName Value="frmVirtualLayer"/>
|
||||||
|
<HasResources Value="True"/>
|
||||||
<ResourceBaseClass Value="Form"/>
|
<ResourceBaseClass Value="Form"/>
|
||||||
<UnitName Value="UfrmVirtualLayer"/>
|
</Unit17>
|
||||||
</Unit18>
|
<Unit18>
|
||||||
<Unit19>
|
|
||||||
<Filename Value="Tools/UfrmFilter.pas"/>
|
<Filename Value="Tools/UfrmFilter.pas"/>
|
||||||
<IsPartOfProject Value="True"/>
|
<IsPartOfProject Value="True"/>
|
||||||
<ComponentName Value="frmFilter"/>
|
<ComponentName Value="frmFilter"/>
|
||||||
|
<HasResources Value="True"/>
|
||||||
<ResourceBaseClass Value="Form"/>
|
<ResourceBaseClass Value="Form"/>
|
||||||
<UnitName Value="UfrmFilter"/>
|
</Unit18>
|
||||||
</Unit19>
|
<Unit19>
|
||||||
<Unit20>
|
|
||||||
<Filename Value="UGUIPlatformUtils.pas"/>
|
<Filename Value="UGUIPlatformUtils.pas"/>
|
||||||
<IsPartOfProject Value="True"/>
|
<IsPartOfProject Value="True"/>
|
||||||
<UnitName Value="UGUIPlatformUtils"/>
|
</Unit19>
|
||||||
</Unit20>
|
<Unit20>
|
||||||
<Unit21>
|
|
||||||
<Filename Value="UPlatformTypes.pas"/>
|
<Filename Value="UPlatformTypes.pas"/>
|
||||||
<IsPartOfProject Value="True"/>
|
<IsPartOfProject Value="True"/>
|
||||||
<UnitName Value="UPlatformTypes"/>
|
</Unit20>
|
||||||
</Unit21>
|
<Unit21>
|
||||||
<Unit22>
|
|
||||||
<Filename Value="UfrmRegionControl.pas"/>
|
<Filename Value="UfrmRegionControl.pas"/>
|
||||||
<IsPartOfProject Value="True"/>
|
<IsPartOfProject Value="True"/>
|
||||||
<ComponentName Value="frmRegionControl"/>
|
<ComponentName Value="frmRegionControl"/>
|
||||||
<HasResources Value="True"/>
|
<HasResources Value="True"/>
|
||||||
<ResourceBaseClass Value="Form"/>
|
<ResourceBaseClass Value="Form"/>
|
||||||
<UnitName Value="UfrmRegionControl"/>
|
</Unit21>
|
||||||
</Unit22>
|
<Unit22>
|
||||||
<Unit23>
|
|
||||||
<Filename Value="UPacketHandlers.pas"/>
|
<Filename Value="UPacketHandlers.pas"/>
|
||||||
<IsPartOfProject Value="True"/>
|
<IsPartOfProject Value="True"/>
|
||||||
<UnitName Value="UPacketHandlers"/>
|
</Unit22>
|
||||||
</Unit23>
|
<Unit23>
|
||||||
<Unit24>
|
|
||||||
<Filename Value="UPackets.pas"/>
|
<Filename Value="UPackets.pas"/>
|
||||||
<IsPartOfProject Value="True"/>
|
<IsPartOfProject Value="True"/>
|
||||||
<UnitName Value="UPackets"/>
|
</Unit23>
|
||||||
</Unit24>
|
<Unit24>
|
||||||
<Unit25>
|
|
||||||
<Filename Value="ULandscape.pas"/>
|
<Filename Value="ULandscape.pas"/>
|
||||||
<IsPartOfProject Value="True"/>
|
<IsPartOfProject Value="True"/>
|
||||||
<UnitName Value="ULandscape"/>
|
</Unit24>
|
||||||
</Unit25>
|
<Unit25>
|
||||||
<Unit26>
|
|
||||||
<Filename Value="UGameResources.pas"/>
|
<Filename Value="UGameResources.pas"/>
|
||||||
<IsPartOfProject Value="True"/>
|
<IsPartOfProject Value="True"/>
|
||||||
<UnitName Value="UGameResources"/>
|
</Unit25>
|
||||||
</Unit26>
|
<Unit26>
|
||||||
<Unit27>
|
|
||||||
<Filename Value="UAdminHandling.pas"/>
|
<Filename Value="UAdminHandling.pas"/>
|
||||||
<IsPartOfProject Value="True"/>
|
<IsPartOfProject Value="True"/>
|
||||||
<UnitName Value="UAdminHandling"/>
|
</Unit26>
|
||||||
</Unit27>
|
<Unit27>
|
||||||
<Unit28>
|
|
||||||
<Filename Value="Tools/UfrmToolWindow.pas"/>
|
<Filename Value="Tools/UfrmToolWindow.pas"/>
|
||||||
<IsPartOfProject Value="True"/>
|
<IsPartOfProject Value="True"/>
|
||||||
<ComponentName Value="frmToolWindow"/>
|
<ComponentName Value="frmToolWindow"/>
|
||||||
|
<HasResources Value="True"/>
|
||||||
<ResourceBaseClass Value="Form"/>
|
<ResourceBaseClass Value="Form"/>
|
||||||
<UnitName Value="UfrmToolWindow"/>
|
</Unit27>
|
||||||
</Unit28>
|
<Unit28>
|
||||||
<Unit29>
|
|
||||||
<Filename Value="../Logging.pas"/>
|
<Filename Value="../Logging.pas"/>
|
||||||
<IsPartOfProject Value="True"/>
|
<IsPartOfProject Value="True"/>
|
||||||
<UnitName Value="Logging"/>
|
</Unit28>
|
||||||
</Unit29>
|
<Unit29>
|
||||||
<Unit30>
|
|
||||||
<Filename Value="../UOLib/UStatics.pas"/>
|
<Filename Value="../UOLib/UStatics.pas"/>
|
||||||
<IsPartOfProject Value="True"/>
|
<IsPartOfProject Value="True"/>
|
||||||
<UnitName Value="UStatics"/>
|
</Unit29>
|
||||||
</Unit30>
|
<Unit30>
|
||||||
<Unit31>
|
|
||||||
<Filename Value="../UOLib/UWorldItem.pas"/>
|
<Filename Value="../UOLib/UWorldItem.pas"/>
|
||||||
<IsPartOfProject Value="True"/>
|
<IsPartOfProject Value="True"/>
|
||||||
<UnitName Value="UWorldItem"/>
|
</Unit30>
|
||||||
</Unit31>
|
<Unit31>
|
||||||
<Unit32>
|
|
||||||
<Filename Value="../UOLib/UMap.pas"/>
|
<Filename Value="../UOLib/UMap.pas"/>
|
||||||
<IsPartOfProject Value="True"/>
|
<IsPartOfProject Value="True"/>
|
||||||
<UnitName Value="UMap"/>
|
</Unit31>
|
||||||
</Unit32>
|
<Unit32>
|
||||||
<Unit33>
|
|
||||||
<Filename Value="../UOLib/UTiledata.pas"/>
|
<Filename Value="../UOLib/UTiledata.pas"/>
|
||||||
<IsPartOfProject Value="True"/>
|
<IsPartOfProject Value="True"/>
|
||||||
<UnitName Value="UTiledata"/>
|
</Unit32>
|
||||||
</Unit33>
|
<Unit33>
|
||||||
<Unit34>
|
|
||||||
<Filename Value="UGLFont.pas"/>
|
<Filename Value="UGLFont.pas"/>
|
||||||
<IsPartOfProject Value="True"/>
|
<IsPartOfProject Value="True"/>
|
||||||
<UnitName Value="UGLFont"/>
|
</Unit33>
|
||||||
</Unit34>
|
<Unit34>
|
||||||
<Unit35>
|
|
||||||
<Filename Value="../UOLib/UAnimData.pas"/>
|
<Filename Value="../UOLib/UAnimData.pas"/>
|
||||||
<IsPartOfProject Value="True"/>
|
<IsPartOfProject Value="True"/>
|
||||||
<UnitName Value="UAnimData"/>
|
</Unit34>
|
||||||
</Unit35>
|
<Unit35>
|
||||||
<Unit36>
|
|
||||||
<Filename Value="../MulProvider/UTileDataProvider.pas"/>
|
<Filename Value="../MulProvider/UTileDataProvider.pas"/>
|
||||||
<IsPartOfProject Value="True"/>
|
<IsPartOfProject Value="True"/>
|
||||||
<UnitName Value="UTileDataProvider"/>
|
</Unit35>
|
||||||
</Unit36>
|
<Unit36>
|
||||||
<Unit37>
|
|
||||||
<Filename Value="../MulProvider/UAnimDataProvider.pas"/>
|
<Filename Value="../MulProvider/UAnimDataProvider.pas"/>
|
||||||
<IsPartOfProject Value="True"/>
|
<IsPartOfProject Value="True"/>
|
||||||
<UnitName Value="UAnimDataProvider"/>
|
</Unit36>
|
||||||
</Unit37>
|
<Unit37>
|
||||||
<Unit38>
|
|
||||||
<Filename Value="../MulProvider/UMulManager.pas"/>
|
<Filename Value="../MulProvider/UMulManager.pas"/>
|
||||||
<IsPartOfProject Value="True"/>
|
<IsPartOfProject Value="True"/>
|
||||||
<UnitName Value="UMulManager"/>
|
</Unit37>
|
||||||
</Unit38>
|
<Unit38>
|
||||||
<Unit39>
|
|
||||||
<Filename Value="../MulProvider/UArtProvider.pas"/>
|
<Filename Value="../MulProvider/UArtProvider.pas"/>
|
||||||
<IsPartOfProject Value="True"/>
|
<IsPartOfProject Value="True"/>
|
||||||
<UnitName Value="UArtProvider"/>
|
</Unit38>
|
||||||
</Unit39>
|
<Unit39>
|
||||||
<Unit40>
|
|
||||||
<Filename Value="../MulProvider/UTexmapProvider.pas"/>
|
<Filename Value="../MulProvider/UTexmapProvider.pas"/>
|
||||||
<IsPartOfProject Value="True"/>
|
<IsPartOfProject Value="True"/>
|
||||||
<UnitName Value="UTexmapProvider"/>
|
</Unit39>
|
||||||
|
<Unit40>
|
||||||
|
<Filename Value="../version.inc"/>
|
||||||
|
<IsPartOfProject Value="True"/>
|
||||||
</Unit40>
|
</Unit40>
|
||||||
<Unit41>
|
<Unit41>
|
||||||
<Filename Value="../version.inc"/>
|
<Filename Value="ULightManager.pas"/>
|
||||||
<IsPartOfProject Value="True"/>
|
<IsPartOfProject Value="True"/>
|
||||||
</Unit41>
|
</Unit41>
|
||||||
<Unit42>
|
<Unit42>
|
||||||
<Filename Value="ULightManager.pas"/>
|
|
||||||
<IsPartOfProject Value="True"/>
|
|
||||||
<UnitName Value="ULightManager"/>
|
|
||||||
</Unit42>
|
|
||||||
<Unit43>
|
|
||||||
<Filename Value="../UOLib/ULight.pas"/>
|
<Filename Value="../UOLib/ULight.pas"/>
|
||||||
<IsPartOfProject Value="True"/>
|
<IsPartOfProject Value="True"/>
|
||||||
<UnitName Value="ULight"/>
|
</Unit42>
|
||||||
</Unit43>
|
<Unit43>
|
||||||
<Unit44>
|
|
||||||
<Filename Value="../MulProvider/ULightProvider.pas"/>
|
<Filename Value="../MulProvider/ULightProvider.pas"/>
|
||||||
<IsPartOfProject Value="True"/>
|
<IsPartOfProject Value="True"/>
|
||||||
<UnitName Value="ULightProvider"/>
|
</Unit43>
|
||||||
</Unit44>
|
<Unit44>
|
||||||
<Unit45>
|
|
||||||
<Filename Value="Tools/UfrmLightlevel.pas"/>
|
<Filename Value="Tools/UfrmLightlevel.pas"/>
|
||||||
<IsPartOfProject Value="True"/>
|
<IsPartOfProject Value="True"/>
|
||||||
<ComponentName Value="frmLightlevel"/>
|
<ComponentName Value="frmLightlevel"/>
|
||||||
|
<HasResources Value="True"/>
|
||||||
|
<ResourceBaseClass Value="Form"/>
|
||||||
|
</Unit44>
|
||||||
|
<Unit45>
|
||||||
|
<Filename Value="UfrmChangePassword.pas"/>
|
||||||
|
<IsPartOfProject Value="True"/>
|
||||||
|
<ComponentName Value="frmChangePassword"/>
|
||||||
|
<HasResources Value="True"/>
|
||||||
<ResourceBaseClass Value="Form"/>
|
<ResourceBaseClass Value="Form"/>
|
||||||
<UnitName Value="UfrmLightlevel"/>
|
|
||||||
</Unit45>
|
</Unit45>
|
||||||
|
<Unit46>
|
||||||
|
<Filename Value="USelectionHelper.pas"/>
|
||||||
|
<IsPartOfProject Value="True"/>
|
||||||
|
</Unit46>
|
||||||
|
<Unit47>
|
||||||
|
<Filename Value="UActions.pas"/>
|
||||||
|
<IsPartOfProject Value="True"/>
|
||||||
|
</Unit47>
|
||||||
|
<Unit48>
|
||||||
|
<Filename Value="UUoaDesigns.pas"/>
|
||||||
|
<IsPartOfProject Value="True"/>
|
||||||
|
</Unit48>
|
||||||
</Units>
|
</Units>
|
||||||
</ProjectOptions>
|
</ProjectOptions>
|
||||||
<CompilerOptions>
|
<CompilerOptions>
|
||||||
<Version Value="8"/>
|
<Version Value="11"/>
|
||||||
<Target>
|
<Target>
|
||||||
<Filename Value="../bin/CentrED"/>
|
<Filename Value="../Client.bin/CentrED"/>
|
||||||
</Target>
|
</Target>
|
||||||
<SearchPaths>
|
<SearchPaths>
|
||||||
<IncludeFiles Value="$(ProjOutDir)/;../Imaging/;../"/>
|
<IncludeFiles Value="$(ProjOutDir);../Imaging;.."/>
|
||||||
<OtherUnitFiles Value="../;../UOLib/;../MulProvider/;../Imaging/;../Imaging/JpegLib/;../Imaging/ZLib/;Tools/"/>
|
<OtherUnitFiles Value="..;../UOLib;../MulProvider;../Imaging;../Imaging/JpegLib;../Imaging/ZLib;Tools"/>
|
||||||
<UnitOutputDirectory Value="../obj/$(TargetCPU)-$(TargetOS)"/>
|
<UnitOutputDirectory Value="../obj/$(TargetCPU)-$(TargetOS)"/>
|
||||||
<SrcPath Value="$(LazarusDir)/lcl/;$(LazarusDir)/lcl/interfaces/$(LCLWidgetType)/;../;../UOLib/;../MulProvider/;../Imaging/;../Imaging/JpegLib/;../Imaging/ZLib/;Tools/"/>
|
|
||||||
</SearchPaths>
|
</SearchPaths>
|
||||||
<Parsing>
|
<Parsing>
|
||||||
<SyntaxOptions>
|
<SyntaxOptions>
|
||||||
<CStyleOperator Value="False"/>
|
<CStyleOperator Value="False"/>
|
||||||
<UseAnsiStrings Value="True"/>
|
|
||||||
</SyntaxOptions>
|
</SyntaxOptions>
|
||||||
</Parsing>
|
</Parsing>
|
||||||
<CodeGeneration>
|
<CodeGeneration>
|
||||||
<SmartLinkUnit Value="True"/>
|
<Checks>
|
||||||
|
<RangeChecks Value="True"/>
|
||||||
|
</Checks>
|
||||||
<Optimizations>
|
<Optimizations>
|
||||||
<OptimizationLevel Value="3"/>
|
<OptimizationLevel Value="0"/>
|
||||||
</Optimizations>
|
</Optimizations>
|
||||||
</CodeGeneration>
|
</CodeGeneration>
|
||||||
<Linking>
|
<Linking>
|
||||||
<Debugging>
|
<Debugging>
|
||||||
<UseLineInfoUnit Value="False"/>
|
<DebugInfoType Value="dsDwarf3"/>
|
||||||
<StripSymbols Value="True"/>
|
|
||||||
</Debugging>
|
</Debugging>
|
||||||
<LinkSmart Value="True"/>
|
|
||||||
<Options>
|
|
||||||
<Win32>
|
|
||||||
<GraphicApplication Value="True"/>
|
|
||||||
</Win32>
|
|
||||||
</Options>
|
|
||||||
</Linking>
|
</Linking>
|
||||||
<Other>
|
<Other>
|
||||||
<CompilerMessages>
|
<CompilerMessages>
|
||||||
<IgnoredMessages idx4079="True" idx4080="True" idx4081="True" idx5024="True" idx5028="True"/>
|
<IgnoredMessages idx5028="True" idx5024="True" idx4081="True" idx4080="True" idx4079="True"/>
|
||||||
</CompilerMessages>
|
</CompilerMessages>
|
||||||
<CustomOptions Value="-FE../bin/
|
<CustomOptions Value="-B"/>
|
||||||
-dNoLogging"/>
|
|
||||||
<CompilerPath Value="$(CompPath)"/>
|
|
||||||
</Other>
|
</Other>
|
||||||
</CompilerOptions>
|
</CompilerOptions>
|
||||||
</CONFIG>
|
</CONFIG>
|
||||||
|
|||||||
+12
-4
@@ -21,21 +21,23 @@
|
|||||||
* CDDL HEADER END
|
* CDDL HEADER END
|
||||||
*
|
*
|
||||||
*
|
*
|
||||||
* Portions Copyright 2009 Andreas Schneider
|
* Portions Copyright 2012 Andreas Schneider
|
||||||
*)
|
*)
|
||||||
program CentrED;
|
program CentrED;
|
||||||
|
|
||||||
{$mode objfpc}{$H+}
|
{$mode objfpc}{$H+}
|
||||||
|
|
||||||
uses
|
uses
|
||||||
|
{$IFNDEF NoLogging}heaptrc, Logging, filechannel,{$ENDIF}
|
||||||
{$IFDEF UNIX}{$IFDEF UseCThreads}
|
{$IFDEF UNIX}{$IFDEF UseCThreads}
|
||||||
cthreads,
|
cthreads,
|
||||||
{$ENDIF}{$ENDIF}
|
{$ENDIF}{$ENDIF}
|
||||||
SysUtils,
|
SysUtils,
|
||||||
Interfaces, // this includes the LCL widgetset
|
Interfaces, // this includes the LCL widgetset
|
||||||
Forms, LResources, UdmNetwork;
|
Forms, UdmNetwork;
|
||||||
|
|
||||||
{$IFDEF WINDOWS}{$R CentrED.rc}{$ENDIF}
|
{$R CentrED.res}
|
||||||
|
{$R Assets.rc} // Beware: you need 'windres', which is part of mingw-binutils on *nix!
|
||||||
|
|
||||||
function GetApplicationName: String;
|
function GetApplicationName: String;
|
||||||
begin
|
begin
|
||||||
@@ -43,8 +45,14 @@ begin
|
|||||||
end;
|
end;
|
||||||
|
|
||||||
begin
|
begin
|
||||||
{$I CentrED.lrs}
|
{$IFNDEF NoLogging}
|
||||||
|
SetHeapTraceOutput('CentrED.trc');
|
||||||
|
Logger.Channels.Add(TFileChannel.Create('CentrED.log'));
|
||||||
|
{$ENDIF}
|
||||||
|
|
||||||
OnGetApplicationName := @GetApplicationName;
|
OnGetApplicationName := @GetApplicationName;
|
||||||
|
|
||||||
|
Application.Scaled:=True;
|
||||||
Application.Initialize;
|
Application.Initialize;
|
||||||
Application.CreateForm(TdmNetwork, dmNetwork);
|
Application.CreateForm(TdmNetwork, dmNetwork);
|
||||||
Application.Run;
|
Application.Run;
|
||||||
|
|||||||
@@ -1,5 +0,0 @@
|
|||||||
Overlay/LeftTopArrow.tga
|
|
||||||
Overlay/TopArrow.tga
|
|
||||||
Overlay/VirtualLayer.tga
|
|
||||||
GLFont/DejaVu.png
|
|
||||||
GLFont/DejaVu.fnt
|
|
||||||
+268
-99
@@ -1,109 +1,278 @@
|
|||||||
inherited frmBoundaries: TfrmBoundaries
|
inherited frmBoundaries: TfrmBoundaries
|
||||||
Left = 290
|
Left = 445
|
||||||
Height = 164
|
Height = 208
|
||||||
Top = 171
|
Top = 332
|
||||||
Width = 205
|
Width = 406
|
||||||
|
AutoSize = True
|
||||||
Caption = 'Boundaries'
|
Caption = 'Boundaries'
|
||||||
ClientHeight = 164
|
ClientHeight = 208
|
||||||
ClientWidth = 205
|
ClientWidth = 406
|
||||||
object lblMaxZ: TLabel[0]
|
OnCreate = FormCreate
|
||||||
|
object gbZRestriction: TGroupBox[0]
|
||||||
AnchorSideLeft.Control = Owner
|
AnchorSideLeft.Control = Owner
|
||||||
AnchorSideTop.Control = seMaxZ
|
AnchorSideTop.Control = Owner
|
||||||
AnchorSideTop.Side = asrCenter
|
Left = 4
|
||||||
Left = 8
|
Height = 204
|
||||||
Height = 16
|
Top = 4
|
||||||
Top = 89
|
Width = 200
|
||||||
Width = 68
|
AutoSize = True
|
||||||
BorderSpacing.Left = 8
|
BorderSpacing.Left = 4
|
||||||
Caption = 'Maximum Z:'
|
BorderSpacing.Top = 4
|
||||||
Layout = tlCenter
|
Caption = 'Restrict Height'
|
||||||
ParentColor = False
|
ClientHeight = 180
|
||||||
end
|
ClientWidth = 198
|
||||||
object lblMinZ: TLabel[1]
|
Constraints.MinWidth = 200
|
||||||
AnchorSideLeft.Control = Owner
|
|
||||||
AnchorSideTop.Control = seMinZ
|
|
||||||
AnchorSideTop.Side = asrCenter
|
|
||||||
Left = 8
|
|
||||||
Height = 16
|
|
||||||
Top = 12
|
|
||||||
Width = 67
|
|
||||||
BorderSpacing.Left = 8
|
|
||||||
Caption = 'Minimum Z:'
|
|
||||||
Layout = tlCenter
|
|
||||||
ParentColor = False
|
|
||||||
end
|
|
||||||
object tbMinZ: TTrackBar[2]
|
|
||||||
AnchorSideLeft.Control = Owner
|
|
||||||
AnchorSideTop.Control = seMinZ
|
|
||||||
AnchorSideTop.Side = asrBottom
|
|
||||||
AnchorSideRight.Control = Owner
|
|
||||||
AnchorSideRight.Side = asrBottom
|
|
||||||
Left = 8
|
|
||||||
Height = 36
|
|
||||||
Top = 41
|
|
||||||
Width = 189
|
|
||||||
Frequency = 10
|
|
||||||
Max = 127
|
|
||||||
Min = -128
|
|
||||||
OnChange = tbMinZChange
|
|
||||||
PageSize = 1
|
|
||||||
Position = -128
|
|
||||||
Anchors = [akTop, akLeft, akRight]
|
|
||||||
BorderSpacing.Around = 8
|
|
||||||
TabOrder = 0
|
TabOrder = 0
|
||||||
|
object lblMinZ: TLabel
|
||||||
|
AnchorSideLeft.Control = tbMinZ
|
||||||
|
AnchorSideTop.Control = seMinZ
|
||||||
|
AnchorSideTop.Side = asrCenter
|
||||||
|
Left = 4
|
||||||
|
Height = 23
|
||||||
|
Top = 9
|
||||||
|
Width = 93
|
||||||
|
Caption = 'Minimum Z:'
|
||||||
|
Color = clDefault
|
||||||
|
Layout = tlCenter
|
||||||
|
ParentColor = False
|
||||||
|
Transparent = False
|
||||||
|
end
|
||||||
|
object seMinZ: TSpinEdit
|
||||||
|
AnchorSideTop.Control = gbZRestriction
|
||||||
|
AnchorSideRight.Control = gbZRestriction
|
||||||
|
AnchorSideRight.Side = asrBottom
|
||||||
|
Left = 132
|
||||||
|
Height = 33
|
||||||
|
Top = 4
|
||||||
|
Width = 62
|
||||||
|
Anchors = [akTop, akRight]
|
||||||
|
BorderSpacing.Top = 4
|
||||||
|
BorderSpacing.Right = 4
|
||||||
|
MaxValue = 127
|
||||||
|
MinValue = -128
|
||||||
|
OnChange = seMinZChange
|
||||||
|
TabOrder = 0
|
||||||
|
Value = -128
|
||||||
|
end
|
||||||
|
object tbMinZ: TTrackBar
|
||||||
|
AnchorSideLeft.Control = gbZRestriction
|
||||||
|
AnchorSideTop.Control = seMinZ
|
||||||
|
AnchorSideTop.Side = asrBottom
|
||||||
|
AnchorSideRight.Control = gbZRestriction
|
||||||
|
AnchorSideRight.Side = asrBottom
|
||||||
|
Left = 4
|
||||||
|
Height = 47
|
||||||
|
Top = 41
|
||||||
|
Width = 190
|
||||||
|
Frequency = 10
|
||||||
|
Max = 127
|
||||||
|
Min = -128
|
||||||
|
OnChange = tbMinZChange
|
||||||
|
PageSize = 1
|
||||||
|
Position = -128
|
||||||
|
Anchors = [akTop, akLeft, akRight]
|
||||||
|
BorderSpacing.Around = 4
|
||||||
|
TabOrder = 1
|
||||||
|
end
|
||||||
|
object lblMaxZ: TLabel
|
||||||
|
AnchorSideLeft.Control = tbMaxZ
|
||||||
|
AnchorSideTop.Control = seMaxZ
|
||||||
|
AnchorSideTop.Side = asrCenter
|
||||||
|
Left = 4
|
||||||
|
Height = 23
|
||||||
|
Top = 97
|
||||||
|
Width = 97
|
||||||
|
Caption = 'Maximum Z:'
|
||||||
|
Color = clDefault
|
||||||
|
Layout = tlCenter
|
||||||
|
ParentColor = False
|
||||||
|
Transparent = False
|
||||||
|
end
|
||||||
|
object seMaxZ: TSpinEdit
|
||||||
|
AnchorSideTop.Control = tbMinZ
|
||||||
|
AnchorSideTop.Side = asrBottom
|
||||||
|
AnchorSideRight.Control = seMinZ
|
||||||
|
AnchorSideRight.Side = asrBottom
|
||||||
|
Left = 132
|
||||||
|
Height = 33
|
||||||
|
Top = 92
|
||||||
|
Width = 62
|
||||||
|
Anchors = [akTop, akRight]
|
||||||
|
MaxValue = 127
|
||||||
|
MinValue = -128
|
||||||
|
OnChange = seMaxZChange
|
||||||
|
TabOrder = 2
|
||||||
|
Value = 127
|
||||||
|
end
|
||||||
|
object tbMaxZ: TTrackBar
|
||||||
|
AnchorSideLeft.Control = gbZRestriction
|
||||||
|
AnchorSideTop.Control = seMaxZ
|
||||||
|
AnchorSideTop.Side = asrBottom
|
||||||
|
AnchorSideRight.Control = gbZRestriction
|
||||||
|
AnchorSideRight.Side = asrBottom
|
||||||
|
Left = 4
|
||||||
|
Height = 47
|
||||||
|
Top = 129
|
||||||
|
Width = 190
|
||||||
|
Frequency = 10
|
||||||
|
Max = 127
|
||||||
|
Min = -128
|
||||||
|
OnChange = tbMaxZChange
|
||||||
|
PageSize = 1
|
||||||
|
Position = 127
|
||||||
|
Anchors = [akTop, akLeft, akRight]
|
||||||
|
BorderSpacing.Around = 4
|
||||||
|
TabOrder = 3
|
||||||
|
end
|
||||||
end
|
end
|
||||||
object tbMaxZ: TTrackBar[3]
|
object gbViewRestriction: TGroupBox[1]
|
||||||
AnchorSideLeft.Control = Owner
|
AnchorSideLeft.Control = gbZRestriction
|
||||||
AnchorSideTop.Control = seMaxZ
|
AnchorSideLeft.Side = asrBottom
|
||||||
AnchorSideTop.Side = asrBottom
|
|
||||||
AnchorSideRight.Control = Owner
|
|
||||||
AnchorSideRight.Side = asrBottom
|
|
||||||
Left = 8
|
|
||||||
Height = 36
|
|
||||||
Top = 118
|
|
||||||
Width = 189
|
|
||||||
Frequency = 10
|
|
||||||
Max = 127
|
|
||||||
Min = -128
|
|
||||||
OnChange = tbMaxZChange
|
|
||||||
PageSize = 1
|
|
||||||
Position = 127
|
|
||||||
Anchors = [akTop, akLeft, akRight]
|
|
||||||
BorderSpacing.Around = 8
|
|
||||||
TabOrder = 1
|
|
||||||
end
|
|
||||||
object seMaxZ: TSpinEdit[4]
|
|
||||||
AnchorSideTop.Control = tbMinZ
|
|
||||||
AnchorSideTop.Side = asrBottom
|
|
||||||
AnchorSideRight.Control = Owner
|
|
||||||
AnchorSideRight.Side = asrBottom
|
|
||||||
Left = 149
|
|
||||||
Height = 25
|
|
||||||
Top = 85
|
|
||||||
Width = 48
|
|
||||||
Anchors = [akTop, akRight]
|
|
||||||
BorderSpacing.Right = 8
|
|
||||||
MaxValue = 127
|
|
||||||
MinValue = -128
|
|
||||||
OnChange = seMaxZChange
|
|
||||||
TabOrder = 2
|
|
||||||
Value = 127
|
|
||||||
end
|
|
||||||
object seMinZ: TSpinEdit[5]
|
|
||||||
AnchorSideTop.Control = Owner
|
AnchorSideTop.Control = Owner
|
||||||
AnchorSideRight.Control = Owner
|
AnchorSideRight.Control = Owner
|
||||||
AnchorSideRight.Side = asrBottom
|
AnchorSideRight.Side = asrBottom
|
||||||
Left = 149
|
AnchorSideBottom.Control = gbZRestriction
|
||||||
Height = 25
|
AnchorSideBottom.Side = asrBottom
|
||||||
Top = 8
|
Left = 208
|
||||||
Width = 48
|
Height = 200
|
||||||
Anchors = [akTop, akRight]
|
Top = 4
|
||||||
BorderSpacing.Top = 8
|
Width = 194
|
||||||
BorderSpacing.Right = 8
|
Anchors = [akTop, akLeft, akRight, akBottom]
|
||||||
MaxValue = 127
|
BorderSpacing.Around = 4
|
||||||
MinValue = -128
|
Caption = 'Restrict View Range'
|
||||||
OnChange = seMinZChange
|
ClientHeight = 176
|
||||||
TabOrder = 3
|
ClientWidth = 192
|
||||||
Value = -128
|
TabOrder = 1
|
||||||
|
object seMinX: TSpinEdit
|
||||||
|
AnchorSideLeft.Control = lblX
|
||||||
|
AnchorSideLeft.Side = asrBottom
|
||||||
|
AnchorSideTop.Control = seMaxX
|
||||||
|
Left = 22
|
||||||
|
Height = 33
|
||||||
|
Top = 4
|
||||||
|
Width = 74
|
||||||
|
BorderSpacing.Left = 4
|
||||||
|
OnChange = seMinXChange
|
||||||
|
TabOrder = 0
|
||||||
|
end
|
||||||
|
object seMaxX: TSpinEdit
|
||||||
|
AnchorSideTop.Control = gbViewRestriction
|
||||||
|
AnchorSideRight.Control = gbViewRestriction
|
||||||
|
AnchorSideRight.Side = asrBottom
|
||||||
|
Left = 114
|
||||||
|
Height = 33
|
||||||
|
Top = 4
|
||||||
|
Width = 74
|
||||||
|
Anchors = [akTop, akRight]
|
||||||
|
BorderSpacing.Top = 4
|
||||||
|
BorderSpacing.Right = 4
|
||||||
|
OnChange = seMaxXChange
|
||||||
|
TabOrder = 1
|
||||||
|
end
|
||||||
|
object seMinY: TSpinEdit
|
||||||
|
AnchorSideLeft.Control = seMinX
|
||||||
|
AnchorSideTop.Control = seMinX
|
||||||
|
AnchorSideTop.Side = asrBottom
|
||||||
|
AnchorSideRight.Control = seMinX
|
||||||
|
AnchorSideRight.Side = asrBottom
|
||||||
|
Left = 22
|
||||||
|
Height = 33
|
||||||
|
Top = 45
|
||||||
|
Width = 74
|
||||||
|
Anchors = [akTop, akLeft, akRight]
|
||||||
|
BorderSpacing.Top = 8
|
||||||
|
OnChange = seMinYChange
|
||||||
|
TabOrder = 2
|
||||||
|
end
|
||||||
|
object seMaxY: TSpinEdit
|
||||||
|
AnchorSideLeft.Control = seMaxX
|
||||||
|
AnchorSideTop.Control = seMinY
|
||||||
|
AnchorSideRight.Control = seMaxX
|
||||||
|
AnchorSideRight.Side = asrBottom
|
||||||
|
Left = 114
|
||||||
|
Height = 33
|
||||||
|
Top = 45
|
||||||
|
Width = 74
|
||||||
|
Anchors = [akTop, akLeft, akRight]
|
||||||
|
OnChange = seMaxYChange
|
||||||
|
TabOrder = 3
|
||||||
|
end
|
||||||
|
object lblX: TLabel
|
||||||
|
AnchorSideLeft.Control = gbViewRestriction
|
||||||
|
AnchorSideTop.Control = seMinX
|
||||||
|
AnchorSideTop.Side = asrCenter
|
||||||
|
Left = 4
|
||||||
|
Height = 23
|
||||||
|
Top = 9
|
||||||
|
Width = 14
|
||||||
|
BorderSpacing.Left = 4
|
||||||
|
Caption = 'X:'
|
||||||
|
Color = clDefault
|
||||||
|
ParentColor = False
|
||||||
|
Transparent = False
|
||||||
|
end
|
||||||
|
object lblY: TLabel
|
||||||
|
AnchorSideLeft.Control = lblX
|
||||||
|
AnchorSideTop.Control = seMinY
|
||||||
|
AnchorSideTop.Side = asrCenter
|
||||||
|
Left = 4
|
||||||
|
Height = 23
|
||||||
|
Top = 50
|
||||||
|
Width = 13
|
||||||
|
Caption = 'Y:'
|
||||||
|
Color = clDefault
|
||||||
|
ParentColor = False
|
||||||
|
Transparent = False
|
||||||
|
end
|
||||||
|
object lblXSep: TLabel
|
||||||
|
AnchorSideLeft.Control = seMinX
|
||||||
|
AnchorSideLeft.Side = asrBottom
|
||||||
|
AnchorSideTop.Control = seMaxX
|
||||||
|
AnchorSideTop.Side = asrCenter
|
||||||
|
Left = 100
|
||||||
|
Height = 23
|
||||||
|
Top = 9
|
||||||
|
Width = 17
|
||||||
|
BorderSpacing.Left = 4
|
||||||
|
Caption = '—'
|
||||||
|
Color = clDefault
|
||||||
|
ParentColor = False
|
||||||
|
Transparent = False
|
||||||
|
end
|
||||||
|
object lblYSep: TLabel
|
||||||
|
AnchorSideLeft.Control = lblXSep
|
||||||
|
AnchorSideTop.Control = seMinY
|
||||||
|
AnchorSideTop.Side = asrCenter
|
||||||
|
Left = 100
|
||||||
|
Height = 23
|
||||||
|
Top = 50
|
||||||
|
Width = 17
|
||||||
|
Caption = '—'
|
||||||
|
Color = clDefault
|
||||||
|
ParentColor = False
|
||||||
|
Transparent = False
|
||||||
|
end
|
||||||
|
object btnSelectArea: TButton
|
||||||
|
Left = 0
|
||||||
|
Height = 25
|
||||||
|
Top = 95
|
||||||
|
Width = 112
|
||||||
|
Caption = 'Select Area'
|
||||||
|
OnClick = btnSelectAreaClick
|
||||||
|
TabOrder = 4
|
||||||
|
end
|
||||||
|
object btnClear: TButton
|
||||||
|
Left = 117
|
||||||
|
Height = 25
|
||||||
|
Top = 95
|
||||||
|
Width = 75
|
||||||
|
Caption = 'Clear'
|
||||||
|
OnClick = btnClearClick
|
||||||
|
TabOrder = 5
|
||||||
|
end
|
||||||
|
end
|
||||||
|
inherited tmClose: TTimer[2]
|
||||||
|
Left = 200
|
||||||
|
Top = 176
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -21,7 +21,8 @@
|
|||||||
* CDDL HEADER END
|
* CDDL HEADER END
|
||||||
*
|
*
|
||||||
*
|
*
|
||||||
* Portions Copyright 2009 Andreas Schneider
|
* Portions Copyright 2015 Andreas Schneider
|
||||||
|
* Portions Copyright 2015 StaticZ
|
||||||
*)
|
*)
|
||||||
unit UfrmBoundaries;
|
unit UfrmBoundaries;
|
||||||
|
|
||||||
@@ -31,23 +32,44 @@ interface
|
|||||||
|
|
||||||
uses
|
uses
|
||||||
Classes, SysUtils, LResources, Forms, Controls, Graphics, Dialogs, StdCtrls,
|
Classes, SysUtils, LResources, Forms, Controls, Graphics, Dialogs, StdCtrls,
|
||||||
ComCtrls, Spin, ExtCtrls, UfrmToolWindow;
|
ComCtrls, Spin, ExtCtrls, UfrmToolWindow, USelectionHelper;
|
||||||
|
|
||||||
type
|
type
|
||||||
|
|
||||||
{ TfrmBoundaries }
|
{ TfrmBoundaries }
|
||||||
|
|
||||||
TfrmBoundaries = class(TfrmToolWindow)
|
TfrmBoundaries = class(TfrmToolWindow)
|
||||||
|
btnSelectArea: TButton;
|
||||||
|
btnClear: TButton;
|
||||||
|
gbZRestriction: TGroupBox;
|
||||||
|
gbViewRestriction: TGroupBox;
|
||||||
|
lblYSep: TLabel;
|
||||||
|
lblXSep: TLabel;
|
||||||
|
lblY: TLabel;
|
||||||
|
lblX: TLabel;
|
||||||
lblMaxZ: TLabel;
|
lblMaxZ: TLabel;
|
||||||
lblMinZ: TLabel;
|
lblMinZ: TLabel;
|
||||||
seMaxZ: TSpinEdit;
|
seMaxZ: TSpinEdit;
|
||||||
seMinZ: TSpinEdit;
|
seMinZ: TSpinEdit;
|
||||||
tbMinZ: TTrackBar;
|
seMinX: TSpinEdit;
|
||||||
|
seMaxX: TSpinEdit;
|
||||||
|
seMinY: TSpinEdit;
|
||||||
|
seMaxY: TSpinEdit;
|
||||||
tbMaxZ: TTrackBar;
|
tbMaxZ: TTrackBar;
|
||||||
|
tbMinZ: TTrackBar;
|
||||||
|
procedure btnSelectAreaClick(Sender: TObject);
|
||||||
|
procedure btnClearClick(Sender: TObject);
|
||||||
|
procedure FormCreate(Sender: TObject);
|
||||||
|
procedure seMaxXChange(Sender: TObject);
|
||||||
|
procedure seMaxYChange(Sender: TObject);
|
||||||
procedure seMaxZChange(Sender: TObject);
|
procedure seMaxZChange(Sender: TObject);
|
||||||
|
procedure seMinXChange(Sender: TObject);
|
||||||
|
procedure seMinYChange(Sender: TObject);
|
||||||
procedure seMinZChange(Sender: TObject);
|
procedure seMinZChange(Sender: TObject);
|
||||||
procedure tbMaxZChange(Sender: TObject);
|
procedure tbMaxZChange(Sender: TObject);
|
||||||
procedure tbMinZChange(Sender: TObject);
|
procedure tbMinZChange(Sender: TObject);
|
||||||
|
protected
|
||||||
|
procedure RangeSelected(AX1, AY1, AX2, AY2: Word);
|
||||||
public
|
public
|
||||||
{ public declarations }
|
{ public declarations }
|
||||||
end;
|
end;
|
||||||
@@ -62,12 +84,57 @@ uses
|
|||||||
|
|
||||||
{ TfrmBoundaries }
|
{ TfrmBoundaries }
|
||||||
|
|
||||||
|
procedure TfrmBoundaries.FormCreate(Sender: TObject);
|
||||||
|
begin
|
||||||
|
seMinX.MaxValue := frmMain.Landscape.CellWidth - 1;
|
||||||
|
seMaxX.MaxValue := seMinX.MaxValue;
|
||||||
|
seMaxX.Value := seMaxX.MaxValue;
|
||||||
|
|
||||||
|
seMinY.MaxValue := frmMain.Landscape.CellHeight - 1;
|
||||||
|
seMaxY.MaxValue := seMinY.MaxValue;
|
||||||
|
seMaxY.Value := seMaxX.MaxValue;
|
||||||
|
end;
|
||||||
|
|
||||||
|
procedure TfrmBoundaries.btnSelectAreaClick(Sender: TObject);
|
||||||
|
begin
|
||||||
|
SelectRange(@RangeSelected);
|
||||||
|
end;
|
||||||
|
|
||||||
|
procedure TfrmBoundaries.btnClearClick(Sender: TObject);
|
||||||
|
begin
|
||||||
|
seMinX.Value := 0;
|
||||||
|
seMinY.Value := 0;
|
||||||
|
seMaxX.Value := seMaxX.MaxValue;
|
||||||
|
seMaxY.Value := seMaxY.MaxValue;
|
||||||
|
frmMain.InvalidateFilter;
|
||||||
|
end;
|
||||||
|
|
||||||
|
procedure TfrmBoundaries.seMaxXChange(Sender: TObject);
|
||||||
|
begin
|
||||||
|
frmMain.InvalidateFilter;
|
||||||
|
end;
|
||||||
|
|
||||||
|
procedure TfrmBoundaries.seMaxYChange(Sender: TObject);
|
||||||
|
begin
|
||||||
|
frmMain.InvalidateFilter;
|
||||||
|
end;
|
||||||
|
|
||||||
procedure TfrmBoundaries.seMaxZChange(Sender: TObject);
|
procedure TfrmBoundaries.seMaxZChange(Sender: TObject);
|
||||||
begin
|
begin
|
||||||
tbMaxZ.Position := seMaxZ.Value;
|
tbMaxZ.Position := seMaxZ.Value;
|
||||||
frmMain.InvalidateFilter;
|
frmMain.InvalidateFilter;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
procedure TfrmBoundaries.seMinXChange(Sender: TObject);
|
||||||
|
begin
|
||||||
|
frmMain.InvalidateFilter;
|
||||||
|
end;
|
||||||
|
|
||||||
|
procedure TfrmBoundaries.seMinYChange(Sender: TObject);
|
||||||
|
begin
|
||||||
|
frmMain.InvalidateFilter;
|
||||||
|
end;
|
||||||
|
|
||||||
procedure TfrmBoundaries.seMinZChange(Sender: TObject);
|
procedure TfrmBoundaries.seMinZChange(Sender: TObject);
|
||||||
begin
|
begin
|
||||||
tbMinZ.Position := seMinZ.Value;
|
tbMinZ.Position := seMinZ.Value;
|
||||||
@@ -86,6 +153,15 @@ begin
|
|||||||
frmMain.InvalidateFilter;
|
frmMain.InvalidateFilter;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
procedure TfrmBoundaries.RangeSelected(AX1, AY1, AX2, AY2: Word);
|
||||||
|
begin
|
||||||
|
seMinX.Value := AX1;
|
||||||
|
seMinY.Value := AY1;
|
||||||
|
seMaxX.Value := AX2;
|
||||||
|
seMaxY.Value := AY2;
|
||||||
|
frmBoundaries.Show;
|
||||||
|
end;
|
||||||
|
|
||||||
initialization
|
initialization
|
||||||
{$I UfrmBoundaries.lrs}
|
{$I UfrmBoundaries.lrs}
|
||||||
|
|
||||||
|
|||||||
@@ -1,37 +1,34 @@
|
|||||||
object frmConfirmation: TfrmConfirmation
|
object frmConfirmation: TfrmConfirmation
|
||||||
Left = 290
|
Left = 290
|
||||||
Height = 43
|
Height = 54
|
||||||
Top = 171
|
Top = 171
|
||||||
Width = 108
|
Width = 135
|
||||||
BorderIcons = []
|
BorderIcons = []
|
||||||
BorderStyle = bsToolWindow
|
BorderStyle = bsToolWindow
|
||||||
Caption = 'Apply?'
|
Caption = 'Apply?'
|
||||||
ClientHeight = 43
|
ClientHeight = 54
|
||||||
ClientWidth = 108
|
ClientWidth = 135
|
||||||
Font.Height = -11
|
Font.Height = -14
|
||||||
LCLVersion = '0.9.25'
|
|
||||||
object btnYes: TButton
|
object btnYes: TButton
|
||||||
Left = 8
|
Left = 10
|
||||||
Height = 25
|
Height = 31
|
||||||
Top = 8
|
Top = 10
|
||||||
Width = 40
|
Width = 50
|
||||||
BorderSpacing.InnerBorder = 4
|
BorderSpacing.InnerBorder = 5
|
||||||
Caption = 'Yes'
|
Caption = 'Yes'
|
||||||
Default = True
|
Default = True
|
||||||
ModalResult = 6
|
ModalResult = 6
|
||||||
ParentFont = True
|
|
||||||
TabOrder = 0
|
TabOrder = 0
|
||||||
end
|
end
|
||||||
object btnNo: TButton
|
object btnNo: TButton
|
||||||
Left = 56
|
Left = 70
|
||||||
Height = 25
|
Height = 31
|
||||||
Top = 8
|
Top = 10
|
||||||
Width = 40
|
Width = 50
|
||||||
BorderSpacing.InnerBorder = 4
|
BorderSpacing.InnerBorder = 5
|
||||||
Cancel = True
|
Cancel = True
|
||||||
Caption = 'No'
|
Caption = 'No'
|
||||||
ModalResult = 7
|
ModalResult = 7
|
||||||
ParentFont = True
|
|
||||||
TabOrder = 1
|
TabOrder = 1
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -1,40 +1,41 @@
|
|||||||
inherited frmDrawSettings: TfrmDrawSettings
|
inherited frmDrawSettings: TfrmDrawSettings
|
||||||
Left = 268
|
Left = 268
|
||||||
Height = 180
|
Height = 194
|
||||||
Top = 165
|
Top = 165
|
||||||
Width = 242
|
Width = 375
|
||||||
ActiveControl = rbTileList
|
ActiveControl = rbTileList
|
||||||
|
AutoSize = True
|
||||||
Caption = 'Draw settings'
|
Caption = 'Draw settings'
|
||||||
ClientHeight = 180
|
ClientHeight = 194
|
||||||
ClientWidth = 242
|
ClientWidth = 375
|
||||||
|
Constraints.MinWidth = 375
|
||||||
OnCreate = FormCreate
|
OnCreate = FormCreate
|
||||||
object rbTileList: TRadioButton[0]
|
object rbTileList: TRadioButton[0]
|
||||||
AnchorSideLeft.Control = Owner
|
AnchorSideLeft.Control = Owner
|
||||||
AnchorSideTop.Control = Owner
|
AnchorSideTop.Control = Owner
|
||||||
Left = 8
|
Left = 8
|
||||||
Height = 22
|
Height = 25
|
||||||
Top = 8
|
Top = 8
|
||||||
Width = 146
|
Width = 178
|
||||||
BorderSpacing.Left = 8
|
BorderSpacing.Left = 8
|
||||||
BorderSpacing.Top = 8
|
BorderSpacing.Top = 8
|
||||||
BorderSpacing.Bottom = 4
|
BorderSpacing.Bottom = 4
|
||||||
Caption = 'Use tile from the list'
|
Caption = 'Use tile from the list'
|
||||||
Checked = True
|
Checked = True
|
||||||
State = cbChecked
|
|
||||||
TabOrder = 0
|
TabOrder = 0
|
||||||
|
TabStop = True
|
||||||
end
|
end
|
||||||
object rbRandom: TRadioButton[1]
|
object rbRandom: TRadioButton[1]
|
||||||
AnchorSideLeft.Control = rbTileList
|
AnchorSideLeft.Control = rbTileList
|
||||||
AnchorSideTop.Control = rbTileList
|
AnchorSideTop.Control = rbTileList
|
||||||
AnchorSideTop.Side = asrBottom
|
AnchorSideTop.Side = asrBottom
|
||||||
Left = 8
|
Left = 8
|
||||||
Height = 22
|
Height = 25
|
||||||
Top = 34
|
Top = 37
|
||||||
Width = 213
|
Width = 264
|
||||||
BorderSpacing.Top = 4
|
BorderSpacing.Top = 4
|
||||||
Caption = 'Use tiles from the random pool'
|
Caption = 'Use tiles from the random pool'
|
||||||
TabOrder = 1
|
TabOrder = 1
|
||||||
TabStop = False
|
|
||||||
end
|
end
|
||||||
object gbHue: TGroupBox[2]
|
object gbHue: TGroupBox[2]
|
||||||
AnchorSideLeft.Control = Owner
|
AnchorSideLeft.Control = Owner
|
||||||
@@ -43,25 +44,27 @@ inherited frmDrawSettings: TfrmDrawSettings
|
|||||||
AnchorSideRight.Control = Owner
|
AnchorSideRight.Control = Owner
|
||||||
AnchorSideRight.Side = asrBottom
|
AnchorSideRight.Side = asrBottom
|
||||||
Left = 8
|
Left = 8
|
||||||
Height = 49
|
Height = 38
|
||||||
Top = 132
|
Top = 148
|
||||||
Width = 226
|
Width = 359
|
||||||
Anchors = [akTop, akLeft, akRight]
|
Anchors = [akTop, akLeft, akRight]
|
||||||
BorderSpacing.Around = 8
|
BorderSpacing.Around = 8
|
||||||
Caption = 'Hue (Statics only)'
|
Caption = 'Hue (Statics only)'
|
||||||
ClientHeight = 45
|
ClientHeight = 14
|
||||||
ClientWidth = 222
|
ClientWidth = 357
|
||||||
TabOrder = 2
|
TabOrder = 2
|
||||||
object pbHue: TPaintBox
|
object pbHue: TPaintBox
|
||||||
Cursor = crHandPoint
|
Cursor = crHandPoint
|
||||||
Left = 4
|
Left = 4
|
||||||
Height = 41
|
Height = 10
|
||||||
Top = 0
|
Top = 0
|
||||||
Width = 214
|
Width = 349
|
||||||
Align = alClient
|
Align = alClient
|
||||||
BorderSpacing.Left = 4
|
BorderSpacing.Left = 4
|
||||||
BorderSpacing.Right = 4
|
BorderSpacing.Right = 4
|
||||||
BorderSpacing.Bottom = 4
|
BorderSpacing.Bottom = 4
|
||||||
|
Font.Height = 14
|
||||||
|
ParentFont = False
|
||||||
OnClick = pbHueClick
|
OnClick = pbHueClick
|
||||||
OnPaint = pbHuePaint
|
OnPaint = pbHuePaint
|
||||||
end
|
end
|
||||||
@@ -71,9 +74,9 @@ inherited frmDrawSettings: TfrmDrawSettings
|
|||||||
AnchorSideTop.Control = cbForceAltitude
|
AnchorSideTop.Control = cbForceAltitude
|
||||||
AnchorSideTop.Side = asrBottom
|
AnchorSideTop.Side = asrBottom
|
||||||
Left = 8
|
Left = 8
|
||||||
Height = 22
|
Height = 25
|
||||||
Top = 102
|
Top = 111
|
||||||
Width = 149
|
Width = 188
|
||||||
BorderSpacing.Top = 12
|
BorderSpacing.Top = 12
|
||||||
Caption = 'Add Random Altitude'
|
Caption = 'Add Random Altitude'
|
||||||
TabOrder = 3
|
TabOrder = 3
|
||||||
@@ -83,9 +86,9 @@ inherited frmDrawSettings: TfrmDrawSettings
|
|||||||
AnchorSideTop.Side = asrCenter
|
AnchorSideTop.Side = asrCenter
|
||||||
AnchorSideRight.Control = Owner
|
AnchorSideRight.Control = Owner
|
||||||
AnchorSideRight.Side = asrBottom
|
AnchorSideRight.Side = asrBottom
|
||||||
Left = 184
|
Left = 317
|
||||||
Height = 21
|
Height = 33
|
||||||
Top = 103
|
Top = 107
|
||||||
Width = 50
|
Width = 50
|
||||||
Anchors = [akTop, akRight]
|
Anchors = [akTop, akRight]
|
||||||
BorderSpacing.Right = 8
|
BorderSpacing.Right = 8
|
||||||
@@ -96,9 +99,9 @@ inherited frmDrawSettings: TfrmDrawSettings
|
|||||||
AnchorSideTop.Control = rbRandom
|
AnchorSideTop.Control = rbRandom
|
||||||
AnchorSideTop.Side = asrBottom
|
AnchorSideTop.Side = asrBottom
|
||||||
Left = 8
|
Left = 8
|
||||||
Height = 22
|
Height = 25
|
||||||
Top = 68
|
Top = 74
|
||||||
Width = 111
|
Width = 133
|
||||||
BorderSpacing.Top = 12
|
BorderSpacing.Top = 12
|
||||||
Caption = 'Force altitude:'
|
Caption = 'Force altitude:'
|
||||||
TabOrder = 5
|
TabOrder = 5
|
||||||
@@ -108,9 +111,9 @@ inherited frmDrawSettings: TfrmDrawSettings
|
|||||||
AnchorSideTop.Side = asrCenter
|
AnchorSideTop.Side = asrCenter
|
||||||
AnchorSideRight.Control = Owner
|
AnchorSideRight.Control = Owner
|
||||||
AnchorSideRight.Side = asrBottom
|
AnchorSideRight.Side = asrBottom
|
||||||
Left = 184
|
Left = 317
|
||||||
Height = 21
|
Height = 33
|
||||||
Top = 69
|
Top = 70
|
||||||
Width = 50
|
Width = 50
|
||||||
Anchors = [akTop, akRight]
|
Anchors = [akTop, akRight]
|
||||||
BorderSpacing.Right = 8
|
BorderSpacing.Right = 8
|
||||||
@@ -119,5 +122,6 @@ inherited frmDrawSettings: TfrmDrawSettings
|
|||||||
TabOrder = 6
|
TabOrder = 6
|
||||||
end
|
end
|
||||||
inherited tmClose: TTimer[7]
|
inherited tmClose: TTimer[7]
|
||||||
|
Left = 312
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -87,12 +87,18 @@ var
|
|||||||
begin
|
begin
|
||||||
if frmHueSettings <> nil then
|
if frmHueSettings <> nil then
|
||||||
begin
|
begin
|
||||||
if frmHueSettings.lbHue.ItemIndex > 0 then
|
if frmHueSettings.cbRandom.Checked then
|
||||||
hue := ResMan.Hue.Hues[frmHueSettings.lbHue.ItemIndex - 1]
|
begin
|
||||||
else
|
pbHue.Canvas.TextOut(36, 1, '[Random]');
|
||||||
hue := nil;
|
end else
|
||||||
TfrmHueSettings.DrawHue(hue, pbHue.Canvas, pbHue.Canvas.ClipRect,
|
begin
|
||||||
frmHueSettings.lbHue.Items.Strings[frmHueSettings.lbHue.ItemIndex]);
|
if frmHueSettings.lbHue.ItemIndex > 0 then
|
||||||
|
hue := ResMan.Hue.Hues[frmHueSettings.lbHue.ItemIndex - 1]
|
||||||
|
else
|
||||||
|
hue := nil;
|
||||||
|
TfrmHueSettings.DrawHue(hue, pbHue.Canvas, pbHue.Canvas.ClipRect,
|
||||||
|
frmHueSettings.lbHue.Items.Strings[frmHueSettings.lbHue.ItemIndex]);
|
||||||
|
end;
|
||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
|||||||
@@ -1,57 +1,55 @@
|
|||||||
inherited frmElevateSettings: TfrmElevateSettings
|
inherited frmElevateSettings: TfrmElevateSettings
|
||||||
Left = 290
|
Left = 290
|
||||||
Height = 114
|
Height = 141
|
||||||
Top = 171
|
Top = 171
|
||||||
Width = 250
|
Width = 297
|
||||||
Caption = 'Elevate'
|
Caption = 'Elevate'
|
||||||
ClientHeight = 114
|
ClientHeight = 141
|
||||||
ClientWidth = 250
|
ClientWidth = 297
|
||||||
object rbRaise: TRadioButton[0]
|
object rbRaise: TRadioButton[0]
|
||||||
AnchorSideLeft.Control = Owner
|
AnchorSideLeft.Control = Owner
|
||||||
AnchorSideTop.Control = Owner
|
AnchorSideTop.Control = Owner
|
||||||
Left = 8
|
Left = 8
|
||||||
Height = 19
|
Height = 25
|
||||||
Top = 8
|
Top = 8
|
||||||
Width = 47
|
Width = 64
|
||||||
BorderSpacing.Left = 8
|
BorderSpacing.Left = 8
|
||||||
BorderSpacing.Top = 8
|
BorderSpacing.Top = 8
|
||||||
Caption = 'Raise'
|
Caption = 'Raise'
|
||||||
Checked = True
|
Checked = True
|
||||||
State = cbChecked
|
|
||||||
TabOrder = 2
|
TabOrder = 2
|
||||||
|
TabStop = True
|
||||||
end
|
end
|
||||||
object rbLower: TRadioButton[1]
|
object rbLower: TRadioButton[1]
|
||||||
AnchorSideLeft.Control = rbRaise
|
AnchorSideLeft.Control = rbRaise
|
||||||
AnchorSideTop.Control = rbRaise
|
AnchorSideTop.Control = rbRaise
|
||||||
AnchorSideTop.Side = asrBottom
|
AnchorSideTop.Side = asrBottom
|
||||||
Left = 8
|
Left = 8
|
||||||
Height = 19
|
Height = 25
|
||||||
Top = 27
|
Top = 33
|
||||||
Width = 52
|
Width = 72
|
||||||
Caption = 'Lower'
|
Caption = 'Lower'
|
||||||
TabOrder = 0
|
TabOrder = 0
|
||||||
TabStop = False
|
|
||||||
end
|
end
|
||||||
object rbSet: TRadioButton[2]
|
object rbSet: TRadioButton[2]
|
||||||
AnchorSideLeft.Control = rbLower
|
AnchorSideLeft.Control = rbLower
|
||||||
AnchorSideTop.Control = rbLower
|
AnchorSideTop.Control = rbLower
|
||||||
AnchorSideTop.Side = asrBottom
|
AnchorSideTop.Side = asrBottom
|
||||||
Left = 8
|
Left = 8
|
||||||
Height = 19
|
Height = 25
|
||||||
Top = 46
|
Top = 58
|
||||||
Width = 36
|
Width = 48
|
||||||
Caption = 'Set'
|
Caption = 'Set'
|
||||||
TabOrder = 1
|
TabOrder = 1
|
||||||
TabStop = False
|
|
||||||
end
|
end
|
||||||
object cbRandomHeight: TCheckBox[3]
|
object cbRandomHeight: TCheckBox[3]
|
||||||
AnchorSideLeft.Control = rbSet
|
AnchorSideLeft.Control = rbSet
|
||||||
AnchorSideTop.Control = rbSet
|
AnchorSideTop.Control = rbSet
|
||||||
AnchorSideTop.Side = asrBottom
|
AnchorSideTop.Side = asrBottom
|
||||||
Left = 8
|
Left = 8
|
||||||
Height = 19
|
Height = 25
|
||||||
Top = 81
|
Top = 99
|
||||||
Width = 135
|
Width = 188
|
||||||
BorderSpacing.Top = 16
|
BorderSpacing.Top = 16
|
||||||
Caption = 'Add Random Altitude'
|
Caption = 'Add Random Altitude'
|
||||||
TabOrder = 3
|
TabOrder = 3
|
||||||
@@ -62,9 +60,9 @@ inherited frmElevateSettings: TfrmElevateSettings
|
|||||||
AnchorSideTop.Side = asrCenter
|
AnchorSideTop.Side = asrCenter
|
||||||
AnchorSideRight.Control = Owner
|
AnchorSideRight.Control = Owner
|
||||||
AnchorSideRight.Side = asrBottom
|
AnchorSideRight.Side = asrBottom
|
||||||
Left = 197
|
Left = 244
|
||||||
Height = 25
|
Height = 33
|
||||||
Top = 78
|
Top = 95
|
||||||
Width = 45
|
Width = 45
|
||||||
Anchors = [akTop, akLeft, akRight]
|
Anchors = [akTop, akLeft, akRight]
|
||||||
BorderSpacing.Right = 8
|
BorderSpacing.Right = 8
|
||||||
@@ -78,9 +76,9 @@ inherited frmElevateSettings: TfrmElevateSettings
|
|||||||
AnchorSideTop.Side = asrCenter
|
AnchorSideTop.Side = asrCenter
|
||||||
AnchorSideRight.Control = Owner
|
AnchorSideRight.Control = Owner
|
||||||
AnchorSideRight.Side = asrBottom
|
AnchorSideRight.Side = asrBottom
|
||||||
Left = 197
|
Left = 244
|
||||||
Height = 25
|
Height = 33
|
||||||
Top = 24
|
Top = 29
|
||||||
Width = 45
|
Width = 45
|
||||||
Anchors = [akTop, akRight]
|
Anchors = [akTop, akRight]
|
||||||
BorderSpacing.Right = 8
|
BorderSpacing.Right = 8
|
||||||
@@ -89,4 +87,8 @@ inherited frmElevateSettings: TfrmElevateSettings
|
|||||||
TabOrder = 5
|
TabOrder = 5
|
||||||
Value = 1
|
Value = 1
|
||||||
end
|
end
|
||||||
|
inherited tmClose: TTimer[6]
|
||||||
|
Left = 144
|
||||||
|
Top = 16
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
+81
-84
@@ -1,27 +1,26 @@
|
|||||||
object frmFilter: TfrmFilter
|
object frmFilter: TfrmFilter
|
||||||
Left = 290
|
Left = 290
|
||||||
Height = 492
|
Height = 615
|
||||||
Top = 171
|
Top = 171
|
||||||
Width = 232
|
Width = 290
|
||||||
ActiveControl = rgFilterType.RadioButton0
|
|
||||||
BorderIcons = [biSystemMenu, biMinimize]
|
BorderIcons = [biSystemMenu, biMinimize]
|
||||||
BorderStyle = bsToolWindow
|
BorderStyle = bsToolWindow
|
||||||
Caption = 'Filter'
|
Caption = 'Filter'
|
||||||
ClientHeight = 492
|
ClientHeight = 615
|
||||||
ClientWidth = 232
|
ClientWidth = 290
|
||||||
Font.Height = -11
|
Font.Height = -14
|
||||||
|
LCLVersion = '4.99.0.0'
|
||||||
OnCreate = FormCreate
|
OnCreate = FormCreate
|
||||||
OnDestroy = FormDestroy
|
OnDestroy = FormDestroy
|
||||||
OnShow = FormShow
|
OnShow = FormShow
|
||||||
LCLVersion = '0.9.29'
|
|
||||||
object rgFilterType: TRadioGroup
|
object rgFilterType: TRadioGroup
|
||||||
Left = 4
|
Left = 5
|
||||||
Height = 40
|
Height = 50
|
||||||
Top = 4
|
Top = 5
|
||||||
Width = 224
|
Width = 280
|
||||||
Align = alTop
|
Align = alTop
|
||||||
AutoFill = True
|
AutoFill = True
|
||||||
BorderSpacing.Around = 4
|
BorderSpacing.Around = 5
|
||||||
Caption = 'Filter rule'
|
Caption = 'Filter rule'
|
||||||
ChildSizing.LeftRightSpacing = 6
|
ChildSizing.LeftRightSpacing = 6
|
||||||
ChildSizing.TopBottomSpacing = 6
|
ChildSizing.TopBottomSpacing = 6
|
||||||
@@ -31,27 +30,27 @@ object frmFilter: TfrmFilter
|
|||||||
ChildSizing.ShrinkVertical = crsScaleChilds
|
ChildSizing.ShrinkVertical = crsScaleChilds
|
||||||
ChildSizing.Layout = cclLeftToRightThenTopToBottom
|
ChildSizing.Layout = cclLeftToRightThenTopToBottom
|
||||||
ChildSizing.ControlsPerLine = 2
|
ChildSizing.ControlsPerLine = 2
|
||||||
ClientHeight = 26
|
ClientHeight = 38
|
||||||
ClientWidth = 222
|
ClientWidth = 268
|
||||||
Columns = 2
|
Columns = 2
|
||||||
ItemIndex = 0
|
ItemIndex = 0
|
||||||
Items.Strings = (
|
Items.Strings = (
|
||||||
'Exclusive'
|
'Exclusive'
|
||||||
'Inclusive'
|
'Inclusive'
|
||||||
)
|
)
|
||||||
OnClick = rgFilterTypeClick
|
|
||||||
TabOrder = 0
|
TabOrder = 0
|
||||||
|
OnClick = rgFilterTypeClick
|
||||||
end
|
end
|
||||||
object GroupBox1: TGroupBox
|
object GroupBox1: TGroupBox
|
||||||
Left = 4
|
Left = 5
|
||||||
Height = 259
|
Height = 324
|
||||||
Top = 48
|
Top = 60
|
||||||
Width = 224
|
Width = 280
|
||||||
Align = alClient
|
Align = alClient
|
||||||
BorderSpacing.Around = 4
|
BorderSpacing.Around = 5
|
||||||
Caption = 'Tile filter'
|
Caption = 'Tile filter'
|
||||||
ClientHeight = 245
|
ClientHeight = 312
|
||||||
ClientWidth = 222
|
ClientWidth = 268
|
||||||
TabOrder = 1
|
TabOrder = 1
|
||||||
object Label1: TLabel
|
object Label1: TLabel
|
||||||
AnchorSideLeft.Control = GroupBox1
|
AnchorSideLeft.Control = GroupBox1
|
||||||
@@ -59,12 +58,12 @@ object frmFilter: TfrmFilter
|
|||||||
AnchorSideTop.Side = asrBottom
|
AnchorSideTop.Side = asrBottom
|
||||||
AnchorSideRight.Control = GroupBox1
|
AnchorSideRight.Control = GroupBox1
|
||||||
AnchorSideRight.Side = asrBottom
|
AnchorSideRight.Side = asrBottom
|
||||||
Left = 4
|
Left = 5
|
||||||
Height = 30
|
Height = 40
|
||||||
Top = 30
|
Top = 32
|
||||||
Width = 214
|
Width = 268
|
||||||
Anchors = [akTop, akLeft, akRight]
|
Anchors = [akTop, akLeft, akRight]
|
||||||
BorderSpacing.Around = 4
|
BorderSpacing.Around = 5
|
||||||
Caption = 'Drag and Drop static tiles from the tile list on this list to add them to the filter.'
|
Caption = 'Drag and Drop static tiles from the tile list on this list to add them to the filter.'
|
||||||
ParentColor = False
|
ParentColor = False
|
||||||
WordWrap = True
|
WordWrap = True
|
||||||
@@ -76,13 +75,12 @@ object frmFilter: TfrmFilter
|
|||||||
AnchorSideRight.Side = asrCenter
|
AnchorSideRight.Side = asrCenter
|
||||||
AnchorSideBottom.Control = btnDelete
|
AnchorSideBottom.Control = btnDelete
|
||||||
AnchorSideBottom.Side = asrBottom
|
AnchorSideBottom.Side = asrBottom
|
||||||
Left = 30
|
Left = 38
|
||||||
Height = 22
|
Height = 28
|
||||||
Hint = 'Clear'
|
Hint = 'Clear'
|
||||||
Top = 219
|
Top = 270
|
||||||
Width = 22
|
Width = 28
|
||||||
Anchors = [akLeft, akBottom]
|
Anchors = [akLeft, akBottom]
|
||||||
Color = clBtnFace
|
|
||||||
Glyph.Data = {
|
Glyph.Data = {
|
||||||
36040000424D3604000000000000360000002800000010000000100000000100
|
36040000424D3604000000000000360000002800000010000000100000000100
|
||||||
20000000000000040000640000006400000000000000000000003ADCFE004800
|
20000000000000040000640000006400000000000000000000003ADCFE004800
|
||||||
@@ -119,23 +117,21 @@ object frmFilter: TfrmFilter
|
|||||||
DE00D86FDF00D86FDF00E0A223004AC6080000000000580000005870DF000C70
|
DE00D86FDF00D86FDF00E0A223004AC6080000000000580000005870DF000C70
|
||||||
DF000000000000000000000000002070DF000000000000000000
|
DF000000000000000000000000002070DF000000000000000000
|
||||||
}
|
}
|
||||||
NumGlyphs = 0
|
|
||||||
OnClick = btnClearClick
|
|
||||||
ShowHint = True
|
ShowHint = True
|
||||||
ParentShowHint = False
|
ParentShowHint = False
|
||||||
|
OnClick = btnClearClick
|
||||||
end
|
end
|
||||||
object btnDelete: TSpeedButton
|
object btnDelete: TSpeedButton
|
||||||
AnchorSideLeft.Control = GroupBox1
|
AnchorSideLeft.Control = GroupBox1
|
||||||
AnchorSideBottom.Control = GroupBox1
|
AnchorSideBottom.Control = GroupBox1
|
||||||
AnchorSideBottom.Side = asrBottom
|
AnchorSideBottom.Side = asrBottom
|
||||||
Left = 4
|
Left = 5
|
||||||
Height = 22
|
Height = 28
|
||||||
Hint = 'Delete'
|
Hint = 'Delete'
|
||||||
Top = 219
|
Top = 270
|
||||||
Width = 22
|
Width = 28
|
||||||
Anchors = [akLeft, akBottom]
|
Anchors = [akLeft, akBottom]
|
||||||
BorderSpacing.Around = 4
|
BorderSpacing.Around = 5
|
||||||
Color = clBtnFace
|
|
||||||
Glyph.Data = {
|
Glyph.Data = {
|
||||||
36040000424D3604000000000000360000002800000010000000100000000100
|
36040000424D3604000000000000360000002800000010000000100000000100
|
||||||
20000000000000040000640000006400000000000000000000004F91AB005588
|
20000000000000040000640000006400000000000000000000004F91AB005588
|
||||||
@@ -172,12 +168,11 @@ object frmFilter: TfrmFilter
|
|||||||
DE0068B0E00068B0E0000E049300F8049500F2009500070102000F049500F804
|
DE0068B0E00068B0E0000E049300F8049500F2009500070102000F049500F804
|
||||||
0200F2000200080104000E040200F8040400F200040009010500
|
0200F2000200080104000E040200F8040400F200040009010500
|
||||||
}
|
}
|
||||||
NumGlyphs = 0
|
|
||||||
OnClick = btnDeleteClick
|
|
||||||
ShowHint = True
|
ShowHint = True
|
||||||
ParentShowHint = False
|
ParentShowHint = False
|
||||||
|
OnClick = btnDeleteClick
|
||||||
end
|
end
|
||||||
object vdtFilter: TVirtualDrawTree
|
object vdtFilter: TLazVirtualDrawTree
|
||||||
Tag = 1
|
Tag = 1
|
||||||
AnchorSideLeft.Control = GroupBox1
|
AnchorSideLeft.Control = GroupBox1
|
||||||
AnchorSideTop.Control = Label1
|
AnchorSideTop.Control = Label1
|
||||||
@@ -186,13 +181,13 @@ object frmFilter: TfrmFilter
|
|||||||
AnchorSideRight.Side = asrBottom
|
AnchorSideRight.Side = asrBottom
|
||||||
AnchorSideBottom.Control = btnDelete
|
AnchorSideBottom.Control = btnDelete
|
||||||
Cursor = 63
|
Cursor = 63
|
||||||
Left = 4
|
Left = 5
|
||||||
Height = 151
|
Height = 188
|
||||||
Top = 64
|
Top = 77
|
||||||
Width = 214
|
Width = 268
|
||||||
Anchors = [akTop, akLeft, akRight, akBottom]
|
Anchors = [akTop, akLeft, akRight, akBottom]
|
||||||
BorderSpacing.Around = 4
|
BorderSpacing.Around = 5
|
||||||
DefaultNodeHeight = 44
|
DefaultNodeHeight = 55
|
||||||
DragType = dtVCL
|
DragType = dtVCL
|
||||||
Header.AutoSizeIndex = 0
|
Header.AutoSizeIndex = 0
|
||||||
Header.Columns = <
|
Header.Columns = <
|
||||||
@@ -203,14 +198,15 @@ object frmFilter: TfrmFilter
|
|||||||
item
|
item
|
||||||
Position = 1
|
Position = 1
|
||||||
Text = 'Tile'
|
Text = 'Tile'
|
||||||
Width = 44
|
Width = 55
|
||||||
end
|
end
|
||||||
item
|
item
|
||||||
Position = 2
|
Position = 2
|
||||||
Text = 'Name'
|
Text = 'Name'
|
||||||
Width = 100
|
Width = 125
|
||||||
end>
|
end>
|
||||||
Header.DefaultHeight = 17
|
Header.DefaultHeight = 21
|
||||||
|
Header.Height = 36
|
||||||
Header.Options = [hoColumnResize, hoDrag, hoVisible]
|
Header.Options = [hoColumnResize, hoDrag, hoVisible]
|
||||||
Header.ParentFont = True
|
Header.ParentFont = True
|
||||||
Header.Style = hsFlatButtons
|
Header.Style = hsFlatButtons
|
||||||
@@ -224,63 +220,64 @@ object frmFilter: TfrmFilter
|
|||||||
object cbTileFilter: TCheckBox
|
object cbTileFilter: TCheckBox
|
||||||
AnchorSideLeft.Control = GroupBox1
|
AnchorSideLeft.Control = GroupBox1
|
||||||
AnchorSideTop.Control = GroupBox1
|
AnchorSideTop.Control = GroupBox1
|
||||||
Left = 4
|
Left = 5
|
||||||
Height = 22
|
Height = 22
|
||||||
Top = 4
|
Top = 5
|
||||||
Width = 85
|
Width = 101
|
||||||
BorderSpacing.Around = 4
|
BorderSpacing.Around = 5
|
||||||
Caption = 'Filter active'
|
Caption = 'Filter active'
|
||||||
OnChange = cbTileFilterChange
|
|
||||||
TabOrder = 1
|
TabOrder = 1
|
||||||
|
OnChange = cbTileFilterChange
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
object GroupBox2: TGroupBox
|
object GroupBox2: TGroupBox
|
||||||
Left = 4
|
Left = 5
|
||||||
Height = 168
|
Height = 210
|
||||||
Top = 320
|
Top = 400
|
||||||
Width = 224
|
Width = 280
|
||||||
Align = alBottom
|
Align = alBottom
|
||||||
BorderSpacing.Around = 4
|
BorderSpacing.Around = 5
|
||||||
Caption = 'Hue filter'
|
Caption = 'Hue filter'
|
||||||
ClientHeight = 154
|
ClientHeight = 198
|
||||||
ClientWidth = 222
|
ClientWidth = 268
|
||||||
TabOrder = 2
|
TabOrder = 2
|
||||||
object cbHueFilter: TCheckBox
|
object cbHueFilter: TCheckBox
|
||||||
Left = 4
|
Left = 5
|
||||||
Height = 22
|
Height = 22
|
||||||
Top = 4
|
Top = 5
|
||||||
Width = 214
|
Width = 268
|
||||||
Align = alTop
|
Align = alTop
|
||||||
BorderSpacing.Around = 4
|
BorderSpacing.Around = 5
|
||||||
Caption = 'Filter active'
|
Caption = 'Filter active'
|
||||||
OnChange = cbHueFilterChange
|
|
||||||
TabOrder = 0
|
TabOrder = 0
|
||||||
|
OnChange = cbHueFilterChange
|
||||||
end
|
end
|
||||||
object vdtHues: TVirtualDrawTree
|
object vdtHues: TLazVirtualDrawTree
|
||||||
Cursor = 63
|
Cursor = 63
|
||||||
Left = 4
|
Left = 5
|
||||||
Height = 120
|
Height = 152
|
||||||
Top = 30
|
Top = 32
|
||||||
Width = 214
|
Width = 268
|
||||||
Align = alClient
|
Align = alClient
|
||||||
BorderSpacing.Around = 4
|
BorderSpacing.Around = 5
|
||||||
Header.AutoSizeIndex = 2
|
Header.AutoSizeIndex = 2
|
||||||
Header.Columns = <
|
Header.Columns = <
|
||||||
item
|
item
|
||||||
Position = 0
|
Position = 0
|
||||||
Width = 20
|
Width = 25
|
||||||
end
|
end
|
||||||
item
|
item
|
||||||
Position = 1
|
Position = 1
|
||||||
Text = 'Hue'
|
Text = 'Hue'
|
||||||
Width = 38
|
Width = 48
|
||||||
end
|
end
|
||||||
item
|
item
|
||||||
Position = 2
|
Position = 2
|
||||||
Text = 'Name'
|
Text = 'Name'
|
||||||
Width = 154
|
Width = 195
|
||||||
end>
|
end>
|
||||||
Header.DefaultHeight = 17
|
Header.DefaultHeight = 21
|
||||||
|
Header.Height = 36
|
||||||
Header.Options = [hoAutoResize, hoColumnResize, hoDrag, hoVisible]
|
Header.Options = [hoAutoResize, hoColumnResize, hoDrag, hoVisible]
|
||||||
Header.ParentFont = True
|
Header.ParentFont = True
|
||||||
Header.Style = hsFlatButtons
|
Header.Style = hsFlatButtons
|
||||||
@@ -296,15 +293,15 @@ object frmFilter: TfrmFilter
|
|||||||
object Splitter1: TSplitter
|
object Splitter1: TSplitter
|
||||||
Cursor = crVSplit
|
Cursor = crVSplit
|
||||||
Left = 0
|
Left = 0
|
||||||
Height = 5
|
Height = 6
|
||||||
Top = 311
|
Top = 389
|
||||||
Width = 232
|
Width = 290
|
||||||
Align = alBottom
|
Align = alBottom
|
||||||
ResizeAnchor = akBottom
|
ResizeAnchor = akBottom
|
||||||
end
|
end
|
||||||
object pmHues: TPopupMenu
|
object pmHues: TPopupMenu
|
||||||
left = 148
|
Left = 185
|
||||||
top = 404
|
Top = 505
|
||||||
object mnuCheckHues: TMenuItem
|
object mnuCheckHues: TMenuItem
|
||||||
Caption = 'Check all hues'
|
Caption = 'Check all hues'
|
||||||
OnClick = mnuCheckHuesClick
|
OnClick = mnuCheckHuesClick
|
||||||
|
|||||||
@@ -31,8 +31,8 @@ interface
|
|||||||
|
|
||||||
uses
|
uses
|
||||||
Classes, SysUtils, LResources, Forms, Controls, Graphics, Dialogs, StdCtrls,
|
Classes, SysUtils, LResources, Forms, Controls, Graphics, Dialogs, StdCtrls,
|
||||||
ExtCtrls, VirtualTrees, LCLIntf, LMessages, Buttons, UPlatformTypes, UStatics,
|
ExtCtrls, laz.VirtualTrees, LCLIntf, LMessages, Buttons, UPlatformTypes,
|
||||||
Menus;
|
UStatics, Menus;
|
||||||
|
|
||||||
type
|
type
|
||||||
|
|
||||||
@@ -55,8 +55,8 @@ type
|
|||||||
pmHues: TPopupMenu;
|
pmHues: TPopupMenu;
|
||||||
rgFilterType: TRadioGroup;
|
rgFilterType: TRadioGroup;
|
||||||
Splitter1: TSplitter;
|
Splitter1: TSplitter;
|
||||||
vdtFilter: TVirtualDrawTree;
|
vdtFilter: TLazVirtualDrawTree;
|
||||||
vdtHues: TVirtualDrawTree;
|
vdtHues: TLazVirtualDrawTree;
|
||||||
procedure btnClearClick(Sender: TObject);
|
procedure btnClearClick(Sender: TObject);
|
||||||
procedure btnDeleteClick(Sender: TObject);
|
procedure btnDeleteClick(Sender: TObject);
|
||||||
procedure cbHueFilterChange(Sender: TObject);
|
procedure cbHueFilterChange(Sender: TObject);
|
||||||
@@ -149,11 +149,11 @@ procedure TfrmFilter.vdtFilterDragDrop(Sender: TBaseVirtualTree;
|
|||||||
Source: TObject; DataObject: IDataObject; Formats: TFormatArray;
|
Source: TObject; DataObject: IDataObject; Formats: TFormatArray;
|
||||||
Shift: TShiftState; Pt: TPoint; var Effect: Integer; Mode: TDropMode);
|
Shift: TShiftState; Pt: TPoint; var Effect: Integer; Mode: TDropMode);
|
||||||
var
|
var
|
||||||
sourceTree: TVirtualDrawTree;
|
sourceTree: TLazVirtualDrawTree;
|
||||||
selected, node: PVirtualNode;
|
selected, node: PVirtualNode;
|
||||||
sourceTileInfo, targetTileInfo: PTileInfo;
|
sourceTileInfo, targetTileInfo: PTileInfo;
|
||||||
begin
|
begin
|
||||||
sourceTree := Source as TVirtualDrawTree;
|
sourceTree := Source as TLazVirtualDrawTree;
|
||||||
if (sourceTree <> Sender) and (sourceTree <> nil) and
|
if (sourceTree <> Sender) and (sourceTree <> nil) and
|
||||||
(sourceTree.Tag = 1) then
|
(sourceTree.Tag = 1) then
|
||||||
begin
|
begin
|
||||||
@@ -180,8 +180,8 @@ procedure TfrmFilter.vdtFilterDragOver(Sender: TBaseVirtualTree;
|
|||||||
Source: TObject; Shift: TShiftState; State: TDragState; Pt: TPoint;
|
Source: TObject; Shift: TShiftState; State: TDragState; Pt: TPoint;
|
||||||
Mode: TDropMode; var Effect: Integer; var Accept: Boolean);
|
Mode: TDropMode; var Effect: Integer; var Accept: Boolean);
|
||||||
begin
|
begin
|
||||||
if (Source <> Sender) and (Source is TVirtualDrawTree) and
|
if (Source <> Sender) and (Source is TLazVirtualDrawTree) and
|
||||||
(TVirtualDrawTree(Source).Tag = 1) then
|
(TLazVirtualDrawTree(Source).Tag = 1) then
|
||||||
begin
|
begin
|
||||||
Accept := True;
|
Accept := True;
|
||||||
end;
|
end;
|
||||||
@@ -329,6 +329,7 @@ end;
|
|||||||
procedure TfrmFilter.btnDeleteClick(Sender: TObject);
|
procedure TfrmFilter.btnDeleteClick(Sender: TObject);
|
||||||
begin
|
begin
|
||||||
vdtFilter.DeleteSelectedNodes;
|
vdtFilter.DeleteSelectedNodes;
|
||||||
|
frmMain.InvalidateFilter;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
procedure TfrmFilter.cbHueFilterChange(Sender: TObject);
|
procedure TfrmFilter.cbHueFilterChange(Sender: TObject);
|
||||||
@@ -344,6 +345,7 @@ end;
|
|||||||
procedure TfrmFilter.btnClearClick(Sender: TObject);
|
procedure TfrmFilter.btnClearClick(Sender: TObject);
|
||||||
begin
|
begin
|
||||||
vdtFilter.Clear;
|
vdtFilter.Clear;
|
||||||
|
frmMain.InvalidateFilter;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
initialization
|
initialization
|
||||||
|
|||||||
@@ -1,30 +1,34 @@
|
|||||||
inherited frmHueSettings: TfrmHueSettings
|
inherited frmHueSettings: TfrmHueSettings
|
||||||
Left = 290
|
Left = 290
|
||||||
Height = 209
|
Height = 389
|
||||||
Top = 171
|
Top = 171
|
||||||
Width = 217
|
Width = 255
|
||||||
|
AutoSize = True
|
||||||
Caption = 'Hue Settings'
|
Caption = 'Hue Settings'
|
||||||
ClientHeight = 209
|
ClientHeight = 389
|
||||||
ClientWidth = 217
|
ClientWidth = 255
|
||||||
|
Constraints.MinWidth = 255
|
||||||
OnCreate = FormCreate
|
OnCreate = FormCreate
|
||||||
|
OnDestroy = FormDestroy
|
||||||
object lblHue: TLabel[0]
|
object lblHue: TLabel[0]
|
||||||
AnchorSideLeft.Control = Owner
|
AnchorSideLeft.Control = Owner
|
||||||
AnchorSideTop.Control = edHue
|
AnchorSideTop.Control = edHue
|
||||||
AnchorSideTop.Side = asrCenter
|
AnchorSideTop.Side = asrCenter
|
||||||
Left = 8
|
Left = 8
|
||||||
Height = 16
|
Height = 23
|
||||||
Top = 12
|
Top = 14
|
||||||
Width = 26
|
Width = 35
|
||||||
BorderSpacing.Left = 8
|
BorderSpacing.Left = 8
|
||||||
Caption = 'Hue:'
|
Caption = 'Hue:'
|
||||||
|
Color = clDefault
|
||||||
ParentColor = False
|
ParentColor = False
|
||||||
end
|
end
|
||||||
object edHue: TEdit[1]
|
object edHue: TEdit[1]
|
||||||
AnchorSideLeft.Control = lblHue
|
AnchorSideLeft.Control = lblHue
|
||||||
AnchorSideLeft.Side = asrBottom
|
AnchorSideLeft.Side = asrBottom
|
||||||
AnchorSideTop.Control = Owner
|
AnchorSideTop.Control = Owner
|
||||||
Left = 42
|
Left = 51
|
||||||
Height = 25
|
Height = 35
|
||||||
Top = 8
|
Top = 8
|
||||||
Width = 80
|
Width = 80
|
||||||
BorderSpacing.Left = 8
|
BorderSpacing.Left = 8
|
||||||
@@ -41,19 +45,351 @@ inherited frmHueSettings: TfrmHueSettings
|
|||||||
AnchorSideBottom.Control = Owner
|
AnchorSideBottom.Control = Owner
|
||||||
AnchorSideBottom.Side = asrBottom
|
AnchorSideBottom.Side = asrBottom
|
||||||
Left = 8
|
Left = 8
|
||||||
Height = 160
|
Height = 139
|
||||||
Top = 41
|
Top = 51
|
||||||
Width = 201
|
Width = 239
|
||||||
Anchors = [akTop, akLeft, akRight, akBottom]
|
Anchors = [akTop, akLeft, akRight]
|
||||||
BorderSpacing.Around = 8
|
BorderSpacing.Around = 8
|
||||||
|
DragMode = dmAutomatic
|
||||||
|
Font.Height = 14
|
||||||
ItemHeight = 16
|
ItemHeight = 16
|
||||||
OnDrawItem = lbHueDrawItem
|
OnDrawItem = lbHueDrawItem
|
||||||
OnSelectionChange = lbHueSelectionChange
|
OnSelectionChange = lbHueSelectionChange
|
||||||
|
ParentFont = False
|
||||||
Style = lbOwnerDrawFixed
|
Style = lbOwnerDrawFixed
|
||||||
TabOrder = 1
|
TabOrder = 1
|
||||||
|
TopIndex = -1
|
||||||
end
|
end
|
||||||
inherited tmClose: TTimer[3]
|
object gbRandom: TGroupBox[3]
|
||||||
left = 152
|
AnchorSideLeft.Control = Owner
|
||||||
top = 112
|
AnchorSideTop.Control = lbHue
|
||||||
|
AnchorSideTop.Side = asrBottom
|
||||||
|
AnchorSideRight.Control = Owner
|
||||||
|
AnchorSideRight.Side = asrBottom
|
||||||
|
AnchorSideBottom.Side = asrBottom
|
||||||
|
Left = 8
|
||||||
|
Height = 183
|
||||||
|
Top = 198
|
||||||
|
Width = 239
|
||||||
|
Anchors = [akTop, akLeft, akRight]
|
||||||
|
BorderSpacing.Left = 8
|
||||||
|
BorderSpacing.Top = 4
|
||||||
|
BorderSpacing.Right = 8
|
||||||
|
BorderSpacing.Bottom = 8
|
||||||
|
Caption = 'Random pool'
|
||||||
|
ClientHeight = 159
|
||||||
|
ClientWidth = 237
|
||||||
|
TabOrder = 2
|
||||||
|
Visible = False
|
||||||
|
object btnAddRandom: TSpeedButton
|
||||||
|
AnchorSideLeft.Control = gbRandom
|
||||||
|
AnchorSideTop.Control = gbRandom
|
||||||
|
Left = 4
|
||||||
|
Height = 22
|
||||||
|
Hint = 'Add'
|
||||||
|
Top = 0
|
||||||
|
Width = 23
|
||||||
|
BorderSpacing.Left = 4
|
||||||
|
Glyph.Data = {
|
||||||
|
36040000424D3604000000000000360000002800000010000000100000000100
|
||||||
|
2000000000000004000064000000640000000000000000000000000000000000
|
||||||
|
0000000000000000000000000000000000000000000000000000000000000000
|
||||||
|
0000000000000000000000000000000000000000000000000000000000000000
|
||||||
|
0000000000000000000000000000000000003A8C44FF368940FF32873CFF2F84
|
||||||
|
37FF000000000000000000000000000000000000000000000000000000000000
|
||||||
|
00000000000000000000459653FF419950FF7DC28FFF96D0A6FF96CFA6FF78BE
|
||||||
|
89FF368D42FF2C8134FF00000000000000000000000000000000000000000000
|
||||||
|
0000000000004D9C5DFF64B478FFA8DBB5FF87CC98FF66BC7DFF64BA7CFF86CB
|
||||||
|
98FFA5D9B4FF58AA6BFF2C8134FF000000000000000000000000000000000000
|
||||||
|
000056A366FF6AB97DFFA8DBB2FF60BC77FF5CBA73FF59B870FF59B56FFF58B5
|
||||||
|
6FFF5BB774FFA5D9B3FF5AAA6CFF2C8234FF0000000000000000000000000000
|
||||||
|
000053AB68FFAADDB4FF64C179FF5FBE71FF60BC77FFFFFFFFFFFFFFFFFF59B8
|
||||||
|
70FF58B56EFF5CB774FFA6DAB4FF388F43FF00000000000000000000000061AC
|
||||||
|
75FF8ACC98FF89D396FF6BC67AFF63C170FF55AB65FFFFFFFFFFFFFFFFFF59B8
|
||||||
|
70FF59B870FF5BB972FF85CC97FF7BBE8DFF308539FF000000000000000065AF
|
||||||
|
7AFFA9DDB3FF7DCF8AFF75CC81FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF
|
||||||
|
FFFFFFFFFFFF59B870FF67BE7DFF9CD4ABFF34883DFF000000000000000069B2
|
||||||
|
7EFFB6E2BEFF8BD597FF7AC986FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF
|
||||||
|
FFFFFFFFFFFF59B870FF69C17EFF9DD4AAFF388B42FF00000000000000006DB5
|
||||||
|
83FFACDDB6FFA6DFAFFF81CB8CFF7CC986FF6EBD79FFFFFFFFFFFFFFFFFF5BAC
|
||||||
|
6AFF60BC77FF5CBA73FF8BD199FF80C592FF3C8E47FF00000000000000000000
|
||||||
|
000085C797FFD2EED7FF95D9A0FF8AD394FF7FC889FFFFFFFFFFFFFFFFFF79CD
|
||||||
|
85FF6BC37CFF6FC77EFFACDFB5FF459E57FF0000000000000000000000000000
|
||||||
|
000070B887FFAADAB7FFD8F1DCFF92D89DFF88CD93FF84CC8EFF8BD496FF8AD4
|
||||||
|
95FF83D28EFFAFE0B7FF6BB97DFF489856FF0000000000000000000000000000
|
||||||
|
00000000000070B887FFAFDCBBFFDCF2E0FFB6E4BDFF9BDBA5FF96D9A0FFA5DF
|
||||||
|
AFFFC0E8C5FF79C28AFF509E5FFF000000000000000000000000000000000000
|
||||||
|
0000000000000000000071B887FF94CEA4FFC3E6CBFFCFEBD4FFC9E9CEFFAFDD
|
||||||
|
B8FF6DB97FFF58A569FF00000000000000000000000000000000000000000000
|
||||||
|
0000000000000000000000000000000000006EB684FF6AB380FF67B17CFF63AE
|
||||||
|
77FF000000000000000000000000000000000000000000000000000000000000
|
||||||
|
0000000000000000000000000000000000000000000000000000000000000000
|
||||||
|
0000000000000000000000000000000000000000000000000000
|
||||||
|
}
|
||||||
|
OnClick = btnAddRandomClick
|
||||||
|
ShowHint = True
|
||||||
|
ParentShowHint = False
|
||||||
|
end
|
||||||
|
object btnDeleteRandom: TSpeedButton
|
||||||
|
AnchorSideLeft.Control = btnAddRandom
|
||||||
|
AnchorSideLeft.Side = asrBottom
|
||||||
|
AnchorSideTop.Control = btnAddRandom
|
||||||
|
Left = 31
|
||||||
|
Height = 22
|
||||||
|
Hint = 'Delete'
|
||||||
|
Top = 0
|
||||||
|
Width = 23
|
||||||
|
BorderSpacing.Left = 4
|
||||||
|
Glyph.Data = {
|
||||||
|
36040000424D3604000000000000360000002800000010000000100000000100
|
||||||
|
2000000000000004000064000000640000000000000000000000000000000000
|
||||||
|
0000000000000000000000000000000000000000000000000000000000000000
|
||||||
|
0000000000000000000000000000000000000000000000000000000000000000
|
||||||
|
0000000000000000000000000000000000003853BEFF3551BDFF304BBCFF2E4E
|
||||||
|
B8FF000000000000000000000000000000000000000000000000000000000000
|
||||||
|
000000000000000000004255C6FF3C52CCFF757AE8FF8F92EEFF8F92EEFF7178
|
||||||
|
E4FF334DC1FF2B4AB7FF00000000000000000000000000000000000000000000
|
||||||
|
0000000000004959CBFF5C65E0FFA1A6F5FF7E86EFFF5B63E9FF595DE7FF7D84
|
||||||
|
EEFF9EA0F4FF515DD7FF2B4AB7FF000000000000000000000000000000000000
|
||||||
|
00005361CFFF616BE3FFA1ACF5FF545FECFF505CEAFF4D59E9FF4E59E6FF4C56
|
||||||
|
E6FF5056E6FF9EA2F4FF5460D6FF2A4AB8FF0000000000000000000000000000
|
||||||
|
00004B56DBFFA2ABF6FF5664F0FF5266EEFF4D59E9FF4D59E9FF4D59E9FF4D59
|
||||||
|
E9FF4C58E6FF525AE6FF9FA3F5FF3450C4FF0000000000000000000000005C62
|
||||||
|
D7FF818CEEFF7E91F7FF5D73F3FF4D59E9FF4D59E9FF4D59E9FF4D59E9FF4D59
|
||||||
|
E9FF4D59E9FF4F5BE9FF7B83F0FF757BE2FF2E4BBAFF00000000000000005F63
|
||||||
|
DAFFA1ABF7FF7086F8FF6882F6FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF
|
||||||
|
FFFFFFFFFFFF4D59E9FF5C66EAFF969CF1FF3250BCFF00000000000000006469
|
||||||
|
DBFFAFB9F9FF7F93FAFF7085F0FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF
|
||||||
|
FFFFFFFFFFFF4D59E9FF5E6AEEFF969DF1FF364FBEFF0000000000000000676A
|
||||||
|
DEFFA5AFF5FF9DABFAFF778CF0FF545FECFF545FECFF545FECFF545FECFF545F
|
||||||
|
ECFF545FECFF6377F2FF818EF4FF787FE9FF3A53C0FF00000000000000000000
|
||||||
|
00007D83EAFFCDD4FCFF8B9DFAFF7E93F7FF758AEEFF6C84F6FF6C84F6FF6C84
|
||||||
|
F6FF6C84F6FF6379F3FFA4AFF8FF3E4FD0FF0000000000000000000000000000
|
||||||
|
00006A69E0FFA3A7F3FFD4DBFDFF879AFAFF7F91F0FF7A8EF1FF7F94F8FF7E92
|
||||||
|
F9FF768CF8FFA8B6F8FF636EE3FF4557C7FF0000000000000000000000000000
|
||||||
|
0000000000006A69E0FFAAADF2FFD8DCFDFFAEBAFAFF91A3FAFF8B9DFAFF9CA9
|
||||||
|
FBFFBAC7FCFF707BE9FF4C5BCCFF000000000000000000000000000000000000
|
||||||
|
000000000000000000006A6ADFFF8E93EDFFBEC3F8FFCCD3F9FFC4CBF9FFAAB4
|
||||||
|
F4FF6670E2FF535ED1FF00000000000000000000000000000000000000000000
|
||||||
|
000000000000000000000000000000000000686ADDFF6364DCFF6164DAFF5D63
|
||||||
|
D9FF000000000000000000000000000000000000000000000000000000000000
|
||||||
|
0000000000000000000000000000000000000000000000000000000000000000
|
||||||
|
0000000000000000000000000000000000000000000000000000
|
||||||
|
}
|
||||||
|
OnClick = btnDeleteRandomClick
|
||||||
|
ShowHint = True
|
||||||
|
ParentShowHint = False
|
||||||
|
end
|
||||||
|
object btnClearRandom: TSpeedButton
|
||||||
|
AnchorSideLeft.Control = btnDeleteRandom
|
||||||
|
AnchorSideLeft.Side = asrBottom
|
||||||
|
AnchorSideTop.Control = btnDeleteRandom
|
||||||
|
Left = 58
|
||||||
|
Height = 22
|
||||||
|
Hint = 'Clear'
|
||||||
|
Top = 0
|
||||||
|
Width = 23
|
||||||
|
BorderSpacing.Left = 4
|
||||||
|
Glyph.Data = {
|
||||||
|
36040000424D3604000000000000360000002800000010000000100000000100
|
||||||
|
2000000000000004000064000000640000000000000000000000000000000000
|
||||||
|
0000000000000000000000000000000000000000000000000000000000000000
|
||||||
|
0000000000000000000000000000000000000000000000000000000000000000
|
||||||
|
000000000000000000000000F1FF0000F1FF0000F1FF0000F1FF0000EFFF0000
|
||||||
|
EFFF0000EDFF0000EDFF00000000000000000000000000000000000000000000
|
||||||
|
0000000000000000F5FF1A20F5FF3C4CF9FF3A49F8FF3847F8FF3545F8FF3443
|
||||||
|
F7FF3242F7FF141BF1FF0000EDFF000000000000000000000000000000000000
|
||||||
|
00000000F7FF1D23F9FF4453FAFF2429F9FF1212F7FF0F0FF6FF0C0CF5FF0909
|
||||||
|
F5FF161BF5FF3343F7FF141BF1FF0000EDFF0000000000000000000000000000
|
||||||
|
F9FF1F25FAFF4A58FBFF4247FBFFC9C9FDFF3B3BF9FF1313F7FF1010F6FF3333
|
||||||
|
F7FFC5C5FDFF3035F7FF3444F7FF141BF2FF0000EDFF00000000000000000000
|
||||||
|
FBFF4F5DFDFF3237FBFFCBCBFEFFF2F2FFFFEBEBFEFF3B3BF9FF3939F8FFEAEA
|
||||||
|
FEFFF1F1FEFFC5C5FDFF181DF6FF3343F7FF0000EFFF00000000000000000000
|
||||||
|
FDFF525FFDFF2828FCFF4747FCFFECECFFFFF2F2FFFFECECFFFFECECFEFFF1F1
|
||||||
|
FFFFEAEAFEFF3434F7FF0B0BF5FF3545F8FF0000EFFF00000000000000000000
|
||||||
|
FDFF5562FEFF2C2CFDFF2929FCFF4848FCFFEDEDFFFFF2F2FFFFF2F2FFFFECEC
|
||||||
|
FEFF3A3AF9FF1212F7FF0F0FF6FF3848F8FF0000F1FF00000000000000000000
|
||||||
|
FDFF5764FEFF3030FDFF2D2DFDFF4B4BFCFFEDEDFFFFF2F2FFFFF2F2FFFFECEC
|
||||||
|
FFFF3D3DF9FF1616F8FF1313F7FF3C4BF8FF0000F1FF00000000000000000000
|
||||||
|
FFFF5A67FEFF3333FEFF5050FDFFEDEDFFFFF3F3FFFFEDEDFFFFEDEDFFFFF2F2
|
||||||
|
FFFFECECFEFF3E3EFAFF1717F8FF3F4EF9FF0000F1FF00000000000000000000
|
||||||
|
FFFF5B68FFFF4347FEFFCFCFFFFFF3F3FFFFEDEDFFFF4C4CFCFF4A4AFCFFECEC
|
||||||
|
FFFFF2F2FFFFCACAFEFF2A2FFAFF4251FAFF0000F3FF00000000000000000000
|
||||||
|
FFFF262BFFFF5D6AFFFF585BFFFFCFCFFFFF5252FEFF2F2FFDFF2C2CFDFF4B4B
|
||||||
|
FCFFCCCCFEFF484CFBFF4957FBFF1D23F9FF0000F5FF00000000000000000000
|
||||||
|
00000000FFFF262BFFFF5D6AFFFF4347FFFF3434FEFF3232FEFF3030FDFF2D2D
|
||||||
|
FDFF383CFCFF4F5DFCFF1F25FAFF0000F7FF0000000000000000000000000000
|
||||||
|
0000000000000000FFFF262BFFFF5C69FFFF5B68FFFF5A67FEFF5865FEFF5663
|
||||||
|
FEFF5461FEFF2227FCFF0000FBFF000000000000000000000000000000000000
|
||||||
|
000000000000000000000000FFFF0000FFFF0000FFFF0000FFFF0000FDFF0000
|
||||||
|
FDFF0000FDFF0000FDFF00000000000000000000000000000000000000000000
|
||||||
|
0000000000000000000000000000000000000000000000000000000000000000
|
||||||
|
0000000000000000000000000000000000000000000000000000
|
||||||
|
}
|
||||||
|
OnClick = btnClearRandomClick
|
||||||
|
ShowHint = True
|
||||||
|
ParentShowHint = False
|
||||||
|
end
|
||||||
|
object btnRandomPresetSave: TSpeedButton
|
||||||
|
AnchorSideTop.Control = cbRandomPreset
|
||||||
|
AnchorSideRight.Control = btnRandomPresetDelete
|
||||||
|
Left = 185
|
||||||
|
Height = 22
|
||||||
|
Hint = 'Save Preset'
|
||||||
|
Top = 116
|
||||||
|
Width = 22
|
||||||
|
Anchors = [akTop, akRight]
|
||||||
|
BorderSpacing.Right = 4
|
||||||
|
Glyph.Data = {
|
||||||
|
36040000424D3604000000000000360000002800000010000000100000000100
|
||||||
|
2000000000000004000064000000640000000000000000000000000000000000
|
||||||
|
000000000000000000000000000000000000BA6833FFC38458FFD38B68FFE18F
|
||||||
|
70FFDC8D6CFFDA8B6DFFD78A6EFFCD8B6CFFAB6D44FFA65F2EFF00000000BA65
|
||||||
|
30FFBB6631FFBA6630FFBA6630FFBA6530FFC68355FFEFCEBAFFDDFFFFFF87EE
|
||||||
|
C7FFA2F4D7FFA2F6D7FF8CEEC7FFE0FFFFFFDDA285FFAB6A3EFFBC6933FFF8F1
|
||||||
|
EAFFF7ECDFFFF6EADEFFF6EADCFFF6EADCFFC37F51FFEFB69AFFEAF3E8FF51BF
|
||||||
|
84FF6FC998FF71C999FF54BF84FFE4F4E9FFDD9C7BFFAA693AFFBF7138FFF5EB
|
||||||
|
DFFFFDBF68FFFBBE65FFFCBE64FFFCBE64FFC48154FFEAB697FFF3F3EAFFEDF1
|
||||||
|
E6FFEFF1E6FFEFF0E6FFEDF1E5FFF3F5EDFFD59C79FFB07044FFC1783CFFF7ED
|
||||||
|
E3FFFDC26EFFFFD79EFFFFD69BFFFFD798FFC98B61FFE6B592FFE2A781FFE1A7
|
||||||
|
81FFDEA37DFFDCA17BFFDB9F79FFD99E77FFD49A73FFBB7E57FFC47C40FFF7F0
|
||||||
|
E6FFF8B455FFF7B554FFF8B453FFF8B253FFCA8D65FFEAB899FFDDA57EFFDDA6
|
||||||
|
80FFDBA37CFFD9A07AFFD9A079FFD89F78FFD89E78FFBF845DFFC58245FFF8F2
|
||||||
|
EBFFFEE7D6FFFDE7D6FFFDE7D6FFFDE6D5FFC8885DFFEFBFA1FFFDFCFAFFFEFC
|
||||||
|
FBFFFEFDFDFFFEFDFCFFFDFBFAFFFDFCFBFFDDA885FFC17F53FFC68447FFF9F3
|
||||||
|
ECFFFEE8D6FFFDE7D6FFFDE7D6FFFDE7D5FFC7865BFFEFC09EFFFFFFFFFFCC93
|
||||||
|
6EFFFFFFFFFFFFFFFFFFFFFBF7FFFFF8F1FFE4AF8CFFC78A61FFC68849FFF9F4
|
||||||
|
EDFFFEE8D8FFFEE8D7FFFEE7D6FFFDE5D3FFCC8D65FFF3CDB0FFFFFFFFFFE3C7
|
||||||
|
B3FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFEABFA1FFC98960FFC6884AFFF9F4
|
||||||
|
EFFFFEE7D7FFFDE7D5FFFDE6D4FFFCE6D2FFD4976EFFD49E7BFFD09871FFD6A4
|
||||||
|
82FFCD8E68FFCD9069FFD09A75FFD19973FFC88B62FF00000000C6894BFFF9F4
|
||||||
|
F0FFFCE6D3FFFDE7D3FFFCE4D1FFFBE3CDFFFAE0C8FFF8DCC2FFF5D6BBFFF3D4
|
||||||
|
B5FFF1D2B3FFF8F4F0FFC48246FF000000000000000000000000C6894BFFF9F5
|
||||||
|
F1FFFCE3CFFFFCE4CFFFFCE3CDFFFAE1CAFFF9DDC4FFF6D9BCFFF4E9DFFFF7F2
|
||||||
|
ECFFFBF7F3FFF5EFE9FFC27E45FF000000000000000000000000C6894CFFF9F5
|
||||||
|
F1FFFCE3CDFFFBE3CDFFFBE2CBFFF9E0C8FFF8DCC2FFF5D6BAFFFDFBF8FFFCE6
|
||||||
|
CDFFFAE5C9FFE2B684FFBF7942FF000000000000000000000000C5884BFFFAF6
|
||||||
|
F2FFFAE0C7FFFBE2C9FFFBE0C8FFF9DFC5FFF8DBC1FFF4D6B8FFFFFBF8FFF6D8
|
||||||
|
B4FFE1B07DFFDB9264FF00000000000000000000000000000000C48549FFF7F2
|
||||||
|
ECFFF8F4EEFFF8F3EDFFF8F3EDFFF8F3EDFFF8F2ECFFF7F2ECFFF2E6D7FFE2B2
|
||||||
|
7DFFDB9465FF000000000000000000000000000000000000000000000000C88B
|
||||||
|
4DFFC88C4FFFC88C4FFFC88C4FFFC88D4FFFC98C4FFFC78B4FFFC5894BFFC476
|
||||||
|
3BFF000000000000000000000000000000000000000000000000
|
||||||
|
}
|
||||||
|
OnClick = btnRandomPresetSaveClick
|
||||||
|
ShowCaption = False
|
||||||
|
ShowHint = True
|
||||||
|
ParentShowHint = False
|
||||||
|
end
|
||||||
|
object btnRandomPresetDelete: TSpeedButton
|
||||||
|
AnchorSideTop.Control = btnRandomPresetSave
|
||||||
|
AnchorSideRight.Control = gbRandom
|
||||||
|
AnchorSideRight.Side = asrBottom
|
||||||
|
Left = 211
|
||||||
|
Height = 22
|
||||||
|
Hint = 'Delete Preset'
|
||||||
|
Top = 116
|
||||||
|
Width = 22
|
||||||
|
Anchors = [akTop, akRight]
|
||||||
|
BorderSpacing.Right = 4
|
||||||
|
Glyph.Data = {
|
||||||
|
36040000424D3604000000000000360000002800000010000000100000000100
|
||||||
|
2000000000000004000064000000640000000000000000000000000000000000
|
||||||
|
0000BA6530FFBB6631FFBA6630FFBA6630FFBA6630FFBA6530FFBA652FFFB965
|
||||||
|
2EFF6E5E76FF1949A8FF0542BBFF1348ADFF394E8FFF0000000000000000BC69
|
||||||
|
33FFF8F1EAFFF7ECDFFFF6EBDEFFF6EADEFFF6EADCFFF6EADCFFFAF3EBFF8AA5
|
||||||
|
D7FF2866CAFF2177E6FF0579EAFF0164DDFF064DBBFF0000000000000000BF71
|
||||||
|
38FFF5EBDFFFFDBF68FFFCBD67FFFBBE65FFFCBE64FFFCBE64FFFCBD62FF1E52
|
||||||
|
B0FF639DF4FF187FFFFF0076F8FF0076EEFF0368E1FF0345B9FF00000000C178
|
||||||
|
3CFFF7EDE3FFFDC26EFFFFD8A0FFFFD79EFFFFD69BFFFFD798FFFFD696FF0543
|
||||||
|
BCFFAECDFEFFFFFFFFFFFFFFFFFFFFFFFFFF187FEFFF0442BCFF00000000C47C
|
||||||
|
40FFF7F0E6FFF8B455FFF7B456FFF7B554FFF8B453FFF8B253FFF7B352FF2453
|
||||||
|
ABFF8DB5F6FF4D92FFFF1177FFFF2186FFFF408AEBFF0344B9FF00000000C580
|
||||||
|
42FFF8F1E8FFFEE5D5FFFDE5D3FFFDE5D3FFFCE5D3FFFCE5D3FFFCE4D1FF94A1
|
||||||
|
C9FF3D76D1FF8DB5F7FFB8D6FEFF72A8F5FF2F6BC9FF0000000000000000C582
|
||||||
|
45FFF8F2EBFFFEE7D6FFFDE7D6FFFDE7D6FFFDE7D6FFFDE6D5FFFDE5D3FFFCE4
|
||||||
|
D1FF94A1C9FF2A5EC1FF0543BCFF1F59BFFF686279FF0000000000000000C684
|
||||||
|
47FFF9F3ECFFFEE8D6FFFEE8D7FFFDE7D6FFFDE7D6FFFDE7D5FFFDE5D3FFFBE4
|
||||||
|
D0FFFBE3CCFFFADFC7FFFADFC6FFFAF2EAFFC68042FF0000000000000000C688
|
||||||
|
49FFF9F4EDFFFEE8D8FFFEE8D8FFFEE8D7FFFEE7D6FFFDE5D3FFFCE4D1FFFBE1
|
||||||
|
CCFFFAE0C7FFF9DDC3FFF8DCC2FFFAF4EDFFC68245FF0000000000000000C688
|
||||||
|
4AFFF9F4EFFFFEE7D7FFFDE7D6FFFDE7D5FFFDE6D4FFFCE6D2FFFBE1CCFFFADF
|
||||||
|
C7FFF8DCC2FFF6DABDFFF6D8BBFFFAF4EFFFC68346FF0000000000000000C689
|
||||||
|
4BFFF9F4F0FFFCE6D3FFFCE6D4FFFDE7D3FFFCE4D1FFFBE3CDFFFAE0C8FFF8DC
|
||||||
|
C2FFF5D6BBFFF3D4B5FFF1D2B3FFF8F4F0FFC48246FF0000000000000000C689
|
||||||
|
4BFFF9F5F1FFFCE3CFFFFBE4D0FFFCE4CFFFFCE3CDFFFAE1CAFFF9DDC4FFF6D9
|
||||||
|
BCFFF4E9DFFFF7F2ECFFFBF7F3FFF5EFE9FFC27E45FF0000000000000000C689
|
||||||
|
4CFFF9F5F1FFFCE3CDFFFBE3CEFFFBE3CDFFFBE2CBFFF9E0C8FFF8DCC2FFF5D6
|
||||||
|
BAFFFDFBF8FFFCE6CDFFFAE5C9FFE2B684FFBF7942FF0000000000000000C588
|
||||||
|
4BFFFAF6F2FFFAE0C7FFFBE1C9FFFBE2C9FFFBE0C8FFF9DFC5FFF8DBC1FFF4D6
|
||||||
|
B8FFFFFBF8FFF6D8B4FFE1B07DFFDB9264FF000000000000000000000000C485
|
||||||
|
49FFF7F2ECFFF8F4EEFFF8F4EDFFF8F3EDFFF8F3EDFFF8F3EDFFF8F2ECFFF7F2
|
||||||
|
ECFFF2E6D7FFE2B27DFFDB9465FF000000000000000000000000000000000000
|
||||||
|
0000C88B4DFFC88C4FFFC88C4FFFC88C4FFFC88C4FFFC88D4FFFC98C4FFFC78B
|
||||||
|
4FFFC5894BFFC4763BFF00000000000000000000000000000000
|
||||||
|
}
|
||||||
|
OnClick = btnRandomPresetDeleteClick
|
||||||
|
ShowCaption = False
|
||||||
|
ShowHint = True
|
||||||
|
ParentShowHint = False
|
||||||
|
end
|
||||||
|
object cbRandomPreset: TComboBox
|
||||||
|
AnchorSideLeft.Control = gbRandom
|
||||||
|
AnchorSideRight.Control = btnRandomPresetSave
|
||||||
|
AnchorSideBottom.Control = gbRandom
|
||||||
|
AnchorSideBottom.Side = asrBottom
|
||||||
|
Left = 4
|
||||||
|
Height = 39
|
||||||
|
Top = 116
|
||||||
|
Width = 177
|
||||||
|
Anchors = [akLeft, akRight, akBottom]
|
||||||
|
BorderSpacing.Left = 4
|
||||||
|
BorderSpacing.Right = 4
|
||||||
|
BorderSpacing.Bottom = 4
|
||||||
|
ItemHeight = 0
|
||||||
|
OnChange = cbRandomPresetChange
|
||||||
|
Sorted = True
|
||||||
|
Style = csDropDownList
|
||||||
|
TabOrder = 0
|
||||||
|
end
|
||||||
|
object lbRandom: TListBox
|
||||||
|
AnchorSideLeft.Control = gbRandom
|
||||||
|
AnchorSideTop.Control = btnAddRandom
|
||||||
|
AnchorSideTop.Side = asrBottom
|
||||||
|
AnchorSideRight.Control = gbRandom
|
||||||
|
AnchorSideRight.Side = asrBottom
|
||||||
|
AnchorSideBottom.Control = cbRandomPreset
|
||||||
|
Left = 4
|
||||||
|
Height = 86
|
||||||
|
Top = 26
|
||||||
|
Width = 229
|
||||||
|
Anchors = [akTop, akLeft, akRight, akBottom]
|
||||||
|
BorderSpacing.Around = 4
|
||||||
|
ItemHeight = 0
|
||||||
|
MultiSelect = True
|
||||||
|
OnDragDrop = lbRandomDragDrop
|
||||||
|
OnDragOver = lbRandomDragOver
|
||||||
|
OnDrawItem = lbHueDrawItem
|
||||||
|
TabOrder = 1
|
||||||
|
TopIndex = -1
|
||||||
|
end
|
||||||
|
end
|
||||||
|
object cbRandom: TCheckBox[4]
|
||||||
|
AnchorSideTop.Control = edHue
|
||||||
|
AnchorSideTop.Side = asrCenter
|
||||||
|
AnchorSideRight.Control = lbHue
|
||||||
|
AnchorSideRight.Side = asrBottom
|
||||||
|
Left = 158
|
||||||
|
Height = 25
|
||||||
|
Top = 13
|
||||||
|
Width = 89
|
||||||
|
Anchors = [akTop, akRight]
|
||||||
|
Caption = 'Random'
|
||||||
|
OnChange = cbRandomChange
|
||||||
|
TabOrder = 3
|
||||||
|
end
|
||||||
|
inherited tmClose: TTimer[5]
|
||||||
|
Left = 152
|
||||||
|
Top = 112
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -21,7 +21,7 @@
|
|||||||
* CDDL HEADER END
|
* CDDL HEADER END
|
||||||
*
|
*
|
||||||
*
|
*
|
||||||
* Portions Copyright 2009 Andreas Schneider
|
* Portions Copyright 2011 Andreas Schneider
|
||||||
*)
|
*)
|
||||||
unit UfrmHueSettings;
|
unit UfrmHueSettings;
|
||||||
|
|
||||||
@@ -31,21 +31,51 @@ interface
|
|||||||
|
|
||||||
uses
|
uses
|
||||||
Classes, SysUtils, LResources, Forms, Controls, Graphics, Dialogs, StdCtrls,
|
Classes, SysUtils, LResources, Forms, Controls, Graphics, Dialogs, StdCtrls,
|
||||||
UfrmToolWindow, UHue;
|
ExtCtrls, Buttons, UfrmToolWindow, UHue,
|
||||||
|
XMLRead, XMLWrite, DOM;
|
||||||
|
|
||||||
type
|
type
|
||||||
|
|
||||||
{ TfrmHueSettings }
|
{ TfrmHueSettings }
|
||||||
|
|
||||||
TfrmHueSettings = class(TfrmToolWindow)
|
TfrmHueSettings = class(TfrmToolWindow)
|
||||||
|
btnAddRandom: TSpeedButton;
|
||||||
|
btnClearRandom: TSpeedButton;
|
||||||
|
btnDeleteRandom: TSpeedButton;
|
||||||
|
btnRandomPresetDelete: TSpeedButton;
|
||||||
|
btnRandomPresetSave: TSpeedButton;
|
||||||
|
cbRandomPreset: TComboBox;
|
||||||
|
cbRandom: TCheckBox;
|
||||||
edHue: TEdit;
|
edHue: TEdit;
|
||||||
|
gbRandom: TGroupBox;
|
||||||
lblHue: TLabel;
|
lblHue: TLabel;
|
||||||
lbHue: TListBox;
|
lbHue: TListBox;
|
||||||
|
lbRandom: TListBox;
|
||||||
|
procedure btnAddRandomClick(Sender: TObject);
|
||||||
|
procedure btnClearRandomClick(Sender: TObject);
|
||||||
|
procedure btnDeleteRandomClick(Sender: TObject);
|
||||||
|
procedure btnRandomPresetDeleteClick(Sender: TObject);
|
||||||
|
procedure btnRandomPresetSaveClick(Sender: TObject);
|
||||||
|
procedure cbRandomChange(Sender: TObject);
|
||||||
|
procedure cbRandomPresetChange(Sender: TObject);
|
||||||
procedure edHueEditingDone(Sender: TObject);
|
procedure edHueEditingDone(Sender: TObject);
|
||||||
procedure FormCreate(Sender: TObject);
|
procedure FormCreate(Sender: TObject);
|
||||||
|
procedure FormDestroy(Sender: TObject);
|
||||||
procedure lbHueDrawItem(Control: TWinControl; Index: Integer; ARect: TRect;
|
procedure lbHueDrawItem(Control: TWinControl; Index: Integer; ARect: TRect;
|
||||||
State: TOwnerDrawState);
|
State: TOwnerDrawState);
|
||||||
procedure lbHueSelectionChange(Sender: TObject; User: boolean);
|
procedure lbHueSelectionChange(Sender: TObject; User: boolean);
|
||||||
|
procedure lbRandomDragDrop(Sender, Source: TObject; X, Y: Integer);
|
||||||
|
procedure lbRandomDragOver(Sender, Source: TObject; X, Y: Integer;
|
||||||
|
State: TDragState; var Accept: Boolean);
|
||||||
|
private
|
||||||
|
FConfigDir: String;
|
||||||
|
FRandomHuePresetsFile: String;
|
||||||
|
FRandomHuePresetsDoc: TXMLDocument;
|
||||||
|
function FindRandomPreset(AName: String): TDOMElement;
|
||||||
|
procedure LoadRandomPresets;
|
||||||
|
procedure SaveRandomPresets;
|
||||||
|
public
|
||||||
|
function GetHue: Word;
|
||||||
public
|
public
|
||||||
class procedure DrawHue(AHue: THue; ACanvas: TCanvas; ARect: TRect;
|
class procedure DrawHue(AHue: THue; ACanvas: TCanvas; ARect: TRect;
|
||||||
ACaption: string);
|
ACaption: string);
|
||||||
@@ -73,6 +103,112 @@ begin
|
|||||||
lbHue.ItemIndex := hueID;
|
lbHue.ItemIndex := hueID;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
procedure TfrmHueSettings.btnDeleteRandomClick(Sender: TObject);
|
||||||
|
var
|
||||||
|
i: Integer;
|
||||||
|
begin
|
||||||
|
lbRandom.Items.BeginUpdate;
|
||||||
|
for i := lbRandom.Items.Count - 1 downto 0 do
|
||||||
|
if lbRandom.Selected[i] then
|
||||||
|
lbRandom.Items.Delete(i);
|
||||||
|
lbRandom.Items.EndUpdate;
|
||||||
|
end;
|
||||||
|
|
||||||
|
procedure TfrmHueSettings.btnRandomPresetDeleteClick(Sender: TObject);
|
||||||
|
var
|
||||||
|
preset: TDOMElement;
|
||||||
|
begin
|
||||||
|
if cbRandomPreset.ItemIndex > -1 then
|
||||||
|
begin
|
||||||
|
preset := TDOMElement(cbRandomPreset.Items.Objects[cbRandomPreset.ItemIndex]);
|
||||||
|
FRandomHuePresetsDoc.DocumentElement.RemoveChild(preset);
|
||||||
|
cbRandomPreset.Items.Delete(cbRandomPreset.ItemIndex);
|
||||||
|
cbRandomPreset.ItemIndex := -1;
|
||||||
|
end;
|
||||||
|
end;
|
||||||
|
|
||||||
|
procedure TfrmHueSettings.btnRandomPresetSaveClick(Sender: TObject);
|
||||||
|
var
|
||||||
|
presetName: string;
|
||||||
|
i: Integer;
|
||||||
|
preset, hue: TDOMElement;
|
||||||
|
children: TDOMNodeList;
|
||||||
|
begin
|
||||||
|
presetName := cbRandomPreset.Text;
|
||||||
|
if InputQuery('Save Preset', 'Enter the name of the preset:', presetName) then
|
||||||
|
begin
|
||||||
|
preset := FindRandomPreset(presetName);
|
||||||
|
if preset = nil then
|
||||||
|
begin
|
||||||
|
preset := FRandomHuePresetsDoc.CreateElement('Preset');
|
||||||
|
preset.AttribStrings['Name'] := presetName;
|
||||||
|
FRandomHuePresetsDoc.DocumentElement.AppendChild(preset);
|
||||||
|
cbRandomPreset.Items.AddObject(presetName, preset);
|
||||||
|
end else
|
||||||
|
begin
|
||||||
|
children := preset.GetChildNodes;
|
||||||
|
for i := children.Count - 1 downto 0 do
|
||||||
|
preset.RemoveChild(children[i]);
|
||||||
|
end;
|
||||||
|
|
||||||
|
for i := 0 to lbRandom.Items.Count - 1 do
|
||||||
|
begin
|
||||||
|
hue := FRandomHuePresetsDoc.CreateElement('Hue');
|
||||||
|
hue.AttribStrings['ID'] := IntToStr(PtrInt(lbRandom.Items.Objects[i]));
|
||||||
|
preset.AppendChild(hue);
|
||||||
|
end;
|
||||||
|
|
||||||
|
cbRandomPreset.ItemIndex := cbRandomPreset.Items.IndexOfObject(preset);
|
||||||
|
|
||||||
|
SaveRandomPresets;
|
||||||
|
end;
|
||||||
|
end;
|
||||||
|
|
||||||
|
procedure TfrmHueSettings.cbRandomChange(Sender: TObject);
|
||||||
|
begin
|
||||||
|
lbHue.MultiSelect := cbRandom.Checked;
|
||||||
|
gbRandom.Visible := cbRandom.Checked;
|
||||||
|
end;
|
||||||
|
|
||||||
|
procedure TfrmHueSettings.cbRandomPresetChange(Sender: TObject);
|
||||||
|
var
|
||||||
|
preset, hue: TDOMElement;
|
||||||
|
id: PtrInt;
|
||||||
|
begin
|
||||||
|
lbRandom.Clear;
|
||||||
|
if cbRandomPreset.ItemIndex > -1 then
|
||||||
|
begin
|
||||||
|
preset := TDOMElement(cbRandomPreset.Items.Objects[cbRandomPreset.ItemIndex]);
|
||||||
|
hue := TDOMElement(preset.FirstChild);
|
||||||
|
|
||||||
|
while hue <> nil do
|
||||||
|
begin
|
||||||
|
if hue.NodeName = 'Hue' then
|
||||||
|
begin
|
||||||
|
id := StrToInt(hue.AttribStrings['ID']);
|
||||||
|
lbRandom.Items.AddObject(lbHue.Items.Strings[id], TObject(id));
|
||||||
|
end;
|
||||||
|
hue := TDOMElement(hue.NextSibling);
|
||||||
|
end;
|
||||||
|
end;
|
||||||
|
end;
|
||||||
|
|
||||||
|
procedure TfrmHueSettings.btnClearRandomClick(Sender: TObject);
|
||||||
|
begin
|
||||||
|
lbRandom.Items.Clear;
|
||||||
|
end;
|
||||||
|
|
||||||
|
procedure TfrmHueSettings.btnAddRandomClick(Sender: TObject);
|
||||||
|
var
|
||||||
|
i: PtrInt;
|
||||||
|
begin
|
||||||
|
lbRandom.Items.BeginUpdate;
|
||||||
|
for i := 0 to lbHue.Count - 1 do
|
||||||
|
if lbHue.Selected[i] then
|
||||||
|
lbRandom.Items.AddObject(lbHue.Items.Strings[i], TObject(i));
|
||||||
|
lbRandom.Items.EndUpdate;
|
||||||
|
end;
|
||||||
|
|
||||||
procedure TfrmHueSettings.FormCreate(Sender: TObject);
|
procedure TfrmHueSettings.FormCreate(Sender: TObject);
|
||||||
var
|
var
|
||||||
i: Integer;
|
i: Integer;
|
||||||
@@ -86,6 +222,17 @@ begin
|
|||||||
lbHue.Items.AddObject(Format('$%x (%s)', [i, hue.Name]), hue);
|
lbHue.Items.AddObject(Format('$%x (%s)', [i, hue.Name]), hue);
|
||||||
end;
|
end;
|
||||||
lbHue.ItemIndex := 0;
|
lbHue.ItemIndex := 0;
|
||||||
|
|
||||||
|
FConfigDir := GetAppConfigDir(False);
|
||||||
|
ForceDirectories(FConfigDir);
|
||||||
|
FRandomHuePresetsFile := FConfigDir + 'RandomHuePresets.xml';
|
||||||
|
|
||||||
|
LoadRandomPresets;
|
||||||
|
end;
|
||||||
|
|
||||||
|
procedure TfrmHueSettings.FormDestroy(Sender: TObject);
|
||||||
|
begin
|
||||||
|
FreeAndNil(FRandomHuePresetsDoc);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
procedure TfrmHueSettings.lbHueDrawItem(Control: TWinControl; Index: Integer;
|
procedure TfrmHueSettings.lbHueDrawItem(Control: TWinControl; Index: Integer;
|
||||||
@@ -97,7 +244,7 @@ begin
|
|||||||
hue := ResMan.Hue.Hues[Index-1]
|
hue := ResMan.Hue.Hues[Index-1]
|
||||||
else
|
else
|
||||||
hue := nil;
|
hue := nil;
|
||||||
DrawHue(hue, lbHue.Canvas, ARect, lbHue.Items.Strings[Index]);
|
DrawHue(hue, TListBox(Control).Canvas, ARect, TListBox(Control).Items.Strings[Index]);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
procedure TfrmHueSettings.lbHueSelectionChange(Sender: TObject; User: boolean);
|
procedure TfrmHueSettings.lbHueSelectionChange(Sender: TObject; User: boolean);
|
||||||
@@ -105,6 +252,67 @@ begin
|
|||||||
edHue.Text := Format('$%x', [lbHue.ItemIndex]);
|
edHue.Text := Format('$%x', [lbHue.ItemIndex]);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
procedure TfrmHueSettings.lbRandomDragDrop(Sender, Source: TObject; X,
|
||||||
|
Y: Integer);
|
||||||
|
begin
|
||||||
|
if Source = lbHue then
|
||||||
|
btnAddRandomClick(Sender);
|
||||||
|
end;
|
||||||
|
|
||||||
|
procedure TfrmHueSettings.lbRandomDragOver(Sender, Source: TObject; X,
|
||||||
|
Y: Integer; State: TDragState; var Accept: Boolean);
|
||||||
|
begin
|
||||||
|
if Source = lbHue then Accept := True;
|
||||||
|
end;
|
||||||
|
|
||||||
|
function TfrmHueSettings.FindRandomPreset(AName: String): TDOMElement;
|
||||||
|
begin
|
||||||
|
Result := TDOMElement(FRandomHuePresetsDoc.DocumentElement.FirstChild);
|
||||||
|
while Result <> nil do
|
||||||
|
begin
|
||||||
|
if SameText(Result.AttribStrings['Name'], AName) then
|
||||||
|
Break;
|
||||||
|
|
||||||
|
Result := TDOMElement(Result.NextSibling);
|
||||||
|
end;
|
||||||
|
end;
|
||||||
|
|
||||||
|
procedure TfrmHueSettings.LoadRandomPresets;
|
||||||
|
var
|
||||||
|
presetElement, hueElement: TDOMElement;
|
||||||
|
begin
|
||||||
|
FreeAndNil(FRandomHuePresetsDoc);
|
||||||
|
cbRandomPreset.Items.Clear;
|
||||||
|
if FileExists(FRandomHuePresetsFile) then
|
||||||
|
begin
|
||||||
|
ReadXMLFile(FRandomHuePresetsDoc, FRandomHuePresetsFile);
|
||||||
|
presetElement := TDOMElement(FRandomHuePresetsDoc.DocumentElement.FirstChild);
|
||||||
|
while presetElement <> nil do
|
||||||
|
begin
|
||||||
|
if presetElement.NodeName = 'Preset' then
|
||||||
|
cbRandomPreset.Items.AddObject(presetElement.AttribStrings['Name'], presetElement);
|
||||||
|
presetElement := TDOMElement(presetElement.NextSibling);
|
||||||
|
end;
|
||||||
|
end else
|
||||||
|
begin
|
||||||
|
FRandomHuePresetsDoc := TXMLDocument.Create;
|
||||||
|
FRandomHuePresetsDoc.AppendChild(FRandomHuePresetsDoc.CreateElement('RandomHuePresets'));
|
||||||
|
end;
|
||||||
|
end;
|
||||||
|
|
||||||
|
procedure TfrmHueSettings.SaveRandomPresets;
|
||||||
|
begin
|
||||||
|
WriteXMLFile(FRandomHuePresetsDoc, FRandomHuePresetsFile);
|
||||||
|
end;
|
||||||
|
|
||||||
|
function TfrmHueSettings.GetHue: Word;
|
||||||
|
begin
|
||||||
|
if cbRandom.Checked and (lbRandom.Items.Count > 0) then
|
||||||
|
Result := PtrInt(lbRandom.Items.Objects[Random(lbRandom.Items.Count)])
|
||||||
|
else
|
||||||
|
Result := lbHue.ItemIndex;
|
||||||
|
end;
|
||||||
|
|
||||||
class procedure TfrmHueSettings.DrawHue(AHue: THue; ACanvas: TCanvas; ARect: TRect;
|
class procedure TfrmHueSettings.DrawHue(AHue: THue; ACanvas: TCanvas; ARect: TRect;
|
||||||
ACaption: string);
|
ACaption: string);
|
||||||
var
|
var
|
||||||
@@ -121,7 +329,7 @@ begin
|
|||||||
ACanvas.MoveTo(ARect.Left + 2 + i, ARect.Top + 1);
|
ACanvas.MoveTo(ARect.Left + 2 + i, ARect.Top + 1);
|
||||||
ACanvas.LineTo(ARect.Left + 2 + i, ARect.Bottom - 1);
|
ACanvas.LineTo(ARect.Left + 2 + i, ARect.Bottom - 1);
|
||||||
end;
|
end;
|
||||||
ACanvas.TextOut(ARect.Left + 36, ARect.Top, ACaption);
|
ACanvas.TextOut(ARect.Left + 36, ARect.Top + 1, ACaption);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
initialization
|
initialization
|
||||||
|
|||||||
@@ -1,21 +1,21 @@
|
|||||||
inherited frmMoveSettings: TfrmMoveSettings
|
inherited frmMoveSettings: TfrmMoveSettings
|
||||||
Left = 290
|
Left = 290
|
||||||
Height = 120
|
Height = 104
|
||||||
Top = 171
|
Top = 171
|
||||||
Width = 232
|
Width = 258
|
||||||
ActiveControl = cbAsk
|
ActiveControl = cbAsk
|
||||||
AutoSize = True
|
AutoSize = True
|
||||||
Caption = 'Move settings'
|
Caption = 'Move settings'
|
||||||
ClientHeight = 120
|
ClientHeight = 104
|
||||||
ClientWidth = 232
|
ClientWidth = 258
|
||||||
object cbAsk: TCheckBox[0]
|
object cbAsk: TCheckBox[0]
|
||||||
AnchorSideLeft.Control = gbDirection
|
AnchorSideLeft.Control = gbDirection
|
||||||
AnchorSideLeft.Side = asrBottom
|
AnchorSideLeft.Side = asrBottom
|
||||||
AnchorSideTop.Control = gbDirection
|
AnchorSideTop.Control = gbDirection
|
||||||
Left = 121
|
Left = 119
|
||||||
Height = 19
|
Height = 25
|
||||||
Top = 20
|
Top = 20
|
||||||
Width = 94
|
Width = 131
|
||||||
BorderSpacing.Left = 8
|
BorderSpacing.Left = 8
|
||||||
BorderSpacing.Top = 16
|
BorderSpacing.Top = 16
|
||||||
BorderSpacing.Right = 8
|
BorderSpacing.Right = 8
|
||||||
@@ -28,9 +28,9 @@ inherited frmMoveSettings: TfrmMoveSettings
|
|||||||
AnchorSideLeft.Control = Owner
|
AnchorSideLeft.Control = Owner
|
||||||
AnchorSideTop.Control = Owner
|
AnchorSideTop.Control = Owner
|
||||||
Left = 8
|
Left = 8
|
||||||
Height = 108
|
Height = 92
|
||||||
Top = 4
|
Top = 4
|
||||||
Width = 105
|
Width = 103
|
||||||
AutoSize = True
|
AutoSize = True
|
||||||
BorderSpacing.Left = 4
|
BorderSpacing.Left = 4
|
||||||
BorderSpacing.Bottom = 4
|
BorderSpacing.Bottom = 4
|
||||||
@@ -46,7 +46,6 @@ inherited frmMoveSettings: TfrmMoveSettings
|
|||||||
Top = 0
|
Top = 0
|
||||||
Width = 23
|
Width = 23
|
||||||
BorderSpacing.Left = 8
|
BorderSpacing.Left = 8
|
||||||
Color = clBtnFace
|
|
||||||
Down = True
|
Down = True
|
||||||
Glyph.Data = {
|
Glyph.Data = {
|
||||||
36040000424D3604000000000000360000002800000010000000100000000100
|
36040000424D3604000000000000360000002800000010000000100000000100
|
||||||
@@ -85,7 +84,6 @@ inherited frmMoveSettings: TfrmMoveSettings
|
|||||||
0000000000000000000000000000000000000000000000000000
|
0000000000000000000000000000000000000000000000000000
|
||||||
}
|
}
|
||||||
GroupIndex = 1
|
GroupIndex = 1
|
||||||
NumGlyphs = 0
|
|
||||||
OnClick = btnTopLeftClick
|
OnClick = btnTopLeftClick
|
||||||
end
|
end
|
||||||
object btnTop: TSpeedButton
|
object btnTop: TSpeedButton
|
||||||
@@ -97,7 +95,6 @@ inherited frmMoveSettings: TfrmMoveSettings
|
|||||||
Top = 0
|
Top = 0
|
||||||
Width = 23
|
Width = 23
|
||||||
BorderSpacing.Left = 8
|
BorderSpacing.Left = 8
|
||||||
Color = clBtnFace
|
|
||||||
Glyph.Data = {
|
Glyph.Data = {
|
||||||
36040000424D3604000000000000360000002800000010000000100000000100
|
36040000424D3604000000000000360000002800000010000000100000000100
|
||||||
2000000000000004000064000000640000000000000000000000000000000000
|
2000000000000004000064000000640000000000000000000000000000000000
|
||||||
@@ -135,7 +132,6 @@ inherited frmMoveSettings: TfrmMoveSettings
|
|||||||
0000000000000000000000000000000000000000000000000000
|
0000000000000000000000000000000000000000000000000000
|
||||||
}
|
}
|
||||||
GroupIndex = 1
|
GroupIndex = 1
|
||||||
NumGlyphs = 0
|
|
||||||
OnClick = btnTopLeftClick
|
OnClick = btnTopLeftClick
|
||||||
end
|
end
|
||||||
object btnTopRight: TSpeedButton
|
object btnTopRight: TSpeedButton
|
||||||
@@ -147,7 +143,6 @@ inherited frmMoveSettings: TfrmMoveSettings
|
|||||||
Top = 0
|
Top = 0
|
||||||
Width = 23
|
Width = 23
|
||||||
BorderSpacing.Left = 8
|
BorderSpacing.Left = 8
|
||||||
Color = clBtnFace
|
|
||||||
Glyph.Data = {
|
Glyph.Data = {
|
||||||
36040000424D3604000000000000360000002800000010000000100000000100
|
36040000424D3604000000000000360000002800000010000000100000000100
|
||||||
2000000000000004000064000000640000000000000000000000000000000000
|
2000000000000004000064000000640000000000000000000000000000000000
|
||||||
@@ -185,7 +180,6 @@ inherited frmMoveSettings: TfrmMoveSettings
|
|||||||
0000000000000000000000000000000000000000000000000000
|
0000000000000000000000000000000000000000000000000000
|
||||||
}
|
}
|
||||||
GroupIndex = 1
|
GroupIndex = 1
|
||||||
NumGlyphs = 0
|
|
||||||
OnClick = btnTopLeftClick
|
OnClick = btnTopLeftClick
|
||||||
end
|
end
|
||||||
object btnRight: TSpeedButton
|
object btnRight: TSpeedButton
|
||||||
@@ -198,7 +192,6 @@ inherited frmMoveSettings: TfrmMoveSettings
|
|||||||
Width = 23
|
Width = 23
|
||||||
BorderSpacing.Top = 8
|
BorderSpacing.Top = 8
|
||||||
BorderSpacing.Right = 8
|
BorderSpacing.Right = 8
|
||||||
Color = clBtnFace
|
|
||||||
Glyph.Data = {
|
Glyph.Data = {
|
||||||
36040000424D3604000000000000360000002800000010000000100000000100
|
36040000424D3604000000000000360000002800000010000000100000000100
|
||||||
2000000000000004000064000000640000000000000000000000000000000000
|
2000000000000004000064000000640000000000000000000000000000000000
|
||||||
@@ -236,7 +229,6 @@ inherited frmMoveSettings: TfrmMoveSettings
|
|||||||
0000000000000000000000000000000000000000000000000000
|
0000000000000000000000000000000000000000000000000000
|
||||||
}
|
}
|
||||||
GroupIndex = 1
|
GroupIndex = 1
|
||||||
NumGlyphs = 0
|
|
||||||
OnClick = btnTopLeftClick
|
OnClick = btnTopLeftClick
|
||||||
end
|
end
|
||||||
object btnBottomRight: TSpeedButton
|
object btnBottomRight: TSpeedButton
|
||||||
@@ -248,7 +240,6 @@ inherited frmMoveSettings: TfrmMoveSettings
|
|||||||
Top = 60
|
Top = 60
|
||||||
Width = 23
|
Width = 23
|
||||||
BorderSpacing.Top = 8
|
BorderSpacing.Top = 8
|
||||||
Color = clBtnFace
|
|
||||||
Glyph.Data = {
|
Glyph.Data = {
|
||||||
36040000424D3604000000000000360000002800000010000000100000000100
|
36040000424D3604000000000000360000002800000010000000100000000100
|
||||||
2000000000000004000064000000640000000000000000000000000000000000
|
2000000000000004000064000000640000000000000000000000000000000000
|
||||||
@@ -286,7 +277,6 @@ inherited frmMoveSettings: TfrmMoveSettings
|
|||||||
0000000000000000000000000000000000000000000000000000
|
0000000000000000000000000000000000000000000000000000
|
||||||
}
|
}
|
||||||
GroupIndex = 1
|
GroupIndex = 1
|
||||||
NumGlyphs = 0
|
|
||||||
OnClick = btnTopLeftClick
|
OnClick = btnTopLeftClick
|
||||||
end
|
end
|
||||||
object btnBottom: TSpeedButton
|
object btnBottom: TSpeedButton
|
||||||
@@ -299,7 +289,6 @@ inherited frmMoveSettings: TfrmMoveSettings
|
|||||||
Width = 23
|
Width = 23
|
||||||
BorderSpacing.Left = 8
|
BorderSpacing.Left = 8
|
||||||
BorderSpacing.Bottom = 8
|
BorderSpacing.Bottom = 8
|
||||||
Color = clBtnFace
|
|
||||||
Glyph.Data = {
|
Glyph.Data = {
|
||||||
36040000424D3604000000000000360000002800000010000000100000000100
|
36040000424D3604000000000000360000002800000010000000100000000100
|
||||||
2000000000000004000064000000640000000000000000000000000000000000
|
2000000000000004000064000000640000000000000000000000000000000000
|
||||||
@@ -337,7 +326,6 @@ inherited frmMoveSettings: TfrmMoveSettings
|
|||||||
0000000000000000000000000000000000000000000000000000
|
0000000000000000000000000000000000000000000000000000
|
||||||
}
|
}
|
||||||
GroupIndex = 1
|
GroupIndex = 1
|
||||||
NumGlyphs = 0
|
|
||||||
OnClick = btnTopLeftClick
|
OnClick = btnTopLeftClick
|
||||||
end
|
end
|
||||||
object btnBottomLeft: TSpeedButton
|
object btnBottomLeft: TSpeedButton
|
||||||
@@ -349,7 +337,6 @@ inherited frmMoveSettings: TfrmMoveSettings
|
|||||||
Top = 60
|
Top = 60
|
||||||
Width = 23
|
Width = 23
|
||||||
BorderSpacing.Top = 8
|
BorderSpacing.Top = 8
|
||||||
Color = clBtnFace
|
|
||||||
Glyph.Data = {
|
Glyph.Data = {
|
||||||
36040000424D3604000000000000360000002800000010000000100000000100
|
36040000424D3604000000000000360000002800000010000000100000000100
|
||||||
2000000000000004000064000000640000000000000000000000000000000000
|
2000000000000004000064000000640000000000000000000000000000000000
|
||||||
@@ -387,7 +374,6 @@ inherited frmMoveSettings: TfrmMoveSettings
|
|||||||
0000000000000000000000000000000000000000000000000000
|
0000000000000000000000000000000000000000000000000000
|
||||||
}
|
}
|
||||||
GroupIndex = 1
|
GroupIndex = 1
|
||||||
NumGlyphs = 0
|
|
||||||
OnClick = btnTopLeftClick
|
OnClick = btnTopLeftClick
|
||||||
end
|
end
|
||||||
object btnLeft: TSpeedButton
|
object btnLeft: TSpeedButton
|
||||||
@@ -399,7 +385,6 @@ inherited frmMoveSettings: TfrmMoveSettings
|
|||||||
Top = 30
|
Top = 30
|
||||||
Width = 23
|
Width = 23
|
||||||
BorderSpacing.Top = 8
|
BorderSpacing.Top = 8
|
||||||
Color = clBtnFace
|
|
||||||
Glyph.Data = {
|
Glyph.Data = {
|
||||||
36040000424D3604000000000000360000002800000010000000100000000100
|
36040000424D3604000000000000360000002800000010000000100000000100
|
||||||
2000000000000004000064000000640000000000000000000000000000000000
|
2000000000000004000064000000640000000000000000000000000000000000
|
||||||
@@ -437,7 +422,6 @@ inherited frmMoveSettings: TfrmMoveSettings
|
|||||||
0000000000000000000000000000000000000000000000000000
|
0000000000000000000000000000000000000000000000000000
|
||||||
}
|
}
|
||||||
GroupIndex = 1
|
GroupIndex = 1
|
||||||
NumGlyphs = 0
|
|
||||||
OnClick = btnTopLeftClick
|
OnClick = btnTopLeftClick
|
||||||
end
|
end
|
||||||
object seOffset: TSpinEdit
|
object seOffset: TSpinEdit
|
||||||
@@ -446,7 +430,7 @@ inherited frmMoveSettings: TfrmMoveSettings
|
|||||||
AnchorSideTop.Control = btnTop
|
AnchorSideTop.Control = btnTop
|
||||||
AnchorSideTop.Side = asrBottom
|
AnchorSideTop.Side = asrBottom
|
||||||
Left = 33
|
Left = 33
|
||||||
Height = 25
|
Height = 33
|
||||||
Hint = 'Offset'
|
Hint = 'Offset'
|
||||||
Top = 30
|
Top = 30
|
||||||
Width = 34
|
Width = 34
|
||||||
@@ -464,9 +448,9 @@ inherited frmMoveSettings: TfrmMoveSettings
|
|||||||
AnchorSideLeft.Side = asrBottom
|
AnchorSideLeft.Side = asrBottom
|
||||||
AnchorSideBottom.Control = gbDirection
|
AnchorSideBottom.Control = gbDirection
|
||||||
AnchorSideBottom.Side = asrBottom
|
AnchorSideBottom.Side = asrBottom
|
||||||
Left = 121
|
Left = 119
|
||||||
Height = 25
|
Height = 25
|
||||||
Top = 83
|
Top = 67
|
||||||
Width = 103
|
Width = 103
|
||||||
Anchors = [akLeft, akBottom]
|
Anchors = [akLeft, akBottom]
|
||||||
BorderSpacing.Left = 8
|
BorderSpacing.Left = 8
|
||||||
@@ -478,4 +462,6 @@ inherited frmMoveSettings: TfrmMoveSettings
|
|||||||
ModalResult = 2
|
ModalResult = 2
|
||||||
TabOrder = 2
|
TabOrder = 2
|
||||||
end
|
end
|
||||||
|
inherited tmClose: TTimer[3]
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -1,8 +1,8 @@
|
|||||||
object frmToolWindow: TfrmToolWindow
|
object frmToolWindow: TfrmToolWindow
|
||||||
Left = 282
|
Left = 282
|
||||||
Height = 300
|
Height = 375
|
||||||
Top = 157
|
Top = 157
|
||||||
Width = 400
|
Width = 500
|
||||||
BorderIcons = []
|
BorderIcons = []
|
||||||
BorderStyle = bsToolWindow
|
BorderStyle = bsToolWindow
|
||||||
Caption = 'ToolWindow'
|
Caption = 'ToolWindow'
|
||||||
@@ -11,11 +11,10 @@ object frmToolWindow: TfrmToolWindow
|
|||||||
OnDeactivate = FormDeactivate
|
OnDeactivate = FormDeactivate
|
||||||
OnShow = FormShow
|
OnShow = FormShow
|
||||||
ShowInTaskBar = stNever
|
ShowInTaskBar = stNever
|
||||||
LCLVersion = '0.9.29'
|
|
||||||
object tmClose: TTimer
|
object tmClose: TTimer
|
||||||
Enabled = False
|
Enabled = False
|
||||||
OnTimer = tmCloseTimer
|
OnTimer = tmCloseTimer
|
||||||
left = 8
|
Left = 10
|
||||||
top = 8
|
Top = 10
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -2,11 +2,11 @@ inherited frmVirtualLayer: TfrmVirtualLayer
|
|||||||
Left = 290
|
Left = 290
|
||||||
Height = 82
|
Height = 82
|
||||||
Top = 171
|
Top = 171
|
||||||
Width = 210
|
Width = 231
|
||||||
ActiveControl = cbShowLayer
|
ActiveControl = cbShowLayer
|
||||||
Caption = 'Virtual Layer'
|
Caption = 'Virtual Layer'
|
||||||
ClientHeight = 82
|
ClientHeight = 82
|
||||||
ClientWidth = 210
|
ClientWidth = 231
|
||||||
object tbZ: TTrackBar[0]
|
object tbZ: TTrackBar[0]
|
||||||
AnchorSideLeft.Control = Owner
|
AnchorSideLeft.Control = Owner
|
||||||
AnchorSideTop.Control = seZ
|
AnchorSideTop.Control = seZ
|
||||||
@@ -14,9 +14,9 @@ inherited frmVirtualLayer: TfrmVirtualLayer
|
|||||||
AnchorSideRight.Control = Owner
|
AnchorSideRight.Control = Owner
|
||||||
AnchorSideRight.Side = asrBottom
|
AnchorSideRight.Side = asrBottom
|
||||||
Left = 8
|
Left = 8
|
||||||
Height = 36
|
Height = 47
|
||||||
Top = 37
|
Top = 49
|
||||||
Width = 194
|
Width = 215
|
||||||
Frequency = 10
|
Frequency = 10
|
||||||
Max = 127
|
Max = 127
|
||||||
Min = -128
|
Min = -128
|
||||||
@@ -32,9 +32,9 @@ inherited frmVirtualLayer: TfrmVirtualLayer
|
|||||||
AnchorSideTop.Control = seZ
|
AnchorSideTop.Control = seZ
|
||||||
AnchorSideTop.Side = asrCenter
|
AnchorSideTop.Side = asrCenter
|
||||||
Left = 8
|
Left = 8
|
||||||
Height = 22
|
Height = 25
|
||||||
Top = 7
|
Top = 12
|
||||||
Width = 126
|
Width = 150
|
||||||
BorderSpacing.Left = 8
|
BorderSpacing.Left = 8
|
||||||
Caption = 'Show Layer at Z:'
|
Caption = 'Show Layer at Z:'
|
||||||
OnChange = cbShowLayerChange
|
OnChange = cbShowLayerChange
|
||||||
@@ -44,8 +44,8 @@ inherited frmVirtualLayer: TfrmVirtualLayer
|
|||||||
AnchorSideTop.Control = Owner
|
AnchorSideTop.Control = Owner
|
||||||
AnchorSideRight.Control = Owner
|
AnchorSideRight.Control = Owner
|
||||||
AnchorSideRight.Side = asrBottom
|
AnchorSideRight.Side = asrBottom
|
||||||
Left = 152
|
Left = 173
|
||||||
Height = 21
|
Height = 33
|
||||||
Top = 8
|
Top = 8
|
||||||
Width = 50
|
Width = 50
|
||||||
Anchors = [akTop, akRight]
|
Anchors = [akTop, akRight]
|
||||||
@@ -56,4 +56,6 @@ inherited frmVirtualLayer: TfrmVirtualLayer
|
|||||||
OnChange = seZChange
|
OnChange = seZChange
|
||||||
TabOrder = 2
|
TabOrder = 2
|
||||||
end
|
end
|
||||||
|
inherited tmClose: TTimer[3]
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -0,0 +1,466 @@
|
|||||||
|
(*
|
||||||
|
* CDDL HEADER START
|
||||||
|
*
|
||||||
|
* The contents of this file are subject to the terms of the
|
||||||
|
* Common Development and Distribution License, Version 1.0 only
|
||||||
|
* (the "License"). You may not use this file except in compliance
|
||||||
|
* with the License.
|
||||||
|
*
|
||||||
|
* You can obtain a copy of the license at
|
||||||
|
* http://www.opensource.org/licenses/cddl1.php.
|
||||||
|
* See the License for the specific language governing permissions
|
||||||
|
* and limitations under the License.
|
||||||
|
*
|
||||||
|
* When distributing Covered Code, include this CDDL HEADER in each
|
||||||
|
* file and include the License file at
|
||||||
|
* http://www.opensource.org/licenses/cddl1.php. If applicable,
|
||||||
|
* add the following below this CDDL HEADER, with the fields enclosed
|
||||||
|
* by brackets "[]" replaced with your own identifying * information:
|
||||||
|
* Portions Copyright [yyyy] [name of copyright owner]
|
||||||
|
*
|
||||||
|
* CDDL HEADER END
|
||||||
|
*
|
||||||
|
*
|
||||||
|
* Portions Copyright 2022 Andreas Schneider
|
||||||
|
*)
|
||||||
|
|
||||||
|
unit UActions;
|
||||||
|
|
||||||
|
{$mode ObjFPC}{$H+}
|
||||||
|
|
||||||
|
interface
|
||||||
|
|
||||||
|
uses
|
||||||
|
Classes, SysUtils, fgl, UWorldItem, UStatics, UMap, UPacket, ULandscape;
|
||||||
|
|
||||||
|
type
|
||||||
|
|
||||||
|
TPacketList = specialize TFPGObjectList<TPacket>;
|
||||||
|
TIdList = specialize TFPGList<Word>;
|
||||||
|
|
||||||
|
{ TBaseEditAction }
|
||||||
|
|
||||||
|
TBaseEditAction = class(TObject)
|
||||||
|
private
|
||||||
|
FLandscape: TLandscape;
|
||||||
|
FMapTiles: TMapCellList;
|
||||||
|
FStaticTiles: TStaticItemList;
|
||||||
|
public
|
||||||
|
constructor Create(ALandscape: TLandscape);
|
||||||
|
destructor Destroy; override;
|
||||||
|
public
|
||||||
|
property MapTiles: TMapCellList read FMapTiles;
|
||||||
|
property StaticTiles: TStaticItemList read FStaticTiles;
|
||||||
|
|
||||||
|
procedure StartSelection(ATile: TWorldItem); virtual; abstract;
|
||||||
|
procedure AddSelection(ATile: TWorldItem); virtual; abstract;
|
||||||
|
function IsHighlighted(ATile: TWorldItem): Boolean; virtual; abstract;
|
||||||
|
procedure Execute(AScreenBuffer: TScreenBuffer; out AForwardActions, AReverseActions: TPacketList); virtual;
|
||||||
|
end;
|
||||||
|
|
||||||
|
{ TRectangleEditAction }
|
||||||
|
|
||||||
|
TRectangleEditAction = class(TBaseEditAction)
|
||||||
|
private
|
||||||
|
FFirstTile: TWorldItem;
|
||||||
|
FLastTile: TWorldItem;
|
||||||
|
FRect: TRect;
|
||||||
|
public
|
||||||
|
constructor Create(ALandscape: TLandscape);
|
||||||
|
procedure StartSelection(ATile: TWorldItem); override;
|
||||||
|
procedure AddSelection(ATile: TWorldItem); override;
|
||||||
|
function IsHighlighted(ATile: TWorldItem): Boolean; override;
|
||||||
|
private
|
||||||
|
procedure UpdateArea; virtual;
|
||||||
|
function IsEditableTile(AWorldItem: TWorldItem): Boolean; inline;
|
||||||
|
function IsEditableStaticTile(AWorldItem: TWorldItem): Boolean; inline;
|
||||||
|
end;
|
||||||
|
|
||||||
|
{ TDrawAction }
|
||||||
|
|
||||||
|
TDrawAction = class(TRectangleEditAction)
|
||||||
|
private
|
||||||
|
FTileIds: TIdList;
|
||||||
|
FForceZ: Boolean;
|
||||||
|
FForceZValue: ShortInt;
|
||||||
|
FRandomZ: Boolean;
|
||||||
|
FRandomZValue: Byte;
|
||||||
|
FHue: Word;
|
||||||
|
public
|
||||||
|
property TileIds: TIdList read FTileIds;
|
||||||
|
property ForceZ: Boolean read FForceZ write FForceZ;
|
||||||
|
property ForceZValue: ShortInt read FForceZValue write FForceZValue;
|
||||||
|
property RandomZ: Boolean read FRandomZ write FRandomZ;
|
||||||
|
property RandomZValue: Byte read FRandomZValue write FRandomZValue;
|
||||||
|
property Hue: Word read FHue write FHue;
|
||||||
|
|
||||||
|
constructor Create(ALandscape: TLandscape);
|
||||||
|
|
||||||
|
function IsHighlighted(ATile: TWorldItem): Boolean; override;
|
||||||
|
procedure Execute(AScreenBuffer: TScreenBuffer; out AForwardActions,
|
||||||
|
AReverseActions: TPacketList); override;
|
||||||
|
private
|
||||||
|
procedure UpdateArea; override;
|
||||||
|
end;
|
||||||
|
|
||||||
|
{ TMoveAction }
|
||||||
|
|
||||||
|
TMoveAction = class(TRectangleEditAction)
|
||||||
|
private
|
||||||
|
FOffsetX: Integer;
|
||||||
|
FOffsetY: Integer;
|
||||||
|
public
|
||||||
|
property OffsetX: Integer read FOffsetX write FOffsetX;
|
||||||
|
property OffsetY: Integer read FOffsetY write FOffsetY;
|
||||||
|
|
||||||
|
procedure Execute(AScreenBuffer: TScreenBuffer; out AForwardActions,
|
||||||
|
AReverseActions: TPacketList); override;
|
||||||
|
end;
|
||||||
|
|
||||||
|
{ TElevateAction }
|
||||||
|
|
||||||
|
TElevateAction = class(TRectangleEditAction)
|
||||||
|
public type
|
||||||
|
TMode = (emSet, emRaise, emLower);
|
||||||
|
private
|
||||||
|
FMode: TMode;
|
||||||
|
FZ: ShortInt;
|
||||||
|
FRandomZ: Boolean;
|
||||||
|
FRandomZValue: Byte;
|
||||||
|
public
|
||||||
|
property Mode: TMode read FMode write FMode;
|
||||||
|
property Z: ShortInt read FZ write FZ;
|
||||||
|
|
||||||
|
procedure Execute(AScreenBuffer: TScreenBuffer; out AForwardActions,
|
||||||
|
AReverseActions: TPacketList); override;
|
||||||
|
end;
|
||||||
|
|
||||||
|
{ TDeleteAction }
|
||||||
|
|
||||||
|
TDeleteAction = class(TRectangleEditAction)
|
||||||
|
public
|
||||||
|
procedure Execute(AScreenBuffer: TScreenBuffer; out AForwardActions,
|
||||||
|
AReverseActions: TPacketList); override;
|
||||||
|
end;
|
||||||
|
|
||||||
|
{ THueAction }
|
||||||
|
|
||||||
|
THueAction = class(TRectangleEditAction)
|
||||||
|
private
|
||||||
|
FHue: Word;
|
||||||
|
public
|
||||||
|
property Hue: Word read FHue write FHue;
|
||||||
|
|
||||||
|
procedure Execute(AScreenBuffer: TScreenBuffer; out AForwardActions,
|
||||||
|
AReverseActions: TPacketList); override;
|
||||||
|
end;
|
||||||
|
|
||||||
|
implementation
|
||||||
|
|
||||||
|
uses
|
||||||
|
Math, UGameResources, UPackets;
|
||||||
|
|
||||||
|
{ TBaseEditAction }
|
||||||
|
|
||||||
|
constructor TBaseEditAction.Create(ALandscape: TLandscape);
|
||||||
|
begin
|
||||||
|
FLandscape := ALandscape;
|
||||||
|
FMapTiles := TMapCellList.Create;
|
||||||
|
FStaticTiles := TStaticItemList.Create;
|
||||||
|
end;
|
||||||
|
|
||||||
|
destructor TBaseEditAction.Destroy;
|
||||||
|
begin
|
||||||
|
FMapTiles.Free;
|
||||||
|
FStaticTiles.Free;
|
||||||
|
inherited Destroy;
|
||||||
|
end;
|
||||||
|
|
||||||
|
procedure TBaseEditAction.Execute(AScreenBuffer: TScreenBuffer; out
|
||||||
|
AForwardActions, AReverseActions: TPacketList);
|
||||||
|
begin
|
||||||
|
AForwardActions := TPacketList.Create;
|
||||||
|
AReverseActions := TPacketList.Create;
|
||||||
|
end;
|
||||||
|
|
||||||
|
{ TRectangleEditAction }
|
||||||
|
|
||||||
|
constructor TRectangleEditAction.Create(ALandscape: TLandscape);
|
||||||
|
begin
|
||||||
|
inherited Create(ALandscape);
|
||||||
|
FRect.Left := -1;
|
||||||
|
FRect.Top := -1;
|
||||||
|
FRect.Bottom := -1;
|
||||||
|
FRect.Right := -1;
|
||||||
|
end;
|
||||||
|
|
||||||
|
procedure TRectangleEditAction.StartSelection(ATile: TWorldItem);
|
||||||
|
begin
|
||||||
|
FFirstTile := ATile;
|
||||||
|
FLastTile := ATile;
|
||||||
|
UpdateArea;
|
||||||
|
end;
|
||||||
|
|
||||||
|
procedure TRectangleEditAction.AddSelection(ATile: TWorldItem);
|
||||||
|
begin
|
||||||
|
FLastTile := ATile;
|
||||||
|
UpdateArea;
|
||||||
|
end;
|
||||||
|
|
||||||
|
function TRectangleEditAction.IsHighlighted(ATile: TWorldItem): Boolean;
|
||||||
|
begin
|
||||||
|
Result := ((FFirstTile = FLastTile) and (FFirsttile = ATile)) or
|
||||||
|
FRect.Contains(TPoint.Create(ATile.X, ATile.Y));
|
||||||
|
end;
|
||||||
|
|
||||||
|
procedure TRectangleEditAction.UpdateArea;
|
||||||
|
begin
|
||||||
|
if FFirstTile = FLastTile then
|
||||||
|
begin
|
||||||
|
FRect.Left := -1;
|
||||||
|
FRect.Top := -1;
|
||||||
|
FRect.Bottom := -1;
|
||||||
|
FRect.Right := -1;
|
||||||
|
end else
|
||||||
|
begin
|
||||||
|
FRect.Left := Min(FFirstTile.X, FLastTile.X);
|
||||||
|
FRect.Top := Min(FFirstTile.Y, FLastTile.Y);
|
||||||
|
FRect.Right := Max(FFirstTile.X, FLastTile.X);
|
||||||
|
FRect.Bottom := Max(FFirstTile.Y, FLastTile.Y);
|
||||||
|
end;
|
||||||
|
end;
|
||||||
|
|
||||||
|
function TRectangleEditAction.IsEditableTile(AWorldItem: TWorldItem): Boolean;
|
||||||
|
begin
|
||||||
|
if not AWorldItem.CanBeEdited then
|
||||||
|
Exit(False);
|
||||||
|
|
||||||
|
if FFirstTile = FLastTile then
|
||||||
|
begin
|
||||||
|
if AWorldItem <> FFirstTile then
|
||||||
|
Exit(False);
|
||||||
|
end else
|
||||||
|
begin
|
||||||
|
if not FRect.Contains(TPoint.Create(AWorldItem.X, AWorldItem.Y)) then
|
||||||
|
Exit(False);
|
||||||
|
end;
|
||||||
|
|
||||||
|
Result := True;
|
||||||
|
end;
|
||||||
|
|
||||||
|
function TRectangleEditAction.IsEditableStaticTile(AWorldItem: TWorldItem): Boolean;
|
||||||
|
begin
|
||||||
|
if not IsEditableTile(AWorldItem) then
|
||||||
|
Exit(False);
|
||||||
|
|
||||||
|
if not (AWorldItem is TStaticItem) then
|
||||||
|
Exit(False);
|
||||||
|
|
||||||
|
Result := True;
|
||||||
|
end;
|
||||||
|
|
||||||
|
{ TDrawAction }
|
||||||
|
|
||||||
|
constructor TDrawAction.Create(ALandscape: TLandscape);
|
||||||
|
begin
|
||||||
|
inherited Create(ALandscape);
|
||||||
|
FTileIds := TIdList.Create;
|
||||||
|
end;
|
||||||
|
|
||||||
|
function TDrawAction.IsHighlighted(ATile: TWorldItem): Boolean;
|
||||||
|
begin
|
||||||
|
// Since we add new tiles, we don't need to highlight any existing
|
||||||
|
// tiles.
|
||||||
|
Result := False;
|
||||||
|
end;
|
||||||
|
|
||||||
|
procedure TDrawAction.Execute(AScreenBuffer: TScreenBuffer; out
|
||||||
|
AForwardActions, AReverseActions: TPacketList);
|
||||||
|
var
|
||||||
|
staticTile: TStaticItem;
|
||||||
|
mapTile, previousMapTile: TMapCell;
|
||||||
|
begin
|
||||||
|
inherited Execute(AScreenBuffer, AForwardActions, AReverseActions);
|
||||||
|
|
||||||
|
if FTileIds.Count < 1 then
|
||||||
|
Exit;
|
||||||
|
|
||||||
|
for mapTile in FMapTiles do
|
||||||
|
begin
|
||||||
|
previousMapTile := FLandscape.MapCell[mapTile.X, mapTile.Y];
|
||||||
|
AForwardActions.Add(TDrawMapPacket.Create(mapTile.X, mapTile.Y, mapTile.Z, mapTile.TileID));
|
||||||
|
AReverseActions.Add(TDrawMapPacket.Create(previousMapTile.X, previousMapTile.Y, previousMapTile.Z, previousMapTile.TileID));
|
||||||
|
end;
|
||||||
|
|
||||||
|
for staticTile in FStaticTiles do
|
||||||
|
begin
|
||||||
|
AForwardActions.Add(TInsertStaticPacket.Create(staticTile));
|
||||||
|
AReverseActions.Add(TDeleteStaticPacket.Create(staticTile));
|
||||||
|
end;
|
||||||
|
end;
|
||||||
|
|
||||||
|
procedure TDrawAction.UpdateArea;
|
||||||
|
var
|
||||||
|
targetArea: TRect;
|
||||||
|
tileX, tileY: Word;
|
||||||
|
tileId: Word;
|
||||||
|
mapCell: TMapCell;
|
||||||
|
staticItem: TStaticItem;
|
||||||
|
worldItem: TWorldItem;
|
||||||
|
begin
|
||||||
|
inherited UpdateArea;
|
||||||
|
|
||||||
|
FMapTiles.Clear;
|
||||||
|
FStaticTiles.Clear;
|
||||||
|
|
||||||
|
// TODO Only update relevant section of the tile lists.
|
||||||
|
|
||||||
|
if FFirstTile = nil then
|
||||||
|
Exit;
|
||||||
|
|
||||||
|
targetArea.Left := Min(FFirstTile.X, FLastTile.X);
|
||||||
|
targetArea.Top := Min(FFirstTile.Y, FLastTile.Y);
|
||||||
|
targetArea.Right := Max(FFirstTile.X, FLastTile.X);
|
||||||
|
targetArea.Bottom := Max(FFirstTile.Y, FLastTile.Y);
|
||||||
|
|
||||||
|
for tileX := targetArea.Left to targetArea.Right do
|
||||||
|
for tileY := targetArea.Top to targetArea.Bottom do
|
||||||
|
begin
|
||||||
|
tileId := FTileIds[Random(FTileIds.Count)];
|
||||||
|
if tileId < $4000 then
|
||||||
|
begin
|
||||||
|
// Map Tile
|
||||||
|
mapCell := FLandscape.MapCell[tileX, tileY].Clone;
|
||||||
|
mapCell.TileID := tileId;
|
||||||
|
worldItem := mapCell;
|
||||||
|
FMapTiles.Add(mapCell);
|
||||||
|
end else
|
||||||
|
begin
|
||||||
|
// Static Tile
|
||||||
|
staticItem := TStaticItem.Create(nil, nil, 0, 0);
|
||||||
|
staticItem.TileID := tileId - $4000;
|
||||||
|
staticItem.Hue := FHue;
|
||||||
|
if not FForceZ then
|
||||||
|
begin
|
||||||
|
staticItem.Z := FFirstTile.Z;
|
||||||
|
if FFirstTile is TStaticItem then
|
||||||
|
staticItem.Z := staticItem.Z + ResMan.Tiledata.StaticTiles[FFirstTile.TileID].Height;
|
||||||
|
end;
|
||||||
|
worldItem := staticItem;
|
||||||
|
FStaticTiles.Add(staticItem);
|
||||||
|
end;
|
||||||
|
|
||||||
|
worldItem.X := tileX;
|
||||||
|
worldItem.Y := tileY;
|
||||||
|
|
||||||
|
if FForceZ then
|
||||||
|
worldItem.Z := FForceZValue;
|
||||||
|
if FRandomZ then
|
||||||
|
worldItem.Z := worldItem.Z + Random(FRandomZValue);
|
||||||
|
worldItem.Z := EnsureRange(worldItem.Z, -128, 127);
|
||||||
|
end;
|
||||||
|
end;
|
||||||
|
|
||||||
|
{ TDeleteAction }
|
||||||
|
|
||||||
|
procedure TDeleteAction.Execute(AScreenBuffer: TScreenBuffer; out
|
||||||
|
AForwardActions, AReverseActions: TPacketList);
|
||||||
|
var
|
||||||
|
item: TWorldItem;
|
||||||
|
begin
|
||||||
|
inherited Execute(AScreenBuffer, AForwardActions, AReverseActions);
|
||||||
|
|
||||||
|
for item in AScreenBuffer do
|
||||||
|
begin
|
||||||
|
if not IsEditableStaticTile(item) then
|
||||||
|
Continue;
|
||||||
|
|
||||||
|
AForwardActions.Add(TDeleteStaticPacket.Create(TStaticItem(item)));
|
||||||
|
AReverseActions.Add(TInsertStaticPacket.Create(TStaticItem(item)));
|
||||||
|
end;
|
||||||
|
end;
|
||||||
|
|
||||||
|
{ TMoveAction }
|
||||||
|
|
||||||
|
procedure TMoveAction.Execute(AScreenBuffer: TScreenBuffer; out
|
||||||
|
AForwardActions, AReverseActions: TPacketList);
|
||||||
|
var
|
||||||
|
newX, newY: Word;
|
||||||
|
item: TWorldItem;
|
||||||
|
begin
|
||||||
|
inherited Execute(AScreenBuffer, AForwardActions, AReverseActions);
|
||||||
|
|
||||||
|
for item in AScreenBuffer do
|
||||||
|
begin
|
||||||
|
if not IsEditableStaticTile(item) then
|
||||||
|
Continue;
|
||||||
|
|
||||||
|
newX := EnsureRange(item.X + FOffsetX, 0, FLandscape.CellWidth - 1);
|
||||||
|
newY := EnsureRange(item.Y + FOffsetY, 0, FLandscape.CellHeight - 1);
|
||||||
|
|
||||||
|
AForwardActions.Add(TMoveStaticPacket.Create(TStaticItem(item), newX, newY));
|
||||||
|
AReverseActions.Add(TMoveStaticPacket.Create(TStaticItem(item), item.X, item.Y));
|
||||||
|
end;
|
||||||
|
end;
|
||||||
|
|
||||||
|
{ TElevateAction }
|
||||||
|
|
||||||
|
procedure TElevateAction.Execute(AScreenBuffer: TScreenBuffer; out
|
||||||
|
AForwardActions, AReverseActions: TPacketList);
|
||||||
|
var
|
||||||
|
item: TWorldItem;
|
||||||
|
newZ: Integer;
|
||||||
|
begin
|
||||||
|
inherited Execute(AScreenBuffer, AForwardActions, AReverseActions);
|
||||||
|
|
||||||
|
for item in AScreenBuffer do
|
||||||
|
begin
|
||||||
|
if not IsEditableTile(item) then
|
||||||
|
Continue;
|
||||||
|
|
||||||
|
newZ := FZ;
|
||||||
|
case FMode of
|
||||||
|
emRaise: newZ := item.Z + FZ;
|
||||||
|
emLower: newZ := item.Z - FZ;
|
||||||
|
end;
|
||||||
|
if FRandomZ then
|
||||||
|
newZ := newZ + Random(FRandomZValue);
|
||||||
|
|
||||||
|
newZ := EnsureRange(newZ, -128, 127);
|
||||||
|
|
||||||
|
if item is TMapCell then
|
||||||
|
begin
|
||||||
|
AForwardActions.Add(TDrawMapPacket.Create(item.X, item.Y, newZ, item.TileID));
|
||||||
|
AReverseActions.Add(TDrawMapPacket.Create(item.X, item.Y, item.Z, item.TileID));
|
||||||
|
end else if item is TStaticItem then
|
||||||
|
begin
|
||||||
|
AForwardActions.Add(TElevateStaticPacket.Create(TStaticItem(item), newZ));
|
||||||
|
AReverseActions.Add(TElevateStaticPacket.Create(TStaticItem(item), item.Z));
|
||||||
|
end;
|
||||||
|
end;
|
||||||
|
end;
|
||||||
|
|
||||||
|
{ THueAction }
|
||||||
|
|
||||||
|
procedure THueAction.Execute(AScreenBuffer: TScreenBuffer; out AForwardActions,
|
||||||
|
AReverseActions: TPacketList);
|
||||||
|
var
|
||||||
|
item: TWorldItem;
|
||||||
|
begin
|
||||||
|
inherited Execute(AScreenBuffer, AForwardActions, AReverseActions);
|
||||||
|
|
||||||
|
for item in AScreenBuffer do
|
||||||
|
begin
|
||||||
|
if not IsEditableStaticTile(item) then
|
||||||
|
Continue;
|
||||||
|
|
||||||
|
if TStaticItem(item).Hue = FHue then
|
||||||
|
Continue;
|
||||||
|
|
||||||
|
AForwardActions.Add(THueStaticPacket.Create(TStaticItem(item), FHue));
|
||||||
|
AReverseActions.Add(THueStaticPacket.Create(TStaticItem(item), TStaticItem(item).Hue));
|
||||||
|
end;
|
||||||
|
end;
|
||||||
|
|
||||||
|
end.
|
||||||
|
|
||||||
+2
-1
@@ -185,7 +185,8 @@ begin
|
|||||||
AFontInfo.Read(FSpaceWidth, SizeOf(FSpaceWidth));
|
AFontInfo.Read(FSpaceWidth, SizeOf(FSpaceWidth));
|
||||||
SetLength(FFontInfo, (AFontInfo.Size - AFontInfo.Position) div
|
SetLength(FFontInfo, (AFontInfo.Size - AFontInfo.Position) div
|
||||||
SizeOf(TFontInfo));
|
SizeOf(TFontInfo));
|
||||||
AFontInfo.Read(FFontInfo[0], Length(FFontInfo) * SizeOf(TFontInfo));
|
if Length(FFontInfo) > 0 then
|
||||||
|
AFontInfo.Read(FFontInfo[0], Length(FFontInfo) * SizeOf(TFontInfo));
|
||||||
end;
|
end;
|
||||||
|
|
||||||
procedure TGLFont.UpdateTexture;
|
procedure TGLFont.UpdateTexture;
|
||||||
|
|||||||
@@ -42,8 +42,12 @@ implementation
|
|||||||
procedure SetWindowParent(AHandle, AParent: THANDLE);
|
procedure SetWindowParent(AHandle, AParent: THANDLE);
|
||||||
begin
|
begin
|
||||||
{$IFDEF LCLWin32}
|
{$IFDEF LCLWin32}
|
||||||
|
{$IFDEF CPU64}
|
||||||
|
SetWindowLongPtr(AHandle, GWLP_HWNDPARENT, AParent);
|
||||||
|
{$ELSE}
|
||||||
SetWindowLong(AHandle, GWL_HWNDPARENT, AParent);
|
SetWindowLong(AHandle, GWL_HWNDPARENT, AParent);
|
||||||
{$ENDIF}
|
{$ENDIF}
|
||||||
|
{$ENDIF}
|
||||||
{$IFDEF LCLGtk}
|
{$IFDEF LCLGtk}
|
||||||
gtk_window_set_transient_for(PGtkWindow(AHandle), PGtkWindow(AParent));
|
gtk_window_set_transient_for(PGtkWindow(AHandle), PGtkWindow(AParent));
|
||||||
{$ENDIF}
|
{$ENDIF}
|
||||||
|
|||||||
+152
-78
@@ -21,7 +21,8 @@
|
|||||||
* CDDL HEADER END
|
* CDDL HEADER END
|
||||||
*
|
*
|
||||||
*
|
*
|
||||||
* Portions Copyright 2009 Andreas Schneider
|
* Portions Copyright 2015 Andreas Schneider
|
||||||
|
* Portions Copyright 2015 StaticZ
|
||||||
*)
|
*)
|
||||||
unit ULandscape;
|
unit ULandscape;
|
||||||
|
|
||||||
@@ -33,9 +34,7 @@ uses
|
|||||||
SysUtils, Classes, math, matrix, LCLIntf, GL, GLu, ImagingOpenGL, Imaging,
|
SysUtils, Classes, math, matrix, LCLIntf, GL, GLu, ImagingOpenGL, Imaging,
|
||||||
ImagingClasses, ImagingTypes, ImagingUtility,
|
ImagingClasses, ImagingTypes, ImagingUtility,
|
||||||
UGenericIndex, UMap, UStatics, UArt, UTexture, UTiledata, UHue, UWorldItem,
|
UGenericIndex, UMap, UStatics, UArt, UTexture, UTiledata, UHue, UWorldItem,
|
||||||
UMulBlock, UAnimData,
|
UMulBlock, UAnimData, UEnhancedMemoryStream, UGLFont, UCacheManager;
|
||||||
UEnhancedMemoryStream, UGLFont,
|
|
||||||
UCacheManager;
|
|
||||||
|
|
||||||
type
|
type
|
||||||
TGlVector3f = array[0..2] of GLfloat;
|
TGlVector3f = array[0..2] of GLfloat;
|
||||||
@@ -188,8 +187,8 @@ type
|
|||||||
FMaxStaticID: Cardinal;
|
FMaxStaticID: Cardinal;
|
||||||
{ Methods }
|
{ Methods }
|
||||||
function GetMapBlock(AX, AY: Word): TMapBlock;
|
function GetMapBlock(AX, AY: Word): TMapBlock;
|
||||||
function GetMapCell(AX, AY: Word): TMapCell;
|
function GetMapCell(AX, AY: Integer): TMapCell;
|
||||||
function GetNormals(AX, AY: Word): TNormals;
|
function GetNormals(AX, AY: Integer): TNormals;
|
||||||
function GetStaticBlock(AX, AY: Word): TSeperatedStaticBlock;
|
function GetStaticBlock(AX, AY: Word): TSeperatedStaticBlock;
|
||||||
function GetStaticList(AX, AY: Word): TStaticItemList;
|
function GetStaticList(AX, AY: Word): TStaticItemList;
|
||||||
{ Events }
|
{ Events }
|
||||||
@@ -207,9 +206,9 @@ type
|
|||||||
property Height: Word read FHeight;
|
property Height: Word read FHeight;
|
||||||
property CellWidth: Word read FCellWidth;
|
property CellWidth: Word read FCellWidth;
|
||||||
property CellHeight: Word read FCellHeight;
|
property CellHeight: Word read FCellHeight;
|
||||||
property MapCell[X, Y: Word]: TMapCell read GetMapCell;
|
property MapCell[X, Y: Integer]: TMapCell read GetMapCell;
|
||||||
property StaticList[X, Y: Word]: TStaticItemList read GetStaticList;
|
property StaticList[X, Y: Word]: TStaticItemList read GetStaticList;
|
||||||
property Normals[X, Y: Word]: TNormals read GetNormals;
|
property Normals[X, Y: Integer]: TNormals read GetNormals;
|
||||||
property MaxStaticID: Cardinal read FMaxStaticID;
|
property MaxStaticID: Cardinal read FMaxStaticID;
|
||||||
property OnChange: TLandscapeChangeEvent read FOnChange write FOnChange;
|
property OnChange: TLandscapeChangeEvent read FOnChange write FOnChange;
|
||||||
property OnMapChanged: TMapChangedEvent read FOnMapChanged write FOnMapChanged;
|
property OnMapChanged: TMapChangedEvent read FOnMapChanged write FOnMapChanged;
|
||||||
@@ -226,7 +225,7 @@ type
|
|||||||
function CanWrite(AX, AY: Word): Boolean;
|
function CanWrite(AX, AY: Word): Boolean;
|
||||||
procedure FillDrawList(ADrawList: TScreenBuffer; AX, AY, AWidth,
|
procedure FillDrawList(ADrawList: TScreenBuffer; AX, AY, AWidth,
|
||||||
AHeight: Word; AMap, AStatics: Boolean; ANoDraw: Boolean;
|
AHeight: Word; AMap, AStatics: Boolean; ANoDraw: Boolean;
|
||||||
AAdditionalTiles: TWorldItemList = nil);
|
AAdditionalTiles: TWorldItemList = nil; ATileFilters: TTileDataFlags = []);
|
||||||
function GetEffectiveAltitude(ATile: TMapCell): ShortInt;
|
function GetEffectiveAltitude(ATile: TMapCell): ShortInt;
|
||||||
function GetLandAlt(AX, AY: Word; ADefault: ShortInt): ShortInt;
|
function GetLandAlt(AX, AY: Word; ADefault: ShortInt): ShortInt;
|
||||||
procedure GetNormals(AX, AY: Word; var ANormals: TNormals);
|
procedure GetNormals(AX, AY: Word; var ANormals: TNormals);
|
||||||
@@ -258,6 +257,8 @@ type
|
|||||||
ScreenRect: TRect;
|
ScreenRect: TRect;
|
||||||
DrawQuad: array[0..3,0..1] of TGLint;
|
DrawQuad: array[0..3,0..1] of TGLint;
|
||||||
RealQuad: array[0..3,0..1] of TGLint;
|
RealQuad: array[0..3,0..1] of TGLint;
|
||||||
|
LineWidth: array[0..2] of GLfloat;
|
||||||
|
LineDraw: array[0..2,0..1,0..1] of TGLint;
|
||||||
Item: TWorldItem;
|
Item: TWorldItem;
|
||||||
HighRes: TMaterial;
|
HighRes: TMaterial;
|
||||||
LowRes: TMaterial;
|
LowRes: TMaterial;
|
||||||
@@ -265,6 +266,7 @@ type
|
|||||||
State: TScreenState;
|
State: TScreenState;
|
||||||
Highlighted: Boolean;
|
Highlighted: Boolean;
|
||||||
HueOverride: Boolean;
|
HueOverride: Boolean;
|
||||||
|
Hue: Word;
|
||||||
CheckRealQuad: Boolean;
|
CheckRealQuad: Boolean;
|
||||||
Translucent: Boolean;
|
Translucent: Boolean;
|
||||||
WalkRestriction: TWalkRestriction;
|
WalkRestriction: TWalkRestriction;
|
||||||
@@ -298,6 +300,18 @@ type
|
|||||||
procedure OnTileRemoved(ATile: TMulBlock);
|
procedure OnTileRemoved(ATile: TMulBlock);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
{ TScreenBufferItemEnumerator }
|
||||||
|
|
||||||
|
TScreenBufferItemEnumerator = object
|
||||||
|
private
|
||||||
|
FScreenBuffer: TScreenBuffer;
|
||||||
|
FCurrentBlock: PBlockInfo;
|
||||||
|
FCurrentItem: TWorldItem;
|
||||||
|
public
|
||||||
|
function MoveNext: Boolean;
|
||||||
|
property Current: TWorldItem read FCurrentItem;
|
||||||
|
end;
|
||||||
|
|
||||||
TStaticInfo = packed record
|
TStaticInfo = packed record
|
||||||
X: Word;
|
X: Word;
|
||||||
Y: Word;
|
Y: Word;
|
||||||
@@ -306,6 +320,23 @@ type
|
|||||||
Hue: Word;
|
Hue: Word;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
TGhostTile = class(TStaticItem);
|
||||||
|
|
||||||
|
{ TMovableGhostTile }
|
||||||
|
|
||||||
|
TMovableGhostTile = class(TGhostTile)
|
||||||
|
private
|
||||||
|
FOriginalX: Word;
|
||||||
|
FOriginalY: Word;
|
||||||
|
FOriginalZ: ShortInt;
|
||||||
|
public
|
||||||
|
property OriginalX: Word read FOriginalX write FOriginalX;
|
||||||
|
property OriginalY: Word read FOriginalY write FOriginalY;
|
||||||
|
property OriginalZ: ShortInt read FOriginalZ write FOriginalZ;
|
||||||
|
end;
|
||||||
|
|
||||||
|
operator enumerator(AScreenBuffer: TScreenBuffer): TScreenBufferItemEnumerator;
|
||||||
|
|
||||||
implementation
|
implementation
|
||||||
|
|
||||||
uses
|
uses
|
||||||
@@ -323,14 +354,29 @@ begin
|
|||||||
GLVector[2] := AVector.data[2];
|
GLVector[2] := AVector.data[2];
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
operator enumerator(AScreenBuffer: TScreenBuffer): TScreenBufferItemEnumerator;
|
||||||
|
begin
|
||||||
|
Result.FScreenBuffer := AScreenBuffer;
|
||||||
|
Result.MoveNext;
|
||||||
|
end;
|
||||||
|
|
||||||
|
{ TScreenBufferItemEnumerator }
|
||||||
|
|
||||||
|
function TScreenBufferItemEnumerator.MoveNext: Boolean;
|
||||||
|
begin
|
||||||
|
Result := FScreenBuffer.Iterate(FCurrentBlock);
|
||||||
|
if not Result then
|
||||||
|
FCurrentItem := nil;
|
||||||
|
end;
|
||||||
|
|
||||||
{ TLandTextureManager }
|
{ TLandTextureManager }
|
||||||
|
|
||||||
constructor TLandTextureManager.Create;
|
constructor TLandTextureManager.Create;
|
||||||
begin
|
begin
|
||||||
inherited Create;
|
inherited Create;
|
||||||
FArtCache := TMaterialCache.Create(1024);
|
FArtCache := TMaterialCache.Create(4096);
|
||||||
FTexCache := TMaterialCache.Create(128);
|
FTexCache := TMaterialCache.Create(512);
|
||||||
FAnimCache := TMaterialCache.Create(128);
|
FAnimCache := TMaterialCache.Create(512);
|
||||||
FUseAnims := True;
|
FUseAnims := True;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
@@ -418,11 +464,14 @@ var
|
|||||||
staticTiledata: TStaticTiledata;
|
staticTiledata: TStaticTiledata;
|
||||||
hue: THue;
|
hue: THue;
|
||||||
begin
|
begin
|
||||||
|
if (AStaticItem.TileID < 0) or
|
||||||
|
(AStaticItem.TileID >= Integer(ResMan.Tiledata.StaticCount)) then
|
||||||
|
raise Exception.CreateFmt('Invalid static tile ID %d', [AStaticItem.TileID]);
|
||||||
staticTiledata := ResMan.Tiledata.StaticTiles[AStaticItem.TileID];
|
staticTiledata := ResMan.Tiledata.StaticTiles[AStaticItem.TileID];
|
||||||
if AOverrideHue < 0 then
|
if AOverrideHue < 0 then
|
||||||
AOverrideHue := AStaticItem.Hue;
|
AOverrideHue := AStaticItem.Hue;
|
||||||
|
|
||||||
if AOverrideHue > 0 then
|
if (AOverrideHue > 0) and (AOverrideHue <= ResMan.Hue.Count) then
|
||||||
hue := ResMan.Hue.Hues[AOverrideHue - 1]
|
hue := ResMan.Hue.Hues[AOverrideHue - 1]
|
||||||
else
|
else
|
||||||
hue := nil;
|
hue := nil;
|
||||||
@@ -473,18 +522,21 @@ begin
|
|||||||
for i := 0 to 63 do
|
for i := 0 to 63 do
|
||||||
Cells[i] := TStaticItemList.Create;
|
Cells[i] := TStaticItemList.Create;
|
||||||
|
|
||||||
if (AData <> nil) and (AIndex.Lookup > 0) and (AIndex.Size > 0) then
|
if (AData <> nil) and (AIndex.Lookup > -1) and (AIndex.Size > 0) then
|
||||||
begin
|
begin
|
||||||
AData.Position := AIndex.Lookup;
|
AData.Position := AIndex.Lookup;
|
||||||
block := TMemoryStream.Create;
|
block := TMemoryStream.Create;
|
||||||
block.CopyFrom(AData, AIndex.Size);
|
try
|
||||||
block.Position := 0;
|
block.CopyFrom(AData, AIndex.Size);
|
||||||
for i := 1 to (AIndex.Size div 7) do
|
block.Position := 0;
|
||||||
begin
|
for i := 1 to (AIndex.Size div 7) do
|
||||||
item := TStaticItem.Create(Self, block, AX, AY);
|
begin
|
||||||
Cells[(item.Y mod 8) * 8 + (item.X mod 8)].Add(item);
|
item := TStaticItem.Create(Self, block, AX, AY);
|
||||||
|
Cells[(item.Y mod 8) * 8 + (item.X mod 8)].Add(item);
|
||||||
|
end;
|
||||||
|
finally
|
||||||
|
block.Free;
|
||||||
end;
|
end;
|
||||||
block.Free;
|
|
||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
@@ -592,7 +644,7 @@ begin
|
|||||||
FHeight := AHeight;
|
FHeight := AHeight;
|
||||||
FCellWidth := FWidth * 8;
|
FCellWidth := FWidth * 8;
|
||||||
FCellHeight := FHeight * 8;
|
FCellHeight := FHeight * 8;
|
||||||
FBlockCache := TBlockCache.Create(256);
|
FBlockCache := TBlockCache.Create(1024);
|
||||||
FBlockCache.OnRemoveObject := @OnRemoveCachedObject;
|
FBlockCache.OnRemoveObject := @OnRemoveCachedObject;
|
||||||
|
|
||||||
FOnChange := nil;
|
FOnChange := nil;
|
||||||
@@ -661,7 +713,7 @@ begin
|
|||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
function TLandscape.GetMapCell(AX, AY: Word): TMapCell;
|
function TLandscape.GetMapCell(AX, AY: Integer): TMapCell;
|
||||||
var
|
var
|
||||||
block: TMapBlock;
|
block: TMapBlock;
|
||||||
begin
|
begin
|
||||||
@@ -674,7 +726,7 @@ begin
|
|||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
function TLandscape.GetNormals(AX, AY: Word): TNormals;
|
function TLandscape.GetNormals(AX, AY: Integer): TNormals;
|
||||||
begin
|
begin
|
||||||
GetNormals(AX, AY, Result);
|
GetNormals(AX, AY, Result);
|
||||||
end;
|
end;
|
||||||
@@ -721,30 +773,33 @@ var
|
|||||||
block: TBlock;
|
block: TBlock;
|
||||||
begin
|
begin
|
||||||
index := TGenericIndex.Create(nil);
|
index := TGenericIndex.Create(nil);
|
||||||
while ABuffer.Position < ABuffer.Size do
|
try
|
||||||
begin
|
while ABuffer.Position < ABuffer.Size do
|
||||||
ABuffer.Read(coords, SizeOf(TBlockCoords));
|
begin
|
||||||
id := GetID(coords.X, coords.Y);
|
ABuffer.Read(coords, SizeOf(TBlockCoords));
|
||||||
|
id := GetID(coords.X, coords.Y);
|
||||||
|
|
||||||
map := TMapBlock.Create(ABuffer, coords.X, coords.Y);
|
map := TMapBlock.Create(ABuffer, coords.X, coords.Y);
|
||||||
count := ABuffer.ReadWord;
|
count := ABuffer.ReadWord;
|
||||||
if count > 0 then
|
if count > 0 then
|
||||||
index.Lookup := ABuffer.Position
|
index.Lookup := ABuffer.Position
|
||||||
else
|
else
|
||||||
index.Lookup := -1;
|
index.Lookup := -1;
|
||||||
index.Size := count * 7;
|
index.Size := count * 7;
|
||||||
statics := TSeperatedStaticBlock.Create(ABuffer, index, coords.X, coords.Y);
|
statics := TSeperatedStaticBlock.Create(ABuffer, index, coords.X, coords.Y);
|
||||||
|
|
||||||
FBlockCache.RemoveID(id);
|
FBlockCache.RemoveID(id);
|
||||||
block := TBlock.Create(map, statics);
|
block := TBlock.Create(map, statics);
|
||||||
block.UpdateBlockAcess(Self);
|
block.UpdateBlockAcess(Self);
|
||||||
FBlockCache.StoreID(id, block);
|
FBlockCache.StoreID(id, block);
|
||||||
|
|
||||||
FOpenRequests[coords.Y * FWidth + coords.X] := False;
|
FOpenRequests[coords.Y * FWidth + coords.X] := False;
|
||||||
|
|
||||||
if Assigned(FOnNewBlock) then FOnNewBlock(block);
|
if Assigned(FOnNewBlock) then FOnNewBlock(block);
|
||||||
|
end;
|
||||||
|
finally
|
||||||
|
index.Free;
|
||||||
end;
|
end;
|
||||||
index.Free;
|
|
||||||
end;
|
end;
|
||||||
|
|
||||||
procedure TLandscape.OnDrawMapPacket(ABuffer: TEnhancedMemoryStream);
|
procedure TLandscape.OnDrawMapPacket(ABuffer: TEnhancedMemoryStream);
|
||||||
@@ -958,19 +1013,20 @@ end;
|
|||||||
|
|
||||||
procedure TLandscape.FillDrawList(ADrawList: TScreenBuffer; AX, AY, AWidth,
|
procedure TLandscape.FillDrawList(ADrawList: TScreenBuffer; AX, AY, AWidth,
|
||||||
AHeight: Word; AMap, AStatics: Boolean; ANoDraw: Boolean;
|
AHeight: Word; AMap, AStatics: Boolean; ANoDraw: Boolean;
|
||||||
AAdditionalTiles: TWorldItemList = nil);
|
AAdditionalTiles: TWorldItemList; ATileFilters: TTileDataFlags);
|
||||||
var
|
var
|
||||||
drawMapCell: TMapCell;
|
drawMapCell: TMapCell;
|
||||||
drawStatics: TStaticItemList;
|
drawStatics: TStaticItemList;
|
||||||
i, x, y: Integer;
|
i, x, y: Integer;
|
||||||
tempDrawList: TWorldItemList;
|
tempDrawList: TWorldItemList;
|
||||||
staticTileData: TStaticTiledata;
|
staticTileData: TStaticTiledata;
|
||||||
|
blockInfo: PBlockInfo;
|
||||||
begin
|
begin
|
||||||
ADrawList.Clear;
|
ADrawList.Clear;
|
||||||
tempDrawList := TWorldItemList.Create(False);;
|
tempDrawList := TWorldItemList.Create(False);;
|
||||||
for x := AX to AX + AWidth do
|
for x := AX to AX + AWidth do
|
||||||
begin
|
begin
|
||||||
for y := AY to AY + AWidth do
|
for y := AY to AY + AHeight do
|
||||||
begin
|
begin
|
||||||
if AMap then
|
if AMap then
|
||||||
begin
|
begin
|
||||||
@@ -993,6 +1049,10 @@ begin
|
|||||||
staticTileData := ResMan.Tiledata.StaticTiles[drawStatics[i].TileID];
|
staticTileData := ResMan.Tiledata.StaticTiles[drawStatics[i].TileID];
|
||||||
if ANoDraw or FDrawMap[drawStatics[i].TileID + $4000] then
|
if ANoDraw or FDrawMap[drawStatics[i].TileID + $4000] then
|
||||||
begin
|
begin
|
||||||
|
// Check if filters match
|
||||||
|
if staticTileData.Flags * ATileFilters <> [] then
|
||||||
|
Continue;
|
||||||
|
|
||||||
drawStatics[i].UpdatePriorities(staticTileData,
|
drawStatics[i].UpdatePriorities(staticTileData,
|
||||||
ADrawList.GetSerial);
|
ADrawList.GetSerial);
|
||||||
tempDrawList.Add(drawStatics[i]);
|
tempDrawList.Add(drawStatics[i]);
|
||||||
@@ -1007,7 +1067,11 @@ begin
|
|||||||
|
|
||||||
tempDrawList.Sort(@CompareWorldItems);
|
tempDrawList.Sort(@CompareWorldItems);
|
||||||
for i := 0 to tempDrawList.Count - 1 do
|
for i := 0 to tempDrawList.Count - 1 do
|
||||||
ADrawList.Add(TWorldItem(tempDrawList[i]));
|
begin
|
||||||
|
blockInfo := ADrawList.Add(TWorldItem(tempDrawList[i]));
|
||||||
|
if tempDrawList[i] is TGhostTile then
|
||||||
|
blockInfo^.State := ssGhost;
|
||||||
|
end;
|
||||||
tempDrawList.Free;
|
tempDrawList.Free;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
@@ -1020,10 +1084,10 @@ begin
|
|||||||
south := GetLandAlt(ATile.X + 1, ATile.Y + 1, north);
|
south := GetLandAlt(ATile.X + 1, ATile.Y + 1, north);
|
||||||
east := GetLandAlt(ATile.X + 1, ATile.Y, north);
|
east := GetLandAlt(ATile.X + 1, ATile.Y, north);
|
||||||
|
|
||||||
if Abs(north - south) >= Abs(west - east) then
|
if Abs(north - south) > Abs(west - east) then
|
||||||
Result := Min(north, south) + Abs(west - east) div 2
|
Result := Min(north, south) + Abs(north - south) div 2
|
||||||
else
|
else
|
||||||
Result := Min(north, south) + Abs(north - south) div 2;
|
Result := Min(north, south) + Abs(west - east) div 2;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
function TLandscape.GetLandAlt(AX, AY: Word; ADefault: ShortInt): ShortInt;
|
function TLandscape.GetLandAlt(AX, AY: Word; ADefault: ShortInt): ShortInt;
|
||||||
@@ -1134,42 +1198,47 @@ var
|
|||||||
begin
|
begin
|
||||||
AssignFile(noDrawFile, AFileName);
|
AssignFile(noDrawFile, AFileName);
|
||||||
Reset(noDrawFile);
|
Reset(noDrawFile);
|
||||||
while not EOF(noDrawFile) do
|
try
|
||||||
begin
|
while not EOF(noDrawFile) do
|
||||||
ReadLn(noDrawFile, line);
|
|
||||||
if (Length(line) > 0) and (line[1] in ['S', 'T']) then
|
|
||||||
begin
|
begin
|
||||||
splitPos := Pos('-', line);
|
ReadLn(noDrawFile, line);
|
||||||
if splitPos > 1 then
|
if (Length(line) > 0) and (line[1] in ['S', 'T']) then
|
||||||
begin
|
begin
|
||||||
ids1 := Copy(line, 2, splitPos - 2);
|
splitPos := Pos('-', line);
|
||||||
ids2 := Copy(line, splitPos + 1, Length(line));
|
if splitPos > 1 then
|
||||||
if TryStrToInt(ids1, id1) and TryStrToInt(ids2, id2) then
|
|
||||||
begin
|
begin
|
||||||
if line[1] = 'S' then
|
ids1 := Copy(line, 2, splitPos - 2);
|
||||||
|
ids2 := Copy(line, splitPos + 1, Length(line));
|
||||||
|
if TryStrToInt(ids1, id1) and TryStrToInt(ids2, id2) then
|
||||||
begin
|
begin
|
||||||
Inc(id1, $4000);
|
if line[1] = 'S' then
|
||||||
Inc(id2, $4000);
|
begin
|
||||||
end;
|
Inc(id1, $4000);
|
||||||
|
Inc(id2, $4000);
|
||||||
|
end;
|
||||||
|
|
||||||
for i := id1 to id2 do
|
if id1 < 0 then
|
||||||
if i < FDrawMap.Size then
|
id1 := 0;
|
||||||
FDrawMap[i] := False;
|
for i := id1 to id2 do
|
||||||
end;
|
if i < FDrawMap.Size then
|
||||||
end else
|
FDrawMap[i] := False;
|
||||||
begin
|
end;
|
||||||
ids1 := Copy(line, 2, Length(line));
|
end else
|
||||||
if TryStrToInt(ids1, id1) then
|
|
||||||
begin
|
begin
|
||||||
if line[1] = 'S' then
|
ids1 := Copy(line, 2, Length(line));
|
||||||
Inc(id1, $4000);
|
if TryStrToInt(ids1, id1) then
|
||||||
if id1 < FDrawMap.Size then
|
begin
|
||||||
FDrawMap[id1] := False;
|
if line[1] = 'S' then
|
||||||
|
Inc(id1, $4000);
|
||||||
|
if (id1 >= 0) and (id1 < FDrawMap.Size) then
|
||||||
|
FDrawMap[id1] := False;
|
||||||
|
end;
|
||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
|
finally
|
||||||
|
CloseFile(noDrawFile);
|
||||||
end;
|
end;
|
||||||
CloseFile(noDrawFile);
|
|
||||||
end;
|
end;
|
||||||
|
|
||||||
procedure TLandscape.MoveStatic(AStatic: TStaticItem; AX, AY: Word);
|
procedure TLandscape.MoveStatic(AStatic: TStaticItem; AX, AY: Word);
|
||||||
@@ -1258,6 +1327,10 @@ begin
|
|||||||
y1 := AStream.ReadWord;
|
y1 := AStream.ReadWord;
|
||||||
x2 := AStream.ReadWord;
|
x2 := AStream.ReadWord;
|
||||||
y2 := AStream.ReadWord;
|
y2 := AStream.ReadWord;
|
||||||
|
if (x1 >= FCellWidth) or (y1 >= FCellHeight) then
|
||||||
|
Continue;
|
||||||
|
if x2 >= FCellWidth then x2 := FCellWidth - 1;
|
||||||
|
if y2 >= FCellHeight then y2 := FCellHeight - 1;
|
||||||
for cellX := x1 to x2 do
|
for cellX := x1 to x2 do
|
||||||
for cellY := y1 to y2 do
|
for cellY := y1 to y2 do
|
||||||
FWriteMap[cellX * FCellHeight + cellY] := True;
|
FWriteMap[cellX * FCellHeight + cellY] := True;
|
||||||
@@ -1556,7 +1629,7 @@ begin
|
|||||||
current := current^.Next;
|
current := current^.Next;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
if FShortCuts[-1] = current^.Next then
|
if current^.Next = nil then
|
||||||
FShortCuts[-1] := Result; //Update last item
|
FShortCuts[-1] := Result; //Update last item
|
||||||
|
|
||||||
Result^.Next := current^.Next;
|
Result^.Next := current^.Next;
|
||||||
@@ -1587,7 +1660,7 @@ begin
|
|||||||
end
|
end
|
||||||
else if FShortCuts[0] <> nil then
|
else if FShortCuts[0] <> nil then
|
||||||
begin
|
begin
|
||||||
stepSize := FCount div 10;
|
stepSize := FCount div 10 + 1;
|
||||||
nextStep := stepSize;
|
nextStep := stepSize;
|
||||||
step := 0;
|
step := 0;
|
||||||
shortcut := 1;
|
shortcut := 1;
|
||||||
@@ -1762,7 +1835,8 @@ end;
|
|||||||
|
|
||||||
destructor TAnimMaterial.Destroy;
|
destructor TAnimMaterial.Destroy;
|
||||||
begin
|
begin
|
||||||
glDeleteTextures(Length(FTextures), @FTextures[0]);
|
if Length(FTextures) > 0 then
|
||||||
|
glDeleteTextures(Length(FTextures), @FTextures[0]);
|
||||||
inherited Destroy;
|
inherited Destroy;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
|||||||
+167
-30
@@ -21,7 +21,8 @@
|
|||||||
* CDDL HEADER END
|
* CDDL HEADER END
|
||||||
*
|
*
|
||||||
*
|
*
|
||||||
* Portions Copyright 2009 Andreas Schneider
|
* Portions Copyright 2015 Andreas Schneider
|
||||||
|
* Portions Copyright 2015 StaticZ
|
||||||
*)
|
*)
|
||||||
unit ULightManager;
|
unit ULightManager;
|
||||||
|
|
||||||
@@ -31,10 +32,23 @@ interface
|
|||||||
|
|
||||||
uses
|
uses
|
||||||
Classes, SysUtils, Imaging, ImagingTypes, ImagingClasses, ImagingCanvases,
|
Classes, SysUtils, Imaging, ImagingTypes, ImagingClasses, ImagingCanvases,
|
||||||
ImagingOpenGL, GL, GLu, GLext, fgl, ULandscape, UWorldItem, UCacheManager;
|
ImagingOpenGL, GL, GLu, GLext, Math, fgl, ULandscape, UWorldItem,
|
||||||
|
UCacheManager, DOM, XMLRead;
|
||||||
|
|
||||||
|
const
|
||||||
|
ColorsCount = 15;
|
||||||
|
|
||||||
type
|
type
|
||||||
|
|
||||||
|
TLightColor = record
|
||||||
|
r: Float;
|
||||||
|
g: Float;
|
||||||
|
b: Float;
|
||||||
|
end;
|
||||||
|
PLightColor = ^TLightColor;
|
||||||
|
|
||||||
|
TColorRefArray = array of Byte;
|
||||||
|
|
||||||
TCalculateOffset = procedure(AX, AY: Integer; out DrawX, DrawY: Integer) of object;
|
TCalculateOffset = procedure(AX, AY: Integer; out DrawX, DrawY: Integer) of object;
|
||||||
|
|
||||||
{ TLightMaterial }
|
{ TLightMaterial }
|
||||||
@@ -58,11 +72,13 @@ type
|
|||||||
constructor Create(AManager: TLightManager; AWorldItem: TWorldItem);
|
constructor Create(AManager: TLightManager; AWorldItem: TWorldItem);
|
||||||
destructor Destroy; override;
|
destructor Destroy; override;
|
||||||
protected
|
protected
|
||||||
|
FColorID: Byte;
|
||||||
FX: Integer;
|
FX: Integer;
|
||||||
FY: Integer;
|
FY: Integer;
|
||||||
FZ: SmallInt;
|
FZ: SmallInt;
|
||||||
FMaterial: TLightMaterial;
|
FMaterial: TLightMaterial;
|
||||||
public
|
public
|
||||||
|
property ColorID: Byte read FColorID;
|
||||||
property X: Integer read FX;
|
property X: Integer read FX;
|
||||||
property Y: Integer read FY;
|
property Y: Integer read FY;
|
||||||
property Z: SmallInt read FZ;
|
property Z: SmallInt read FZ;
|
||||||
@@ -86,15 +102,20 @@ type
|
|||||||
FLightCache: TLightCache;
|
FLightCache: TLightCache;
|
||||||
FUseFBO: Boolean;
|
FUseFBO: Boolean;
|
||||||
FInitialized: Boolean;
|
FInitialized: Boolean;
|
||||||
|
FLightColors: array[1..ColorsCount] of TLightColor;
|
||||||
|
FTileCol: TColorRefArray;
|
||||||
function GetLight(AID: Integer): TLightMaterial;
|
function GetLight(AID: Integer): TLightMaterial;
|
||||||
procedure SetLightLevel(AValue: Byte);
|
procedure SetLightLevel(AValue: Byte);
|
||||||
procedure UpdateOverlay(AScreenRect: TRect);
|
procedure UpdateOverlay(AScreenRect: TRect);
|
||||||
|
private
|
||||||
|
property TileCol: TColorRefArray read FTileCol;
|
||||||
public
|
public
|
||||||
property LightLevel: Byte read FLightLevel write SetLightLevel;
|
property LightLevel: Byte read FLightLevel write SetLightLevel;
|
||||||
procedure InitGL;
|
procedure InitGL;
|
||||||
procedure UpdateLightMap(ALeft, AWidth, ATop, AHeight: Integer;
|
procedure UpdateLightMap(ALeft, AWidth, ATop, AHeight: Integer;
|
||||||
AScreenBuffer: TScreenBuffer);
|
AScreenBuffer: TScreenBuffer);
|
||||||
procedure Draw(AScreenRect: TRect);
|
procedure Draw(AScreenRect: TRect);
|
||||||
|
procedure LoadConfig(AFileName: String);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
implementation
|
implementation
|
||||||
@@ -153,6 +174,7 @@ var
|
|||||||
lightMaterial: TLightMaterial;
|
lightMaterial: TLightMaterial;
|
||||||
colorGL: GLclampf;
|
colorGL: GLclampf;
|
||||||
fbo: GLuint;
|
fbo: GLuint;
|
||||||
|
colorref: PLightColor;
|
||||||
begin
|
begin
|
||||||
glDeleteTextures(1, @FOverlayTexture);
|
glDeleteTextures(1, @FOverlayTexture);
|
||||||
if FUseFBO then
|
if FUseFBO then
|
||||||
@@ -182,7 +204,9 @@ begin
|
|||||||
lightMaterial := FLightSources[i].Material;
|
lightMaterial := FLightSources[i].Material;
|
||||||
if lightMaterial <> nil then
|
if lightMaterial <> nil then
|
||||||
begin
|
begin
|
||||||
|
colorref := @FLightColors[FLightSources[i].ColorID];
|
||||||
glBindTexture(GL_TEXTURE_2D, lightMaterial.Texture);
|
glBindTexture(GL_TEXTURE_2D, lightMaterial.Texture);
|
||||||
|
glColor3f(colorref^.R, colorref^.G, colorref^.B);
|
||||||
glBegin(GL_QUADS);
|
glBegin(GL_QUADS);
|
||||||
glTexCoord2i(0, 0);
|
glTexCoord2i(0, 0);
|
||||||
glVertex2i(FLightSources[i].FX - lightMaterial.RealWidth div 2,
|
glVertex2i(FLightSources[i].FX - lightMaterial.RealWidth div 2,
|
||||||
@@ -244,6 +268,7 @@ end;
|
|||||||
procedure TLightManager.InitGL;
|
procedure TLightManager.InitGL;
|
||||||
begin
|
begin
|
||||||
FUseFBO := Load_GL_EXT_framebuffer_object;
|
FUseFBO := Load_GL_EXT_framebuffer_object;
|
||||||
|
FInitialized := True;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
procedure TLightManager.UpdateLightMap(ALeft, AWidth, ATop, AHeight: Integer;
|
procedure TLightManager.UpdateLightMap(ALeft, AWidth, ATop, AHeight: Integer;
|
||||||
@@ -260,41 +285,46 @@ begin
|
|||||||
{Logger.Send([lcClient, lcDebug], 'AWidth', AWidth);
|
{Logger.Send([lcClient, lcDebug], 'AWidth', AWidth);
|
||||||
Logger.Send([lcClient, lcDebug], 'AHeight', AHeight);}
|
Logger.Send([lcClient, lcDebug], 'AHeight', AHeight);}
|
||||||
lights := TWorldItemList.Create(False);
|
lights := TWorldItemList.Create(False);
|
||||||
SetLength(tileMap, AWidth, AHeight);
|
try
|
||||||
for x := 0 to AWidth - 1 do
|
SetLength(tileMap, AWidth, AHeight);
|
||||||
for y := 0 to AHeight - 1 do
|
for x := 0 to AWidth - 1 do
|
||||||
tileMap[x,y] := nil;
|
for y := 0 to AHeight - 1 do
|
||||||
|
tileMap[x,y] := nil;
|
||||||
|
|
||||||
blockInfo := nil;
|
blockInfo := nil;
|
||||||
while AScreenBuffer.Iterate(blockInfo) do
|
while AScreenBuffer.Iterate(blockInfo) do
|
||||||
begin
|
|
||||||
if blockInfo^.State = ssNormal then
|
|
||||||
begin
|
begin
|
||||||
if blockInfo^.Item is TStaticItem then
|
if blockInfo^.State = ssNormal then
|
||||||
tileID := blockInfo^.Item.TileID + $4000
|
begin
|
||||||
else
|
if blockInfo^.Item is TStaticItem then
|
||||||
tileID := blockInfo^.Item.TileID;
|
tileID := blockInfo^.Item.TileID + $4000
|
||||||
tileData := ResMan.Tiledata.TileData[tileID];
|
else
|
||||||
|
tileID := blockInfo^.Item.TileID;
|
||||||
|
tileData := ResMan.Tiledata.TileData[tileID];
|
||||||
|
|
||||||
if tdfLightSource in tileData.Flags then
|
if tdfLightSource in tileData.Flags then
|
||||||
lights.Add(blockInfo^.Item)
|
lights.Add(blockInfo^.Item)
|
||||||
else
|
else
|
||||||
tileMap[blockInfo^.Item.X - ALeft, blockInfo^.Item.Y - ATop] :=
|
x := blockInfo^.Item.X - ALeft;
|
||||||
blockInfo^.Item;
|
y := blockInfo^.Item.Y - ATop;
|
||||||
|
if InRange(x, 0, AWidth - 1) and InRange(y, 0, AHeight - 1) then
|
||||||
|
tileMap[x, y] := blockInfo^.Item;
|
||||||
|
end;
|
||||||
end;
|
end;
|
||||||
end;
|
|
||||||
|
|
||||||
for i := 0 to lights.Count - 1 do
|
for i := 0 to lights.Count - 1 do
|
||||||
begin
|
begin
|
||||||
x := lights[i].X + 1 - ALeft;
|
x := lights[i].X + 1 - ALeft;
|
||||||
y := lights[i].Y + 1 - ATop;
|
y := lights[i].Y + 1 - ATop;
|
||||||
if (x = AWidth) or (y = AHeight) or (tileMap[x,y] = nil) or
|
if (x = AWidth) or (y = AHeight) or
|
||||||
(tileMap[x,y].Z < lights[i].Z + 5) then
|
(InRange(x, 0, AWidth - 1) and InRange(y, 0, AHeight - 1) and
|
||||||
FLightSources.Add(TLightSource.Create(Self, lights[i]));
|
((tileMap[x,y] = nil) or (tileMap[x,y].Z < lights[i].Z + 5))) then
|
||||||
|
FLightSources.Add(TLightSource.Create(Self, lights[i]));
|
||||||
|
end;
|
||||||
|
finally
|
||||||
|
lights.Free;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
lights.Free;
|
|
||||||
|
|
||||||
FValid := False;
|
FValid := False;
|
||||||
//Logger.ExitMethod([lcClient, lcDebug], 'UpdateLightMap');
|
//Logger.ExitMethod([lcClient, lcDebug], 'UpdateLightMap');
|
||||||
end;
|
end;
|
||||||
@@ -336,6 +366,110 @@ begin
|
|||||||
glEnd;
|
glEnd;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
procedure TLightManager.LoadConfig(AFileName: String);
|
||||||
|
var
|
||||||
|
XMLDoc: TXMLDocument;
|
||||||
|
iNode, node: TDOMNode;
|
||||||
|
s: string;
|
||||||
|
i, id, col, r, g, b: Integer;
|
||||||
|
begin
|
||||||
|
//writeln('Loading Colors from ', AFileName); //TODO
|
||||||
|
for i := 1 to ColorsCount do begin
|
||||||
|
FLightColors[i].R := 1.0;
|
||||||
|
FLightColors[i].G := 1.0;
|
||||||
|
FLightColors[i].B := 1.0;
|
||||||
|
end;
|
||||||
|
SetLength(FTileCol, ResMan.Landscape.MaxStaticID + 1);
|
||||||
|
for i := 0 to ResMan.Landscape.MaxStaticID do
|
||||||
|
FTileCol[i] := 1;
|
||||||
|
|
||||||
|
//frmInitialize.SetStatusLabel(Format(frmInitialize.SplashLoading, ['ColorLight.xml']));
|
||||||
|
// Read xml file from your hard drive
|
||||||
|
if not FileExists(AFileName) then
|
||||||
|
Exit;
|
||||||
|
ReadXMLFile(XMLDoc, AFileName);
|
||||||
|
try
|
||||||
|
if LowerCase(XMLDoc.DocumentElement.NodeName) = 'colorlight' then
|
||||||
|
begin
|
||||||
|
iNode := XMLDoc.DocumentElement.FirstChild;
|
||||||
|
while iNode <> nil do
|
||||||
|
begin
|
||||||
|
if LowerCase(iNode.NodeName) = 'colors' then
|
||||||
|
begin
|
||||||
|
node := iNode.FirstChild;
|
||||||
|
while node <> nil do
|
||||||
|
begin
|
||||||
|
if (LowerCase(node.NodeName) = 'color') then
|
||||||
|
begin
|
||||||
|
id := -1;
|
||||||
|
r := 255;
|
||||||
|
g := 255;
|
||||||
|
b := 255;
|
||||||
|
for i := node.Attributes.Length - 1 downto 0 do
|
||||||
|
begin
|
||||||
|
s := LowerCase(node.Attributes[i].NodeName);
|
||||||
|
if (s = 'id') then
|
||||||
|
TryStrToInt(node.Attributes[i].NodeValue, id);
|
||||||
|
if (s = 'r') then
|
||||||
|
TryStrToInt(node.Attributes[i].NodeValue, r);
|
||||||
|
if (s = 'g') then
|
||||||
|
TryStrToInt(node.Attributes[i].NodeValue, g);
|
||||||
|
if (s = 'b') then
|
||||||
|
TryStrToInt(node.Attributes[i].NodeValue, b);
|
||||||
|
end;
|
||||||
|
if (id > 0) and (id <= ColorsCount) then
|
||||||
|
begin
|
||||||
|
if (r < 0) then r := 0;
|
||||||
|
if (g < 0) then g := 0;
|
||||||
|
if (b < 0) then b := 0;
|
||||||
|
if (r > 255) then r := 255;
|
||||||
|
if (g > 255) then g := 255;
|
||||||
|
if (b > 255) then b := 255;
|
||||||
|
FLightColors[id].R := (Float(r)) / 255.0;
|
||||||
|
FLightColors[id].G := (Float(g)) / 255.0;
|
||||||
|
FLightColors[id].B := (Float(b)) / 255.0;
|
||||||
|
end;
|
||||||
|
end;
|
||||||
|
node := node.NextSibling;
|
||||||
|
end;
|
||||||
|
end;
|
||||||
|
if LowerCase(iNode.NodeName) = 'sources' then
|
||||||
|
begin
|
||||||
|
node := iNode.FirstChild;
|
||||||
|
while node <> nil do
|
||||||
|
begin
|
||||||
|
s := LowerCase(node.NodeName);
|
||||||
|
if (s = 'tile') or (s = 'item') then begin
|
||||||
|
col := 1;
|
||||||
|
id := -1;
|
||||||
|
for i := node.Attributes.Length - 1 downto 0 do begin
|
||||||
|
if LowerCase(node.Attributes[i].NodeName) = 'id' then
|
||||||
|
if TryStrToInt(node.Attributes[i].NodeValue, id) then
|
||||||
|
begin
|
||||||
|
if s = 'tile' then
|
||||||
|
Dec(id, $4000);
|
||||||
|
end;
|
||||||
|
if LowerCase(node.Attributes[i].NodeName) = 'color' then
|
||||||
|
if TryStrToInt(node.Attributes[i].NodeValue, col) then
|
||||||
|
begin
|
||||||
|
if (col < 1) or (col > ColorsCount) then
|
||||||
|
col := 1;
|
||||||
|
end;
|
||||||
|
end;
|
||||||
|
if (id >= 0) and (id <= ResMan.Landscape.MaxStaticID) then
|
||||||
|
FTileCol[id] := col;
|
||||||
|
end;
|
||||||
|
node := node.NextSibling;
|
||||||
|
end;
|
||||||
|
end;
|
||||||
|
iNode := iNode.NextSibling;
|
||||||
|
end;
|
||||||
|
end;
|
||||||
|
finally
|
||||||
|
XMLDoc.Free;
|
||||||
|
end;
|
||||||
|
end;
|
||||||
|
|
||||||
{ TLightSource }
|
{ TLightSource }
|
||||||
|
|
||||||
constructor TLightSource.Create(AManager: TLightManager; AWorldItem: TWorldItem);
|
constructor TLightSource.Create(AManager: TLightManager; AWorldItem: TWorldItem);
|
||||||
@@ -346,6 +480,9 @@ begin
|
|||||||
FMaterial := AManager.GetLight(lightID);
|
FMaterial := AManager.GetLight(lightID);
|
||||||
if FMaterial <> nil then
|
if FMaterial <> nil then
|
||||||
begin
|
begin
|
||||||
|
FColorID := AManager.TileCol[AWorldItem.TileID];
|
||||||
|
if (FColorID < 1) or (FColorID > ColorsCount) then
|
||||||
|
FColorID := 1;
|
||||||
AManager.FCalculateOffset(AWorldItem.X, AWorldItem.Y, FX, FY);
|
AManager.FCalculateOffset(AWorldItem.X, AWorldItem.Y, FX, FY);
|
||||||
FZ := AWorldItem.Z * 4;
|
FZ := AWorldItem.Z * 4;
|
||||||
FY := FY + 22 - FZ;
|
FY := FY + 22 - FZ;
|
||||||
|
|||||||
+17
-7
@@ -30,7 +30,7 @@ unit UOverlayUI;
|
|||||||
interface
|
interface
|
||||||
|
|
||||||
uses
|
uses
|
||||||
Classes, SysUtils, Gl, GLU, Imaging, ImagingTypes, ImagingClasses,
|
Classes, SysUtils, LCLType, Gl, GLU, Imaging, ImagingTypes, ImagingClasses,
|
||||||
ImagingOpenGL, OpenGLContext, ImagingUtility;
|
ImagingOpenGL, OpenGLContext, ImagingUtility;
|
||||||
|
|
||||||
type
|
type
|
||||||
@@ -78,9 +78,6 @@ type
|
|||||||
|
|
||||||
implementation
|
implementation
|
||||||
|
|
||||||
uses
|
|
||||||
UResourceManager;
|
|
||||||
|
|
||||||
{ TGLArrow }
|
{ TGLArrow }
|
||||||
|
|
||||||
constructor TGLArrow.Create(AGraphic: TSingleImage);
|
constructor TGLArrow.Create(AGraphic: TSingleImage);
|
||||||
@@ -114,7 +111,7 @@ end;
|
|||||||
|
|
||||||
procedure TGLArrow.UpdateTexture;
|
procedure TGLArrow.UpdateTexture;
|
||||||
begin
|
begin
|
||||||
if (FGraphic <> nil) and (FRealWidth > 0) and (FRealWidth > 0) then
|
if (FGraphic <> nil) and (FRealWidth > 0) and (FRealHeight > 0) then
|
||||||
begin
|
begin
|
||||||
FTexture := CreateGLTextureFromImage(FGraphic.ImageDataPointer^, 0, 0, False);
|
FTexture := CreateGLTextureFromImage(FGraphic.ImageDataPointer^, 0, 0, False);
|
||||||
|
|
||||||
@@ -172,12 +169,19 @@ constructor TOverlayUI.Create;
|
|||||||
var
|
var
|
||||||
i: Integer;
|
i: Integer;
|
||||||
arrow: TSingleImage;
|
arrow: TSingleImage;
|
||||||
|
resStream: TResourceStream;
|
||||||
begin
|
begin
|
||||||
inherited Create;
|
inherited Create;
|
||||||
FActiveArrow := -1;
|
FActiveArrow := -1;
|
||||||
FVisible := False;
|
FVisible := False;
|
||||||
|
|
||||||
arrow := TSingleImage.CreateFromStream(ResourceManager.GetResource(0));
|
resStream := TResourceStream.Create(HINSTANCE, 'LEFTTOPARROW', RT_RCDATA);
|
||||||
|
try
|
||||||
|
arrow := TSingleImage.CreateFromStream(resStream);
|
||||||
|
finally
|
||||||
|
resStream.Free;
|
||||||
|
end;
|
||||||
|
|
||||||
for i := 0 to 3 do
|
for i := 0 to 3 do
|
||||||
begin
|
begin
|
||||||
FArrows[2*i] := TGLArrow.Create(arrow);
|
FArrows[2*i] := TGLArrow.Create(arrow);
|
||||||
@@ -186,7 +190,13 @@ begin
|
|||||||
end;
|
end;
|
||||||
arrow.Free;
|
arrow.Free;
|
||||||
|
|
||||||
arrow := TSingleImage.CreateFromStream(ResourceManager.GetResource(1));
|
resStream := TResourceStream.Create(HINSTANCE, 'TOPARROW', RT_RCDATA);
|
||||||
|
try
|
||||||
|
arrow := TSingleImage.CreateFromStream(resStream);
|
||||||
|
finally
|
||||||
|
resStream.Free;
|
||||||
|
end;
|
||||||
|
|
||||||
for i := 0 to 3 do
|
for i := 0 to 3 do
|
||||||
begin
|
begin
|
||||||
FArrows[2*i+1] := TGLArrow.Create(arrow);
|
FArrows[2*i+1] := TGLArrow.Create(arrow);
|
||||||
|
|||||||
@@ -96,21 +96,30 @@ var
|
|||||||
uncompStream: TEnhancedMemoryStream;
|
uncompStream: TEnhancedMemoryStream;
|
||||||
uncompBuffer: TDecompressionStream;
|
uncompBuffer: TDecompressionStream;
|
||||||
targetSize: Cardinal;
|
targetSize: Cardinal;
|
||||||
|
innerSize: Cardinal;
|
||||||
packetID: Byte;
|
packetID: Byte;
|
||||||
begin
|
begin
|
||||||
//writeln('compressed size: ', ABuffer.Size);
|
//writeln('compressed size: ', ABuffer.Size);
|
||||||
targetSize := ABuffer.ReadCardinal;
|
targetSize := ABuffer.ReadCardinal;
|
||||||
//writeln('uncompressed size: ', targetSize);
|
//writeln('uncompressed size: ', targetSize);
|
||||||
|
if (targetSize < 5) or (targetSize > 64 * 1024 * 1024) then Exit;
|
||||||
uncompBuffer := TDecompressionStream.Create(ABuffer);
|
uncompBuffer := TDecompressionStream.Create(ABuffer);
|
||||||
uncompStream := TEnhancedMemoryStream.Create;
|
uncompStream := TEnhancedMemoryStream.Create;
|
||||||
try
|
try
|
||||||
uncompStream.CopyFrom(uncompBuffer, targetSize);
|
uncompStream.CopyFrom(uncompBuffer, targetSize);
|
||||||
uncompStream.Position := 0;
|
uncompStream.Position := 0;
|
||||||
packetID := uncompStream.ReadByte;
|
packetID := uncompStream.ReadByte;
|
||||||
if PacketHandlers[packetID] <> nil then
|
if (packetID <> $01) and (PacketHandlers[packetID] <> nil) then
|
||||||
begin
|
begin
|
||||||
if PacketHandlers[PacketID].PacketLength = 0 then
|
if PacketHandlers[PacketID].PacketLength = 0 then
|
||||||
uncompStream.Position := uncompStream.Position + 4;
|
begin
|
||||||
|
innerSize := uncompStream.ReadCardinal;
|
||||||
|
if (innerSize < 5) or
|
||||||
|
(uncompStream.Size - uncompStream.Position < innerSize - 5) then
|
||||||
|
Exit;
|
||||||
|
end else if uncompStream.Size - uncompStream.Position <
|
||||||
|
PacketHandlers[PacketID].PacketLength - 1 then
|
||||||
|
Exit;
|
||||||
uncompStream.Lock(uncompStream.Position, uncompStream.Size - uncompStream.Position);
|
uncompStream.Lock(uncompStream.Position, uncompStream.Size - uncompStream.Position);
|
||||||
PacketHandlers[PacketID].Process(uncompStream);
|
PacketHandlers[PacketID].Process(uncompStream);
|
||||||
uncompStream.Unlock;
|
uncompStream.Unlock;
|
||||||
@@ -141,6 +150,7 @@ initialization
|
|||||||
//$06-$0B --> handled by TLandscape
|
//$06-$0B --> handled by TLandscape
|
||||||
//$0C --> ClientHandling, done by TfrmMain
|
//$0C --> ClientHandling, done by TfrmMain
|
||||||
//$0D --> RadarMapHandling, done by TfrmRadarMap
|
//$0D --> RadarMapHandling, done by TfrmRadarMap
|
||||||
|
//$0E --> LargeScaleCommands, done by TfrmLargeScaleCommands
|
||||||
finalization
|
finalization
|
||||||
for i := 0 to $FF do
|
for i := 0 to $FF do
|
||||||
if PacketHandlers[i] <> nil then
|
if PacketHandlers[i] <> nil then
|
||||||
|
|||||||
+43
-13
@@ -21,7 +21,7 @@
|
|||||||
* CDDL HEADER END
|
* CDDL HEADER END
|
||||||
*
|
*
|
||||||
*
|
*
|
||||||
* Portions Copyright 2009 Andreas Schneider
|
* Portions Copyright 2013 Andreas Schneider
|
||||||
*)
|
*)
|
||||||
unit UPackets;
|
unit UPackets;
|
||||||
|
|
||||||
@@ -82,8 +82,9 @@ type
|
|||||||
|
|
||||||
{ TInsertStaticPacket }
|
{ TInsertStaticPacket }
|
||||||
|
|
||||||
TInsertStaticPacket = class(TPacket)
|
TInsertStaticPacket = class(TStaticPacket)
|
||||||
constructor Create(AX, AY: Word; AZ: ShortInt; ATileID: Word; AHue: Word);
|
constructor Create(AX, AY: Word; AZ: ShortInt; ATileID: Word; AHue: Word); overload;
|
||||||
|
constructor Create(AStaticItem: TStaticItem); overload;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
{ TDeleteStaticPacket }
|
{ TDeleteStaticPacket }
|
||||||
@@ -97,7 +98,7 @@ type
|
|||||||
TElevateStaticPacket = class(TStaticPacket)
|
TElevateStaticPacket = class(TStaticPacket)
|
||||||
constructor Create(AStaticItem: TStaticItem; ANewZ: ShortInt);
|
constructor Create(AStaticItem: TStaticItem; ANewZ: ShortInt);
|
||||||
constructor Create(AX, AY: Word; AZ: ShortInt; ATileID: Word; AHue: Word;
|
constructor Create(AX, AY: Word; AZ: ShortInt; ATileID: Word; AHue: Word;
|
||||||
ANewZ: Word);
|
ANewZ: ShortInt);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
{ TMoveStaticPacket }
|
{ TMoveStaticPacket }
|
||||||
@@ -134,6 +135,12 @@ type
|
|||||||
constructor Create(AUsername: string);
|
constructor Create(AUsername: string);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
{ TChangePasswordPacket }
|
||||||
|
|
||||||
|
TChangePasswordPacket = class(TPacket)
|
||||||
|
constructor Create(AOldPassword, ANewPassword: String);
|
||||||
|
end;
|
||||||
|
|
||||||
{ TRequestRadarChecksumPacket }
|
{ TRequestRadarChecksumPacket }
|
||||||
|
|
||||||
TRequestRadarChecksumPacket = class(TPacket)
|
TRequestRadarChecksumPacket = class(TPacket)
|
||||||
@@ -164,13 +171,19 @@ var
|
|||||||
begin
|
begin
|
||||||
inherited Create($01, 0);
|
inherited Create($01, 0);
|
||||||
compBuffer := TEnhancedMemoryStream.Create;
|
compBuffer := TEnhancedMemoryStream.Create;
|
||||||
compStream := TCompressionStream.Create(clMax, compBuffer);
|
try
|
||||||
sourceStream := APacket.Stream;
|
compStream := TCompressionStream.Create(clMax, compBuffer);
|
||||||
compStream.CopyFrom(sourceStream, 0);
|
try
|
||||||
compStream.Free;
|
sourceStream := APacket.Stream;
|
||||||
FStream.WriteCardinal(sourceStream.Size);
|
compStream.CopyFrom(sourceStream, 0);
|
||||||
FStream.CopyFrom(compBuffer, 0);
|
finally
|
||||||
compBuffer.Free;
|
compStream.Free;
|
||||||
|
end;
|
||||||
|
FStream.WriteCardinal(sourceStream.Size);
|
||||||
|
FStream.CopyFrom(compBuffer, 0);
|
||||||
|
finally
|
||||||
|
compBuffer.Free;
|
||||||
|
end;
|
||||||
APacket.Free;
|
APacket.Free;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
@@ -197,7 +210,8 @@ end;
|
|||||||
constructor TRequestBlocksPacket.Create(ACoords: TBlockCoordsArray);
|
constructor TRequestBlocksPacket.Create(ACoords: TBlockCoordsArray);
|
||||||
begin
|
begin
|
||||||
inherited Create($04, 0);
|
inherited Create($04, 0);
|
||||||
FStream.Write(ACoords[0], Length(ACoords) * SizeOf(TBlockCoords));
|
if Length(ACoords) > 0 then
|
||||||
|
FStream.Write(ACoords[0], Length(ACoords) * SizeOf(TBlockCoords));
|
||||||
end;
|
end;
|
||||||
|
|
||||||
{ TFreeBlockPacket }
|
{ TFreeBlockPacket }
|
||||||
@@ -244,6 +258,12 @@ begin
|
|||||||
FStream.WriteWord(AHue);
|
FStream.WriteWord(AHue);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
constructor TInsertStaticPacket.Create(AStaticItem: TStaticItem);
|
||||||
|
begin
|
||||||
|
inherited Create($07, 10);
|
||||||
|
WriteStaticItem(AStaticItem);
|
||||||
|
end;
|
||||||
|
|
||||||
{ TDeleteStaticPacket }
|
{ TDeleteStaticPacket }
|
||||||
|
|
||||||
constructor TDeleteStaticPacket.Create(AStaticItem: TStaticItem);
|
constructor TDeleteStaticPacket.Create(AStaticItem: TStaticItem);
|
||||||
@@ -262,7 +282,7 @@ begin
|
|||||||
end;
|
end;
|
||||||
|
|
||||||
constructor TElevateStaticPacket.Create(AX, AY: Word; AZ: ShortInt;
|
constructor TElevateStaticPacket.Create(AX, AY: Word; AZ: ShortInt;
|
||||||
ATileID: Word; AHue: Word; ANewZ: Word);
|
ATileID: Word; AHue: Word; ANewZ: ShortInt);
|
||||||
begin
|
begin
|
||||||
inherited Create($09, 11);
|
inherited Create($09, 11);
|
||||||
FStream.WriteWord(AX);
|
FStream.WriteWord(AX);
|
||||||
@@ -346,6 +366,16 @@ begin
|
|||||||
FStream.WriteStringNull(AUsername);
|
FStream.WriteStringNull(AUsername);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
{ TChangePasswordPacket }
|
||||||
|
|
||||||
|
constructor TChangePasswordPacket.Create(AOldPassword, ANewPassword: String);
|
||||||
|
begin
|
||||||
|
inherited Create($0C, 0);
|
||||||
|
FStream.WriteByte($08);
|
||||||
|
FStream.WriteStringNull(AOldPassword);
|
||||||
|
FStream.WriteStringNull(ANewPassword);
|
||||||
|
end;
|
||||||
|
|
||||||
{ TRequestRadarChecksumPacket }
|
{ TRequestRadarChecksumPacket }
|
||||||
|
|
||||||
constructor TRequestRadarChecksumPacket.Create;
|
constructor TRequestRadarChecksumPacket.Create;
|
||||||
|
|||||||
@@ -30,10 +30,11 @@ unit UPlatformTypes;
|
|||||||
interface
|
interface
|
||||||
|
|
||||||
uses
|
uses
|
||||||
Classes, SysUtils, ActiveX;
|
Classes, SysUtils,
|
||||||
|
{$IFDEF WINDOWS}ActiveX{$ELSE}laz.FakeActiveX{$ENDIF};
|
||||||
|
|
||||||
type
|
type
|
||||||
IDataObject = ActiveX.IDataObject;
|
IDataObject = {$IFDEF WINDOWS}ActiveX{$ELSE}laz.FakeActiveX{$ENDIF}.IDataObject;
|
||||||
|
|
||||||
implementation
|
implementation
|
||||||
|
|
||||||
|
|||||||
@@ -1,105 +0,0 @@
|
|||||||
(*
|
|
||||||
* CDDL HEADER START
|
|
||||||
*
|
|
||||||
* The contents of this file are subject to the terms of the
|
|
||||||
* Common Development and Distribution License, Version 1.0 only
|
|
||||||
* (the "License"). You may not use this file except in compliance
|
|
||||||
* with the License.
|
|
||||||
*
|
|
||||||
* You can obtain a copy of the license at
|
|
||||||
* http://www.opensource.org/licenses/cddl1.php.
|
|
||||||
* See the License for the specific language governing permissions
|
|
||||||
* and limitations under the License.
|
|
||||||
*
|
|
||||||
* When distributing Covered Code, include this CDDL HEADER in each
|
|
||||||
* file and include the License file at
|
|
||||||
* http://www.opensource.org/licenses/cddl1.php. If applicable,
|
|
||||||
* add the following below this CDDL HEADER, with the fields enclosed
|
|
||||||
* by brackets "[]" replaced with your own identifying * information:
|
|
||||||
* Portions Copyright [yyyy] [name of copyright owner]
|
|
||||||
*
|
|
||||||
* CDDL HEADER END
|
|
||||||
*
|
|
||||||
*
|
|
||||||
* Portions Copyright 2009 Andreas Schneider
|
|
||||||
*)
|
|
||||||
unit UResourceManager;
|
|
||||||
|
|
||||||
{$mode objfpc}{$H+}
|
|
||||||
|
|
||||||
interface
|
|
||||||
|
|
||||||
uses
|
|
||||||
Classes, SysUtils;
|
|
||||||
|
|
||||||
type
|
|
||||||
|
|
||||||
{ TResourceManager }
|
|
||||||
|
|
||||||
TResourceManager = class
|
|
||||||
constructor Create(AFileName: string);
|
|
||||||
destructor Destroy; override;
|
|
||||||
protected
|
|
||||||
FFileStream: TFileStream;
|
|
||||||
FCount: Integer;
|
|
||||||
FLookupTable: array of Cardinal;
|
|
||||||
FCurrentResource: Integer;
|
|
||||||
FResourceStream: TMemoryStream;
|
|
||||||
public
|
|
||||||
function GetResource(AIndex: Integer): TStream;
|
|
||||||
end;
|
|
||||||
|
|
||||||
var
|
|
||||||
ResourceManager: TResourceManager;
|
|
||||||
|
|
||||||
implementation
|
|
||||||
|
|
||||||
{ TResourceManager }
|
|
||||||
|
|
||||||
constructor TResourceManager.Create(AFileName: string);
|
|
||||||
begin
|
|
||||||
inherited Create;
|
|
||||||
FFileStream := TFileStream.Create(AFileName, fmOpenRead or fmShareDenyWrite);
|
|
||||||
FFileStream.Position := 0;
|
|
||||||
FFileStream.Read(FCount, SizeOf(Integer));
|
|
||||||
SetLength(FLookupTable, FCount);
|
|
||||||
FFileStream.Read(FLookupTable[0], FCount * SizeOf(Cardinal));
|
|
||||||
FCurrentResource := -1;
|
|
||||||
end;
|
|
||||||
|
|
||||||
destructor TResourceManager.Destroy;
|
|
||||||
begin
|
|
||||||
FreeAndNil(FFileStream);
|
|
||||||
FreeAndNil(FResourceStream);
|
|
||||||
inherited Destroy;
|
|
||||||
end;
|
|
||||||
|
|
||||||
function TResourceManager.GetResource(AIndex: Integer): TStream;
|
|
||||||
var
|
|
||||||
size: Cardinal;
|
|
||||||
begin
|
|
||||||
if AIndex <> FCurrentResource then
|
|
||||||
begin
|
|
||||||
FFileStream.Position := FLookupTable[AIndex];
|
|
||||||
FResourceStream.Free;
|
|
||||||
FResourceStream := TMemoryStream.Create;
|
|
||||||
FFileStream.Read(size, SizeOf(Cardinal));
|
|
||||||
FResourceStream.CopyFrom(FFileStream, size);
|
|
||||||
FCurrentResource := AIndex;
|
|
||||||
end;
|
|
||||||
FResourceStream.Position := 0;
|
|
||||||
Result := FResourceStream;
|
|
||||||
end;
|
|
||||||
|
|
||||||
initialization
|
|
||||||
begin
|
|
||||||
ResourceManager := TResourceManager.Create(ChangeFileExt(ParamStr(0), '.dat'));
|
|
||||||
end;
|
|
||||||
|
|
||||||
finalization
|
|
||||||
begin
|
|
||||||
if ResourceManager <> nil then FreeAndNil(ResourceManager);
|
|
||||||
end;
|
|
||||||
|
|
||||||
end.
|
|
||||||
|
|
||||||
@@ -0,0 +1,111 @@
|
|||||||
|
(*
|
||||||
|
* CDDL HEADER START
|
||||||
|
*
|
||||||
|
* The contents of this file are subject to the terms of the
|
||||||
|
* Common Development and Distribution License, Version 1.0 only
|
||||||
|
* (the "License"). You may not use this file except in compliance with
|
||||||
|
* the License.
|
||||||
|
*
|
||||||
|
* You can obtain a copy of the license at
|
||||||
|
* http://www.opensource.org/licenses/cddl1.php.
|
||||||
|
* See the License for the specific language governing permissions and
|
||||||
|
* limitations under the License.
|
||||||
|
*
|
||||||
|
* When distributing Covered Code, include this CDDL HEADER in each
|
||||||
|
* file and include the License file at
|
||||||
|
* http://www.opensource.org/licenses/cddl1.php. If applicable,
|
||||||
|
* add the following below this CDDL HEADER, with the fields enclosed
|
||||||
|
* by brackets "[]" replaced with your own identifying * information:
|
||||||
|
* Portions Copyright [yyyy] [name of copyright owner]
|
||||||
|
*
|
||||||
|
* CDDL HEADER END
|
||||||
|
*
|
||||||
|
*
|
||||||
|
* Portions Copyright 2015 Andreas Schneider
|
||||||
|
*)
|
||||||
|
unit USelectionHelper;
|
||||||
|
|
||||||
|
{$mode objfpc}{$H+}
|
||||||
|
|
||||||
|
interface
|
||||||
|
|
||||||
|
uses
|
||||||
|
Classes, SysUtils;
|
||||||
|
|
||||||
|
type
|
||||||
|
TSelectedRangeCallback = procedure(AX1, AY1, AX2, AY2: Word) of object;
|
||||||
|
|
||||||
|
procedure SelectRange(ACallback: TSelectedRangeCallback);
|
||||||
|
|
||||||
|
implementation
|
||||||
|
|
||||||
|
uses
|
||||||
|
UfrmMain, UWorldItem, math;
|
||||||
|
|
||||||
|
type
|
||||||
|
{ TRangeSelectionHelper }
|
||||||
|
|
||||||
|
TRangeSelectionHelper = class
|
||||||
|
constructor Create(ACallback: TSelectedRangeCallback);
|
||||||
|
destructor Destroy; override;
|
||||||
|
protected
|
||||||
|
FCallback: TSelectedRangeCallback;
|
||||||
|
FHasFirst: Boolean;
|
||||||
|
FX1, FY1: Word;
|
||||||
|
procedure TileSelected(AWorldItem: TWorldItem);
|
||||||
|
procedure Finish(AX2, AY2: Word);
|
||||||
|
public
|
||||||
|
procedure Run;
|
||||||
|
end;
|
||||||
|
|
||||||
|
var
|
||||||
|
ActiveHelper: TRangeSelectionHelper = nil;
|
||||||
|
|
||||||
|
procedure SelectRange(ACallback: TSelectedRangeCallback);
|
||||||
|
begin
|
||||||
|
FreeAndNil(ActiveHelper);
|
||||||
|
ActiveHelper := TRangeSelectionHelper.Create(ACallback);
|
||||||
|
ActiveHelper.Run;
|
||||||
|
end;
|
||||||
|
|
||||||
|
{ TRangeSelectionHelper }
|
||||||
|
|
||||||
|
constructor TRangeSelectionHelper.Create(ACallback: TSelectedRangeCallback);
|
||||||
|
begin
|
||||||
|
FCallback := ACallback;
|
||||||
|
FHasFirst := False;
|
||||||
|
end;
|
||||||
|
|
||||||
|
destructor TRangeSelectionHelper.Destroy;
|
||||||
|
begin
|
||||||
|
if frmMain <> nil then
|
||||||
|
frmMain.UnregisterSelectionListener(@TileSelected);
|
||||||
|
inherited Destroy;
|
||||||
|
end;
|
||||||
|
|
||||||
|
procedure TRangeSelectionHelper.TileSelected(AWorldItem: TWorldItem);
|
||||||
|
begin
|
||||||
|
if not FHasFirst then
|
||||||
|
begin
|
||||||
|
FHasFirst := True;
|
||||||
|
FX1 := AWorldItem.X;
|
||||||
|
FY1 := AWorldItem.Y;
|
||||||
|
end else
|
||||||
|
Finish(AWorldItem.X, AWorldItem.Y);
|
||||||
|
end;
|
||||||
|
|
||||||
|
procedure TRangeSelectionHelper.Finish(AX2, AY2: Word);
|
||||||
|
begin
|
||||||
|
FCallback(Min(FX1, AX2), Min(FY1, AY2), Max(FX1, AX2), Max(FY1, AY2));
|
||||||
|
if ActiveHelper = Self then
|
||||||
|
ActiveHelper := nil;
|
||||||
|
Free;
|
||||||
|
end;
|
||||||
|
|
||||||
|
procedure TRangeSelectionHelper.Run;
|
||||||
|
begin
|
||||||
|
frmMain.RegisterSelectionListener(@TileSelected);
|
||||||
|
frmMain.SwitchToSelection;
|
||||||
|
end;
|
||||||
|
|
||||||
|
end.
|
||||||
@@ -0,0 +1,189 @@
|
|||||||
|
unit UUoaDesigns;
|
||||||
|
|
||||||
|
{$mode ObjFPC}{$H+}
|
||||||
|
{$modeSwitch advancedRecords}
|
||||||
|
|
||||||
|
interface
|
||||||
|
|
||||||
|
uses
|
||||||
|
Classes, SysUtils, Generics.Collections, UStatics;
|
||||||
|
|
||||||
|
type
|
||||||
|
|
||||||
|
{ TUoaDesignHeader }
|
||||||
|
|
||||||
|
TUoaDesignHeader = record
|
||||||
|
Name: String;
|
||||||
|
Category: String;
|
||||||
|
Subcategory: String;
|
||||||
|
Width: Int32;
|
||||||
|
Height: Int32;
|
||||||
|
UserWidth: Int32;
|
||||||
|
UserHeight: Int32;
|
||||||
|
FilePosition: Int64;
|
||||||
|
TileCount: Int32;
|
||||||
|
public
|
||||||
|
constructor CreateFromStream(AStream: TStream);
|
||||||
|
end;
|
||||||
|
|
||||||
|
{ TUoaDesignHeaders }
|
||||||
|
|
||||||
|
TUoaDesignHeaders = class(specialize TList<TUoaDesignHeader>)
|
||||||
|
constructor CreateFromStream(AStream: TStream);
|
||||||
|
end;
|
||||||
|
|
||||||
|
TUoaDesign = class
|
||||||
|
private
|
||||||
|
FHeader: TUoaDesignHeader;
|
||||||
|
FTiles: TStaticItemList;
|
||||||
|
|
||||||
|
constructor Create(AHeader: TUoaDesignHeader; AData: TStream);
|
||||||
|
public
|
||||||
|
property Header: TUoaDesignHeader read FHeader;
|
||||||
|
property Tiles: TStaticItemList read Ftiles;
|
||||||
|
|
||||||
|
destructor Destroy; override;
|
||||||
|
end;
|
||||||
|
|
||||||
|
{ TUoaDesigns }
|
||||||
|
|
||||||
|
TUoaDesigns = class
|
||||||
|
private
|
||||||
|
FHeaders: TUoaDesignHeaders;
|
||||||
|
FData: TFileStream;
|
||||||
|
public
|
||||||
|
constructor Create(AIdxFile, ABinFile: String);
|
||||||
|
destructor Destroy; override;
|
||||||
|
|
||||||
|
function LoadDesign(AHeader: TUoaDesignHeader): TUoaDesign;
|
||||||
|
public
|
||||||
|
property Headers: TUoaDesignHeaders read FHeaders;
|
||||||
|
end;
|
||||||
|
|
||||||
|
implementation
|
||||||
|
|
||||||
|
uses
|
||||||
|
Math;
|
||||||
|
|
||||||
|
function ReadString(AStream: TStream): String;
|
||||||
|
var
|
||||||
|
nonNullFlag: Byte;
|
||||||
|
length: Byte;
|
||||||
|
begin
|
||||||
|
nonNullFlag := AStream.ReadByte;
|
||||||
|
if nonNullFlag = 1 then
|
||||||
|
begin
|
||||||
|
length := AStream.ReadByte;
|
||||||
|
SetLength(Result, length);
|
||||||
|
if length > 0 then
|
||||||
|
AStream.Read(PChar(Result)^, length);
|
||||||
|
end;
|
||||||
|
end;
|
||||||
|
|
||||||
|
{ TUoaDesign }
|
||||||
|
|
||||||
|
constructor TUoaDesign.Create(AHeader: TUoaDesignHeader; AData: TStream);
|
||||||
|
var
|
||||||
|
i: Integer;
|
||||||
|
tile: TStaticItem;
|
||||||
|
version: Int32;
|
||||||
|
|
||||||
|
function ReadInt: Int32;
|
||||||
|
begin
|
||||||
|
AData.Read(Result, SizeOf(Result));
|
||||||
|
end;
|
||||||
|
|
||||||
|
begin
|
||||||
|
FHeader := AHeader;
|
||||||
|
FTiles := TStaticItemList.Create(True);
|
||||||
|
AData.Seek(FHeader.FilePosition, soFromBeginning);
|
||||||
|
for i := 0 to FHeader.TileCount - 1 do
|
||||||
|
begin
|
||||||
|
AData.Read(version, SizeOf(version));
|
||||||
|
if (version < 0) or (version > 1) then
|
||||||
|
raise Exception.Create('Unsupported binary version');
|
||||||
|
|
||||||
|
tile := TStaticItem.Create(nil);
|
||||||
|
tile.TileID := EnsureRange(ReadInt, 0, $FFFF);
|
||||||
|
tile.X := EnsureRange(ReadInt, 0, $FFFF);
|
||||||
|
tile.Y := EnsureRange(ReadInt, 0, $FFFF);
|
||||||
|
tile.Z := EnsureRange(ReadInt, -128, 127);
|
||||||
|
ReadInt; // Level; unused
|
||||||
|
|
||||||
|
if version = 1 then
|
||||||
|
tile.Hue := EnsureRange(ReadInt, 0, $FFFF);
|
||||||
|
|
||||||
|
FTiles.Add(tile);
|
||||||
|
end;
|
||||||
|
end;
|
||||||
|
|
||||||
|
destructor TUoaDesign.Destroy;
|
||||||
|
begin
|
||||||
|
FTiles.Free;
|
||||||
|
inherited Destroy;
|
||||||
|
end;
|
||||||
|
|
||||||
|
{ TUoaDesignHeaders }
|
||||||
|
|
||||||
|
constructor TUoaDesignHeaders.CreateFromStream(AStream: TStream);
|
||||||
|
var
|
||||||
|
headerCount, version: Int32;
|
||||||
|
i: Integer;
|
||||||
|
begin
|
||||||
|
AStream.Read(headerCount, SizeOf(headerCount));
|
||||||
|
AStream.Read(version, SizeOf(version));
|
||||||
|
|
||||||
|
if version <> 0 then
|
||||||
|
raise Exception.Create('Unknown UOA design index version');
|
||||||
|
|
||||||
|
inherited Create;
|
||||||
|
|
||||||
|
for i := 0 to headerCount-1 do
|
||||||
|
Add(TUoaDesignHeader.CreateFromStream(AStream));
|
||||||
|
end;
|
||||||
|
|
||||||
|
{ TUoaDesignHeader }
|
||||||
|
|
||||||
|
constructor TUoaDesignHeader.CreateFromStream(AStream: TStream);
|
||||||
|
begin
|
||||||
|
Name := ReadString(AStream);
|
||||||
|
Category := ReadString(AStream);
|
||||||
|
Subcategory := ReadString(AStream);
|
||||||
|
AStream.Read(Width, SizeOf(Width));
|
||||||
|
AStream.Read(Height, SizeOf(Height));
|
||||||
|
AStream.Read(UserWidth, SizeOf(UserWidth));
|
||||||
|
AStream.Read(UserHeight, SizeOf(UserHeight));
|
||||||
|
AStream.Read(FilePosition, SizeOf(FilePosition));
|
||||||
|
AStream.Read(TileCount, SizeOf(TileCount));
|
||||||
|
end;
|
||||||
|
|
||||||
|
{ TUoaDesigns }
|
||||||
|
|
||||||
|
constructor TUoaDesigns.Create(AIdxFile, ABinFile: String);
|
||||||
|
var
|
||||||
|
idxStream: TFileStream;
|
||||||
|
begin
|
||||||
|
idxStream := TFileStream.Create(AIdxFile, fmOpenRead);
|
||||||
|
try
|
||||||
|
FHeaders := TUoaDesignHeaders.CreateFromStream(idxStream);
|
||||||
|
finally
|
||||||
|
idxStream.Free;
|
||||||
|
end;
|
||||||
|
|
||||||
|
FData := TFileStream.Create(ABinFile, fmOpenRead);
|
||||||
|
end;
|
||||||
|
|
||||||
|
destructor TUoaDesigns.Destroy;
|
||||||
|
begin
|
||||||
|
Headers.Free;
|
||||||
|
FData.Free;
|
||||||
|
inherited Destroy;
|
||||||
|
end;
|
||||||
|
|
||||||
|
function TUoaDesigns.LoadDesign(AHeader: TUoaDesignHeader): TUoaDesign;
|
||||||
|
begin
|
||||||
|
Result := TUoaDesign.Create(AHeader, FData);
|
||||||
|
end;
|
||||||
|
|
||||||
|
end.
|
||||||
|
|
||||||
@@ -2,10 +2,11 @@ object dmNetwork: TdmNetwork
|
|||||||
OnCreate = DataModuleCreate
|
OnCreate = DataModuleCreate
|
||||||
OnDestroy = DataModuleDestroy
|
OnDestroy = DataModuleDestroy
|
||||||
OldCreateOrder = False
|
OldCreateOrder = False
|
||||||
Height = 300
|
Height = 375
|
||||||
HorizontalOffset = 290
|
HorizontalOffset = 363
|
||||||
VerticalOffset = 171
|
VerticalOffset = 214
|
||||||
Width = 400
|
Width = 500
|
||||||
|
PPI = 120
|
||||||
object TCPClient: TLTCPComponent
|
object TCPClient: TLTCPComponent
|
||||||
Port = 0
|
Port = 0
|
||||||
OnReceive = TCPClientReceive
|
OnReceive = TCPClientReceive
|
||||||
@@ -14,15 +15,15 @@ object dmNetwork: TdmNetwork
|
|||||||
OnConnect = TCPClientConnect
|
OnConnect = TCPClientConnect
|
||||||
Timeout = 0
|
Timeout = 0
|
||||||
ReuseAddress = False
|
ReuseAddress = False
|
||||||
left = 40
|
Left = 50
|
||||||
top = 24
|
Top = 30
|
||||||
end
|
end
|
||||||
object tmNoOp: TTimer
|
object tmNoOp: TTimer
|
||||||
Enabled = False
|
Enabled = False
|
||||||
Interval = 30000
|
Interval = 30000
|
||||||
OnTimer = tmNoOpTimer
|
OnTimer = tmNoOpTimer
|
||||||
OnStartTimer = tmNoOpStartTimer
|
OnStartTimer = tmNoOpStartTimer
|
||||||
left = 112
|
Left = 140
|
||||||
top = 24
|
Top = 30
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
+34
-5
@@ -78,7 +78,8 @@ uses
|
|||||||
UGameResources, UfrmAccountControl, UfrmEditAccount, UfrmDrawSettings,
|
UGameResources, UfrmAccountControl, UfrmEditAccount, UfrmDrawSettings,
|
||||||
UfrmBoundaries, UfrmElevateSettings, UfrmConfirmation, UfrmMoveSettings,
|
UfrmBoundaries, UfrmElevateSettings, UfrmConfirmation, UfrmMoveSettings,
|
||||||
UfrmAbout, UfrmHueSettings, UfrmRadar, UfrmLargeScaleCommand,
|
UfrmAbout, UfrmHueSettings, UfrmRadar, UfrmLargeScaleCommand,
|
||||||
UfrmVirtualLayer, UfrmFilter, UfrmRegionControl, UfrmLightlevel;
|
UfrmVirtualLayer, UfrmFilter, UfrmRegionControl, UfrmLightlevel,
|
||||||
|
UfrmChangePassword, Logging;
|
||||||
|
|
||||||
{$I version.inc}
|
{$I version.inc}
|
||||||
|
|
||||||
@@ -97,7 +98,6 @@ procedure TdmNetwork.DataModuleDestroy(Sender: TObject);
|
|||||||
begin
|
begin
|
||||||
FreeAndNil(FSendQueue);
|
FreeAndNil(FSendQueue);
|
||||||
FreeAndNil(FReceiveQueue);
|
FreeAndNil(FReceiveQueue);
|
||||||
FreeAndNil(PacketHandlers[$02]);
|
|
||||||
end;
|
end;
|
||||||
|
|
||||||
procedure TdmNetwork.TCPClientConnect(aSocket: TLSocket);
|
procedure TdmNetwork.TCPClientConnect(aSocket: TLSocket);
|
||||||
@@ -163,6 +163,7 @@ procedure TdmNetwork.OnConnectionHandlingPacket(ABuffer: TEnhancedMemoryStream);
|
|||||||
var
|
var
|
||||||
subID: Byte;
|
subID: Byte;
|
||||||
loginState: TLoginState;
|
loginState: TLoginState;
|
||||||
|
levelByte: Byte;
|
||||||
width, height: Word;
|
width, height: Word;
|
||||||
serverState: TServerState;
|
serverState: TServerState;
|
||||||
begin
|
begin
|
||||||
@@ -189,10 +190,19 @@ begin
|
|||||||
frmInitialize.Repaint;
|
frmInitialize.Repaint;
|
||||||
frmInitialize.lblStatus.Repaint;
|
frmInitialize.lblStatus.Repaint;
|
||||||
Application.ProcessMessages;
|
Application.ProcessMessages;
|
||||||
FAccessLevel := TAccessLevel(ABuffer.ReadByte);
|
levelByte := ABuffer.ReadByte;
|
||||||
|
if levelByte in [0, 1, 2, 255] then
|
||||||
|
FAccessLevel := TAccessLevel(accessLevel)
|
||||||
|
else
|
||||||
|
FAccessLevel := alNone;
|
||||||
InitGameResourceManager(FDataDir);
|
InitGameResourceManager(FDataDir);
|
||||||
width := ABuffer.ReadWord;
|
width := ABuffer.ReadWord;
|
||||||
height := ABuffer.ReadWord;
|
height := ABuffer.ReadWord;
|
||||||
|
if (width = 0) or (height = 0) then
|
||||||
|
begin
|
||||||
|
Disconnect;
|
||||||
|
Exit;
|
||||||
|
end;
|
||||||
ResMan.InitLandscape(width, height);
|
ResMan.InitLandscape(width, height);
|
||||||
ResMan.Landscape.UpdateWriteMap(ABuffer);
|
ResMan.Landscape.UpdateWriteMap(ABuffer);
|
||||||
|
|
||||||
@@ -212,6 +222,7 @@ begin
|
|||||||
frmVirtualLayer := TfrmVirtualLayer.Create(frmMain);
|
frmVirtualLayer := TfrmVirtualLayer.Create(frmMain);
|
||||||
frmLightlevel := TfrmLightlevel.Create(frmMain);
|
frmLightlevel := TfrmLightlevel.Create(frmMain);
|
||||||
frmAbout := TfrmAbout.Create(frmMain);
|
frmAbout := TfrmAbout.Create(frmMain);
|
||||||
|
frmChangePassword := TfrmChangePassword.Create(frmMain);
|
||||||
frmMain.Show;
|
frmMain.Show;
|
||||||
frmInitialize.Hide;
|
frmInitialize.Hide;
|
||||||
tmNoOp.Enabled := True;
|
tmNoOp.Enabled := True;
|
||||||
@@ -263,16 +274,33 @@ begin
|
|||||||
size := packetHandler.PacketLength;
|
size := packetHandler.PacketLength;
|
||||||
if size = 0 then
|
if size = 0 then
|
||||||
begin
|
begin
|
||||||
if FReceiveQueue.Size > 5 then
|
if FReceiveQueue.Size >= 5 then
|
||||||
size := FReceiveQueue.ReadCardinal
|
size := FReceiveQueue.ReadCardinal
|
||||||
else
|
else
|
||||||
Break; //wait for more data
|
Break; //wait for more data
|
||||||
end;
|
end;
|
||||||
|
if (size < 5) or (size > 32 * 1024 * 1024) then
|
||||||
|
begin
|
||||||
|
Disconnect;
|
||||||
|
FReceiveQueue.Clear;
|
||||||
|
Exit;
|
||||||
|
end;
|
||||||
|
|
||||||
if FReceiveQueue.Size >= size then
|
if FReceiveQueue.Size >= size then
|
||||||
begin
|
begin
|
||||||
FReceiveQueue.Lock(FReceiveQueue.Position, size - FReceiveQueue.Position); //prevent handler from reading too much
|
FReceiveQueue.Lock(FReceiveQueue.Position, size - FReceiveQueue.Position); //prevent handler from reading too much
|
||||||
packetHandler.Process(FReceiveQueue);
|
try
|
||||||
|
packetHandler.Process(FReceiveQueue);
|
||||||
|
except
|
||||||
|
on E: Exception do
|
||||||
|
begin
|
||||||
|
Logger.Send([lcClient, lcError], 'Packet handler exception: %s', [E.Message]);
|
||||||
|
FReceiveQueue.Unlock;
|
||||||
|
Disconnect;
|
||||||
|
FReceiveQueue.Clear;
|
||||||
|
Exit;
|
||||||
|
end;
|
||||||
|
end;
|
||||||
FReceiveQueue.Unlock;
|
FReceiveQueue.Unlock;
|
||||||
FReceiveQueue.Dequeue(size);
|
FReceiveQueue.Dequeue(size);
|
||||||
end else
|
end else
|
||||||
@@ -308,6 +336,7 @@ begin
|
|||||||
FreeAndNil(frmLargeScaleCommand);
|
FreeAndNil(frmLargeScaleCommand);
|
||||||
FreeAndNil(frmRadarMap);
|
FreeAndNil(frmRadarMap);
|
||||||
FreeAndNil(frmLightlevel);
|
FreeAndNil(frmLightlevel);
|
||||||
|
FreeAndNil(frmChangePassword);
|
||||||
|
|
||||||
if frmMain <> nil then
|
if frmMain <> nil then
|
||||||
begin
|
begin
|
||||||
|
|||||||
+73
-65
@@ -1,143 +1,151 @@
|
|||||||
object frmAbout: TfrmAbout
|
object frmAbout: TfrmAbout
|
||||||
Left = 290
|
Left = 290
|
||||||
Height = 308
|
Height = 579
|
||||||
Top = 171
|
Top = 171
|
||||||
Width = 354
|
Width = 388
|
||||||
AutoSize = True
|
AutoSize = True
|
||||||
BorderIcons = [biSystemMenu]
|
BorderIcons = [biSystemMenu]
|
||||||
BorderStyle = bsDialog
|
BorderStyle = bsDialog
|
||||||
Caption = 'About CentrED'
|
Caption = 'About CentrED'
|
||||||
ClientHeight = 308
|
ClientHeight = 579
|
||||||
ClientWidth = 354
|
ClientWidth = 388
|
||||||
Font.Height = -11
|
DesignTimePPI = 120
|
||||||
|
Font.Height = -18
|
||||||
OnCreate = FormCreate
|
OnCreate = FormCreate
|
||||||
Position = poScreenCenter
|
Position = poScreenCenter
|
||||||
LCLVersion = '0.9.29'
|
|
||||||
object Label3: TLabel
|
object Label3: TLabel
|
||||||
Left = 8
|
Left = 12
|
||||||
Height = 53
|
Height = 182
|
||||||
Top = 189
|
Top = 334
|
||||||
Width = 338
|
Width = 364
|
||||||
Align = alTop
|
Align = alTop
|
||||||
BorderSpacing.Top = 16
|
BorderSpacing.Top = 25
|
||||||
BorderSpacing.Around = 8
|
BorderSpacing.Around = 12
|
||||||
Caption = 'Ultima(tm) Online (c) 1997 Electronic Arts Inc. Ultima, the UO logo, Are You With Us?, ORIGIN, the ORIGIN logo and We create worlds are trademarks or registered trademarks of Electronic Arts Inc. in the U.S. and/or other countries. All rights reserved.'
|
Caption = 'Ultima™ Online © 1997 Electronic Arts Inc. Ultima, the UO logo, Are You With Us?, ORIGIN, the ORIGIN logo and We create worlds are trademarks or registered trademarks of Electronic Arts Inc. in the U.S. and/or other countries. All rights reserved.'
|
||||||
|
Color = clDefault
|
||||||
ParentColor = False
|
ParentColor = False
|
||||||
WordWrap = True
|
WordWrap = True
|
||||||
end
|
end
|
||||||
object Label5: TLabel
|
object Label5: TLabel
|
||||||
Left = 8
|
Left = 12
|
||||||
Height = 14
|
Height = 26
|
||||||
Top = 98
|
Top = 167
|
||||||
Width = 338
|
Width = 364
|
||||||
Align = alTop
|
Align = alTop
|
||||||
BorderSpacing.Left = 8
|
BorderSpacing.Left = 12
|
||||||
BorderSpacing.Right = 8
|
BorderSpacing.Right = 12
|
||||||
Caption = 'It is using the following great components:'
|
Caption = 'It is using the following great components:'
|
||||||
|
Color = clDefault
|
||||||
ParentColor = False
|
ParentColor = False
|
||||||
end
|
end
|
||||||
object Label6: TLabel
|
object Label6: TLabel
|
||||||
Left = 16
|
Left = 25
|
||||||
Height = 53
|
Height = 104
|
||||||
Top = 112
|
Top = 193
|
||||||
Width = 330
|
Width = 351
|
||||||
Align = alTop
|
Align = alTop
|
||||||
BorderSpacing.Left = 16
|
BorderSpacing.Left = 25
|
||||||
BorderSpacing.Right = 8
|
BorderSpacing.Right = 12
|
||||||
Caption = '- Vampyre Imaging Lib by Marek Mauder'#13#10'- lNet by Ales Katona and Micha Nelissen'#13#10'- VirtualTrees by Mike Lischke'#13#10'- Silk Icons by Mark James'
|
Caption = '- Vampyre Imaging Lib by Marek Mauder'#13#10'- lNet by Ales Katona and Micha Nelissen'#13#10'- VirtualTrees by Mike Lischke'#13#10'- Silk Icons by Mark James'
|
||||||
|
Color = clDefault
|
||||||
ParentColor = False
|
ParentColor = False
|
||||||
end
|
end
|
||||||
object Label7: TLabel
|
object Label7: TLabel
|
||||||
Left = 8
|
Left = 12
|
||||||
Height = 14
|
Height = 52
|
||||||
Top = 84
|
Top = 115
|
||||||
Width = 338
|
Width = 364
|
||||||
Align = alTop
|
Align = alTop
|
||||||
BorderSpacing.Left = 8
|
BorderSpacing.Left = 12
|
||||||
BorderSpacing.Right = 8
|
BorderSpacing.Right = 12
|
||||||
Caption = 'CentrED has been developed using Lazarus and FreePascal.'
|
Caption = 'CentrED has been developed using Lazarus and FreePascal.'
|
||||||
|
Color = clDefault
|
||||||
ParentColor = False
|
ParentColor = False
|
||||||
WordWrap = True
|
WordWrap = True
|
||||||
end
|
end
|
||||||
object Panel2: TPanel
|
object Panel2: TPanel
|
||||||
Left = 0
|
Left = 0
|
||||||
Height = 76
|
Height = 103
|
||||||
Top = 0
|
Top = 0
|
||||||
Width = 354
|
Width = 388
|
||||||
Align = alTop
|
Align = alTop
|
||||||
AutoSize = True
|
AutoSize = True
|
||||||
BorderSpacing.Bottom = 8
|
BorderSpacing.Bottom = 12
|
||||||
BevelOuter = bvNone
|
BevelOuter = bvNone
|
||||||
ClientHeight = 76
|
ClientHeight = 103
|
||||||
ClientWidth = 354
|
ClientWidth = 388
|
||||||
TabOrder = 0
|
TabOrder = 0
|
||||||
object Panel1: TPanel
|
object Panel1: TPanel
|
||||||
Left = 0
|
Left = 0
|
||||||
Height = 76
|
Height = 103
|
||||||
Top = 0
|
Top = 0
|
||||||
Width = 167
|
Width = 307
|
||||||
AutoSize = True
|
AutoSize = True
|
||||||
BevelInner = bvRaised
|
BevelInner = bvRaised
|
||||||
BevelOuter = bvLowered
|
BevelOuter = bvLowered
|
||||||
ClientHeight = 76
|
ClientHeight = 103
|
||||||
ClientWidth = 167
|
ClientWidth = 307
|
||||||
TabOrder = 0
|
TabOrder = 0
|
||||||
object Label1: TLabel
|
object Label1: TLabel
|
||||||
Left = 2
|
Left = 2
|
||||||
Height = 38
|
Height = 60
|
||||||
Top = 2
|
Top = 2
|
||||||
Width = 163
|
Width = 303
|
||||||
Align = alTop
|
Align = alTop
|
||||||
Alignment = taCenter
|
Alignment = taCenter
|
||||||
AutoSize = False
|
AutoSize = False
|
||||||
Caption = 'UO CentrED'
|
Caption = 'UO CentrED'
|
||||||
Font.Height = -29
|
Color = clDefault
|
||||||
|
Font.Height = -45
|
||||||
Font.Style = [fsBold]
|
Font.Style = [fsBold]
|
||||||
Layout = tlCenter
|
Layout = tlCenter
|
||||||
ParentColor = False
|
ParentColor = False
|
||||||
ParentFont = False
|
ParentFont = False
|
||||||
end
|
end
|
||||||
object lblVersion: TLabel
|
object lblVersion: TLabel
|
||||||
Left = 6
|
Left = 8
|
||||||
Height = 14
|
Height = 1
|
||||||
Top = 40
|
Top = 62
|
||||||
Width = 155
|
Width = 291
|
||||||
Align = alTop
|
Align = alTop
|
||||||
Alignment = taRightJustify
|
Alignment = taRightJustify
|
||||||
BorderSpacing.Left = 4
|
BorderSpacing.Left = 6
|
||||||
BorderSpacing.Right = 4
|
BorderSpacing.Right = 6
|
||||||
|
Color = clDefault
|
||||||
ParentColor = False
|
ParentColor = False
|
||||||
end
|
end
|
||||||
object lblCopyright: TLabel
|
object lblCopyright: TLabel
|
||||||
Left = 6
|
Left = 8
|
||||||
Height = 14
|
Height = 26
|
||||||
Top = 58
|
Top = 69
|
||||||
Width = 155
|
Width = 291
|
||||||
Align = alTop
|
Align = alTop
|
||||||
Alignment = taCenter
|
Alignment = taCenter
|
||||||
BorderSpacing.Around = 4
|
BorderSpacing.Around = 6
|
||||||
|
Caption = 'Copyright 2022 Andreas Schneider'
|
||||||
|
Color = clDefault
|
||||||
ParentColor = False
|
ParentColor = False
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
object Panel3: TPanel
|
object Panel3: TPanel
|
||||||
Left = 8
|
Left = 12
|
||||||
Height = 25
|
Height = 39
|
||||||
Top = 250
|
Top = 528
|
||||||
Width = 338
|
Width = 364
|
||||||
Align = alTop
|
Align = alTop
|
||||||
BorderSpacing.Around = 8
|
BorderSpacing.Around = 12
|
||||||
BevelOuter = bvNone
|
BevelOuter = bvNone
|
||||||
ClientHeight = 25
|
ClientHeight = 39
|
||||||
ClientWidth = 338
|
ClientWidth = 364
|
||||||
TabOrder = 1
|
TabOrder = 1
|
||||||
object btnClose: TButton
|
object btnClose: TButton
|
||||||
Left = 263
|
Left = 246
|
||||||
Height = 25
|
Height = 39
|
||||||
Top = 0
|
Top = 0
|
||||||
Width = 75
|
Width = 118
|
||||||
Align = alRight
|
Align = alRight
|
||||||
BorderSpacing.InnerBorder = 4
|
BorderSpacing.InnerBorder = 6
|
||||||
Caption = 'Close'
|
Caption = 'Close'
|
||||||
OnClick = btnCloseClick
|
OnClick = btnCloseClick
|
||||||
TabOrder = 0
|
TabOrder = 0
|
||||||
|
|||||||
@@ -21,7 +21,7 @@
|
|||||||
* CDDL HEADER END
|
* CDDL HEADER END
|
||||||
*
|
*
|
||||||
*
|
*
|
||||||
* Portions Copyright 2007 Andreas Schneider
|
* Portions Copyright 2012 Andreas Schneider
|
||||||
*)
|
*)
|
||||||
unit UfrmAbout;
|
unit UfrmAbout;
|
||||||
|
|
||||||
@@ -62,7 +62,8 @@ var
|
|||||||
|
|
||||||
implementation
|
implementation
|
||||||
|
|
||||||
{$I version.inc}
|
uses
|
||||||
|
vinfo;
|
||||||
|
|
||||||
{ TfrmAbout }
|
{ TfrmAbout }
|
||||||
|
|
||||||
@@ -73,8 +74,8 @@ end;
|
|||||||
|
|
||||||
procedure TfrmAbout.FormCreate(Sender: TObject);
|
procedure TfrmAbout.FormCreate(Sender: TObject);
|
||||||
begin
|
begin
|
||||||
lblVersion.Caption := Format('Version %s', [ProductVersion]);
|
lblVersion.Caption := Format('Version %s', [VersionInfo.GetProductVersionString]);
|
||||||
lblCopyright.Caption := Format('Copyright %s', [Copyright]);
|
lblCopyright.Caption := VersionInfo.GetCopyright(True);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
initialization
|
initialization
|
||||||
|
|||||||
+179
-288
@@ -1,26 +1,24 @@
|
|||||||
object frmAccountControl: TfrmAccountControl
|
object frmAccountControl: TfrmAccountControl
|
||||||
Left = 290
|
Left = 290
|
||||||
Height = 378
|
Height = 472
|
||||||
Top = 171
|
Top = 171
|
||||||
Width = 369
|
Width = 542
|
||||||
ActiveControl = vstAccounts
|
ActiveControl = vstAccounts
|
||||||
BorderIcons = [biSystemMenu]
|
BorderIcons = [biSystemMenu]
|
||||||
BorderStyle = bsDialog
|
BorderStyle = bsDialog
|
||||||
Caption = 'Account Management'
|
Caption = 'Account Management'
|
||||||
ClientHeight = 378
|
ClientHeight = 472
|
||||||
ClientWidth = 369
|
ClientWidth = 542
|
||||||
Font.Height = -11
|
Font.Height = -14
|
||||||
OnClose = FormClose
|
OnClose = FormClose
|
||||||
OnCreate = FormCreate
|
OnCreate = FormCreate
|
||||||
OnDestroy = FormDestroy
|
OnDestroy = FormDestroy
|
||||||
OnShow = FormShow
|
OnShow = FormShow
|
||||||
Position = poOwnerFormCenter
|
Position = poOwnerFormCenter
|
||||||
LCLVersion = '0.9.29'
|
|
||||||
object tbMain: TToolBar
|
object tbMain: TToolBar
|
||||||
Left = 0
|
Left = 0
|
||||||
Height = 26
|
|
||||||
Top = 0
|
Top = 0
|
||||||
Width = 369
|
Width = 542
|
||||||
Caption = 'tbMain'
|
Caption = 'tbMain'
|
||||||
Images = ilToolbar
|
Images = ilToolbar
|
||||||
TabOrder = 0
|
TabOrder = 0
|
||||||
@@ -30,352 +28,245 @@ object frmAccountControl: TfrmAccountControl
|
|||||||
Top = 2
|
Top = 2
|
||||||
Caption = 'Refresh'
|
Caption = 'Refresh'
|
||||||
ImageIndex = 0
|
ImageIndex = 0
|
||||||
|
OnClick = tbRefreshClick
|
||||||
ParentShowHint = False
|
ParentShowHint = False
|
||||||
ShowHint = True
|
ShowHint = True
|
||||||
OnClick = tbRefreshClick
|
|
||||||
end
|
end
|
||||||
object tbAddUser: TToolButton
|
object tbAddUser: TToolButton
|
||||||
Left = 32
|
Left = 35
|
||||||
Hint = 'Add User'
|
Hint = 'Add User'
|
||||||
Top = 2
|
Top = 2
|
||||||
Caption = 'Add User'
|
Caption = 'Add User'
|
||||||
ImageIndex = 1
|
ImageIndex = 1
|
||||||
|
OnClick = tbAddUserClick
|
||||||
ParentShowHint = False
|
ParentShowHint = False
|
||||||
ShowHint = True
|
ShowHint = True
|
||||||
OnClick = tbAddUserClick
|
|
||||||
end
|
end
|
||||||
object tbEditUser: TToolButton
|
object tbEditUser: TToolButton
|
||||||
Left = 55
|
Left = 64
|
||||||
Hint = 'Edit User'
|
Hint = 'Edit User'
|
||||||
Top = 2
|
Top = 2
|
||||||
Caption = 'Edit User'
|
Caption = 'Edit User'
|
||||||
ImageIndex = 2
|
ImageIndex = 2
|
||||||
|
OnClick = tbEditUserClick
|
||||||
ParentShowHint = False
|
ParentShowHint = False
|
||||||
ShowHint = True
|
ShowHint = True
|
||||||
OnClick = tbEditUserClick
|
|
||||||
end
|
end
|
||||||
object tbDeleteUser: TToolButton
|
object tbDeleteUser: TToolButton
|
||||||
Left = 78
|
Left = 93
|
||||||
Hint = 'Delete User'
|
Hint = 'Delete User'
|
||||||
Top = 2
|
Top = 2
|
||||||
Caption = 'Delete User'
|
Caption = 'Delete User'
|
||||||
ImageIndex = 3
|
ImageIndex = 3
|
||||||
|
OnClick = tbDeleteUserClick
|
||||||
ParentShowHint = False
|
ParentShowHint = False
|
||||||
ShowHint = True
|
ShowHint = True
|
||||||
OnClick = tbDeleteUserClick
|
|
||||||
end
|
end
|
||||||
object tbSeparator1: TToolButton
|
object tbSeparator1: TToolButton
|
||||||
Left = 24
|
Left = 30
|
||||||
|
Height = 28
|
||||||
Top = 2
|
Top = 2
|
||||||
Width = 8
|
|
||||||
Caption = 'tbSeparator1'
|
Caption = 'tbSeparator1'
|
||||||
Style = tbsDivider
|
Style = tbsDivider
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
object vstAccounts: TVirtualStringTree
|
object vstAccounts: TLazVirtualStringTree
|
||||||
|
AnchorSideLeft.Control = Owner
|
||||||
|
AnchorSideTop.Control = tbMain
|
||||||
|
AnchorSideTop.Side = asrBottom
|
||||||
|
AnchorSideRight.Control = Owner
|
||||||
|
AnchorSideRight.Side = asrBottom
|
||||||
|
AnchorSideBottom.Control = Owner
|
||||||
|
AnchorSideBottom.Side = asrBottom
|
||||||
Left = 0
|
Left = 0
|
||||||
Height = 352
|
Height = 440
|
||||||
Top = 26
|
Top = 32
|
||||||
Width = 369
|
Width = 542
|
||||||
Align = alClient
|
Anchors = [akTop, akLeft, akRight, akBottom]
|
||||||
DefaultText = 'Node'
|
DefaultText = 'Node'
|
||||||
Header.AutoSizeIndex = 1
|
Header.AutoSizeIndex = 1
|
||||||
Header.Columns = <
|
Header.Columns = <
|
||||||
item
|
item
|
||||||
Position = 0
|
Position = 0
|
||||||
Width = 30
|
Width = 38
|
||||||
end
|
end
|
||||||
item
|
item
|
||||||
Position = 1
|
Position = 1
|
||||||
Text = 'Username'
|
Text = 'Username'
|
||||||
Width = 200
|
Width = 250
|
||||||
end
|
end
|
||||||
item
|
item
|
||||||
Position = 2
|
Position = 2
|
||||||
Text = 'Accesslevel'
|
Text = 'Accesslevel'
|
||||||
Width = 100
|
Width = 125
|
||||||
|
end
|
||||||
|
item
|
||||||
|
Options = [coAllowClick, coDraggable, coEnabled, coParentBidiMode, coParentColor, coShowDropMark, coVisible, coFixed, coAllowFocus]
|
||||||
|
Position = 3
|
||||||
|
Text = 'Restricted'
|
||||||
|
Width = 94
|
||||||
end>
|
end>
|
||||||
Header.DefaultHeight = 17
|
Header.DefaultHeight = 21
|
||||||
Header.Options = [hoColumnResize, hoDrag, hoVisible]
|
Header.Height = 21
|
||||||
|
Header.Options = [hoColumnResize, hoDrag, hoShowSortGlyphs, hoVisible]
|
||||||
Header.ParentFont = True
|
Header.ParentFont = True
|
||||||
Header.Style = hsFlatButtons
|
Header.Style = hsFlatButtons
|
||||||
|
HintMode = hmHint
|
||||||
Images = ilAccesslevel
|
Images = ilAccesslevel
|
||||||
|
ParentShowHint = False
|
||||||
|
ShowHint = True
|
||||||
TabOrder = 1
|
TabOrder = 1
|
||||||
TreeOptions.AutoOptions = [toAutoScrollOnExpand, toAutoTristateTracking, toAutoDeleteMovedNodes]
|
TreeOptions.AutoOptions = [toAutoScrollOnExpand, toAutoSort, toAutoTristateTracking, toAutoDeleteMovedNodes]
|
||||||
TreeOptions.MiscOptions = [toFullRepaintOnResize, toInitOnSave, toToggleOnDblClick, toWheelPanning]
|
TreeOptions.MiscOptions = [toFullRepaintOnResize, toInitOnSave, toToggleOnDblClick, toWheelPanning]
|
||||||
TreeOptions.PaintOptions = [toShowButtons, toShowDropmark, toThemeAware, toUseBlendedImages]
|
TreeOptions.PaintOptions = [toShowButtons, toShowDropmark, toThemeAware, toUseBlendedImages]
|
||||||
TreeOptions.SelectionOptions = [toFullRowSelect]
|
TreeOptions.SelectionOptions = [toFullRowSelect]
|
||||||
|
OnCompareNodes = vstAccountsCompareNodes
|
||||||
OnDblClick = vstAccountsDblClick
|
OnDblClick = vstAccountsDblClick
|
||||||
OnFreeNode = vstAccountsFreeNode
|
OnFreeNode = vstAccountsFreeNode
|
||||||
OnGetText = vstAccountsGetText
|
OnGetText = vstAccountsGetText
|
||||||
OnGetImageIndex = vstAccountsGetImageIndex
|
OnGetImageIndex = vstAccountsGetImageIndex
|
||||||
|
OnGetHint = vstAccountsGetHint
|
||||||
|
OnHeaderClick = vstAccountsHeaderClick
|
||||||
end
|
end
|
||||||
object ilToolbar: TImageList
|
object ilToolbar: TImageList
|
||||||
left = 144
|
Left = 180
|
||||||
Bitmap = {
|
Bitmap = {
|
||||||
4C69040000001000000010000000000000000000000000000000000000000000
|
4C7A0400000010000000100000004E0500000000000078DAED95794C94671087
|
||||||
0000000000000000000000000000000000000000000000000000000000000000
|
6DD4BFDA946263521B1314B1822926F588A957700B2A725A51ACC8B9805B111B
|
||||||
0000000000000000000000000000000000000000000000000000000000000000
|
2982802087B0B0DC9453103CD045411450904350411014E5D8A24D6B50EBD168
|
||||||
00000000000000000000000000000000000047994FFF419149FF000000000000
|
C413D044F7E9B79B4841D05DFFB069132799ECB7D9F799996FE6FDED8C1AF5FE
|
||||||
0000000000000000000000000000000000000000000000000000000000005BB4
|
6D69960D8B93CDD1E6ACC3310F561F76C6F6C05A2C725762966E854B810487BD
|
||||||
65FF56AD5FFF50A65AFF4B9E53FF45964DFF60A868FF5BA262FF347E3AFF0000
|
6ECC0E99F7C6184E951202EA2388694921B52D87B4F65C922E6511773E156973
|
||||||
000000000000000000000000000000000000000000005EB968FF79C383FF89CA
|
22A10D52ACD3EC98E6FDF5B018EBCAD713D99C40B6229FC48B99A45CDA49FC85
|
||||||
92FF94D09CFF95D19EFF90CF99FF8CCB94FF87C98FFF80C487FF4E9554FF276D
|
34A25B9288688C25A4219280D3DB591A6F89BEC7D461FC96BA10323BF6907A29
|
||||||
2CFF000000000000000000000000000000005CB667FF85C98EFF9BD4A4FF8FCE
|
87A8A6789CE41E7C1B65A2AE7786DF2CCC936C308B5DCE24B1C130D6AED089D0
|
||||||
98FF92CF9AFF8DCC95FF88CA90FF83C68BFF7EC485FF79C17FFF478D4CFF2265
|
FA1875BE8806190B634D991BB168C8B9299ED3D0739D32E2BB5BED59C5ABFECE
|
||||||
25FF0000000000000000000000000000000075BF7EFF98D2A1FF94CF9CFF86C7
|
8F1631277401EF6B8EDAE6129FDA8473F58621BFBD9A65546302D1C23C7E2AF3
|
||||||
8DFF5EA765FF398640FF347E3AFF2E7633FF49904FFF458B4AFF206324FF0000
|
53F7E675D6ADD69BA0A648FCCF84A1EA8DF53E7BCCB357202EF222A23E563DCB
|
||||||
000000000000000000000000000054AB5EFF80C389FF8DCC95FF83C48AFF3D8B
|
F0C6186C33560F635D6A3612D01041EE65B97A96191D7943661978265C3D4BC7
|
||||||
44FF37833EFF000000000000000000000000236627FF1F6123FF000000000000
|
7C315F794D67A4BBF7F3C96DA4B7E7A96799D89A8EAC2599C8A658026BC3F038
|
||||||
00000000000000000000000000004DA155FF47994FFF419149FF3B8842FF3580
|
BC118B941518488CDED86355BD9E4737E17A483230CB994173F9DA77E688776F
|
||||||
3CFF000000000000000000000000000000000000000000000000000000000000
|
247BD5DF51FF631BB72C9ECF2C92D05926435714CCF8590E5ABF8FAE753AE3D6
|
||||||
0000000000000000000000000000000000000000000000000000000000000000
|
640B9E85EECA5FD0592EE5D3459BF97C8685C6183A16190297273032742CA4E8
|
||||||
00000000000000000000000000000000000000000000000000004DA155FF4799
|
0A3EDE3292718BB7A0336B9D46FE934552B6659C40567193CD39E7186FB28909
|
||||||
4FFF419149FF3B8842FF35803CFF000000000000000000000000000000000000
|
A63EE89B79A13BDF5323AFE794CD6F7FF59371F61109D5B7D87EB09D98E3DDB4
|
||||||
000063C06EFF5FBB6AFF0000000000000000000000004B9E53FF45964DFF86C6
|
76F7304522D7C84F7748E1404B0F8517EE226FEBA34070F5736B0FC66E3B35F2
|
||||||
8EFF88C98FFF6FB376FF2E7633FF0000000000000000000000000000000062BE
|
1B164C65B6B79C9C0BCF38A2E857FBFE4B7DCCF62D46B2C858235FB36C224F6F
|
||||||
6DFF7BC785FF77C281FF54AB5EFF4EA357FF499B51FF63AC6BFF83C38BFF87C9
|
28B00E3A88555081DA55CF4FBAEAA95D32F1AD7C83A51E7D37BBE0663E287CA0
|
||||||
8FFF82C689FF509756FF0000000000000000000000000000000060BC6CFF79C4
|
F94738258672678A0BB7E292E1834D8227A208FB61716476A6BC385708ED9928
|
||||||
83FF9ED7A7FF9BD4A4FF97D29FFF92CF9AFF8DCC95FF88CA90FF7AC282FF7EC4
|
9BBC51D6495056BAA32C71429EED8A6B6118698A6354DD6E63437522C689F64C
|
||||||
85FF5DA463FF266B2AFF000000000000000000000000000000005BB465FF73BD
|
F09AAB8E63B8ED225BCBEE52969B0A152E423E31CA525794458E28F7FFC0F268
|
||||||
7CFF96D19FFF94CF9CFF8FCD96FF8ACA91FF85C78BFF7ABE81FF65AD6CFF4B92
|
47923A4B48E92A41651E3571ACAF491CE08D82DB09AFEA21CF730DBDD53BA0C8
|
||||||
51FF246829FF0000000000000000000000000000000000000000000000004EA3
|
0165C15A947BED51E6ACE49B204B7214E50CB6B48ED2015E6553035A897275A5
|
||||||
57FF66B06EFF61AA68FF3D8B44FF37833EFF327B37FF2C7432FF276D2CFF0000
|
CE658E50B790BBD26DC0F537CDC3AD2A16972AA99A75A9940EC93FD8CA6C27B1
|
||||||
0000000000000000000000000000000000000000000000000000000000000000
|
DB448F4366FA142DD1A7D0549F75F6C618C6ADC4BD2A5E9D57F5A9FA3E12FF26
|
||||||
0000419149FF3B8842FF00000000000000000000000000000000000000000000
|
539D7DDD3F68FFDFD7FE9AFD57882CF99D25BBDA7817ED1BEEA8C0BFF60EC73A
|
||||||
0000000000000000000000000000000000000000000000000000000000000000
|
1E72EB8970453B1EB02CAE096DB43F43564748E73D4AFF7C4EECA93B1477F6D1
|
||||||
0000000000000000000000000000000000000000000000000000000000000000
|
70ED059E799D68D2BE28AE8A60450F0D7D2FD978B50FEF96FB88F75DC631BB03
|
||||||
0000000000000000000000000000000000000000000000000000000000000000
|
4DDAAFAB8E22A0B387A6FE9738FFD18BC38D7E02BB1E6392D58D26ED1F9587E2
|
||||||
0000000000000000000000000000000000000000000000000000000000000000
|
7FFE8E9A7512D8B5D7FB09523C6249B20289A7CF003F92F6CBF605E377A29333
|
||||||
0000000000000000000000000000000000000000000000000000000000000000
|
42CDE2EE7E1C6F3C13EA78C8D2B42B6C29BD8B91EF3F7D7B5DFBF2145F02CB7F
|
||||||
00000000000012488DFF104B90FF0F488AFF11427DFF15335BFF000000000000
|
25A9A29D55CD3771E8EE656BDB7D56A47790EEEE4844CD03A6FBB70CA97FB0F6
|
||||||
0000000000000000000000000000000000000000000000000000000000000000
|
BF8B39C4B5C760B7F30A5F06D6629E7916F3E80A72EC4404BA7B3323E422DE7B
|
||||||
0000114E96FF12589BFF125899FF115393FF0F4A87FF0E3E71FF132E4BFF0000
|
3B47BC4B2AED1BBB8791DAF49CE4E6E72C8E6C668A5B3E31E60B29B531D04A43
|
||||||
0000000000000000000000000000000000000000000000000000000000000F4B
|
BA0B5761E82C15729E44145FC387FDFF61FFFF17F67F5AD26E8C1C4F335654CD
|
||||||
97FF12589FFF0F4A8AFF0F4B87FF114B87FF154C85FF124175FF0F335CFF0000
|
C76647DF69FFA785C7B2D0F722F1C7FB39D1A5C4A7A01763AF96B7FE070CDEFF
|
||||||
0000000000000000000000000000000000000000000000000000000000000C3E
|
06B68502DB87550AE8FAC3E4283091DD63B469A556FB7FACA886E256E590FDFF
|
||||||
87FF7C97B8FF8AB7E4FF719CC8FF15406EFF194472FF22456BFF113B66FF0000
|
C5F6078C11D568B5FFF5BE3F8278D7538181517ECF04EF61B4E43AA3CD2AB5DA
|
||||||
0000000000000000000000000000000000000000000000000000000000001F5E
|
FFCE96BE4C133732D9FF366303EEF291FB55C6589D7C676DABF2A96A1E9CF76F
|
||||||
9BFFD9E8F7FF97C5F1FF8EBBE5FF7FA9D1FF89B5DFFFCDDFEEFF2368A7FF0000
|
3E77AC68
|
||||||
0000000000000000000000000000000000000000000000000000000000002A5B
|
|
||||||
92FFA6CAEEFFABCCEAFFA7D0F6FFA8D0F6FFABCCEAFFA7CDEEFF2D629AFF0000
|
|
||||||
0000000000000000000000000000000000000000000000000000000000006A3C
|
|
||||||
25FF346DA7FF9CCCF8FFAFD4F7FFAFD4F7FFA5CFF6FF3474AEFF683E2DFF0000
|
|
||||||
000000000000000000000000000000000000000000000000000000000000BC48
|
|
||||||
1CFFF4E2D4FF4E7BA9FF4D7BA8FF4D7BA8FF4E7BA9FFF3D6C3FFBE461CFF0000
|
|
||||||
0000000000000000000000000000000000000000000000000000C44C1FFFF6E4
|
|
||||||
D6FFFFE4A4FFFFD472FFFFC969FFFFC063FFFFB65FFFAEAB78FF609772FF4F8E
|
|
||||||
66FF428357FF000000000000000000000000000000008A5444FFFCC8ABFFFFD1
|
|
||||||
98FFFEC76DFFFEBF68FFFEB964FFFEB15EFFA79B61FF61AB81FF95D4B4FFBAE6
|
|
||||||
D0FF6ABB8FFF2D8F57FF196B37FF00000000287CCEFF78B3EAFFB39E94FFFFB7
|
|
||||||
60FFFFB663FFFEB261FFFEAC5DFFFEA559FF4A885DFF90D3B1FF92D6B1FFFFFF
|
|
||||||
FFFF65BC8CFF67BC8FFF196B37FF00000000297DD1FF82BAEEFF9F6658FFF5BB
|
|
||||||
84FFFFAC5BFFFEA85AFFFEA257FFFE9C53FF317B4CFF9CD4B6FFFFFFFFFFFFFF
|
|
||||||
FFFFFFFFFFFF95D2B2FF196B37FF00000000000000002579CDFF866161FFBF60
|
|
||||||
35FFFEB961FFFEB962FFFEB962FFFEB962FF226E3AFF62BA8BFF60BA87FFFFFF
|
|
||||||
FFFF60B987FF67BC8FFF196B37FF00000000000000000000000000000000B350
|
|
||||||
20FFA0401FFFAA4522FFAC4622FFAB4422FF5C572DFF288C53FF64BA8DFF95D2
|
|
||||||
B2FF64BA8DFF288C53FF196B37FF000000000000000000000000000000000000
|
|
||||||
00000000000000000000000000000000000000000000196B37FF196B37FF196B
|
|
||||||
37FF196B37FF196B37FF00000000000000000000000000000000000000000000
|
|
||||||
0000000000000000000000000000000000000000000000000000000000000000
|
|
||||||
0000000000000000000000000000000000000000000000000000000000000000
|
|
||||||
000012488DFF104B90FF0F488AFF11427DFF15335BFF00000000000000000000
|
|
||||||
000000000000000000000000000000000000000000000000000000000000114E
|
|
||||||
96FF12589BFF125899FF115393FF0F4A87FF0E3E71FF132E4BFF000000000000
|
|
||||||
00000000000000000000000000000000000000000000000000000F4B97FF1258
|
|
||||||
9FFF0F4A8AFF0F4B87FF114B87FF154C85FF124175FF0F335CFF000000000000
|
|
||||||
00000000000000000000000000000000000000000000000000000C3E87FF7C97
|
|
||||||
B8FF8AB7E4FF719CC8FF15406EFF194472FF22456BFF113B66FF000000000000
|
|
||||||
00000000000000000000000000000000000000000000000000001F5E9BFFD9E8
|
|
||||||
F7FF97C5F1FF8EBBE5FF7FA9D1FF89B5DFFFCDDFEEFF2368A7FF0000000058A5
|
|
||||||
D8FF85B1DBFF469DD0FF000000000000000000000000000000002A5B92FFA6CA
|
|
||||||
EEFFABCCEAFFA7D0F6FFA8D0F6FFABCCEAFFA7CDEEFF2884B7FF77BEE7FFB4D2
|
|
||||||
F0FFE5F3FFFFACD2EFFF488CC7FF0000000000000000000000006A3C25FF346D
|
|
||||||
A7FF9CCCF8FFAFD4F7FFAFD4F7FFA5CFF6FF2E8ABFFF7ED3EBFFB2E3F9FF8BC0
|
|
||||||
E7FFAED3F6FFC4E0FCFF669FD3FF000000000000000000000000BC481CFFF4E2
|
|
||||||
D4FF4E7BA9FF4D7BA8FF4D7BA8FF428CBAFF7DD4EEFFC4F6FDFF6CDDF6FF6DCA
|
|
||||||
EDFF63A3D7FF5D9BD2FF000000000000000000000000C44C1FFFF6E4D6FFFFE4
|
|
||||||
A4FFFFD472FFFFC969FFBFBB86FF79D3EEFFC7F7FDFF5FDCF5FF5BE2F7FF7AD6
|
|
||||||
F2FF4099DFFF0000000000000000000000008A5444FFFCC8ABFFFFD198FFFEC7
|
|
||||||
6DFFFEBF68FFB0A780FF77CBE7FFC7F7FDFF5EDCF5FF5AE1F7FF7BD4F1FF4691
|
|
||||||
D4FF686672FF0000000000000000287CCEFF78B3EAFFB39E94FFFFB760FFFFB6
|
|
||||||
63FFB3A37DFF76B8D3FFC2F6FDFF63DFF7FF5DE2F8FF79D3F0FF4795D8FF75B2
|
|
||||||
EAFF2974C7FF0000000000000000297DD1FF82BAEEFF9F6658FFF5BB84FFA792
|
|
||||||
74FF7AB6D5FF90B7D1FF55C9E4FF5BDFF5FF78D0EDFF5196D2FF96645DFF83BC
|
|
||||||
EFFF2A77CAFF0000000000000000000000002579CDFF866161FFBF6035FF4389
|
|
||||||
AAFFE0F2FFFF549AD8FF1A7ABEFF4998C5FF4988B7FF9C5442FF7A646DFF2E7E
|
|
||||||
CEFF6DA2D3FF0000000000000000000000000000000000000000B35020FF2D64
|
|
||||||
81FF94C7F9FF91C9F9FF4185C9FF2362A4FF89493DFFB24F24FF000000000000
|
|
||||||
000000000000000000000000000000000000000000000000000000000000113D
|
|
||||||
55FF285F87FF4988BDFF428DBCFF000000000000000000000000000000000000
|
|
||||||
0000000000000000000000000000000000000000000000000000000000000000
|
|
||||||
0000000000000000000000000000000000000000000000000000000000000000
|
|
||||||
0000000000000000000000000000000000000000000000000000000000000000
|
|
||||||
00000000000012488DFF104B90FF0F488AFF11427DFF15335BFF000000000000
|
|
||||||
0000000000000000000000000000000000000000000000000000000000000000
|
|
||||||
0000114E96FF12589BFF125899FF115393FF0F4A87FF0E3E71FF132E4BFF0000
|
|
||||||
0000000000000000000000000000000000000000000000000000000000000F4B
|
|
||||||
97FF12589FFF0F4A8AFF0F4B87FF114B87FF154C85FF124175FF0F335CFF0000
|
|
||||||
0000000000000000000000000000000000000000000000000000000000000C3E
|
|
||||||
87FF7C97B8FF8AB7E4FF719CC8FF15406EFF194472FF22456BFF113B66FF0000
|
|
||||||
0000000000000000000000000000000000000000000000000000000000001F5E
|
|
||||||
9BFFD9E8F7FF97C5F1FF8EBBE5FF7FA9D1FF89B5DFFFCDDFEEFF2368A7FF0000
|
|
||||||
0000000000000000000000000000000000000000000000000000000000002A5B
|
|
||||||
92FFA6CAEEFFABCCEAFFA7D0F6FFA8D0F6FFABCCEAFFA7CDEEFF2D629AFF0000
|
|
||||||
0000000000000000000000000000000000000000000000000000000000006A3C
|
|
||||||
25FF346DA7FF9CCCF8FFAFD4F7FFAFD4F7FFA5CFF6FF3474AEFF683E2DFF0000
|
|
||||||
000000000000000000000000000000000000000000000000000000000000BC48
|
|
||||||
1CFFF4E2D4FF4E7BA9FF4D7BA8FF4D7BA8FF4E7BA9FFF3D6C3FFBE461CFF0000
|
|
||||||
0000000000000000000000000000000000000000000000000000C44C1FFFF6E4
|
|
||||||
D6FFFFE4A4FFFFD472FFFFC969FFFFC063FFFFB65FFF9590A0FF295DC1FF0542
|
|
||||||
BBFF0B45B0FF000000000000000000000000000000008A5444FFFCC8ABFFFFD1
|
|
||||||
98FFFEC76DFFFEBF68FFFEB964FFFEB15EFF95828BFF3D74CEFF8DB5F7FFB8D6
|
|
||||||
FEFF72A8F5FF2D6BCAFF0000000000000000287CCEFF78B3EAFFB39E94FFFFB7
|
|
||||||
60FFFFB663FFFEB261FFFEAC5DFFFEA559FF2450ABFF8DB5F6FF4D92FFFF1177
|
|
||||||
FFFF2186FFFF408AEBFF0344B9FF00000000297DD1FF82BAEEFF9F6658FFF5BB
|
|
||||||
84FFFFAC5BFFFEA85AFFFEA257FFFE9C53FF0542BCFFAECDFEFFFFFFFFFFFFFF
|
|
||||||
FFFFFFFFFFFF187FEFFF0442BCFF00000000000000002579CDFF866161FFBF60
|
|
||||||
35FFFEB961FFFEB962FFFEB962FFFEB962FF1F52AFFF639DF4FF187FFFFF0076
|
|
||||||
F8FF0076EEFF0368E1FF0345B9FF00000000000000000000000000000000B350
|
|
||||||
20FFA0401FFFAA4522FFAC4622FFAB4422FF5F4C74FF2763C6FF2177E6FF0579
|
|
||||||
EAFF0164DDFF044DBDFF00000000000000000000000000000000000000000000
|
|
||||||
00000000000000000000000000000000000000000000000000000345B9FF0442
|
|
||||||
BCFF0345B9FF0000000000000000
|
|
||||||
}
|
}
|
||||||
end
|
end
|
||||||
object ilAccesslevel: TImageList
|
object ilAccesslevel: TImageList
|
||||||
left = 176
|
Left = 230
|
||||||
Bitmap = {
|
Bitmap = {
|
||||||
4C69040000001000000010000000000000000000000000000000000000000000
|
4C7A060000001000000010000000BB0A00000000000078DAD597075454571AC7
|
||||||
0000A3A3A3FFA0A0A0FF9D9D9DFF9A9A9AFF979797FF949494FF000000000000
|
B39288214643DA2611DDEC3131C608B1031154547487DE46040686A6088A18CA
|
||||||
000000000000000000000000000000000000000000000000000000000000A2A2
|
C0209D418A14471064A477A48820550441442074AC5905414D2C341731A038FF
|
||||||
A2FFBCBCBCFFCACACAFFCCCCCCFFCACACAFFC2C2C2FFADADADFF8C8C8CFF0000
|
BDEFB9B0BAD4E4247B76DF39FFF3EE9B777FDF77EFF7DEFFDD3B6FBC31FE484C
|
||||||
0000000000000000000000000000000000000000000000000000A1A1A1FFC4C4
|
4C445C5C1CA2A3A321100810111181B0B030BC318323212101A5A5A5A8ABAB43
|
||||||
C4FFBEBEBEFFA1A1A1FF969696FF939393FF979797FFAEAEAEFFAEAEAEFF8484
|
7D7D3D7DAEACAC44565616020303A78C111F1F8FAAAA2A949595816A87878723
|
||||||
84FF000000000000000000000000000000000000000000000000BABABAFFBFBF
|
343494CE9F9D9D4D8BC7E34D1AA3A4A404E5E5E5387EFCF8B83EBEBEBE484B4B
|
||||||
BFFF989898FF00000000000000000000000000000000878787FFA8A8A8FF9E9E
|
434C4CCC843C35572A379577B2F8FEFEFE484F4F0797CB1DD727323212D5D5D5
|
||||||
9EFF00000000000000000000000000000000000000009D9D9DFFC4C4C4FFA1A1
|
53D6C9D5D515191919E07038AFF531B9D009BFB834F0F97C04070743BFF82698
|
||||||
A1FF000000000000000000000000000000000000000000000000898989FFA9A9
|
451DD0CC6F87EAE95B6064DDC4B6B46B707272A2D95D6E415819797D2C867165
|
||||||
A9FF797979FF00000000000000000000000000000000999999FFC6C6C6FF9494
|
276A0746F0C3C00B5C7E2AC4B5A7C0F527C0ED21A083E8C741A0E1F1082A7B9E
|
||||||
94FF0000000000000000000000000000000000000000000000007D7D7DFFABAB
|
E1DCA397FA26F4EA18CF2ABF8D1AC23B740CC3FFA71738F63320B8079CEC05D2
|
||||||
ABFF767676FF00000000000000000000000061C3E1FF88A0A8FF919191FF8E8E
|
7A80C83B80FD9561E8D50F40BDE631CE3E78862F82AE8CF13BCF76E012896F73
|
||||||
8EFF5AB9DCFF55B8DFFF51B5DEFF4DB1DDFF49ADDCFF46A8D7FF787878FF7676
|
73183BCEF6C0E45C1F4E90186B53BAA09CD489235D2073780099A43B6054F5A3
|
||||||
76FF657E8DFF3199D8FF000000000000000060C2E1FFC9F3FCFFCBF3FDFFD4F6
|
E8FE3016F95D1EE3B50BDB51DD3F02AB1B4370E97A8123F749CE07C0AAD80EE8
|
||||||
FEFFD7F6FFFFD8F4FFFFE0F8FFFFDFF8FFFFDAF5FFFFCDF1FCFFC2EDFAFFBDEB
|
1CCE4500E1AD9A87A171F131B655F4A3E0E7617CE2DD36C6ABE5DEC285BEE7D8
|
||||||
FAFFBDEBFAFF2B93D6FF00000000000000005CBFE0FFC8F3FCFF75DFF9FF89E6
|
7575082A05DDD027F98F3D025644DC82AA5706789D8042FA0312AF139BCBFA70
|
||||||
FDFF95E7FFFF9AE5FFFFAAEEFFFFA8EDFFFF99E3FFFF74D5F9FF59CCF3FF4FC8
|
E6DE303E706B1DE3A9FA56F43E07BBED17ECFBFB08DCC9DC43C8BC23FE018492
|
||||||
F1FFBBE9FAFF248DD5FF000000000000000058BBDFFFC7F1FCFF6FDCF9FF56BB
|
B34B0760503F846D84952BE945DE9D61CCE3B68CF15BD2FE8EF2EEE7D06B1A84
|
||||||
EDFF61BDEFFF9BE7FFFF35A6E2FF4BA4E1FF90E2FFFF49ADE9FF38A4E3FF49C4
|
424E37D44AFAA05FD907E3EA3EB0AAFAC898FA209DFC1396093A2153D48BD377
|
||||||
F0FFB8E8F9FF1E88D4FF000000000000000053B7DEFFC6F0FCFF6AD9F8FF7CE2
|
86F0B643F3182F9FF8234AC933297D3482F25E21AAC9B36B24CFADED19D04CCE
|
||||||
FDFF90E8FFFF99E9FFFF329FDFFF548BB2FF8AE2FFFF6AD0F9FF50C5F1FF46C1
|
97C8384A1E8C20EFEE3072BA8668BDF57DD318BF2EFA06FD3E2C0FBB86A547AE
|
||||||
F0FFB6E7F9FF1883D3FF00000000000000004EB2DDFFC3EFFBFF65D6F8FF4CB6
|
6271E015BABE9FF1DAF091472BC45D5AE8F18A719A216AD784370F34E14FFB1B
|
||||||
ECFF5ABDEFFF95EBFFFF3097DDFF4D82ABFF84E1FFFF41A9E9FF329FE1FF42BE
|
67E4E7DF72EC30DC830F363AE3DD0DAE982BC7C1FBB29650DB6136A37C6C334B
|
||||||
EFFFB4E5F9FF137ED2FF000000000000000049ADDCFFC1EEFBFF5FD3F7FF6CDB
|
2C557585A44938E633FCB0DC38147337D86181BC31F48CA68F21ADC5C597FA14
|
||||||
FCFF7FE5FFFF8FEDFFFF97F2FFFF93EDFFFF7CDFFFFF5BCCF8FF46BEEFFF3CBA
|
C3C1173A3E9847D8254C1E3EDE60890F57684CCB8BAFB3C032E5EFA1E21083F5
|
||||||
EEFFB3E3F9FF0E79D1FF000000000000000043A8DBFFBFECFBFF59CFF5FF41B0
|
66C1105F6B80A55A072121AB87F75631A7E53FF99B134E14B620B1B607B117EF
|
||||||
ECFF4EBAEFFF5AC2EFFF60C6EFFF5CC4EFFF4CB6EFFF37A5E6FF2A9AE1FF38B8
|
C33EBE019E39B7109ED788CF54DCA6E557188620A5AE1719F50F91DAFC146944
|
||||||
EEFFB1E3F8FF0975D0FF00000000000000003DA3DAFFBCEBFAFFBCEBFCFFBFEE
|
74BBA11752A682697979797928D8C4208ABCAFA72EFF422BB9E9291438299096
|
||||||
FEFFC6F4FFFFCEF8FFFFD3FAFFFFD0F8FFFFC7F2FFFFBAE9FCFFB3E4F9FFB0E2
|
969E92673018505656A6BF9F2C160B4C97445A2A2A2AF46F6A6A6A747B22D6D1
|
||||||
F8FFB0E2F8FF0571CFFF0000000000000000369DD9FF3199D8FF2C94D7FF2890
|
D191BE47F5A1BED77A7A7AF4B72E3939193A3A3A3874E8104C4D4DA1A4A43421
|
||||||
D6FF238CD5FF1E88D4FF1A84D3FF1580D2FF117CD1FF0E79D1FF0A76D0FF0773
|
6F666686A4A424686868404B4B0B060606282A2A42454505747575A1AAAA0A7D
|
||||||
CFFF0470CFFF016ECEFF00000000000000000000000000000000000000000000
|
7D7DB8B9B9C1D8D8F8B5184B5D1AE194F710CECECEF0F6F6A6FB181A1A829A0F
|
||||||
0000000000000000000000000000000000000000000000000000000000000000
|
3526269309737373B0D96C585B5BC3ADA8075FDB5F1A8BF1B56B0BBC88AFA9FB
|
||||||
0000000000000000000000000000000000000000000000000000000000000000
|
212121741C6A3E545F6A3EB6B6B6B0B1B1A1D71E2A9677691F9639D6BD36862F
|
||||||
0000565D68FF133F7AFF0D3E7DFF0C3C76FF123969FF4E5663FF000000000000
|
B90D30323282BABA3ADD8F928787073D776A4CD435357745454548B935C23AA1
|
||||||
0000000000000000000000000000000000000000000000000000000000005F63
|
0D933D3F6AAED4D8B76FDF4E8B62A8B38C8CCCEFEE5900BFBB16C7375F147179
|
||||||
69FF284D7DFF2D6196FF0F4988FF2C6093FF0C3E73FF1B3D60FF595E63FF0000
|
88591E3D98E5DC0D11DB9FF1B9A0B67926EC97292D6745A37A2012DEF75241BD
|
||||||
0000000000000000000000000000000000000000000000000000000000003752
|
98E5DA8DB75CEE607162C3A5E978B1548AEDA799591E243725CF4710B1B98B37
|
||||||
79FF255A93FF0C3E76FF245485FF0E3E73FF265584FF163E69FF143050FF0000
|
D92D988E17D9FF104649B50828BC8BD5C5F720B2AF036FDA77E12D875B10B1B8
|
||||||
0000000000000000000000000000000000000000000000000000000000001136
|
01797EC9FCA9F80516E98FCF5DEBA3FD1F4DFC2F7BE121742E7623E5463F24EC
|
||||||
67FF2A4B71FF4C759EFF3B638EFF11355BFF28527BFF1C3959FF103255FF0000
|
8A06ADE25A674FC52F610BEA26F3BFA4A9A07E2A56D9EAF8DC6526C7DABFB1CD
|
||||||
0000000000000000000000000000000000000000000000000000000000001848
|
1FE7FFE54E2558C10ABAA5667EF883895825CBE3E2F27B630B677B5E4115595F
|
||||||
78FF9BB7D1FFA3C9EDFF9FC5E8FF74A1CDFF81B0DDFF96B3CEFF1A4C7EFF0000
|
567AD741D1359716D5CEBC3288D99E97B17E4F54F9E63D824F5F65F5CDBD6669
|
||||||
000000000000000000000000000000000000000000000000000000000000305D
|
08DAE3E6F8DE44C95DB26E5E0358E781ED85C0BA1C21969C1442B5588813D785
|
||||||
8FFFA6CAEEFFABCCEAFFA7D0F6FFA8D0F6FFABCCEAFFA7CDEEFF2E629AFF0000
|
98CBBB8A4DBBC2CE6CB188101BE537D9A4468A86F6C3BE16B0AB7DC9C9E402DF
|
||||||
0000000000000000000000000000000000000000000000000000000000003D3D
|
64029FA70AF169C233BC1FF51472B9424865BE80447017E4AC62534779E2FF11
|
||||||
3DFF416F9EFF9CCCF8FFAFD4F7FFAFD4F7FFA5CFF6FF4176A6FF373737FF0000
|
CAFF0B9346B02403B4FE9A268404B9FE73DC30C409FB4EC40044F9DD784F3038
|
||||||
0000000000000000000000000000000000000000000000000000494949FF4B4B
|
EAFF67A33CF1BF90F2FF6C727F6B01B028E9393E4B18C647B143103F31888F63
|
||||||
4BFF989898FF5C5C5CFF557CA3FF557CA3FF4C4C4CFF989898FF4E4E4EFF4C4C
|
7FC187518374EE7901EDA3FE178EF2C4CB5CE2FFE76F1F7988D97EEDF89AE49F
|
||||||
4CFF0000000000000000000000000000000000000000777777FF4C4C4CFF4E4E
|
48A2BC1B78C7B38DF2FF1061BC5FADA1655AC7BBEB5DAB24650E9CEC5CE8D524
|
||||||
4EFF979797FF595959FFABABABFFA5A5A5FF545454FF868686FF626262FF4A4A
|
9CCFBB0231AFAB449731CFB3159FBA3708256D4E0D7CC72D5B6D99DEF9EEEFE5
|
||||||
4AFF0000000000000000000000000000000000000000636363FFA4A4A4FF5050
|
D53FE2F82AF71E16A40E4022F30924D29E6041FC637C95D93EA3644BF3095B30
|
||||||
50FF525252FF5B5B5BFFB8B8B8FFC1C1C1FF575757FF4D4D4DFF5A5A5AFF7E7E
|
088951E512653CC1C293FD589A737BDA180B4BFEC59D7CF2323F2D329678E2BF
|
||||||
7EFF606060FF000000000000000000000000287CCEFF78B3EAFF7A7A7AFF8383
|
D0BBD3F20B6206609AD148FB7F43F52348C4F690F7AA178B92495BF0605A7E91
|
||||||
83FF7E7E7EFF5D5D5DFF494949FF4C4C4CFF555555FF646464FF5F5F5FFF6D6D
|
75165EF5FFD6C63E1834F421EDE6637CEE726E5A7EB9493026F77FE4B4BC8A2D
|
||||||
6DFF7EB8EDFF2974C7FF0000000000000000297DD1FF82BAEEFF5F5F5FFF8F8F
|
036BEC23C7F97FAD733C94ACB64DC973430DF1958F1AF2066BC0F00F81B27B1C
|
||||||
8FFF7A7A7AFF777777FF6D6D6DFF4E4E4EFF727272FF6F6F6FFF848484FF5555
|
2DAA9D7EBF044B78AAB00BD49B30C6A9DB99900E3344EC8B6AF0FB8AE0743516
|
||||||
55FF83BCEFFF2A77CAFF0000000000000000000000002579CDFF5E5E5EFF4F4F
|
360DE1B0AC0E8169B91FEC9A8E23ACBF182BFC34E1E4ABF35A0C5EF43E2826EC
|
||||||
4FFF848484FF848484FF808080FF545454FF838383FF848484FF4A4A4AFF4545
|
85D7ED745A3477E908CC2B0FC3A8D407BAF96ED0C876C4DE1A3E2CCE07405DB0
|
||||||
45FF2E7ECEFF6DA2D3FF00000000000000000000000000000000000000003D3D
|
1B9CA3E6F8CFF55FBFC813A6E7FD69B1CF1DA2AF99792E50CFE280917A000A31
|
||||||
3DFF4D4D4DFF494949FF474747FF474747FF454545FF474747FF383838FF0000
|
1650CDB09F74FDDF44EEEFAF3F0603C2ED2439B54F3B433DD3013AE4AC496258
|
||||||
0000000000000000000000000000000000000000000000000000000000000000
|
540460FD51D6A4EBFFE6680BAC0CD90933D26F22490668E35B3FED29D7FFDD81
|
||||||
0000000000000000000000000000000000000000000000000000000000000000
|
BAD87C9889D5FE5A9022B592F4D580147926B244EA5E6A7FD89EFD7F6DFF3F9F
|
||||||
0000000000000000000000000000000000000000000000000000000000000000
|
1140EFFFE7297AFEEAFDFF7C4608BDFFA7386AFF2FBEF100E6AF3399D1FEFF3D
|
||||||
0000000000000000000000000000000000000000000000000000000000000000
|
693B3885E6D3FEB708BD40EFFF3F9265CF78FFFF1756E498FF5FDDFF17B63DC2
|
||||||
0000000000000000000000000000000000000000000000000000000000000000
|
E25D49D3F2B26CFF49FDFFED0CFC1FBE7703B46DF9E3FCAFC91520D05C6E4A3E
|
||||||
000027B2E5FF1BA7F3FF1CACF4FF1CA8F4FF1BA1F1FF27ACDEFF000000000000
|
99A388D3AE1B71BD2C0EE15EDF83699B842D46F948E0B27183FC76C66333D21C
|
||||||
00000000000000000000000000000000000000000000000000000000000028B5
|
26FE86540A0E20D75581EE73B33C0665012AA82A288591450DF23C55D196E387
|
||||||
E5FF1BB6F5FF1CB6F5FF1CB6F5FF1CB2F5FF1CABF4FF1DAAF0FF28B0E0FF0000
|
4ABE1E4E396F40AC8DC26B31921D9570E1A801BAEA7250E0B51585DE8A28F263
|
||||||
0000000000000000000000000000000000000000000000000000000000001DBA
|
42C9A0191AC6AD28F155419EBB02CA03D4D09CEE8AB2205D44D96C1BE7FFC614
|
||||||
F5FF1CB6F5FF1CAAF4FF1CACF4FF1CACF4FF1CACF3FF1CA1F0FF1C93E4FF0000
|
2E5AB3BDE93E857E7A50554B81A3A90B0A78CAA80A65A12298894B028B49FD5F
|
||||||
0000000000000000000000000000000000000000000000000000000000001B9E
|
11C2C4F5E23012C709F5890E2809257372DF8ABAD8FDA889B2445BB60F8A788C
|
||||||
F3FF62ABCEFF8AB7E4FF3EC6EBFF1C9FEDFF1DA4EEFF1EA5EBFF1C9AE9FF0000
|
49FD7F3E5807F99E5BD076CA87564B863B8A7DB6D363A2AE730E6E443A476E4A
|
||||||
0000000000000000000000000000000000000000000000000000000000001E6D
|
FF47EE5E436AA4806CAE3CB29CE4689D7490259243A8C9CAFF8BFDFF1F29B504
|
||||||
ADFFBDD7EFFFA3C9EDFF9DC5E8FF44CEEFFF5BCDEFFFA8DCF1FF207CBDFF0000
|
5DBE52B496FB6F6155E377F0CDF2ACC13E6509053E83FB6B58953826DF34771F
|
||||||
0000000000000000000000000000000000000000000000000000000000002C61
|
BC5AC8FFC31AB226A5184386B7F1E04C58E5581DBE718E153C9B82E0DE74183B
|
||||||
8EFFA6CAEEFFABCCEAFFA7D0F6FFA8D0F6FFABCCEAFFA7CDEEFF2D6299FF0000
|
534DC8F77C13D6B87D3767B40FFBACD51656A1C5AE716C8C369F1AAF7B6300DC
|
||||||
0000000000000000000000000000000000000000000000000000000000004C72
|
1AFDE9BCD25EF223AB5D65FFCD9658C9B10A76FF647D9E0B6626DB666C4F1FAD
|
||||||
49FF347499FF9CCCF8FFAFD4F7FFAFD4F7FFA5CFF6FF357AA1FF4A6A46FF0000
|
C537CADE03D7067FB834F86247321BEB3CE54656B9C88CB146C596DB0CF277DF
|
||||||
000000000000000000000000000000000000000000000000000079935DFF2785
|
E5D61E824763103453F447489D6C18519A8759591670A93F04EE0F3ED04932C4
|
||||||
4EFFB3F5C8FF49898FFF4B7FA0FF4B7FA0FF49898FFFA9E8BAFF26844DFF738C
|
5A8FF5232B0F4ACF796DEF7F66D7DB7A3966D87B8E035EEB1138D7FAC038D70A
|
||||||
59FF0000000000000000000000000000000000000000AFE0ACFF37945DFF9FFD
|
6667ACE154EB0DA71FBCA09DC8C21AF7EF5EAC745E3767A2FA68A7B3C4485E98
|
||||||
C6FF91EFB8FF78D69FFF6FCD96FF69C68FFF62BF88FF73CF98FF94F0B9FF3088
|
E55BD3733C58EF0B4E9D2738B59ED04AD0A7EA245CC15D3B67CA1AC7688B3104
|
||||||
51FF788754FF000000000000000000000000849D6CFF45A26BFF82E0A9FF82E0
|
9A30C83487639D17EC6BDCA019A7075227E1B74E53B3A3DA7C9421B629783B74
|
||||||
A9FF6FCD96FF69C790FF64C28BFF5EBC85FF57B57EFF50AE77FF6BC891FF67C0
|
C878D5637541EA2494725C33E7D7BC27E4B98A497BCB83D4E9B91467B5E86F79
|
||||||
8AFF4F9A66FF769264FF0000000000000000287CCEFF78B3EAFF5AB881FF62C0
|
4F499DC4241D5689FE37FCF44F29E8A03D
|
||||||
89FF62C089FF5FBD86FF5AB881FF55B37CFF4FAD76FF49A770FF419E67FF4DAB
|
|
||||||
74FF7EB8EDFF2974C7FF0000000000000000297DD1FF82BAEEFF409E67FF6ECC
|
|
||||||
95FF5BB881FF58B57EFF53B17AFF4FAC75FF54B17AFF51AD76FF67C18AFF3B92
|
|
||||||
5CFF83BCEFFF2A77CAFF0000000000000000000000002579CDFF429D67FF318F
|
|
||||||
58FF63C18AFF63C18AFF63C18AFF63C18AFF63C18AFF63C18AFF2D8A53FF2F88
|
|
||||||
53FF2E7ECEFF6DA2D3FF0000000000000000000000000000000000000000668C
|
|
||||||
57FF428B55FF338952FF2E8851FF2D8750FF2E854EFF39854EFF4F824EFF0000
|
|
||||||
0000000000000000000000000000000000000000000000000000000000000000
|
|
||||||
0000000000000000000000000000000000000000000000000000000000000000
|
|
||||||
0000000000000000000000000000000000000000000000000000000000000000
|
|
||||||
0000000000000000000000000000000000000000000000000000000000000000
|
|
||||||
0000000000000000000000000000000000000000000000000000000000000000
|
|
||||||
0000565D68FF133F7AFF0D3E7DFF0C3C76FF123969FF4E5663FF000000000000
|
|
||||||
0000000000000000000000000000000000000000000000000000000000005F63
|
|
||||||
69FF284D7DFF0F498AFF0F4988FF0E4581FF0C3E73FF1B3D60FF595E63FF0000
|
|
||||||
0000000000000000000000000000000000000000000000000000000000003752
|
|
||||||
79FF0F498FFF0C3E76FF0C3E73FF0E3E73FF113F70FF0F3661FF143050FF0000
|
|
||||||
0000000000000000000000000000000000000000000000000000000000001037
|
|
||||||
73FF7893B5FF8AB7E4FF6793C3FF11355BFF15395FFF1C3959FF103255FF0000
|
|
||||||
0000000000000000000000000000000000000000000000000000000000001F5C
|
|
||||||
99FFBDD7EFFFA3C9EDFF9FC5E8FF74A1CDFF81B0DDFFB7D3EBFF2365A4FF0000
|
|
||||||
000000000000000000000000000000000000000000000000000000000000395F
|
|
||||||
89FFA6CAEEFFABCCEAFFA7D0F6FFA8D0F6FFABCCEAFFA7CDEEFF2F6299FF0000
|
|
||||||
000000000000000000000000000000000000000000000000000000000000966B
|
|
||||||
3EFF537291FF9CCCF8FFAFD4F7FFAFD4F7FFA5CFF6FF51799AFF8C643CFF0000
|
|
||||||
0000000000000000000000000000000000000000000000000000A57645FFB17D
|
|
||||||
3FFFD8BEA0FF968271FF5572A4FF435EB5FFA2795FFFD9BEA0FFB48042FFA875
|
|
||||||
46FF0000000000000000000000000000000000000000C29A70FFB27D41FFB480
|
|
||||||
42FFDCBF9EFFBE8A4CFFC4B6BCFF5E67C8FFB3814DFFD3B088FFC29159FFAF7A
|
|
||||||
3EFF9F6F41FF000000000000000000000000A5774AFFC3925BFFE2CAB0FFB682
|
|
||||||
44FFB78345FFB88855FF4A5BD0FF5060D2FFBA874CFFB37F41FFBF8A4EFFD0A9
|
|
||||||
7DFFBE8D57FF9C6F46FF0000000000000000287CCEFF78B3EAFFCEA679FFD2AE
|
|
||||||
83FFD0A97DFFB78859FF4D4EA6FF77627CFFB6844BFFC4935CFFC18E55FFC79A
|
|
||||||
67FF7EB8EDFF2974C7FF0000000000000000297DD1FF82BAEEFFC18F55FFD8B9
|
|
||||||
94FFCEA678FFCCA375FFBA9370FFB27F44FFCA9F6EFFC89C69FFD3AE85FFB884
|
|
||||||
49FF83BCEFFF2A77CAFF0000000000000000000000002579CDFFC08E54FFB581
|
|
||||||
43FFD3AF85FFD3AF85FFD1AB7FFFB98547FFD2AE83FFD3AF85FFB07B3FFFA976
|
|
||||||
3CFF2E7ECEFF6DA2D3FF00000000000000000000000000000000000000009966
|
|
||||||
34FFAF7A41FFAE793DFFAD783CFFAD783CFFAA7539FFAA753CFF936131FF0000
|
|
||||||
0000000000000000000000000000000000000000000000000000000000000000
|
|
||||||
0000000000000000000000000000000000000000000000000000000000000000
|
|
||||||
0000000000000000000000000000
|
|
||||||
}
|
}
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -31,7 +31,7 @@ interface
|
|||||||
|
|
||||||
uses
|
uses
|
||||||
Classes, SysUtils, LResources, Forms, Controls, Graphics, Dialogs, ComCtrls,
|
Classes, SysUtils, LResources, Forms, Controls, Graphics, Dialogs, ComCtrls,
|
||||||
VirtualTrees, Math, UEnhancedMemoryStream, UEnums;
|
StdCtrls, ExtCtrls, laz.VirtualTrees, Math, UEnhancedMemoryStream, UEnums;
|
||||||
|
|
||||||
type
|
type
|
||||||
|
|
||||||
@@ -46,7 +46,7 @@ type
|
|||||||
tbEditUser: TToolButton;
|
tbEditUser: TToolButton;
|
||||||
tbDeleteUser: TToolButton;
|
tbDeleteUser: TToolButton;
|
||||||
tbSeparator1: TToolButton;
|
tbSeparator1: TToolButton;
|
||||||
vstAccounts: TVirtualStringTree;
|
vstAccounts: TLazVirtualStringTree;
|
||||||
procedure tbEditUserClick(Sender: TObject);
|
procedure tbEditUserClick(Sender: TObject);
|
||||||
procedure FormClose(Sender: TObject; var CloseAction: TCloseAction);
|
procedure FormClose(Sender: TObject; var CloseAction: TCloseAction);
|
||||||
procedure FormCreate(Sender: TObject);
|
procedure FormCreate(Sender: TObject);
|
||||||
@@ -55,18 +55,27 @@ type
|
|||||||
procedure tbAddUserClick(Sender: TObject);
|
procedure tbAddUserClick(Sender: TObject);
|
||||||
procedure tbDeleteUserClick(Sender: TObject);
|
procedure tbDeleteUserClick(Sender: TObject);
|
||||||
procedure tbRefreshClick(Sender: TObject);
|
procedure tbRefreshClick(Sender: TObject);
|
||||||
|
procedure vstAccountsCompareNodes(Sender: TBaseVirtualTree; Node1,
|
||||||
|
Node2: PVirtualNode; Column: TColumnIndex; var Result: Integer);
|
||||||
procedure vstAccountsDblClick(Sender: TObject);
|
procedure vstAccountsDblClick(Sender: TObject);
|
||||||
procedure vstAccountsFreeNode(Sender: TBaseVirtualTree; Node: PVirtualNode);
|
procedure vstAccountsFreeNode(Sender: TBaseVirtualTree; Node: PVirtualNode);
|
||||||
|
procedure vstAccountsGetHint(Sender: TBaseVirtualTree; Node: PVirtualNode;
|
||||||
|
Column: TColumnIndex; var LineBreakStyle: TVTTooltipLineBreakStyle;
|
||||||
|
var HintText: String);
|
||||||
procedure vstAccountsGetImageIndex(Sender: TBaseVirtualTree;
|
procedure vstAccountsGetImageIndex(Sender: TBaseVirtualTree;
|
||||||
Node: PVirtualNode; Kind: TVTImageKind; Column: TColumnIndex;
|
Node: PVirtualNode; Kind: TVTImageKind; Column: TColumnIndex;
|
||||||
var Ghosted: Boolean; var ImageIndex: Integer);
|
var Ghosted: Boolean; var ImageIndex: Integer);
|
||||||
procedure vstAccountsGetText(Sender: TBaseVirtualTree; Node: PVirtualNode;
|
procedure vstAccountsGetText(Sender: TBaseVirtualTree; Node: PVirtualNode;
|
||||||
Column: TColumnIndex; TextType: TVSTTextType; var CellText: String);
|
Column: TColumnIndex; TextType: TVSTTextType; var CellText: String);
|
||||||
|
procedure vstAccountsHeaderClick(Sender: TVTHeader; Column: TColumnIndex;
|
||||||
|
Button: TMouseButton; Shift: TShiftState; X, Y: Integer);
|
||||||
protected
|
protected
|
||||||
procedure OnModifyUserResponse(ABuffer: TEnhancedMemoryStream);
|
procedure OnModifyUserResponse(ABuffer: TEnhancedMemoryStream);
|
||||||
procedure OnDeleteUserResponse(ABuffer: TEnhancedMemoryStream);
|
procedure OnDeleteUserResponse(ABuffer: TEnhancedMemoryStream);
|
||||||
procedure OnListUsersPacket(ABuffer: TEnhancedMemoryStream);
|
procedure OnListUsersPacket(ABuffer: TEnhancedMemoryStream);
|
||||||
function FindNode(AUsername: string): PVirtualNode;
|
function FindNode(AUsername: string): PVirtualNode;
|
||||||
|
private
|
||||||
|
procedure OnListModified;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
var
|
var
|
||||||
@@ -118,7 +127,7 @@ begin
|
|||||||
FStream.WriteStringNull(APassword);
|
FStream.WriteStringNull(APassword);
|
||||||
FStream.WriteByte(Byte(AAccessLevel));
|
FStream.WriteByte(Byte(AAccessLevel));
|
||||||
|
|
||||||
regionCount := Min(ARegions.Count, 256);
|
regionCount := Min(ARegions.Count, 255);
|
||||||
FStream.WriteByte(regionCount);
|
FStream.WriteByte(regionCount);
|
||||||
|
|
||||||
for i := 0 to regionCount - 1 do
|
for i := 0 to regionCount - 1 do
|
||||||
@@ -244,6 +253,19 @@ begin
|
|||||||
dmNetwork.Send(TRequestUserListPacket.Create);
|
dmNetwork.Send(TRequestUserListPacket.Create);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
procedure TfrmAccountControl.vstAccountsCompareNodes(Sender: TBaseVirtualTree;
|
||||||
|
Node1, Node2: PVirtualNode; Column: TColumnIndex; var Result: Integer);
|
||||||
|
var
|
||||||
|
accountInfo1, accountInfo2: PAccountInfo;
|
||||||
|
begin
|
||||||
|
accountInfo1 := Sender.GetNodeData(Node1);
|
||||||
|
accountInfo2 := Sender.GetNodeData(Node2);
|
||||||
|
case Column of
|
||||||
|
1: Result := CompareText(accountInfo1^.Username, accountInfo2^.Username);
|
||||||
|
2: Result := Integer(accountInfo1^.AccessLevel) - Integer(accountInfo2^.AccessLevel);
|
||||||
|
end;
|
||||||
|
end;
|
||||||
|
|
||||||
procedure TfrmAccountControl.vstAccountsDblClick(Sender: TObject);
|
procedure TfrmAccountControl.vstAccountsDblClick(Sender: TObject);
|
||||||
begin
|
begin
|
||||||
tbEditUserClick(Sender);
|
tbEditUserClick(Sender);
|
||||||
@@ -259,21 +281,45 @@ begin
|
|||||||
if accountInfo^.Regions <> nil then FreeAndNil(accountInfo^.Regions);
|
if accountInfo^.Regions <> nil then FreeAndNil(accountInfo^.Regions);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
procedure TfrmAccountControl.vstAccountsGetHint(Sender: TBaseVirtualTree;
|
||||||
|
Node: PVirtualNode; Column: TColumnIndex;
|
||||||
|
var LineBreakStyle: TVTTooltipLineBreakStyle; var HintText: String);
|
||||||
|
var
|
||||||
|
accountInfo: PAccountInfo;
|
||||||
|
begin
|
||||||
|
if Column = 3 then
|
||||||
|
begin
|
||||||
|
accountInfo := Sender.GetNodeData(Node);
|
||||||
|
if accountInfo^.Regions.Count > 0 then
|
||||||
|
HintText := Trim(accountInfo^.Regions.Text);
|
||||||
|
end;
|
||||||
|
end;
|
||||||
|
|
||||||
procedure TfrmAccountControl.vstAccountsGetImageIndex(Sender: TBaseVirtualTree;
|
procedure TfrmAccountControl.vstAccountsGetImageIndex(Sender: TBaseVirtualTree;
|
||||||
Node: PVirtualNode; Kind: TVTImageKind; Column: TColumnIndex;
|
Node: PVirtualNode; Kind: TVTImageKind; Column: TColumnIndex;
|
||||||
var Ghosted: Boolean; var ImageIndex: Integer);
|
var Ghosted: Boolean; var ImageIndex: Integer);
|
||||||
var
|
var
|
||||||
accountInfo: PAccountInfo;
|
accountInfo: PAccountInfo;
|
||||||
begin
|
begin
|
||||||
|
accountInfo := Sender.GetNodeData(Node);
|
||||||
if Column = 0 then
|
if Column = 0 then
|
||||||
begin
|
begin
|
||||||
accountInfo := Sender.GetNodeData(Node);
|
|
||||||
case accountInfo^.AccessLevel of
|
case accountInfo^.AccessLevel of
|
||||||
alNone: ImageIndex := 0;
|
alNone: ImageIndex := 0;
|
||||||
alView: ImageIndex := 1;
|
alView: ImageIndex := 1;
|
||||||
alNormal: ImageIndex := 2;
|
alNormal:
|
||||||
alAdministrator: ImageIndex := 3;
|
begin
|
||||||
|
if accountInfo^.Regions.Count > 0 then
|
||||||
|
ImageIndex := 2
|
||||||
|
else
|
||||||
|
ImageIndex := 3;
|
||||||
|
end;
|
||||||
|
alAdministrator: ImageIndex := 4;
|
||||||
end;
|
end;
|
||||||
|
end else if Column = 3 then
|
||||||
|
begin
|
||||||
|
if accountInfo^.Regions.Count > 0 then
|
||||||
|
ImageIndex := 5;
|
||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
@@ -292,6 +338,26 @@ begin
|
|||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
procedure TfrmAccountControl.vstAccountsHeaderClick(Sender: TVTHeader;
|
||||||
|
Column: TColumnIndex; Button: TMouseButton; Shift: TShiftState; X, Y: Integer);
|
||||||
|
begin
|
||||||
|
if Column in [1, 2] then
|
||||||
|
begin
|
||||||
|
if Sender.SortColumn <> Column then
|
||||||
|
begin
|
||||||
|
Sender.SortColumn := Column;
|
||||||
|
Sender.SortDirection := sdAscending;
|
||||||
|
end else
|
||||||
|
begin
|
||||||
|
case Sender.SortDirection of
|
||||||
|
sdAscending: Sender.SortDirection := sdDescending;
|
||||||
|
sdDescending: Sender.SortDirection := sdAscending;
|
||||||
|
end;
|
||||||
|
end;
|
||||||
|
Sender.Treeview.SortTree(Sender.SortColumn, Sender.SortDirection);
|
||||||
|
end;
|
||||||
|
end;
|
||||||
|
|
||||||
procedure TfrmAccountControl.OnModifyUserResponse(ABuffer: TEnhancedMemoryStream);
|
procedure TfrmAccountControl.OnModifyUserResponse(ABuffer: TEnhancedMemoryStream);
|
||||||
var
|
var
|
||||||
node: PVirtualNode;
|
node: PVirtualNode;
|
||||||
@@ -313,6 +379,7 @@ begin
|
|||||||
regions := ABuffer.ReadByte;
|
regions := ABuffer.ReadByte;
|
||||||
for i := 0 to regions - 1 do
|
for i := 0 to regions - 1 do
|
||||||
accountInfo^.Regions.Add(ABuffer.ReadStringNull);
|
accountInfo^.Regions.Add(ABuffer.ReadStringNull);
|
||||||
|
OnListModified;
|
||||||
|
|
||||||
Messagedlg('Success', Format('The user "%s" has been added.', [username]),
|
Messagedlg('Success', Format('The user "%s" has been added.', [username]),
|
||||||
mtInformation, [mbOK], 0);
|
mtInformation, [mbOK], 0);
|
||||||
@@ -328,6 +395,7 @@ begin
|
|||||||
regions := ABuffer.ReadByte;
|
regions := ABuffer.ReadByte;
|
||||||
for i := 0 to regions - 1 do
|
for i := 0 to regions - 1 do
|
||||||
accountInfo^.Regions.Add(ABuffer.ReadStringNull);
|
accountInfo^.Regions.Add(ABuffer.ReadStringNull);
|
||||||
|
OnListModified;
|
||||||
|
|
||||||
Messagedlg('Success', Format('The user "%s" has been modified.', [username]),
|
Messagedlg('Success', Format('The user "%s" has been modified.', [username]),
|
||||||
mtInformation, [mbOK], 0);
|
mtInformation, [mbOK], 0);
|
||||||
@@ -354,6 +422,8 @@ begin
|
|||||||
if node <> nil then
|
if node <> nil then
|
||||||
begin
|
begin
|
||||||
vstAccounts.DeleteNode(node);
|
vstAccounts.DeleteNode(node);
|
||||||
|
OnListModified;
|
||||||
|
|
||||||
Messagedlg('Success', Format('The user "%s" has been deleted.', [username]),
|
Messagedlg('Success', Format('The user "%s" has been deleted.', [username]),
|
||||||
mtInformation, [mbOK], 0);
|
mtInformation, [mbOK], 0);
|
||||||
end;
|
end;
|
||||||
@@ -386,6 +456,7 @@ begin
|
|||||||
accountInfo^.Regions.Add(ABuffer.ReadStringNull);
|
accountInfo^.Regions.Add(ABuffer.ReadStringNull);
|
||||||
end;
|
end;
|
||||||
vstAccounts.EndUpdate;
|
vstAccounts.EndUpdate;
|
||||||
|
OnListModified;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
function TfrmAccountControl.FindNode(AUsername: string): PVirtualNode;
|
function TfrmAccountControl.FindNode(AUsername: string): PVirtualNode;
|
||||||
@@ -404,6 +475,11 @@ begin
|
|||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
procedure TfrmAccountControl.OnListModified;
|
||||||
|
begin
|
||||||
|
vstAccounts.Header.SortColumn := -1;
|
||||||
|
end;
|
||||||
|
|
||||||
initialization
|
initialization
|
||||||
{$I UfrmAccountControl.lrs}
|
{$I UfrmAccountControl.lrs}
|
||||||
|
|
||||||
|
|||||||
@@ -0,0 +1,132 @@
|
|||||||
|
object frmChangePassword: TfrmChangePassword
|
||||||
|
Left = 283
|
||||||
|
Height = 186
|
||||||
|
Top = 193
|
||||||
|
Width = 387
|
||||||
|
BorderStyle = bsDialog
|
||||||
|
Caption = 'Change Password'
|
||||||
|
ClientHeight = 186
|
||||||
|
ClientWidth = 387
|
||||||
|
DesignTimePPI = 120
|
||||||
|
OnShow = FormShow
|
||||||
|
Position = poMainFormCenter
|
||||||
|
object Label1: TLabel
|
||||||
|
AnchorSideTop.Control = edOldPwd
|
||||||
|
AnchorSideTop.Side = asrCenter
|
||||||
|
AnchorSideRight.Control = edOldPwd
|
||||||
|
Left = 40
|
||||||
|
Height = 23
|
||||||
|
Top = 16
|
||||||
|
Width = 110
|
||||||
|
Anchors = [akTop, akRight]
|
||||||
|
BorderSpacing.Right = 10
|
||||||
|
Caption = 'Old Password:'
|
||||||
|
Color = clDefault
|
||||||
|
ParentColor = False
|
||||||
|
end
|
||||||
|
object Label2: TLabel
|
||||||
|
AnchorSideTop.Control = edNewPwd
|
||||||
|
AnchorSideTop.Side = asrCenter
|
||||||
|
AnchorSideRight.Control = edNewPwd
|
||||||
|
Left = 32
|
||||||
|
Height = 23
|
||||||
|
Top = 61
|
||||||
|
Width = 118
|
||||||
|
Anchors = [akTop, akRight]
|
||||||
|
BorderSpacing.Right = 10
|
||||||
|
Caption = 'New Password:'
|
||||||
|
Color = clDefault
|
||||||
|
ParentColor = False
|
||||||
|
end
|
||||||
|
object lblNewPwdRepeat: TLabel
|
||||||
|
AnchorSideTop.Control = edNewPwdRepeat
|
||||||
|
AnchorSideTop.Side = asrCenter
|
||||||
|
AnchorSideRight.Control = edNewPwdRepeat
|
||||||
|
Left = 14
|
||||||
|
Height = 23
|
||||||
|
Top = 106
|
||||||
|
Width = 136
|
||||||
|
Anchors = [akTop, akRight]
|
||||||
|
BorderSpacing.Right = 10
|
||||||
|
Caption = 'Repeat Password:'
|
||||||
|
Color = clDefault
|
||||||
|
ParentColor = False
|
||||||
|
end
|
||||||
|
object edOldPwd: TEdit
|
||||||
|
Left = 160
|
||||||
|
Height = 35
|
||||||
|
Top = 10
|
||||||
|
Width = 220
|
||||||
|
EchoMode = emPassword
|
||||||
|
PasswordChar = '*'
|
||||||
|
TabOrder = 0
|
||||||
|
end
|
||||||
|
object edNewPwd: TEdit
|
||||||
|
AnchorSideLeft.Control = edOldPwd
|
||||||
|
AnchorSideTop.Control = edOldPwd
|
||||||
|
AnchorSideTop.Side = asrBottom
|
||||||
|
AnchorSideRight.Control = edOldPwd
|
||||||
|
AnchorSideRight.Side = asrBottom
|
||||||
|
Left = 160
|
||||||
|
Height = 35
|
||||||
|
Top = 55
|
||||||
|
Width = 220
|
||||||
|
Anchors = [akTop, akLeft, akRight]
|
||||||
|
BorderSpacing.Top = 10
|
||||||
|
EchoMode = emPassword
|
||||||
|
OnChange = edNewPwdChange
|
||||||
|
PasswordChar = '*'
|
||||||
|
TabOrder = 1
|
||||||
|
end
|
||||||
|
object edNewPwdRepeat: TEdit
|
||||||
|
AnchorSideLeft.Control = edNewPwd
|
||||||
|
AnchorSideTop.Control = edNewPwd
|
||||||
|
AnchorSideTop.Side = asrBottom
|
||||||
|
AnchorSideRight.Control = edNewPwd
|
||||||
|
AnchorSideRight.Side = asrBottom
|
||||||
|
Left = 160
|
||||||
|
Height = 35
|
||||||
|
Top = 100
|
||||||
|
Width = 220
|
||||||
|
Anchors = [akTop, akLeft, akRight]
|
||||||
|
BorderSpacing.Top = 10
|
||||||
|
EchoMode = emPassword
|
||||||
|
OnChange = edNewPwdChange
|
||||||
|
PasswordChar = '*'
|
||||||
|
TabOrder = 2
|
||||||
|
end
|
||||||
|
object btnOK: TButton
|
||||||
|
AnchorSideTop.Control = btnCancel
|
||||||
|
AnchorSideRight.Control = btnCancel
|
||||||
|
Left = 179
|
||||||
|
Height = 32
|
||||||
|
Top = 144
|
||||||
|
Width = 94
|
||||||
|
Anchors = [akTop, akRight]
|
||||||
|
BorderSpacing.Right = 10
|
||||||
|
Caption = '&OK'
|
||||||
|
Default = True
|
||||||
|
Enabled = False
|
||||||
|
ModalResult = 1
|
||||||
|
OnClick = btnOKClick
|
||||||
|
TabOrder = 3
|
||||||
|
end
|
||||||
|
object btnCancel: TButton
|
||||||
|
AnchorSideRight.Control = Owner
|
||||||
|
AnchorSideRight.Side = asrBottom
|
||||||
|
AnchorSideBottom.Control = Owner
|
||||||
|
AnchorSideBottom.Side = asrBottom
|
||||||
|
Left = 283
|
||||||
|
Height = 32
|
||||||
|
Top = 144
|
||||||
|
Width = 94
|
||||||
|
Anchors = [akRight, akBottom]
|
||||||
|
BorderSpacing.Right = 10
|
||||||
|
BorderSpacing.Bottom = 10
|
||||||
|
Cancel = True
|
||||||
|
Caption = 'Cancel'
|
||||||
|
ModalResult = 2
|
||||||
|
OnClick = btnCancelClick
|
||||||
|
TabOrder = 4
|
||||||
|
end
|
||||||
|
end
|
||||||
@@ -0,0 +1,81 @@
|
|||||||
|
unit UfrmChangePassword;
|
||||||
|
|
||||||
|
{$mode objfpc}{$H+}
|
||||||
|
|
||||||
|
interface
|
||||||
|
|
||||||
|
uses
|
||||||
|
Classes, SysUtils, FileUtil, Forms, Controls, Graphics, Dialogs, StdCtrls;
|
||||||
|
|
||||||
|
type
|
||||||
|
|
||||||
|
{ TfrmChangePassword }
|
||||||
|
|
||||||
|
TfrmChangePassword = class(TForm)
|
||||||
|
btnOK: TButton;
|
||||||
|
btnCancel: TButton;
|
||||||
|
edOldPwd: TEdit;
|
||||||
|
edNewPwd: TEdit;
|
||||||
|
edNewPwdRepeat: TEdit;
|
||||||
|
Label1: TLabel;
|
||||||
|
Label2: TLabel;
|
||||||
|
lblNewPwdRepeat: TLabel;
|
||||||
|
procedure btnCancelClick(Sender: TObject);
|
||||||
|
procedure btnOKClick(Sender: TObject);
|
||||||
|
procedure edNewPwdChange(Sender: TObject);
|
||||||
|
procedure FormShow(Sender: TObject);
|
||||||
|
private
|
||||||
|
{ private declarations }
|
||||||
|
public
|
||||||
|
{ public declarations }
|
||||||
|
end;
|
||||||
|
|
||||||
|
var
|
||||||
|
frmChangePassword: TfrmChangePassword;
|
||||||
|
|
||||||
|
implementation
|
||||||
|
|
||||||
|
uses
|
||||||
|
UdmNetwork, UPackets, UEnums;
|
||||||
|
|
||||||
|
{$R *.lfm}
|
||||||
|
|
||||||
|
{ TfrmChangePassword }
|
||||||
|
|
||||||
|
procedure TfrmChangePassword.FormShow(Sender: TObject);
|
||||||
|
begin
|
||||||
|
edOldPwd.Text := '';
|
||||||
|
edNewPwd.Text := '';
|
||||||
|
edNewPwdRepeat.Text := '';
|
||||||
|
end;
|
||||||
|
|
||||||
|
procedure TfrmChangePassword.btnCancelClick(Sender: TObject);
|
||||||
|
begin
|
||||||
|
Close;
|
||||||
|
end;
|
||||||
|
|
||||||
|
procedure TfrmChangePassword.btnOKClick(Sender: TObject);
|
||||||
|
begin
|
||||||
|
dmNetwork.Send(TChangePasswordPacket.Create(edOldPwd.Text,
|
||||||
|
edNewPwd.Text));
|
||||||
|
end;
|
||||||
|
|
||||||
|
procedure TfrmChangePassword.edNewPwdChange(Sender: TObject);
|
||||||
|
var
|
||||||
|
pwdValid: Boolean;
|
||||||
|
begin
|
||||||
|
if edNewPwd.Text <> edNewPwdRepeat.Text then
|
||||||
|
begin
|
||||||
|
pwdValid := False;
|
||||||
|
lblNewPwdRepeat.Font.Color := clRed;
|
||||||
|
end else
|
||||||
|
begin
|
||||||
|
pwdValid := True;
|
||||||
|
lblNewPwdRepeat.Font.Color := clDefault;
|
||||||
|
end;
|
||||||
|
|
||||||
|
btnOK.Enabled := (Length(edNewPwd.Text) > 0) and pwdValid;
|
||||||
|
end;
|
||||||
|
|
||||||
|
end.
|
||||||
|
|
||||||
+123
-75
@@ -1,90 +1,135 @@
|
|||||||
object frmEditAccount: TfrmEditAccount
|
object frmEditAccount: TfrmEditAccount
|
||||||
Left = 290
|
Left = 290
|
||||||
Height = 214
|
Height = 335
|
||||||
Top = 171
|
Top = 171
|
||||||
Width = 261
|
Width = 408
|
||||||
ActiveControl = PageControl1
|
ActiveControl = PageControl1
|
||||||
BorderIcons = [biSystemMenu]
|
BorderIcons = [biSystemMenu]
|
||||||
BorderStyle = bsDialog
|
BorderStyle = bsDialog
|
||||||
Caption = 'Edit Account'
|
Caption = 'Edit Account'
|
||||||
ClientHeight = 214
|
ClientHeight = 335
|
||||||
ClientWidth = 261
|
ClientWidth = 408
|
||||||
Font.Height = -11
|
DesignTimePPI = 120
|
||||||
|
Font.Height = -18
|
||||||
OnCreate = FormCreate
|
OnCreate = FormCreate
|
||||||
OnDestroy = FormDestroy
|
OnDestroy = FormDestroy
|
||||||
OnShow = FormShow
|
OnShow = FormShow
|
||||||
ParentFont = False
|
|
||||||
Position = poOwnerFormCenter
|
Position = poOwnerFormCenter
|
||||||
LCLVersion = '0.9.27'
|
|
||||||
object PageControl1: TPageControl
|
object PageControl1: TPageControl
|
||||||
Height = 173
|
Left = 0
|
||||||
Width = 261
|
Height = 272
|
||||||
|
Top = 0
|
||||||
|
Width = 408
|
||||||
ActivePage = tsGeneral
|
ActivePage = tsGeneral
|
||||||
Align = alClient
|
Align = alClient
|
||||||
TabIndex = 0
|
TabIndex = 0
|
||||||
TabOrder = 0
|
TabOrder = 0
|
||||||
object tsGeneral: TTabSheet
|
object tsGeneral: TTabSheet
|
||||||
Caption = 'General'
|
Caption = 'General'
|
||||||
ClientHeight = 148
|
ClientHeight = 234
|
||||||
ClientWidth = 259
|
ClientWidth = 398
|
||||||
object lblPasswordHint: TLabel
|
object lblPasswordHint: TLabel
|
||||||
Left = 86
|
AnchorSideLeft.Control = edPassword
|
||||||
Height = 28
|
AnchorSideTop.Control = edPassword
|
||||||
Top = 64
|
AnchorSideTop.Side = asrBottom
|
||||||
Width = 160
|
AnchorSideRight.Control = edPassword
|
||||||
AutoSize = False
|
AnchorSideRight.Side = asrBottom
|
||||||
|
Left = 128
|
||||||
|
Height = 52
|
||||||
|
Top = 102
|
||||||
|
Width = 260
|
||||||
|
Anchors = [akTop, akLeft, akRight]
|
||||||
|
BorderSpacing.Around = 2
|
||||||
Caption = 'Leave empty to leave the password unchanged.'
|
Caption = 'Leave empty to leave the password unchanged.'
|
||||||
|
Color = clDefault
|
||||||
Enabled = False
|
Enabled = False
|
||||||
ParentColor = False
|
ParentColor = False
|
||||||
WordWrap = True
|
WordWrap = True
|
||||||
end
|
end
|
||||||
object lblUsername: TLabel
|
object lblUsername: TLabel
|
||||||
Left = 6
|
AnchorSideLeft.Control = tsGeneral
|
||||||
Height = 14
|
AnchorSideTop.Control = edUsername
|
||||||
Top = 12
|
AnchorSideTop.Side = asrCenter
|
||||||
Width = 58
|
Left = 8
|
||||||
|
Height = 26
|
||||||
|
Top = 14
|
||||||
|
Width = 92
|
||||||
|
BorderSpacing.Left = 8
|
||||||
Caption = 'Username:'
|
Caption = 'Username:'
|
||||||
|
Color = clDefault
|
||||||
ParentColor = False
|
ParentColor = False
|
||||||
end
|
end
|
||||||
object lblPassword: TLabel
|
object lblPassword: TLabel
|
||||||
Left = 6
|
AnchorSideLeft.Control = lblUsername
|
||||||
Height = 14
|
AnchorSideTop.Control = edPassword
|
||||||
Top = 44
|
AnchorSideTop.Side = asrCenter
|
||||||
Width = 54
|
Left = 8
|
||||||
|
Height = 26
|
||||||
|
Top = 68
|
||||||
|
Width = 87
|
||||||
Caption = 'Password:'
|
Caption = 'Password:'
|
||||||
|
Color = clDefault
|
||||||
ParentColor = False
|
ParentColor = False
|
||||||
end
|
end
|
||||||
object lblAccessLevel: TLabel
|
object lblAccessLevel: TLabel
|
||||||
Left = 6
|
AnchorSideLeft.Control = lblPassword
|
||||||
Height = 14
|
AnchorSideTop.Control = cbAccessLevel
|
||||||
Top = 108
|
AnchorSideTop.Side = asrCenter
|
||||||
Width = 63
|
Left = 8
|
||||||
|
Height = 26
|
||||||
|
Top = 176
|
||||||
|
Width = 102
|
||||||
Caption = 'Accesslevel:'
|
Caption = 'Accesslevel:'
|
||||||
|
Color = clDefault
|
||||||
ParentColor = False
|
ParentColor = False
|
||||||
end
|
end
|
||||||
object edUsername: TEdit
|
object edUsername: TEdit
|
||||||
Left = 86
|
AnchorSideLeft.Control = lblAccessLevel
|
||||||
Height = 23
|
AnchorSideLeft.Side = asrBottom
|
||||||
|
AnchorSideTop.Control = tsGeneral
|
||||||
|
AnchorSideRight.Control = tsGeneral
|
||||||
|
AnchorSideRight.Side = asrBottom
|
||||||
|
Left = 126
|
||||||
|
Height = 38
|
||||||
Top = 8
|
Top = 8
|
||||||
Width = 160
|
Width = 264
|
||||||
|
Anchors = [akTop, akLeft, akRight]
|
||||||
|
BorderSpacing.Left = 16
|
||||||
|
BorderSpacing.Top = 8
|
||||||
|
BorderSpacing.Right = 8
|
||||||
Color = clBtnFace
|
Color = clBtnFace
|
||||||
ReadOnly = True
|
ReadOnly = True
|
||||||
TabOrder = 0
|
TabOrder = 0
|
||||||
end
|
end
|
||||||
object edPassword: TEdit
|
object edPassword: TEdit
|
||||||
Left = 86
|
AnchorSideLeft.Control = edUsername
|
||||||
Height = 23
|
AnchorSideTop.Control = edUsername
|
||||||
Top = 40
|
AnchorSideTop.Side = asrBottom
|
||||||
Width = 160
|
AnchorSideRight.Control = edUsername
|
||||||
|
AnchorSideRight.Side = asrBottom
|
||||||
|
Left = 126
|
||||||
|
Height = 38
|
||||||
|
Top = 62
|
||||||
|
Width = 264
|
||||||
|
Anchors = [akTop, akLeft, akRight]
|
||||||
|
BorderSpacing.Top = 16
|
||||||
EchoMode = emPassword
|
EchoMode = emPassword
|
||||||
PasswordChar = '*'
|
PasswordChar = '*'
|
||||||
TabOrder = 1
|
TabOrder = 1
|
||||||
end
|
end
|
||||||
object cbAccessLevel: TComboBox
|
object cbAccessLevel: TComboBox
|
||||||
Left = 86
|
AnchorSideLeft.Control = edPassword
|
||||||
Height = 25
|
AnchorSideTop.Control = lblPasswordHint
|
||||||
Top = 104
|
AnchorSideTop.Side = asrBottom
|
||||||
Width = 160
|
AnchorSideRight.Control = edPassword
|
||||||
|
AnchorSideRight.Side = asrBottom
|
||||||
|
Left = 126
|
||||||
|
Height = 38
|
||||||
|
Top = 170
|
||||||
|
Width = 264
|
||||||
|
Anchors = [akTop, akLeft, akRight]
|
||||||
|
BorderSpacing.Top = 16
|
||||||
|
ItemHeight = 0
|
||||||
Items.Strings = (
|
Items.Strings = (
|
||||||
'None'
|
'None'
|
||||||
'Viewer'
|
'Viewer'
|
||||||
@@ -97,67 +142,70 @@ object frmEditAccount: TfrmEditAccount
|
|||||||
end
|
end
|
||||||
object tsRegions: TTabSheet
|
object tsRegions: TTabSheet
|
||||||
Caption = 'Regions'
|
Caption = 'Regions'
|
||||||
ClientHeight = 148
|
ClientHeight = 234
|
||||||
ClientWidth = 259
|
ClientWidth = 398
|
||||||
object Label1: TLabel
|
object Label1: TLabel
|
||||||
Left = 8
|
Left = 12
|
||||||
Height = 14
|
Height = 26
|
||||||
Top = 8
|
Top = 12
|
||||||
Width = 243
|
Width = 374
|
||||||
Align = alTop
|
Align = alTop
|
||||||
BorderSpacing.Left = 8
|
BorderSpacing.Left = 12
|
||||||
BorderSpacing.Top = 8
|
BorderSpacing.Top = 12
|
||||||
BorderSpacing.Right = 8
|
BorderSpacing.Right = 12
|
||||||
BorderSpacing.Bottom = 4
|
BorderSpacing.Bottom = 6
|
||||||
Caption = 'Allowed Regions:'
|
Caption = 'Allowed Regions:'
|
||||||
|
Color = clDefault
|
||||||
ParentColor = False
|
ParentColor = False
|
||||||
end
|
end
|
||||||
object cbRegions: TCheckListBox
|
object cbRegions: TCheckListBox
|
||||||
Left = 8
|
Left = 12
|
||||||
Height = 114
|
Height = 178
|
||||||
Top = 26
|
Top = 44
|
||||||
Width = 243
|
Width = 374
|
||||||
Align = alClient
|
Align = alClient
|
||||||
BorderSpacing.Left = 8
|
BorderSpacing.Left = 12
|
||||||
BorderSpacing.Top = 4
|
BorderSpacing.Top = 6
|
||||||
BorderSpacing.Right = 8
|
BorderSpacing.Right = 12
|
||||||
BorderSpacing.Bottom = 8
|
BorderSpacing.Bottom = 12
|
||||||
ItemHeight = 13
|
ItemHeight = 0
|
||||||
TabOrder = 0
|
TabOrder = 0
|
||||||
TopIndex = -1
|
TopIndex = -1
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
object Panel1: TPanel
|
object Panel1: TPanel
|
||||||
Left = 8
|
Left = 12
|
||||||
Height = 25
|
Height = 39
|
||||||
Top = 181
|
Top = 284
|
||||||
Width = 245
|
Width = 384
|
||||||
Align = alBottom
|
Align = alBottom
|
||||||
BorderSpacing.Around = 8
|
BorderSpacing.Around = 12
|
||||||
BevelOuter = bvNone
|
BevelOuter = bvNone
|
||||||
ClientHeight = 25
|
ClientHeight = 39
|
||||||
ClientWidth = 245
|
ClientWidth = 384
|
||||||
TabOrder = 1
|
TabOrder = 1
|
||||||
object btnCancel: TButton
|
object btnCancel: TButton
|
||||||
Left = 170
|
Left = 266
|
||||||
Height = 25
|
Height = 39
|
||||||
Width = 75
|
Top = 0
|
||||||
|
Width = 118
|
||||||
Align = alRight
|
Align = alRight
|
||||||
BorderSpacing.Left = 4
|
BorderSpacing.Left = 6
|
||||||
BorderSpacing.InnerBorder = 4
|
BorderSpacing.InnerBorder = 6
|
||||||
Cancel = True
|
Cancel = True
|
||||||
Caption = 'Cancel'
|
Caption = 'Cancel'
|
||||||
ModalResult = 2
|
ModalResult = 2
|
||||||
TabOrder = 0
|
TabOrder = 0
|
||||||
end
|
end
|
||||||
object btnOK: TButton
|
object btnOK: TButton
|
||||||
Left = 91
|
Left = 142
|
||||||
Height = 25
|
Height = 39
|
||||||
Width = 75
|
Top = 0
|
||||||
|
Width = 118
|
||||||
Align = alRight
|
Align = alRight
|
||||||
BorderSpacing.Right = 4
|
BorderSpacing.Right = 6
|
||||||
BorderSpacing.InnerBorder = 4
|
BorderSpacing.InnerBorder = 6
|
||||||
Caption = 'OK'
|
Caption = 'OK'
|
||||||
Default = True
|
Default = True
|
||||||
ModalResult = 1
|
ModalResult = 1
|
||||||
|
|||||||
@@ -31,7 +31,7 @@ interface
|
|||||||
|
|
||||||
uses
|
uses
|
||||||
Classes, SysUtils, LResources, Forms, Controls, Graphics, Dialogs, StdCtrls,
|
Classes, SysUtils, LResources, Forms, Controls, Graphics, Dialogs, StdCtrls,
|
||||||
UEnums, ComCtrls, ExtCtrls, CheckLst, UfrmRegionControl, VirtualTrees;
|
UEnums, ComCtrls, ExtCtrls, CheckLst, UfrmRegionControl;
|
||||||
|
|
||||||
type
|
type
|
||||||
|
|
||||||
@@ -72,6 +72,9 @@ var
|
|||||||
|
|
||||||
implementation
|
implementation
|
||||||
|
|
||||||
|
uses
|
||||||
|
laz.VirtualTrees;
|
||||||
|
|
||||||
{ TfrmEditAccount }
|
{ TfrmEditAccount }
|
||||||
|
|
||||||
procedure TfrmEditAccount.FormCreate(Sender: TObject);
|
procedure TfrmEditAccount.FormCreate(Sender: TObject);
|
||||||
@@ -100,6 +103,8 @@ begin
|
|||||||
1: Result := alView;
|
1: Result := alView;
|
||||||
2: Result := alNormal;
|
2: Result := alNormal;
|
||||||
3: Result := alAdministrator;
|
3: Result := alAdministrator;
|
||||||
|
else
|
||||||
|
Result := alNone;
|
||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
|||||||
+16
-18
@@ -1,39 +1,37 @@
|
|||||||
object frmInitialize: TfrmInitialize
|
object frmInitialize: TfrmInitialize
|
||||||
Left = 290
|
Left = 290
|
||||||
Height = 65
|
Height = 81
|
||||||
Top = 171
|
Top = 171
|
||||||
Width = 241
|
Width = 301
|
||||||
BorderIcons = []
|
BorderIcons = []
|
||||||
BorderStyle = bsDialog
|
BorderStyle = bsDialog
|
||||||
Caption = 'Please wait ...'
|
Caption = 'Please wait ...'
|
||||||
ClientHeight = 65
|
ClientHeight = 81
|
||||||
ClientWidth = 241
|
ClientWidth = 301
|
||||||
Font.Height = -11
|
Font.Height = -14
|
||||||
OnClose = FormClose
|
OnClose = FormClose
|
||||||
OnCreate = FormCreate
|
OnCreate = FormCreate
|
||||||
Position = poScreenCenter
|
Position = poScreenCenter
|
||||||
LCLVersion = '0.9.25'
|
|
||||||
object pnlMain: TPanel
|
object pnlMain: TPanel
|
||||||
Left = 8
|
Left = 10
|
||||||
Height = 50
|
Height = 62
|
||||||
Top = 8
|
Top = 10
|
||||||
Width = 226
|
Width = 282
|
||||||
BevelInner = bvRaised
|
BevelInner = bvRaised
|
||||||
BevelOuter = bvLowered
|
BevelOuter = bvLowered
|
||||||
ClientHeight = 50
|
ClientHeight = 62
|
||||||
ClientWidth = 226
|
ClientWidth = 282
|
||||||
ParentFont = True
|
|
||||||
TabOrder = 0
|
TabOrder = 0
|
||||||
object lblStatus: TLabel
|
object lblStatus: TLabel
|
||||||
Left = 8
|
Left = 10
|
||||||
Height = 32
|
Height = 40
|
||||||
Top = 8
|
Top = 10
|
||||||
Width = 208
|
Width = 260
|
||||||
Alignment = taCenter
|
Alignment = taCenter
|
||||||
AutoSize = False
|
AutoSize = False
|
||||||
|
Color = clDefault
|
||||||
Layout = tlCenter
|
Layout = tlCenter
|
||||||
ParentColor = False
|
ParentColor = False
|
||||||
ParentFont = True
|
|
||||||
WordWrap = True
|
WordWrap = True
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
+376
-393
File diff suppressed because it is too large
Load Diff
@@ -31,8 +31,8 @@ interface
|
|||||||
|
|
||||||
uses
|
uses
|
||||||
Classes, SysUtils, LResources, Forms, Controls, Graphics, Dialogs, Math,
|
Classes, SysUtils, LResources, Forms, Controls, Graphics, Dialogs, Math,
|
||||||
VirtualTrees, ExtCtrls, ImagingComponents, StdCtrls, Buttons, Spin, LCLIntf,
|
laz.VirtualTrees, ExtCtrls, ImagingComponents, StdCtrls, Buttons, Spin,
|
||||||
Menus, UPlatformTypes, UEnhancedMemoryStream, UWorldItem;
|
LCLIntf, Menus, UPlatformTypes, UEnhancedMemoryStream, UWorldItem;
|
||||||
|
|
||||||
type
|
type
|
||||||
|
|
||||||
@@ -112,11 +112,11 @@ type
|
|||||||
btnGrab1: TSpeedButton;
|
btnGrab1: TSpeedButton;
|
||||||
btnGrab2: TSpeedButton;
|
btnGrab2: TSpeedButton;
|
||||||
btnGrabOffset: TSpeedButton;
|
btnGrabOffset: TSpeedButton;
|
||||||
vdtTerrainTiles: TVirtualDrawTree;
|
vdtTerrainTiles: TLazVirtualDrawTree;
|
||||||
vdtInsertStaticsTiles: TVirtualDrawTree;
|
vdtInsertStaticsTiles: TLazVirtualDrawTree;
|
||||||
vdtDeleteStaticsTiles: TVirtualDrawTree;
|
vdtDeleteStaticsTiles: TLazVirtualDrawTree;
|
||||||
vstActions: TVirtualStringTree;
|
vstActions: TLazVirtualStringTree;
|
||||||
vstArea: TVirtualStringTree;
|
vstArea: TLazVirtualStringTree;
|
||||||
procedure btnGrab1Click(Sender: TObject);
|
procedure btnGrab1Click(Sender: TObject);
|
||||||
procedure btnGrabOffsetClick(Sender: TObject);
|
procedure btnGrabOffsetClick(Sender: TObject);
|
||||||
procedure FormShow(Sender: TObject);
|
procedure FormShow(Sender: TObject);
|
||||||
@@ -176,7 +176,7 @@ type
|
|||||||
function FindNode(AActionID: Integer): PVirtualNode;
|
function FindNode(AActionID: Integer): PVirtualNode;
|
||||||
procedure TileSelection(AWorldItem: TWorldItem);
|
procedure TileSelection(AWorldItem: TWorldItem);
|
||||||
procedure OffsetSelection(AWorldItem: TWorldItem);
|
procedure OffsetSelection(AWorldItem: TWorldItem);
|
||||||
procedure SerializeTiles(ATileList: TVirtualDrawTree;
|
procedure SerializeTiles(ATileList: TLazVirtualDrawTree;
|
||||||
AStream: TEnhancedMemoryStream);
|
AStream: TEnhancedMemoryStream);
|
||||||
public
|
public
|
||||||
{ public declarations }
|
{ public declarations }
|
||||||
@@ -239,6 +239,8 @@ end;
|
|||||||
procedure TfrmLargeScaleCommand.FormDestroy(Sender: TObject);
|
procedure TfrmLargeScaleCommand.FormDestroy(Sender: TObject);
|
||||||
begin
|
begin
|
||||||
frmRadarMap.Dependencies.Remove(pbArea);
|
frmRadarMap.Dependencies.Remove(pbArea);
|
||||||
|
frmMain.UnregisterSelectionListener(@TileSelection);
|
||||||
|
frmMain.UnregisterSelectionListener(@OffsetSelection);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
procedure TfrmLargeScaleCommand.mnuSelectTopLeftClick(Sender: TObject);
|
procedure TfrmLargeScaleCommand.mnuSelectTopLeftClick(Sender: TObject);
|
||||||
@@ -331,6 +333,7 @@ end;
|
|||||||
procedure TfrmLargeScaleCommand.FormShow(Sender: TObject);
|
procedure TfrmLargeScaleCommand.FormShow(Sender: TObject);
|
||||||
begin
|
begin
|
||||||
SetWindowParent(Handle, frmMain.Handle);
|
SetWindowParent(Handle, frmMain.Handle);
|
||||||
|
Position := poOwnerFormCenter;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
procedure TfrmLargeScaleCommand.btnGrab1Click(Sender: TObject);
|
procedure TfrmLargeScaleCommand.btnGrab1Click(Sender: TObject);
|
||||||
@@ -391,27 +394,34 @@ var
|
|||||||
node: PVirtualNode;
|
node: PVirtualNode;
|
||||||
areaInfo: ^TRect;
|
areaInfo: ^TRect;
|
||||||
begin
|
begin
|
||||||
packet := TPacket.Create($0E, 0);
|
|
||||||
stream := packet.Stream;
|
|
||||||
stream.Position := stream.Size;
|
|
||||||
|
|
||||||
//Area
|
|
||||||
areaCount := Min(vstArea.RootNodeCount, 255);
|
areaCount := Min(vstArea.RootNodeCount, 255);
|
||||||
stream.WriteByte(areaCount);
|
if areaCount = 0 then
|
||||||
if areaCount = 0 then Exit;
|
|
||||||
i := 0;
|
|
||||||
node := vstArea.GetFirst;
|
|
||||||
while (node <> nil) and (i < areaCount) do
|
|
||||||
begin
|
begin
|
||||||
areaInfo := vstArea.GetNodeData(node);
|
MessageDlg('Large Scale Command', 'No target areas selected.',
|
||||||
stream.WriteWord(Min(areaInfo^.Left, areaInfo^.Right));
|
mtWarning, [mbOK], 0);
|
||||||
stream.WriteWord(Min(areaInfo^.Top, areaInfo^.Bottom));
|
Exit;
|
||||||
stream.WriteWord(Max(areaInfo^.Left, areaInfo^.Right));
|
|
||||||
stream.WriteWord(Max(areaInfo^.Top, areaInfo^.Bottom));
|
|
||||||
node := vstArea.GetNext(node);
|
|
||||||
Inc(i);
|
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
packet := TPacket.Create($0E, 0);
|
||||||
|
try
|
||||||
|
stream := packet.Stream;
|
||||||
|
stream.Position := stream.Size;
|
||||||
|
|
||||||
|
//Area
|
||||||
|
stream.WriteByte(areaCount);
|
||||||
|
i := 0;
|
||||||
|
node := vstArea.GetFirst;
|
||||||
|
while (node <> nil) and (i < areaCount) do
|
||||||
|
begin
|
||||||
|
areaInfo := vstArea.GetNodeData(node);
|
||||||
|
stream.WriteWord(Min(areaInfo^.Left, areaInfo^.Right));
|
||||||
|
stream.WriteWord(Min(areaInfo^.Top, areaInfo^.Bottom));
|
||||||
|
stream.WriteWord(Max(areaInfo^.Left, areaInfo^.Right));
|
||||||
|
stream.WriteWord(Max(areaInfo^.Top, areaInfo^.Bottom));
|
||||||
|
node := vstArea.GetNext(node);
|
||||||
|
Inc(i);
|
||||||
|
end;
|
||||||
|
|
||||||
//Copy/Move
|
//Copy/Move
|
||||||
node := FindNode(0);
|
node := FindNode(0);
|
||||||
if vstActions.CheckState[node] = csCheckedNormal then
|
if vstActions.CheckState[node] = csCheckedNormal then
|
||||||
@@ -480,7 +490,11 @@ begin
|
|||||||
end else
|
end else
|
||||||
stream.WriteBoolean(False);
|
stream.WriteBoolean(False);
|
||||||
|
|
||||||
dmNetwork.Send(TCompressedPacket.Create(packet));
|
dmNetwork.Send(TCompressedPacket.Create(packet));
|
||||||
|
except
|
||||||
|
packet.Free;
|
||||||
|
raise;
|
||||||
|
end;
|
||||||
Close;
|
Close;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
@@ -565,11 +579,11 @@ procedure TfrmLargeScaleCommand.vdtTerrainTilesDragDrop(Sender: TBaseVirtualTree
|
|||||||
Source: TObject; DataObject: IDataObject; Formats: TFormatArray;
|
Source: TObject; DataObject: IDataObject; Formats: TFormatArray;
|
||||||
Shift: TShiftState; Pt: TPoint; var Effect: Integer; Mode: TDropMode);
|
Shift: TShiftState; Pt: TPoint; var Effect: Integer; Mode: TDropMode);
|
||||||
var
|
var
|
||||||
sourceTree: TVirtualDrawTree;
|
sourceTree: TLazVirtualDrawTree;
|
||||||
selected, node: PVirtualNode;
|
selected, node: PVirtualNode;
|
||||||
sourceTileInfo, targetTileInfo: PTileInfo;
|
sourceTileInfo, targetTileInfo: PTileInfo;
|
||||||
begin
|
begin
|
||||||
sourceTree := Source as TVirtualDrawTree;
|
sourceTree := Source as TLazVirtualDrawTree;
|
||||||
if (sourceTree <> Sender) and (sourceTree <> nil) and
|
if (sourceTree <> Sender) and (sourceTree <> nil) and
|
||||||
(sourceTree.Tag = 1) then
|
(sourceTree.Tag = 1) then
|
||||||
begin
|
begin
|
||||||
@@ -596,8 +610,8 @@ procedure TfrmLargeScaleCommand.vdtTerrainTilesDragOver(Sender: TBaseVirtualTree
|
|||||||
Source: TObject; Shift: TShiftState; State: TDragState; Pt: TPoint;
|
Source: TObject; Shift: TShiftState; State: TDragState; Pt: TPoint;
|
||||||
Mode: TDropMode; var Effect: Integer; var Accept: Boolean);
|
Mode: TDropMode; var Effect: Integer; var Accept: Boolean);
|
||||||
begin
|
begin
|
||||||
if (Source <> Sender) and (Source is TVirtualDrawTree) and
|
if (Source <> Sender) and (Source is TLazVirtualDrawTree) and
|
||||||
(TVirtualDrawTree(Source).Tag = 1) then
|
(TLazVirtualDrawTree(Source).Tag = 1) then
|
||||||
begin
|
begin
|
||||||
Accept := True;
|
Accept := True;
|
||||||
end;
|
end;
|
||||||
@@ -666,10 +680,18 @@ begin
|
|||||||
if selected then
|
if selected then
|
||||||
begin
|
begin
|
||||||
nodeInfo := Sender.GetNodeData(Node);
|
nodeInfo := Sender.GetNodeData(Node);
|
||||||
|
seX1.OnChange := nil;
|
||||||
|
seX2.OnChange := nil;
|
||||||
|
seY1.OnChange := nil;
|
||||||
|
seY2.OnChange := nil;
|
||||||
seX1.Value := nodeInfo^.Left;
|
seX1.Value := nodeInfo^.Left;
|
||||||
seX2.Value := nodeInfo^.Right;
|
seX2.Value := nodeInfo^.Right;
|
||||||
seY1.Value := nodeInfo^.Top;
|
seY1.Value := nodeInfo^.Top;
|
||||||
seY2.Value := nodeInfo^.Bottom;
|
seY2.Value := nodeInfo^.Bottom;
|
||||||
|
seX1.OnChange := @seX1Change;
|
||||||
|
seX2.OnChange := @seX1Change;
|
||||||
|
seY1.OnChange := @seX1Change;
|
||||||
|
seY2.OnChange := @seX1Change;
|
||||||
end;
|
end;
|
||||||
pbArea.Repaint;
|
pbArea.Repaint;
|
||||||
end;
|
end;
|
||||||
@@ -759,19 +781,22 @@ begin
|
|||||||
WindowState := FOldWindowState;
|
WindowState := FOldWindowState;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
procedure TfrmLargeScaleCommand.SerializeTiles(ATileList: TVirtualDrawTree;
|
procedure TfrmLargeScaleCommand.SerializeTiles(ATileList: TLazVirtualDrawTree;
|
||||||
AStream: TEnhancedMemoryStream);
|
AStream: TEnhancedMemoryStream);
|
||||||
var
|
var
|
||||||
node: PVirtualNode;
|
node: PVirtualNode;
|
||||||
tileInfo: PTileInfo;
|
tileInfo: PTileInfo;
|
||||||
|
i: Integer;
|
||||||
begin
|
begin
|
||||||
AStream.WriteWord(ATileList.RootNodeCount);
|
AStream.WriteWord(Min(ATileList.RootNodeCount, High(Word)));
|
||||||
node := ATileList.GetFirst;
|
node := ATileList.GetFirst;
|
||||||
while node <> nil do
|
i := 0;
|
||||||
|
while (node <> nil) and (i < High(Word)) do
|
||||||
begin
|
begin
|
||||||
tileInfo := ATileList.GetNodeData(node);
|
tileInfo := ATileList.GetNodeData(node);
|
||||||
AStream.WriteWord(tileInfo^.ID);
|
AStream.WriteWord(tileInfo^.ID);
|
||||||
node := ATileList.GetNext(node);
|
node := ATileList.GetNext(node);
|
||||||
|
Inc(i);
|
||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
|||||||
+148
-142
@@ -1,21 +1,20 @@
|
|||||||
object frmLogin: TfrmLogin
|
object frmLogin: TfrmLogin
|
||||||
Left = 290
|
Left = 290
|
||||||
Height = 266
|
Height = 414
|
||||||
Top = 171
|
Top = 201
|
||||||
Width = 481
|
Width = 755
|
||||||
ActiveControl = btnOK
|
ActiveControl = btnOK
|
||||||
AutoSize = True
|
|
||||||
BorderIcons = [biSystemMenu]
|
BorderIcons = [biSystemMenu]
|
||||||
BorderStyle = bsDialog
|
BorderStyle = bsDialog
|
||||||
Caption = 'UO CentrED'
|
Caption = 'UO CentrED'
|
||||||
ClientHeight = 266
|
ClientHeight = 414
|
||||||
ClientWidth = 481
|
ClientWidth = 755
|
||||||
Font.Height = -11
|
DesignTimePPI = 120
|
||||||
|
Font.Height = -18
|
||||||
OnClose = FormClose
|
OnClose = FormClose
|
||||||
OnCreate = FormCreate
|
OnCreate = FormCreate
|
||||||
Position = poScreenCenter
|
Position = poScreenCenter
|
||||||
ShowInTaskBar = stAlways
|
ShowInTaskBar = stAlways
|
||||||
LCLVersion = '0.9.29'
|
|
||||||
object lblCopyright: TLabel
|
object lblCopyright: TLabel
|
||||||
AnchorSideLeft.Control = Owner
|
AnchorSideLeft.Control = Owner
|
||||||
AnchorSideTop.Control = gbData
|
AnchorSideTop.Control = gbData
|
||||||
@@ -25,80 +24,91 @@ object frmLogin: TfrmLogin
|
|||||||
AnchorSideBottom.Control = Owner
|
AnchorSideBottom.Control = Owner
|
||||||
AnchorSideBottom.Side = asrBottom
|
AnchorSideBottom.Side = asrBottom
|
||||||
Left = 0
|
Left = 0
|
||||||
Height = 19
|
Height = 26
|
||||||
Top = 239
|
Top = 388
|
||||||
Width = 481
|
Width = 755
|
||||||
Alignment = taCenter
|
Alignment = taCenter
|
||||||
Anchors = [akTop, akLeft, akRight]
|
Anchors = [akTop, akLeft, akRight]
|
||||||
BorderSpacing.Top = 8
|
BorderSpacing.Top = 12
|
||||||
|
Caption = ' '
|
||||||
|
Color = clDefault
|
||||||
ParentColor = False
|
ParentColor = False
|
||||||
|
Transparent = False
|
||||||
end
|
end
|
||||||
object gbConnection: TGroupBox
|
object gbConnection: TGroupBox
|
||||||
AnchorSideLeft.Control = Owner
|
AnchorSideLeft.Control = Owner
|
||||||
AnchorSideTop.Control = Owner
|
AnchorSideTop.Control = Owner
|
||||||
AnchorSideRight.Control = gbActions
|
AnchorSideRight.Control = gbActions
|
||||||
AnchorSideBottom.Side = asrCenter
|
AnchorSideBottom.Side = asrCenter
|
||||||
Left = 8
|
Left = 12
|
||||||
Height = 128
|
Height = 215
|
||||||
Top = 4
|
Top = 6
|
||||||
Width = 314
|
Width = 495
|
||||||
Anchors = [akTop, akLeft, akRight]
|
Anchors = [akTop, akLeft, akRight]
|
||||||
AutoSize = True
|
BorderSpacing.Left = 12
|
||||||
BorderSpacing.Left = 8
|
BorderSpacing.Top = 6
|
||||||
BorderSpacing.Top = 4
|
BorderSpacing.Right = 12
|
||||||
Caption = 'Connection'
|
Caption = 'Connection'
|
||||||
ClientHeight = 114
|
ClientHeight = 177
|
||||||
ClientWidth = 312
|
ClientWidth = 491
|
||||||
TabOrder = 0
|
TabOrder = 0
|
||||||
object lblHost: TLabel
|
object lblHost: TLabel
|
||||||
AnchorSideLeft.Control = imgHost
|
AnchorSideLeft.Control = imgHost
|
||||||
AnchorSideLeft.Side = asrBottom
|
AnchorSideLeft.Side = asrBottom
|
||||||
AnchorSideTop.Control = edHost
|
AnchorSideTop.Control = edHost
|
||||||
AnchorSideTop.Side = asrCenter
|
AnchorSideTop.Side = asrCenter
|
||||||
Left = 32
|
Left = 40
|
||||||
Height = 14
|
Height = 26
|
||||||
Top = 10
|
Top = 19
|
||||||
Width = 28
|
Width = 45
|
||||||
BorderSpacing.Left = 8
|
BorderSpacing.Left = 12
|
||||||
Caption = 'Host:'
|
Caption = 'Host:'
|
||||||
|
Color = clDefault
|
||||||
|
Font.Height = -18
|
||||||
ParentColor = False
|
ParentColor = False
|
||||||
|
ParentFont = False
|
||||||
|
Transparent = False
|
||||||
end
|
end
|
||||||
object lblUsername: TLabel
|
object lblUsername: TLabel
|
||||||
AnchorSideLeft.Control = imgUsername
|
AnchorSideLeft.Control = imgUsername
|
||||||
AnchorSideLeft.Side = asrBottom
|
AnchorSideLeft.Side = asrBottom
|
||||||
AnchorSideTop.Control = edUsername
|
AnchorSideTop.Control = edUsername
|
||||||
AnchorSideTop.Side = asrCenter
|
AnchorSideTop.Side = asrCenter
|
||||||
Left = 32
|
Left = 40
|
||||||
Height = 14
|
Height = 26
|
||||||
Top = 46
|
Top = 85
|
||||||
Width = 58
|
Width = 93
|
||||||
BorderSpacing.Left = 8
|
BorderSpacing.Left = 12
|
||||||
Caption = 'Username:'
|
Caption = 'Username:'
|
||||||
|
Color = clDefault
|
||||||
ParentColor = False
|
ParentColor = False
|
||||||
|
Transparent = False
|
||||||
end
|
end
|
||||||
object lblPassword: TLabel
|
object lblPassword: TLabel
|
||||||
AnchorSideLeft.Control = imgPassword
|
AnchorSideLeft.Control = imgPassword
|
||||||
AnchorSideLeft.Side = asrBottom
|
AnchorSideLeft.Side = asrBottom
|
||||||
AnchorSideTop.Control = edPassword
|
AnchorSideTop.Control = edPassword
|
||||||
AnchorSideTop.Side = asrCenter
|
AnchorSideTop.Side = asrCenter
|
||||||
Left = 32
|
Left = 40
|
||||||
Height = 14
|
Height = 26
|
||||||
Top = 81
|
Top = 150
|
||||||
Width = 54
|
Width = 87
|
||||||
BorderSpacing.Left = 8
|
BorderSpacing.Left = 12
|
||||||
Caption = 'Password:'
|
Caption = 'Password:'
|
||||||
|
Color = clDefault
|
||||||
ParentColor = False
|
ParentColor = False
|
||||||
|
Transparent = False
|
||||||
end
|
end
|
||||||
object imgHost: TImage
|
object imgHost: TImage
|
||||||
AnchorSideLeft.Control = gbConnection
|
AnchorSideLeft.Control = gbConnection
|
||||||
AnchorSideTop.Control = lblHost
|
AnchorSideTop.Control = lblHost
|
||||||
AnchorSideTop.Side = asrCenter
|
AnchorSideTop.Side = asrCenter
|
||||||
Left = 8
|
Left = 12
|
||||||
Height = 16
|
Height = 16
|
||||||
Top = 9
|
Top = 24
|
||||||
Width = 16
|
Width = 16
|
||||||
AutoSize = True
|
AutoSize = True
|
||||||
BorderSpacing.Left = 8
|
BorderSpacing.Left = 12
|
||||||
Picture.Data = {
|
Picture.Data = {
|
||||||
07545069786D61702E0A00002F2A2058504D202A2F0A73746174696320636861
|
07545069786D61702E0A00002F2A2058504D202A2F0A73746174696320636861
|
||||||
72202A64756D6D795B5D3D7B0A223136203136203132342032222C0A22517420
|
72202A64756D6D795B5D3D7B0A223136203136203132342032222C0A22517420
|
||||||
@@ -189,9 +199,9 @@ object frmLogin: TfrmLogin
|
|||||||
AnchorSideLeft.Control = imgHost
|
AnchorSideLeft.Control = imgHost
|
||||||
AnchorSideTop.Control = lblUsername
|
AnchorSideTop.Control = lblUsername
|
||||||
AnchorSideTop.Side = asrCenter
|
AnchorSideTop.Side = asrCenter
|
||||||
Left = 8
|
Left = 12
|
||||||
Height = 16
|
Height = 16
|
||||||
Top = 45
|
Top = 90
|
||||||
Width = 16
|
Width = 16
|
||||||
AutoSize = True
|
AutoSize = True
|
||||||
Picture.Data = {
|
Picture.Data = {
|
||||||
@@ -284,9 +294,9 @@ object frmLogin: TfrmLogin
|
|||||||
AnchorSideLeft.Control = imgUsername
|
AnchorSideLeft.Control = imgUsername
|
||||||
AnchorSideTop.Control = lblPassword
|
AnchorSideTop.Control = lblPassword
|
||||||
AnchorSideTop.Side = asrCenter
|
AnchorSideTop.Side = asrCenter
|
||||||
Left = 8
|
Left = 12
|
||||||
Height = 16
|
Height = 16
|
||||||
Top = 80
|
Top = 155
|
||||||
Width = 16
|
Width = 16
|
||||||
AutoSize = True
|
AutoSize = True
|
||||||
Picture.Data = {
|
Picture.Data = {
|
||||||
@@ -370,13 +380,13 @@ object frmLogin: TfrmLogin
|
|||||||
AnchorSideLeft.Side = asrBottom
|
AnchorSideLeft.Side = asrBottom
|
||||||
AnchorSideTop.Control = gbConnection
|
AnchorSideTop.Control = gbConnection
|
||||||
AnchorSideRight.Control = edPort
|
AnchorSideRight.Control = edPort
|
||||||
Left = 98
|
Left = 145
|
||||||
Height = 19
|
Height = 40
|
||||||
Top = 8
|
Top = 12
|
||||||
Width = 143
|
Width = 236
|
||||||
Anchors = [akTop, akLeft, akRight]
|
Anchors = [akTop, akLeft, akRight]
|
||||||
BorderSpacing.Left = 8
|
BorderSpacing.Left = 12
|
||||||
BorderSpacing.Top = 8
|
BorderSpacing.Top = 12
|
||||||
TabOrder = 0
|
TabOrder = 0
|
||||||
Text = 'localhost'
|
Text = 'localhost'
|
||||||
end
|
end
|
||||||
@@ -386,12 +396,12 @@ object frmLogin: TfrmLogin
|
|||||||
AnchorSideTop.Side = asrBottom
|
AnchorSideTop.Side = asrBottom
|
||||||
AnchorSideRight.Control = edPort
|
AnchorSideRight.Control = edPort
|
||||||
AnchorSideRight.Side = asrBottom
|
AnchorSideRight.Side = asrBottom
|
||||||
Left = 98
|
Left = 145
|
||||||
Height = 19
|
Height = 40
|
||||||
Top = 44
|
Top = 78
|
||||||
Width = 206
|
Width = 334
|
||||||
Anchors = [akTop, akLeft, akRight]
|
Anchors = [akTop, akLeft, akRight]
|
||||||
BorderSpacing.Top = 17
|
BorderSpacing.Top = 26
|
||||||
TabOrder = 2
|
TabOrder = 2
|
||||||
end
|
end
|
||||||
object edPassword: TEdit
|
object edPassword: TEdit
|
||||||
@@ -400,13 +410,13 @@ object frmLogin: TfrmLogin
|
|||||||
AnchorSideTop.Side = asrBottom
|
AnchorSideTop.Side = asrBottom
|
||||||
AnchorSideRight.Control = edUsername
|
AnchorSideRight.Control = edUsername
|
||||||
AnchorSideRight.Side = asrBottom
|
AnchorSideRight.Side = asrBottom
|
||||||
Left = 98
|
Left = 145
|
||||||
Height = 19
|
Height = 40
|
||||||
Top = 79
|
Top = 143
|
||||||
Width = 206
|
Width = 334
|
||||||
Anchors = [akTop, akLeft, akRight]
|
Anchors = [akTop, akLeft, akRight]
|
||||||
BorderSpacing.Top = 16
|
BorderSpacing.Top = 25
|
||||||
BorderSpacing.Bottom = 16
|
BorderSpacing.Bottom = 25
|
||||||
EchoMode = emPassword
|
EchoMode = emPassword
|
||||||
PasswordChar = '*'
|
PasswordChar = '*'
|
||||||
TabOrder = 3
|
TabOrder = 3
|
||||||
@@ -419,13 +429,13 @@ object frmLogin: TfrmLogin
|
|||||||
AnchorSideRight.Side = asrBottom
|
AnchorSideRight.Side = asrBottom
|
||||||
AnchorSideBottom.Control = edHost
|
AnchorSideBottom.Control = edHost
|
||||||
AnchorSideBottom.Side = asrBottom
|
AnchorSideBottom.Side = asrBottom
|
||||||
Left = 249
|
Left = 393
|
||||||
Height = 19
|
Height = 40
|
||||||
Top = 8
|
Top = 12
|
||||||
Width = 55
|
Width = 86
|
||||||
Anchors = [akTop, akRight, akBottom]
|
Anchors = [akTop, akRight, akBottom]
|
||||||
BorderSpacing.Left = 8
|
BorderSpacing.Left = 12
|
||||||
BorderSpacing.Right = 8
|
BorderSpacing.Right = 12
|
||||||
MaxValue = 65565
|
MaxValue = 65565
|
||||||
MinValue = 1024
|
MinValue = 1024
|
||||||
TabOrder = 1
|
TabOrder = 1
|
||||||
@@ -438,29 +448,28 @@ object frmLogin: TfrmLogin
|
|||||||
AnchorSideTop.Control = gbConnection
|
AnchorSideTop.Control = gbConnection
|
||||||
AnchorSideRight.Control = Owner
|
AnchorSideRight.Control = Owner
|
||||||
AnchorSideRight.Side = asrBottom
|
AnchorSideRight.Side = asrBottom
|
||||||
Left = 330
|
Left = 519
|
||||||
Height = 78
|
Height = 144
|
||||||
Top = 12
|
Top = 6
|
||||||
Width = 143
|
Width = 224
|
||||||
Anchors = [akTop, akLeft, akRight]
|
Anchors = [akTop, akRight]
|
||||||
AutoSize = True
|
BorderSpacing.Left = 12
|
||||||
BorderSpacing.Left = 8
|
BorderSpacing.Right = 12
|
||||||
BorderSpacing.Top = 8
|
ClientHeight = 140
|
||||||
BorderSpacing.Right = 8
|
ClientWidth = 220
|
||||||
ClientHeight = 76
|
|
||||||
ClientWidth = 141
|
|
||||||
TabOrder = 2
|
TabOrder = 2
|
||||||
object btnOK: TButton
|
object btnOK: TButton
|
||||||
AnchorSideLeft.Control = gbActions
|
AnchorSideLeft.Control = gbActions
|
||||||
AnchorSideTop.Control = gbActions
|
AnchorSideTop.Control = gbActions
|
||||||
AnchorSideRight.Control = gbActions
|
AnchorSideRight.Control = gbActions
|
||||||
AnchorSideRight.Side = asrBottom
|
AnchorSideRight.Side = asrBottom
|
||||||
Left = 8
|
Left = 12
|
||||||
Height = 25
|
Height = 39
|
||||||
Top = 8
|
Top = 12
|
||||||
Width = 125
|
Width = 196
|
||||||
BorderSpacing.Around = 8
|
Anchors = [akTop, akLeft, akRight]
|
||||||
BorderSpacing.InnerBorder = 4
|
BorderSpacing.Around = 12
|
||||||
|
BorderSpacing.InnerBorder = 6
|
||||||
Caption = '&OK'
|
Caption = '&OK'
|
||||||
Default = True
|
Default = True
|
||||||
OnClick = btnOKClick
|
OnClick = btnOKClick
|
||||||
@@ -472,13 +481,13 @@ object frmLogin: TfrmLogin
|
|||||||
AnchorSideTop.Side = asrBottom
|
AnchorSideTop.Side = asrBottom
|
||||||
AnchorSideRight.Control = btnOK
|
AnchorSideRight.Control = btnOK
|
||||||
AnchorSideRight.Side = asrBottom
|
AnchorSideRight.Side = asrBottom
|
||||||
Left = 8
|
Left = 12
|
||||||
Height = 25
|
Height = 39
|
||||||
Top = 41
|
Top = 63
|
||||||
Width = 125
|
Width = 196
|
||||||
Anchors = [akTop, akLeft, akRight]
|
Anchors = [akTop, akLeft, akRight]
|
||||||
BorderSpacing.Bottom = 8
|
BorderSpacing.Bottom = 12
|
||||||
BorderSpacing.InnerBorder = 4
|
BorderSpacing.InnerBorder = 6
|
||||||
Caption = '&Cancel'
|
Caption = '&Cancel'
|
||||||
ModalResult = 2
|
ModalResult = 2
|
||||||
OnClick = btnCancelClick
|
OnClick = btnCancelClick
|
||||||
@@ -491,47 +500,49 @@ object frmLogin: TfrmLogin
|
|||||||
AnchorSideTop.Side = asrBottom
|
AnchorSideTop.Side = asrBottom
|
||||||
AnchorSideRight.Control = gbConnection
|
AnchorSideRight.Control = gbConnection
|
||||||
AnchorSideRight.Side = asrBottom
|
AnchorSideRight.Side = asrBottom
|
||||||
Left = 8
|
Left = 12
|
||||||
Height = 95
|
Height = 149
|
||||||
Top = 136
|
Top = 227
|
||||||
Width = 314
|
Width = 495
|
||||||
Anchors = [akTop, akLeft, akRight]
|
Anchors = [akTop, akLeft, akRight]
|
||||||
AutoSize = True
|
BorderSpacing.Top = 6
|
||||||
BorderSpacing.Top = 4
|
|
||||||
Caption = 'Data files'
|
Caption = 'Data files'
|
||||||
ClientHeight = 81
|
ClientHeight = 111
|
||||||
ClientWidth = 312
|
ClientWidth = 491
|
||||||
TabOrder = 1
|
TabOrder = 1
|
||||||
object lblData: TLabel
|
object lblData: TLabel
|
||||||
AnchorSideLeft.Control = gbData
|
AnchorSideLeft.Control = gbData
|
||||||
AnchorSideTop.Control = gbData
|
AnchorSideTop.Control = gbData
|
||||||
AnchorSideRight.Control = gbData
|
AnchorSideRight.Control = gbData
|
||||||
AnchorSideRight.Side = asrBottom
|
AnchorSideRight.Side = asrBottom
|
||||||
Left = 8
|
Left = 12
|
||||||
Height = 46
|
Height = 76
|
||||||
Top = 4
|
Top = 6
|
||||||
Width = 296
|
Width = 467
|
||||||
Anchors = [akTop, akLeft, akRight]
|
Anchors = [akTop, akLeft, akRight]
|
||||||
BorderSpacing.Left = 8
|
BorderSpacing.Left = 12
|
||||||
BorderSpacing.Top = 4
|
BorderSpacing.Top = 6
|
||||||
BorderSpacing.Right = 8
|
BorderSpacing.Right = 12
|
||||||
Caption = 'Select the directory containing art.mul, artidx.mul, hues.mul, tiledata.mul, animdata.mul, texmaps.mul, texidx.mul, light.mul and lightidx.mul.'
|
Caption = 'Select the directory containing art.mul, artidx.mul, hues.mul, tiledata.mul, animdata.mul, texmaps.mul, texidx.mul, light.mul and lightidx.mul.'
|
||||||
|
Color = clDefault
|
||||||
ParentColor = False
|
ParentColor = False
|
||||||
|
Transparent = False
|
||||||
WordWrap = True
|
WordWrap = True
|
||||||
end
|
end
|
||||||
object edData: TDirectoryEdit
|
object edData: TDirectoryEdit
|
||||||
AnchorSideLeft.Control = lblData
|
AnchorSideLeft.Control = lblData
|
||||||
AnchorSideTop.Control = lblData
|
AnchorSideTop.Control = lblData
|
||||||
AnchorSideTop.Side = asrBottom
|
AnchorSideTop.Side = asrBottom
|
||||||
Left = 8
|
Left = 12
|
||||||
Height = 19
|
Height = 32
|
||||||
Top = 54
|
Top = 88
|
||||||
Width = 272
|
Width = 425
|
||||||
ShowHidden = False
|
ShowHidden = False
|
||||||
ButtonWidth = 23
|
ButtonWidth = 36
|
||||||
NumGlyphs = 1
|
NumGlyphs = 1
|
||||||
BorderSpacing.Top = 4
|
AutoSize = False
|
||||||
BorderSpacing.Bottom = 8
|
BorderSpacing.Top = 6
|
||||||
|
BorderSpacing.Bottom = 12
|
||||||
MaxLength = 0
|
MaxLength = 0
|
||||||
TabOrder = 0
|
TabOrder = 0
|
||||||
end
|
end
|
||||||
@@ -542,28 +553,26 @@ object frmLogin: TfrmLogin
|
|||||||
AnchorSideTop.Side = asrBottom
|
AnchorSideTop.Side = asrBottom
|
||||||
AnchorSideRight.Control = gbActions
|
AnchorSideRight.Control = gbActions
|
||||||
AnchorSideRight.Side = asrBottom
|
AnchorSideRight.Side = asrBottom
|
||||||
Left = 330
|
Left = 519
|
||||||
Height = 85
|
Height = 126
|
||||||
Top = 98
|
Top = 162
|
||||||
Width = 143
|
Width = 224
|
||||||
Anchors = [akTop, akLeft, akRight]
|
Anchors = [akTop, akLeft, akRight]
|
||||||
AutoSize = True
|
BorderSpacing.Top = 12
|
||||||
BorderSpacing.Top = 8
|
|
||||||
Caption = 'Profiles'
|
Caption = 'Profiles'
|
||||||
ClientHeight = 71
|
ClientHeight = 88
|
||||||
ClientWidth = 141
|
ClientWidth = 220
|
||||||
TabOrder = 3
|
TabOrder = 3
|
||||||
object btnSaveProfile: TSpeedButton
|
object btnSaveProfile: TSpeedButton
|
||||||
AnchorSideTop.Control = btnDeleteProfile
|
AnchorSideTop.Control = btnDeleteProfile
|
||||||
AnchorSideRight.Control = btnDeleteProfile
|
AnchorSideRight.Control = btnDeleteProfile
|
||||||
Left = 81
|
Left = 126
|
||||||
Height = 22
|
Height = 35
|
||||||
Hint = 'Save profile'
|
Hint = 'Save profile'
|
||||||
Top = 41
|
Top = 58
|
||||||
Width = 22
|
Width = 35
|
||||||
Anchors = [akTop, akRight]
|
Anchors = [akTop, akRight]
|
||||||
BorderSpacing.Right = 8
|
BorderSpacing.Right = 12
|
||||||
Color = clBtnFace
|
|
||||||
Glyph.Data = {
|
Glyph.Data = {
|
||||||
36040000424D3604000000000000360000002800000010000000100000000100
|
36040000424D3604000000000000360000002800000010000000100000000100
|
||||||
2000000000000004000064000000640000000000000000000000BA6A36FFB969
|
2000000000000004000064000000640000000000000000000000BA6A36FFB969
|
||||||
@@ -600,7 +609,6 @@ object frmLogin: TfrmLogin
|
|||||||
36FFBC6B36FFBC6B36FFBC6B36FFBB6B36FFBB6B36FFBB6A36FFBB6A36FFBC6C
|
36FFBC6B36FFBC6B36FFBC6B36FFBB6B36FFBB6B36FFBB6A36FFBB6A36FFBC6C
|
||||||
39FFBD6E3BFFBB6D3AFFBB6B38FFBB703EFF0000000000000000
|
39FFBD6E3BFFBB6D3AFFBB6B38FFBB703EFF0000000000000000
|
||||||
}
|
}
|
||||||
NumGlyphs = 0
|
|
||||||
OnClick = btnSaveProfileClick
|
OnClick = btnSaveProfileClick
|
||||||
ShowCaption = False
|
ShowCaption = False
|
||||||
ShowHint = True
|
ShowHint = True
|
||||||
@@ -611,15 +619,14 @@ object frmLogin: TfrmLogin
|
|||||||
AnchorSideTop.Side = asrBottom
|
AnchorSideTop.Side = asrBottom
|
||||||
AnchorSideRight.Control = cbProfile
|
AnchorSideRight.Control = cbProfile
|
||||||
AnchorSideRight.Side = asrBottom
|
AnchorSideRight.Side = asrBottom
|
||||||
Left = 111
|
Left = 173
|
||||||
Height = 22
|
Height = 35
|
||||||
Hint = 'Delete profile'
|
Hint = 'Delete profile'
|
||||||
Top = 41
|
Top = 58
|
||||||
Width = 22
|
Width = 35
|
||||||
Anchors = [akTop, akRight]
|
Anchors = [akTop, akRight]
|
||||||
BorderSpacing.Top = 8
|
BorderSpacing.Top = 12
|
||||||
BorderSpacing.Bottom = 8
|
BorderSpacing.Bottom = 12
|
||||||
Color = clBtnFace
|
|
||||||
Glyph.Data = {
|
Glyph.Data = {
|
||||||
36040000424D3604000000000000360000002800000010000000100000000100
|
36040000424D3604000000000000360000002800000010000000100000000100
|
||||||
2000000000000004000064000000640000000000000000000000000000000000
|
2000000000000004000064000000640000000000000000000000000000000000
|
||||||
@@ -656,7 +663,6 @@ object frmLogin: TfrmLogin
|
|||||||
0000000000000000000000000000000000000000000000000000000000000000
|
0000000000000000000000000000000000000000000000000000000000000000
|
||||||
0000000000000000000000000000000000000000000000000000
|
0000000000000000000000000000000000000000000000000000
|
||||||
}
|
}
|
||||||
NumGlyphs = 0
|
|
||||||
OnClick = btnDeleteProfileClick
|
OnClick = btnDeleteProfileClick
|
||||||
ShowCaption = False
|
ShowCaption = False
|
||||||
ShowHint = True
|
ShowHint = True
|
||||||
@@ -667,15 +673,15 @@ object frmLogin: TfrmLogin
|
|||||||
AnchorSideTop.Control = gbProfiles
|
AnchorSideTop.Control = gbProfiles
|
||||||
AnchorSideRight.Control = gbProfiles
|
AnchorSideRight.Control = gbProfiles
|
||||||
AnchorSideRight.Side = asrBottom
|
AnchorSideRight.Side = asrBottom
|
||||||
Left = 8
|
Left = 12
|
||||||
Height = 29
|
Height = 40
|
||||||
Top = 4
|
Top = 6
|
||||||
Width = 125
|
Width = 196
|
||||||
Anchors = [akTop, akLeft, akRight]
|
Anchors = [akTop, akLeft, akRight]
|
||||||
BorderSpacing.Left = 8
|
BorderSpacing.Left = 12
|
||||||
BorderSpacing.Top = 4
|
BorderSpacing.Top = 6
|
||||||
BorderSpacing.Right = 8
|
BorderSpacing.Right = 12
|
||||||
ItemHeight = 0
|
ItemHeight = 26
|
||||||
OnChange = cbProfileChange
|
OnChange = cbProfileChange
|
||||||
Style = csDropDownList
|
Style = csDropDownList
|
||||||
TabOrder = 0
|
TabOrder = 0
|
||||||
|
|||||||
+21
-17
@@ -79,9 +79,7 @@ var
|
|||||||
implementation
|
implementation
|
||||||
|
|
||||||
uses
|
uses
|
||||||
UdmNetwork;
|
UdmNetwork, vinfo;
|
||||||
|
|
||||||
{$I version.inc}
|
|
||||||
|
|
||||||
{ TfrmLogin }
|
{ TfrmLogin }
|
||||||
|
|
||||||
@@ -130,11 +128,14 @@ begin
|
|||||||
if InputQuery('Save profile', 'Enter the name of the profile:', profileName) then
|
if InputQuery('Save profile', 'Enter the name of the profile:', profileName) then
|
||||||
begin
|
begin
|
||||||
profile := TIniFile.Create(FProfilePath + profileName + '.ini');
|
profile := TIniFile.Create(FProfilePath + profileName + '.ini');
|
||||||
profile.WriteString('Connection', 'Host', edHost.Text);
|
try
|
||||||
profile.WriteInteger('Connection', 'Port', edPort.Value);
|
profile.WriteString('Connection', 'Host', edHost.Text);
|
||||||
profile.WriteString('Connection', 'Username', edUsername.Text);
|
profile.WriteInteger('Connection', 'Port', edPort.Value);
|
||||||
profile.WriteString('Data', 'Path', edData.Text);
|
profile.WriteString('Connection', 'Username', edUsername.Text);
|
||||||
profile.Free;
|
profile.WriteString('Data', 'Path', edData.Text);
|
||||||
|
finally
|
||||||
|
profile.Free;
|
||||||
|
end;
|
||||||
cbProfile.ItemIndex := cbProfile.Items.IndexOf(profileName);
|
cbProfile.ItemIndex := cbProfile.Items.IndexOf(profileName);
|
||||||
if cbProfile.ItemIndex = -1 then
|
if cbProfile.ItemIndex = -1 then
|
||||||
begin
|
begin
|
||||||
@@ -151,13 +152,16 @@ begin
|
|||||||
if cbProfile.ItemIndex > -1 then
|
if cbProfile.ItemIndex > -1 then
|
||||||
begin
|
begin
|
||||||
profile := TIniFile.Create(FProfilePath + cbProfile.Text + '.ini');
|
profile := TIniFile.Create(FProfilePath + cbProfile.Text + '.ini');
|
||||||
edHost.Text := profile.ReadString('Connection', 'Host', '');
|
try
|
||||||
edPort.Value := profile.ReadInteger('Connection', 'Port', 2597);
|
edHost.Text := profile.ReadString('Connection', 'Host', '');
|
||||||
edUsername.Text := profile.ReadString('Connection', 'Username', '');
|
edPort.Value := profile.ReadInteger('Connection', 'Port', 2597);
|
||||||
edPassword.Text := '';
|
edUsername.Text := profile.ReadString('Connection', 'Username', '');
|
||||||
edData.Text := profile.ReadString('Data', 'Path', '');
|
edPassword.Text := '';
|
||||||
edPassword.SetFocus;
|
edData.Text := profile.ReadString('Data', 'Path', '');
|
||||||
profile.Free;
|
edPassword.SetFocus;
|
||||||
|
finally
|
||||||
|
profile.Free;
|
||||||
|
end;
|
||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
@@ -171,8 +175,8 @@ procedure TfrmLogin.FormCreate(Sender: TObject);
|
|||||||
var
|
var
|
||||||
searchRec: TSearchRec;
|
searchRec: TSearchRec;
|
||||||
begin
|
begin
|
||||||
lblCopyright.Caption := Format('UO CentrED Client Version %s (c) %s',
|
lblCopyright.Caption := Format('UO CentrED Client Version %s %s',
|
||||||
[ProductVersion, Copyright]);
|
[VersionInfo.GetProductVersionString, VersionInfo.GetCopyright]);
|
||||||
|
|
||||||
FProfilePath := GetAppConfigDir(False) + 'Profiles' + PathDelim;
|
FProfilePath := GetAppConfigDir(False) + 'Profiles' + PathDelim;
|
||||||
ForceDirectories(FProfilePath);
|
ForceDirectories(FProfilePath);
|
||||||
|
|||||||
+771
-1537
File diff suppressed because it is too large
Load Diff
+702
-137
File diff suppressed because it is too large
Load Diff
+25
-21
@@ -1,59 +1,63 @@
|
|||||||
object frmRadarMap: TfrmRadarMap
|
object frmRadarMap: TfrmRadarMap
|
||||||
Left = 290
|
Left = 290
|
||||||
Height = 360
|
Height = 562
|
||||||
Top = 171
|
Top = 171
|
||||||
Width = 479
|
Width = 749
|
||||||
HorzScrollBar.Page = 478
|
HorzScrollBar.Page = 478
|
||||||
VertScrollBar.Page = 359
|
VertScrollBar.Page = 359
|
||||||
ActiveControl = sbMain
|
ActiveControl = sbMain
|
||||||
Caption = 'Radar Map (1:8)'
|
Caption = 'Radar Map (1:8)'
|
||||||
ClientHeight = 360
|
ClientHeight = 562
|
||||||
ClientWidth = 479
|
ClientWidth = 749
|
||||||
|
DesignTimePPI = 120
|
||||||
OnClose = FormClose
|
OnClose = FormClose
|
||||||
OnCreate = FormCreate
|
OnCreate = FormCreate
|
||||||
OnDestroy = FormDestroy
|
OnDestroy = FormDestroy
|
||||||
OnResize = FormResize
|
OnResize = FormResize
|
||||||
Position = poOwnerFormCenter
|
Position = poOwnerFormCenter
|
||||||
ShowInTaskBar = stAlways
|
ShowInTaskBar = stAlways
|
||||||
LCLVersion = '0.9.29'
|
LCLVersion = '2.3.0.0'
|
||||||
object pnlBottom: TPanel
|
object pnlBottom: TPanel
|
||||||
Left = 0
|
Left = 0
|
||||||
Height = 21
|
Height = 32
|
||||||
Top = 339
|
Top = 418
|
||||||
Width = 479
|
Width = 599
|
||||||
Align = alBottom
|
Align = alBottom
|
||||||
BevelOuter = bvNone
|
BevelOuter = bvNone
|
||||||
ClientHeight = 21
|
ClientHeight = 32
|
||||||
ClientWidth = 479
|
ClientWidth = 599
|
||||||
TabOrder = 0
|
TabOrder = 0
|
||||||
object lblPosition: TLabel
|
object lblPosition: TLabel
|
||||||
Left = 8
|
Left = 10
|
||||||
Height = 21
|
Height = 26
|
||||||
Top = 0
|
Top = 0
|
||||||
Width = 41
|
Width = 1
|
||||||
Align = alLeft
|
Align = alLeft
|
||||||
BorderSpacing.Left = 8
|
BorderSpacing.Left = 12
|
||||||
|
Color = clDefault
|
||||||
Layout = tlCenter
|
Layout = tlCenter
|
||||||
ParentColor = False
|
ParentColor = False
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
object sbMain: TScrollBox
|
object sbMain: TScrollBox
|
||||||
Left = 0
|
Left = 0
|
||||||
Height = 339
|
Height = 424
|
||||||
Top = 0
|
Top = 0
|
||||||
Width = 479
|
Width = 599
|
||||||
|
HorzScrollBar.Page = 365
|
||||||
|
VertScrollBar.Page = 252
|
||||||
Align = alClient
|
Align = alClient
|
||||||
ClientHeight = 335
|
ClientHeight = 422
|
||||||
ClientWidth = 475
|
ClientWidth = 597
|
||||||
TabOrder = 1
|
TabOrder = 1
|
||||||
object pbRadar: TPaintBox
|
object pbRadar: TPaintBox
|
||||||
Left = 0
|
Left = 0
|
||||||
Height = 202
|
Height = 315
|
||||||
Top = 0
|
Top = 0
|
||||||
Width = 292
|
Width = 456
|
||||||
OnMouseDown = pbRadarMouseDown
|
OnMouseDown = pbRadarMouseDown
|
||||||
OnMouseMove = pbRadarMouseMove
|
|
||||||
OnMouseLeave = pbRadarMouseLeave
|
OnMouseLeave = pbRadarMouseLeave
|
||||||
|
OnMouseMove = pbRadarMouseMove
|
||||||
OnPaint = pbRadarPaint
|
OnPaint = pbRadarPaint
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
+38
-20
@@ -110,18 +110,27 @@ var
|
|||||||
begin
|
begin
|
||||||
RegisterPacketHandler($0D, nil);
|
RegisterPacketHandler($0D, nil);
|
||||||
|
|
||||||
SetLength(radarMap, FRadar.Width * FRadar.Height);
|
|
||||||
for x := 0 to FRadar.Width - 1 do
|
|
||||||
for y := 0 to FRadar.Height - 1 do
|
|
||||||
radarMap[x * FRadar.Height + y] := EncodeUOColor(PInteger(FRadar.PixelPointers[x, y])^);
|
|
||||||
|
|
||||||
radarMapFile := TFileStream.Create(GetAppConfigDir(False) + 'RadarMap.cache',
|
|
||||||
fmCreate);
|
|
||||||
radarMapFile.Write(radarMap[0], Length(radarMap) * SizeOf(Word));
|
|
||||||
radarMapFile.Free;
|
|
||||||
|
|
||||||
if FRadarDependencies <> nil then FreeAndNil(FRadarDependencies);
|
if FRadarDependencies <> nil then FreeAndNil(FRadarDependencies);
|
||||||
if FRadar <> nil then FreeAndNil(FRadar);
|
|
||||||
|
if FRadar <> nil then
|
||||||
|
begin
|
||||||
|
SetLength(radarMap, FRadar.Width * FRadar.Height);
|
||||||
|
if Length(radarMap) > 0 then
|
||||||
|
begin
|
||||||
|
for x := 0 to FRadar.Width - 1 do
|
||||||
|
for y := 0 to FRadar.Height - 1 do
|
||||||
|
radarMap[x * FRadar.Height + y] := EncodeUOColor(PInteger(FRadar.PixelPointer[x, y])^);
|
||||||
|
|
||||||
|
radarMapFile := TFileStream.Create(GetAppConfigDir(False) + 'RadarMap.cache',
|
||||||
|
fmCreate);
|
||||||
|
try
|
||||||
|
radarMapFile.Write(radarMap[0], Length(radarMap) * SizeOf(Word));
|
||||||
|
finally
|
||||||
|
radarMapFile.Free;
|
||||||
|
end;
|
||||||
|
end;
|
||||||
|
FreeAndNil(FRadar);
|
||||||
|
end;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
procedure TfrmRadarMap.FormResize(Sender: TObject);
|
procedure TfrmRadarMap.FormResize(Sender: TObject);
|
||||||
@@ -183,11 +192,16 @@ begin
|
|||||||
if FileExists(radarMapFileName) then
|
if FileExists(radarMapFileName) then
|
||||||
begin
|
begin
|
||||||
radarMapFile := TFileStream.Create(radarMapFileName, fmOpenRead);
|
radarMapFile := TFileStream.Create(radarMapFileName, fmOpenRead);
|
||||||
SetLength(radarMap, radarMapFile.Size div SizeOf(Word));
|
try
|
||||||
radarMapFile.Read(radarMap[0], radarMapFile.Size);
|
SetLength(radarMap, radarMapFile.Size div SizeOf(Word));
|
||||||
radarMapFile.Free;
|
if Length(radarMap) > 0 then
|
||||||
|
begin
|
||||||
realChecksum := crc32(realChecksum, @radarMap[0], Length(radarMap) * SizeOf(Word));
|
radarMapFile.Read(radarMap[0], radarMapFile.Size);
|
||||||
|
realChecksum := crc32(realChecksum, @radarMap[0], Length(radarMap) * SizeOf(Word));
|
||||||
|
end;
|
||||||
|
finally
|
||||||
|
radarMapFile.Free;
|
||||||
|
end;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
if checksum <> realChecksum then
|
if checksum <> realChecksum then
|
||||||
@@ -203,7 +217,8 @@ begin
|
|||||||
$02: //radar map
|
$02: //radar map
|
||||||
begin
|
begin
|
||||||
SetLength(radarMap, (ABuffer.Size - ABuffer.Position) div SizeOf(Word));
|
SetLength(radarMap, (ABuffer.Size - ABuffer.Position) div SizeOf(Word));
|
||||||
ABuffer.Read(radarMap[0], Length(radarMap) * SizeOf(Word));
|
if Length(radarMap) > 0 then
|
||||||
|
ABuffer.Read(radarMap[0], Length(radarMap) * SizeOf(Word));
|
||||||
RefreshRadar(radarMap);
|
RefreshRadar(radarMap);
|
||||||
//frmMain.Enabled := True;
|
//frmMain.Enabled := True;
|
||||||
frmInitialize.UnsetModal;
|
frmInitialize.UnsetModal;
|
||||||
@@ -213,8 +228,11 @@ begin
|
|||||||
begin
|
begin
|
||||||
x := ABuffer.ReadWord;
|
x := ABuffer.ReadWord;
|
||||||
y := ABuffer.ReadWord;
|
y := ABuffer.ReadWord;
|
||||||
PInteger(FRadar.PixelPointers[x, y])^ := DecodeUOColor(ABuffer.ReadWord);
|
if (x < FRadar.Width) and (y < FRadar.Height) then
|
||||||
RepaintRadar;
|
begin
|
||||||
|
PInteger(FRadar.PixelPointer[x, y])^ := DecodeUOColor(ABuffer.ReadWord);
|
||||||
|
RepaintRadar;
|
||||||
|
end;
|
||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
@@ -225,7 +243,7 @@ var
|
|||||||
begin
|
begin
|
||||||
for x := 0 to FRadar.Width - 1 do
|
for x := 0 to FRadar.Width - 1 do
|
||||||
for y := 0 to FRadar.Height - 1 do
|
for y := 0 to FRadar.Height - 1 do
|
||||||
PInteger(FRadar.PixelPointers[x, y])^ := DecodeUOColor(ARadarMap[x * FRadar.Height + y]);
|
PInteger(FRadar.PixelPointer[x, y])^ := DecodeUOColor(ARadarMap[x * FRadar.Height + y]);
|
||||||
RepaintRadar;
|
RepaintRadar;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
|||||||
+124
-127
@@ -1,20 +1,20 @@
|
|||||||
object frmRegionControl: TfrmRegionControl
|
object frmRegionControl: TfrmRegionControl
|
||||||
Left = 247
|
Left = 247
|
||||||
Height = 413
|
Height = 645
|
||||||
Top = 139
|
Top = 139
|
||||||
Width = 620
|
Width = 1007
|
||||||
ActiveControl = vstRegions
|
ActiveControl = vstRegions
|
||||||
Caption = 'Region Control'
|
Caption = 'Region Control'
|
||||||
ClientHeight = 413
|
ClientHeight = 645
|
||||||
ClientWidth = 620
|
ClientWidth = 1007
|
||||||
Font.Height = -11
|
DesignTimePPI = 120
|
||||||
|
Font.Height = -18
|
||||||
OnClose = FormClose
|
OnClose = FormClose
|
||||||
OnCreate = FormCreate
|
OnCreate = FormCreate
|
||||||
OnDestroy = FormDestroy
|
OnDestroy = FormDestroy
|
||||||
OnShow = FormShow
|
OnShow = FormShow
|
||||||
Position = poOwnerFormCenter
|
Position = poOwnerFormCenter
|
||||||
ShowInTaskBar = stAlways
|
ShowInTaskBar = stAlways
|
||||||
LCLVersion = '0.9.29'
|
|
||||||
object sbArea: TScrollBox
|
object sbArea: TScrollBox
|
||||||
AnchorSideLeft.Control = vstRegions
|
AnchorSideLeft.Control = vstRegions
|
||||||
AnchorSideLeft.Side = asrBottom
|
AnchorSideLeft.Side = asrBottom
|
||||||
@@ -22,19 +22,21 @@ object frmRegionControl: TfrmRegionControl
|
|||||||
AnchorSideRight.Control = Owner
|
AnchorSideRight.Control = Owner
|
||||||
AnchorSideRight.Side = asrBottom
|
AnchorSideRight.Side = asrBottom
|
||||||
AnchorSideBottom.Control = btnClose
|
AnchorSideBottom.Control = btnClose
|
||||||
Left = 160
|
Left = 250
|
||||||
Height = 372
|
Height = 582
|
||||||
Top = 0
|
Top = 0
|
||||||
Width = 460
|
Width = 757
|
||||||
|
HorzScrollBar.Page = 164
|
||||||
|
VertScrollBar.Page = 164
|
||||||
Anchors = [akTop, akLeft, akRight, akBottom]
|
Anchors = [akTop, akLeft, akRight, akBottom]
|
||||||
ClientHeight = 368
|
ClientHeight = 580
|
||||||
ClientWidth = 456
|
ClientWidth = 755
|
||||||
TabOrder = 0
|
TabOrder = 0
|
||||||
object pbArea: TPaintBox
|
object pbArea: TPaintBox
|
||||||
Left = 0
|
Left = 0
|
||||||
Height = 105
|
Height = 164
|
||||||
Top = 0
|
Top = 0
|
||||||
Width = 105
|
Width = 164
|
||||||
OnMouseDown = pbAreaMouseDown
|
OnMouseDown = pbAreaMouseDown
|
||||||
OnMouseMove = pbAreaMouseMove
|
OnMouseMove = pbAreaMouseMove
|
||||||
OnPaint = pbAreaPaint
|
OnPaint = pbAreaPaint
|
||||||
@@ -45,12 +47,12 @@ object frmRegionControl: TfrmRegionControl
|
|||||||
AnchorSideRight.Side = asrBottom
|
AnchorSideRight.Side = asrBottom
|
||||||
AnchorSideBottom.Control = Owner
|
AnchorSideBottom.Control = Owner
|
||||||
AnchorSideBottom.Side = asrBottom
|
AnchorSideBottom.Side = asrBottom
|
||||||
Left = 548
|
Left = 895
|
||||||
Height = 25
|
Height = 39
|
||||||
Top = 380
|
Top = 594
|
||||||
Width = 64
|
Width = 100
|
||||||
Anchors = [akRight, akBottom]
|
Anchors = [akRight, akBottom]
|
||||||
BorderSpacing.Around = 8
|
BorderSpacing.Around = 12
|
||||||
Caption = 'Close'
|
Caption = 'Close'
|
||||||
OnClick = btnCloseClick
|
OnClick = btnCloseClick
|
||||||
TabOrder = 1
|
TabOrder = 1
|
||||||
@@ -59,35 +61,37 @@ object frmRegionControl: TfrmRegionControl
|
|||||||
AnchorSideRight.Control = btnClose
|
AnchorSideRight.Control = btnClose
|
||||||
AnchorSideBottom.Control = btnClose
|
AnchorSideBottom.Control = btnClose
|
||||||
AnchorSideBottom.Side = asrBottom
|
AnchorSideBottom.Side = asrBottom
|
||||||
Left = 476
|
Left = 783
|
||||||
Height = 25
|
Height = 39
|
||||||
Top = 380
|
Top = 594
|
||||||
Width = 64
|
Width = 100
|
||||||
Anchors = [akRight, akBottom]
|
Anchors = [akRight, akBottom]
|
||||||
BorderSpacing.Right = 4
|
BorderSpacing.Right = 6
|
||||||
Caption = 'Save'
|
Caption = 'Save'
|
||||||
Enabled = False
|
Enabled = False
|
||||||
OnClick = btnSaveClick
|
OnClick = btnSaveClick
|
||||||
TabOrder = 2
|
TabOrder = 2
|
||||||
end
|
end
|
||||||
object vstRegions: TVirtualStringTree
|
object vstRegions: TLazVirtualStringTree
|
||||||
AnchorSideLeft.Control = Owner
|
AnchorSideLeft.Control = Owner
|
||||||
AnchorSideTop.Control = Owner
|
AnchorSideTop.Control = Owner
|
||||||
AnchorSideBottom.Control = btnAddRegion
|
AnchorSideBottom.Control = btnAddRegion
|
||||||
Left = 0
|
Left = 0
|
||||||
Height = 130
|
Height = 203
|
||||||
Top = 0
|
Top = 0
|
||||||
Width = 160
|
Width = 250
|
||||||
Anchors = [akTop, akLeft, akBottom]
|
Anchors = [akTop, akLeft, akBottom]
|
||||||
|
DefaultNodeHeight = 26
|
||||||
DefaultText = 'Node'
|
DefaultText = 'Node'
|
||||||
Header.AutoSizeIndex = 0
|
Header.AutoSizeIndex = 0
|
||||||
Header.Columns = <
|
Header.Columns = <
|
||||||
item
|
item
|
||||||
Position = 0
|
Position = 0
|
||||||
Text = 'Regions'
|
Text = 'Regions'
|
||||||
Width = 156
|
Width = 248
|
||||||
end>
|
end>
|
||||||
Header.DefaultHeight = 17
|
Header.DefaultHeight = 26
|
||||||
|
Header.Height = 45
|
||||||
Header.Options = [hoAutoResize, hoVisible]
|
Header.Options = [hoAutoResize, hoVisible]
|
||||||
Header.ParentFont = True
|
Header.ParentFont = True
|
||||||
Header.Style = hsFlatButtons
|
Header.Style = hsFlatButtons
|
||||||
@@ -103,14 +107,13 @@ object frmRegionControl: TfrmRegionControl
|
|||||||
object btnAddRegion: TSpeedButton
|
object btnAddRegion: TSpeedButton
|
||||||
AnchorSideLeft.Control = vstRegions
|
AnchorSideLeft.Control = vstRegions
|
||||||
AnchorSideBottom.Control = spRegionsArea
|
AnchorSideBottom.Control = spRegionsArea
|
||||||
Left = 4
|
Left = 6
|
||||||
Height = 22
|
Height = 35
|
||||||
Hint = 'Add region'
|
Hint = 'Add region'
|
||||||
Top = 134
|
Top = 209
|
||||||
Width = 22
|
Width = 35
|
||||||
Anchors = [akLeft, akBottom]
|
Anchors = [akLeft, akBottom]
|
||||||
BorderSpacing.Around = 4
|
BorderSpacing.Around = 6
|
||||||
Color = clBtnFace
|
|
||||||
Glyph.Data = {
|
Glyph.Data = {
|
||||||
36040000424D3604000000000000360000002800000010000000100000000100
|
36040000424D3604000000000000360000002800000010000000100000000100
|
||||||
2000000000000004000064000000640000000000000000000000000000000000
|
2000000000000004000064000000640000000000000000000000000000000000
|
||||||
@@ -147,7 +150,6 @@ object frmRegionControl: TfrmRegionControl
|
|||||||
0000000000000000000000000000000000000000000000000000000000000000
|
0000000000000000000000000000000000000000000000000000000000000000
|
||||||
0000000000000000000000000000000000000000000000000000
|
0000000000000000000000000000000000000000000000000000
|
||||||
}
|
}
|
||||||
NumGlyphs = 0
|
|
||||||
OnClick = mnuAddRegionClick
|
OnClick = mnuAddRegionClick
|
||||||
ShowHint = True
|
ShowHint = True
|
||||||
ParentShowHint = False
|
ParentShowHint = False
|
||||||
@@ -157,14 +159,13 @@ object frmRegionControl: TfrmRegionControl
|
|||||||
AnchorSideLeft.Side = asrBottom
|
AnchorSideLeft.Side = asrBottom
|
||||||
AnchorSideBottom.Control = btnAddRegion
|
AnchorSideBottom.Control = btnAddRegion
|
||||||
AnchorSideBottom.Side = asrBottom
|
AnchorSideBottom.Side = asrBottom
|
||||||
Left = 30
|
Left = 47
|
||||||
Height = 22
|
Height = 35
|
||||||
Hint = 'Delete region'
|
Hint = 'Delete region'
|
||||||
Top = 134
|
Top = 209
|
||||||
Width = 22
|
Width = 35
|
||||||
Anchors = [akLeft, akBottom]
|
Anchors = [akLeft, akBottom]
|
||||||
BorderSpacing.Left = 4
|
BorderSpacing.Left = 6
|
||||||
Color = clBtnFace
|
|
||||||
Enabled = False
|
Enabled = False
|
||||||
Glyph.Data = {
|
Glyph.Data = {
|
||||||
36040000424D3604000000000000360000002800000010000000100000000100
|
36040000424D3604000000000000360000002800000010000000100000000100
|
||||||
@@ -202,30 +203,31 @@ object frmRegionControl: TfrmRegionControl
|
|||||||
0000000000000000000000000000000000000000000000000000000000000000
|
0000000000000000000000000000000000000000000000000000000000000000
|
||||||
0000000000000000000000000000000000000000000000000000
|
0000000000000000000000000000000000000000000000000000
|
||||||
}
|
}
|
||||||
NumGlyphs = 0
|
|
||||||
OnClick = mnuDeleteRegionClick
|
OnClick = mnuDeleteRegionClick
|
||||||
ShowHint = True
|
ShowHint = True
|
||||||
ParentShowHint = False
|
ParentShowHint = False
|
||||||
end
|
end
|
||||||
object vstArea: TVirtualStringTree
|
object vstArea: TLazVirtualStringTree
|
||||||
AnchorSideLeft.Control = spRegionsArea
|
AnchorSideLeft.Control = spRegionsArea
|
||||||
AnchorSideTop.Control = Label1
|
AnchorSideTop.Control = Label1
|
||||||
AnchorSideTop.Side = asrBottom
|
AnchorSideTop.Side = asrBottom
|
||||||
AnchorSideRight.Control = spRegionsArea
|
AnchorSideRight.Control = spRegionsArea
|
||||||
AnchorSideRight.Side = asrBottom
|
AnchorSideRight.Side = asrBottom
|
||||||
AnchorSideBottom.Control = btnDeleteArea
|
AnchorSideBottom.Control = btnDeleteArea
|
||||||
Left = 4
|
Left = 6
|
||||||
Height = 124
|
Height = 177
|
||||||
Top = 179
|
Top = 284
|
||||||
Width = 152
|
Width = 238
|
||||||
Anchors = [akTop, akLeft, akRight, akBottom]
|
Anchors = [akTop, akLeft, akRight, akBottom]
|
||||||
BorderSpacing.Left = 4
|
BorderSpacing.Left = 6
|
||||||
BorderSpacing.Right = 4
|
BorderSpacing.Right = 6
|
||||||
BorderSpacing.Bottom = 4
|
BorderSpacing.Bottom = 6
|
||||||
|
DefaultNodeHeight = 26
|
||||||
DefaultText = 'Node'
|
DefaultText = 'Node'
|
||||||
Header.AutoSizeIndex = 0
|
Header.AutoSizeIndex = 0
|
||||||
Header.Columns = <>
|
Header.Columns = <>
|
||||||
Header.DefaultHeight = 17
|
Header.DefaultHeight = 26
|
||||||
|
Header.Height = 36
|
||||||
Header.MainColumn = -1
|
Header.MainColumn = -1
|
||||||
Header.Options = [hoColumnResize, hoDrag]
|
Header.Options = [hoColumnResize, hoDrag]
|
||||||
TabOrder = 4
|
TabOrder = 4
|
||||||
@@ -240,14 +242,15 @@ object frmRegionControl: TfrmRegionControl
|
|||||||
AnchorSideTop.Side = asrBottom
|
AnchorSideTop.Side = asrBottom
|
||||||
AnchorSideRight.Control = spRegionsArea
|
AnchorSideRight.Control = spRegionsArea
|
||||||
AnchorSideRight.Side = asrBottom
|
AnchorSideRight.Side = asrBottom
|
||||||
Left = 4
|
Left = 6
|
||||||
Height = 14
|
Height = 26
|
||||||
Top = 165
|
Top = 258
|
||||||
Width = 152
|
Width = 238
|
||||||
Anchors = [akTop, akLeft, akRight]
|
Anchors = [akTop, akLeft, akRight]
|
||||||
BorderSpacing.Left = 4
|
BorderSpacing.Left = 6
|
||||||
BorderSpacing.Right = 4
|
BorderSpacing.Right = 6
|
||||||
Caption = 'Area:'
|
Caption = 'Area:'
|
||||||
|
Color = clDefault
|
||||||
ParentColor = False
|
ParentColor = False
|
||||||
end
|
end
|
||||||
object spRegionsArea: TSplitter
|
object spRegionsArea: TSplitter
|
||||||
@@ -256,9 +259,9 @@ object frmRegionControl: TfrmRegionControl
|
|||||||
AnchorSideRight.Side = asrBottom
|
AnchorSideRight.Side = asrBottom
|
||||||
Cursor = crVSplit
|
Cursor = crVSplit
|
||||||
Left = 0
|
Left = 0
|
||||||
Height = 5
|
Height = 8
|
||||||
Top = 160
|
Top = 250
|
||||||
Width = 160
|
Width = 250
|
||||||
Align = alNone
|
Align = alNone
|
||||||
Anchors = [akTop, akLeft, akRight]
|
Anchors = [akTop, akLeft, akRight]
|
||||||
AutoSnap = False
|
AutoSnap = False
|
||||||
@@ -267,13 +270,12 @@ object frmRegionControl: TfrmRegionControl
|
|||||||
object btnAddArea: TSpeedButton
|
object btnAddArea: TSpeedButton
|
||||||
AnchorSideTop.Control = btnDeleteArea
|
AnchorSideTop.Control = btnDeleteArea
|
||||||
AnchorSideRight.Control = btnDeleteArea
|
AnchorSideRight.Control = btnDeleteArea
|
||||||
Left = 43
|
Left = 67
|
||||||
Height = 22
|
Height = 35
|
||||||
Hint = 'Add area'
|
Hint = 'Add area'
|
||||||
Top = 307
|
Top = 467
|
||||||
Width = 22
|
Width = 35
|
||||||
Anchors = [akTop, akRight]
|
Anchors = [akTop, akRight]
|
||||||
Color = clBtnFace
|
|
||||||
Enabled = False
|
Enabled = False
|
||||||
Glyph.Data = {
|
Glyph.Data = {
|
||||||
36040000424D3604000000000000360000002800000010000000100000000100
|
36040000424D3604000000000000360000002800000010000000100000000100
|
||||||
@@ -311,7 +313,6 @@ object frmRegionControl: TfrmRegionControl
|
|||||||
0000000000000000000000000000000000000000000000000000000000000000
|
0000000000000000000000000000000000000000000000000000000000000000
|
||||||
0000000000000000000000000000000000000000000000000000
|
0000000000000000000000000000000000000000000000000000
|
||||||
}
|
}
|
||||||
NumGlyphs = 0
|
|
||||||
OnClick = btnAddAreaClick
|
OnClick = btnAddAreaClick
|
||||||
ShowHint = True
|
ShowHint = True
|
||||||
ParentShowHint = False
|
ParentShowHint = False
|
||||||
@@ -320,15 +321,14 @@ object frmRegionControl: TfrmRegionControl
|
|||||||
AnchorSideLeft.Control = vstArea
|
AnchorSideLeft.Control = vstArea
|
||||||
AnchorSideLeft.Side = asrCenter
|
AnchorSideLeft.Side = asrCenter
|
||||||
AnchorSideBottom.Control = seX1
|
AnchorSideBottom.Control = seX1
|
||||||
Left = 69
|
Left = 108
|
||||||
Height = 22
|
Height = 35
|
||||||
Hint = 'Delete area'
|
Hint = 'Delete area'
|
||||||
Top = 307
|
Top = 467
|
||||||
Width = 22
|
Width = 35
|
||||||
Anchors = [akLeft, akBottom]
|
Anchors = [akLeft, akBottom]
|
||||||
BorderSpacing.Bottom = 4
|
BorderSpacing.Bottom = 6
|
||||||
BorderSpacing.Around = 4
|
BorderSpacing.Around = 6
|
||||||
Color = clBtnFace
|
|
||||||
Enabled = False
|
Enabled = False
|
||||||
Glyph.Data = {
|
Glyph.Data = {
|
||||||
36040000424D3604000000000000360000002800000010000000100000000100
|
36040000424D3604000000000000360000002800000010000000100000000100
|
||||||
@@ -366,7 +366,6 @@ object frmRegionControl: TfrmRegionControl
|
|||||||
0000000000000000000000000000000000000000000000000000000000000000
|
0000000000000000000000000000000000000000000000000000000000000000
|
||||||
0000000000000000000000000000000000000000000000000000
|
0000000000000000000000000000000000000000000000000000
|
||||||
}
|
}
|
||||||
NumGlyphs = 0
|
|
||||||
OnClick = btnDeleteAreaClick
|
OnClick = btnDeleteAreaClick
|
||||||
ShowHint = True
|
ShowHint = True
|
||||||
ParentShowHint = False
|
ParentShowHint = False
|
||||||
@@ -375,12 +374,11 @@ object frmRegionControl: TfrmRegionControl
|
|||||||
AnchorSideLeft.Control = btnDeleteArea
|
AnchorSideLeft.Control = btnDeleteArea
|
||||||
AnchorSideLeft.Side = asrBottom
|
AnchorSideLeft.Side = asrBottom
|
||||||
AnchorSideTop.Control = btnDeleteArea
|
AnchorSideTop.Control = btnDeleteArea
|
||||||
Left = 95
|
Left = 149
|
||||||
Height = 22
|
Height = 35
|
||||||
Hint = 'Delete all areas'
|
Hint = 'Delete all areas'
|
||||||
Top = 307
|
Top = 467
|
||||||
Width = 22
|
Width = 35
|
||||||
Color = clBtnFace
|
|
||||||
Enabled = False
|
Enabled = False
|
||||||
Glyph.Data = {
|
Glyph.Data = {
|
||||||
36040000424D3604000000000000360000002800000010000000100000000100
|
36040000424D3604000000000000360000002800000010000000100000000100
|
||||||
@@ -418,7 +416,6 @@ object frmRegionControl: TfrmRegionControl
|
|||||||
0000000000000000000000000000000000000000000000000000000000000000
|
0000000000000000000000000000000000000000000000000000000000000000
|
||||||
0000000000000000000000000000000000000000000000000000
|
0000000000000000000000000000000000000000000000000000
|
||||||
}
|
}
|
||||||
NumGlyphs = 0
|
|
||||||
OnClick = btnClearAreaClick
|
OnClick = btnClearAreaClick
|
||||||
ShowHint = True
|
ShowHint = True
|
||||||
ParentShowHint = False
|
ParentShowHint = False
|
||||||
@@ -427,24 +424,27 @@ object frmRegionControl: TfrmRegionControl
|
|||||||
AnchorSideLeft.Control = Owner
|
AnchorSideLeft.Control = Owner
|
||||||
AnchorSideTop.Control = seX1
|
AnchorSideTop.Control = seX1
|
||||||
AnchorSideTop.Side = asrCenter
|
AnchorSideTop.Side = asrCenter
|
||||||
Left = 4
|
Left = 6
|
||||||
Height = 14
|
Height = 26
|
||||||
Top = 339
|
Top = 519
|
||||||
Width = 8
|
Width = 11
|
||||||
BorderSpacing.Left = 4
|
BorderSpacing.Left = 6
|
||||||
Caption = 'X'
|
Caption = 'X'
|
||||||
|
Color = clDefault
|
||||||
Enabled = False
|
Enabled = False
|
||||||
ParentColor = False
|
ParentColor = False
|
||||||
end
|
end
|
||||||
object seX1: TSpinEdit
|
object seX1: TSpinEdit
|
||||||
AnchorSideLeft.Control = seY1
|
AnchorSideLeft.Control = seY1
|
||||||
|
AnchorSideRight.Control = seY1
|
||||||
|
AnchorSideRight.Side = asrBottom
|
||||||
AnchorSideBottom.Control = seY1
|
AnchorSideBottom.Control = seY1
|
||||||
Left = 20
|
Left = 28
|
||||||
Height = 19
|
Height = 36
|
||||||
Top = 337
|
Top = 514
|
||||||
Width = 50
|
Width = 76
|
||||||
Anchors = [akLeft, akBottom]
|
Anchors = [akLeft, akRight, akBottom]
|
||||||
BorderSpacing.Bottom = 8
|
BorderSpacing.Bottom = 12
|
||||||
Enabled = False
|
Enabled = False
|
||||||
OnChange = seX1Change
|
OnChange = seX1Change
|
||||||
TabOrder = 6
|
TabOrder = 6
|
||||||
@@ -454,11 +454,11 @@ object frmRegionControl: TfrmRegionControl
|
|||||||
AnchorSideLeft.Control = seX1
|
AnchorSideLeft.Control = seX1
|
||||||
AnchorSideLeft.Side = asrBottom
|
AnchorSideLeft.Side = asrBottom
|
||||||
AnchorSideTop.Control = seX1
|
AnchorSideTop.Control = seX1
|
||||||
Left = 78
|
Left = 116
|
||||||
Height = 19
|
Height = 36
|
||||||
Top = 337
|
Top = 514
|
||||||
Width = 50
|
Width = 76
|
||||||
BorderSpacing.Left = 8
|
BorderSpacing.Left = 12
|
||||||
Enabled = False
|
Enabled = False
|
||||||
OnChange = seX1Change
|
OnChange = seX1Change
|
||||||
TabOrder = 7
|
TabOrder = 7
|
||||||
@@ -468,11 +468,12 @@ object frmRegionControl: TfrmRegionControl
|
|||||||
AnchorSideLeft.Control = lblX
|
AnchorSideLeft.Control = lblX
|
||||||
AnchorSideTop.Control = seY1
|
AnchorSideTop.Control = seY1
|
||||||
AnchorSideTop.Side = asrCenter
|
AnchorSideTop.Side = asrCenter
|
||||||
Left = 4
|
Left = 6
|
||||||
Height = 14
|
Height = 26
|
||||||
Top = 366
|
Top = 567
|
||||||
Width = 8
|
Width = 10
|
||||||
Caption = 'Y'
|
Caption = 'Y'
|
||||||
|
Color = clDefault
|
||||||
Enabled = False
|
Enabled = False
|
||||||
ParentColor = False
|
ParentColor = False
|
||||||
end
|
end
|
||||||
@@ -482,16 +483,16 @@ object frmRegionControl: TfrmRegionControl
|
|||||||
AnchorSideRight.Control = seX1
|
AnchorSideRight.Control = seX1
|
||||||
AnchorSideRight.Side = asrBottom
|
AnchorSideRight.Side = asrBottom
|
||||||
AnchorSideBottom.Control = btnGrab1
|
AnchorSideBottom.Control = btnGrab1
|
||||||
Left = 20
|
Left = 28
|
||||||
Height = 19
|
Height = 36
|
||||||
Top = 364
|
Top = 562
|
||||||
Width = 50
|
Width = 76
|
||||||
Anchors = [akLeft, akRight, akBottom]
|
Anchors = [akLeft, akBottom]
|
||||||
BorderSpacing.Left = 8
|
BorderSpacing.Left = 12
|
||||||
Enabled = False
|
Enabled = False
|
||||||
OnChange = seX1Change
|
OnChange = seX1Change
|
||||||
TabOrder = 8
|
TabOrder = 8
|
||||||
Value = 1
|
Value = 2
|
||||||
end
|
end
|
||||||
object seY2: TSpinEdit
|
object seY2: TSpinEdit
|
||||||
AnchorSideLeft.Control = seX2
|
AnchorSideLeft.Control = seX2
|
||||||
@@ -499,12 +500,12 @@ object frmRegionControl: TfrmRegionControl
|
|||||||
AnchorSideTop.Side = asrBottom
|
AnchorSideTop.Side = asrBottom
|
||||||
AnchorSideRight.Control = seX2
|
AnchorSideRight.Control = seX2
|
||||||
AnchorSideRight.Side = asrBottom
|
AnchorSideRight.Side = asrBottom
|
||||||
Left = 78
|
Left = 116
|
||||||
Height = 19
|
Height = 36
|
||||||
Top = 364
|
Top = 562
|
||||||
Width = 50
|
Width = 76
|
||||||
Anchors = [akTop, akLeft, akRight]
|
Anchors = [akTop, akLeft, akRight]
|
||||||
BorderSpacing.Top = 8
|
BorderSpacing.Top = 12
|
||||||
Enabled = False
|
Enabled = False
|
||||||
OnChange = seX1Change
|
OnChange = seX1Change
|
||||||
TabOrder = 9
|
TabOrder = 9
|
||||||
@@ -515,14 +516,13 @@ object frmRegionControl: TfrmRegionControl
|
|||||||
AnchorSideLeft.Side = asrCenter
|
AnchorSideLeft.Side = asrCenter
|
||||||
AnchorSideBottom.Control = Owner
|
AnchorSideBottom.Control = Owner
|
||||||
AnchorSideBottom.Side = asrBottom
|
AnchorSideBottom.Side = asrBottom
|
||||||
Left = 34
|
Left = 49
|
||||||
Height = 22
|
Height = 35
|
||||||
Hint = 'Grab coordinates from the main window.'
|
Hint = 'Grab coordinates from the main window.'
|
||||||
Top = 387
|
Top = 604
|
||||||
Width = 22
|
Width = 35
|
||||||
Anchors = [akLeft, akBottom]
|
Anchors = [akLeft, akBottom]
|
||||||
BorderSpacing.Around = 4
|
BorderSpacing.Around = 6
|
||||||
Color = clBtnFace
|
|
||||||
Enabled = False
|
Enabled = False
|
||||||
Glyph.Data = {
|
Glyph.Data = {
|
||||||
36040000424D3604000000000000360000002800000010000000100000000100
|
36040000424D3604000000000000360000002800000010000000100000000100
|
||||||
@@ -560,7 +560,6 @@ object frmRegionControl: TfrmRegionControl
|
|||||||
FF00FFFFFF00FFFFFF00CBCBCB7EFFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF
|
FF00FFFFFF00FFFFFF00CBCBCB7EFFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF
|
||||||
FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00
|
FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00
|
||||||
}
|
}
|
||||||
NumGlyphs = 0
|
|
||||||
OnClick = btnGrab1Click
|
OnClick = btnGrab1Click
|
||||||
ShowHint = True
|
ShowHint = True
|
||||||
ParentShowHint = False
|
ParentShowHint = False
|
||||||
@@ -570,13 +569,12 @@ object frmRegionControl: TfrmRegionControl
|
|||||||
AnchorSideLeft.Side = asrCenter
|
AnchorSideLeft.Side = asrCenter
|
||||||
AnchorSideBottom.Control = btnGrab1
|
AnchorSideBottom.Control = btnGrab1
|
||||||
AnchorSideBottom.Side = asrBottom
|
AnchorSideBottom.Side = asrBottom
|
||||||
Left = 92
|
Left = 137
|
||||||
Height = 22
|
Height = 35
|
||||||
Hint = 'Grab coordinates from the main window.'
|
Hint = 'Grab coordinates from the main window.'
|
||||||
Top = 387
|
Top = 604
|
||||||
Width = 22
|
Width = 35
|
||||||
Anchors = [akLeft, akBottom]
|
Anchors = [akLeft, akBottom]
|
||||||
Color = clBtnFace
|
|
||||||
Enabled = False
|
Enabled = False
|
||||||
Glyph.Data = {
|
Glyph.Data = {
|
||||||
36040000424D3604000000000000360000002800000010000000100000000100
|
36040000424D3604000000000000360000002800000010000000100000000100
|
||||||
@@ -614,14 +612,13 @@ object frmRegionControl: TfrmRegionControl
|
|||||||
FF00FFFFFF00FFFFFF00CBCBCB7EFFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF
|
FF00FFFFFF00FFFFFF00CBCBCB7EFFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF
|
||||||
FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00
|
FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00
|
||||||
}
|
}
|
||||||
NumGlyphs = 0
|
|
||||||
OnClick = btnGrab1Click
|
OnClick = btnGrab1Click
|
||||||
ShowHint = True
|
ShowHint = True
|
||||||
ParentShowHint = False
|
ParentShowHint = False
|
||||||
end
|
end
|
||||||
object pmRegions: TPopupMenu
|
object pmRegions: TPopupMenu
|
||||||
left = 48
|
Left = 75
|
||||||
top = 43
|
Top = 68
|
||||||
object mnuAddRegion: TMenuItem
|
object mnuAddRegion: TMenuItem
|
||||||
Caption = 'Add'
|
Caption = 'Add'
|
||||||
OnClick = mnuAddRegionClick
|
OnClick = mnuAddRegionClick
|
||||||
|
|||||||
@@ -31,7 +31,7 @@ interface
|
|||||||
|
|
||||||
uses
|
uses
|
||||||
Classes, SysUtils, math, LResources, Forms, Controls, Graphics, Dialogs,
|
Classes, SysUtils, math, LResources, Forms, Controls, Graphics, Dialogs,
|
||||||
VirtualTrees, ExtCtrls, ImagingComponents, StdCtrls, Buttons, Spin, LCLIntf,
|
laz.VirtualTrees, ExtCtrls, ImagingComponents, StdCtrls, Buttons, Spin, LCLIntf,
|
||||||
UEnhancedMemoryStream, Menus, URectList, UEnums, UWorldItem;
|
UEnhancedMemoryStream, Menus, URectList, UEnums, UWorldItem;
|
||||||
|
|
||||||
type
|
type
|
||||||
@@ -73,8 +73,8 @@ type
|
|||||||
btnGrab1: TSpeedButton;
|
btnGrab1: TSpeedButton;
|
||||||
btnGrab2: TSpeedButton;
|
btnGrab2: TSpeedButton;
|
||||||
spRegionsArea: TSplitter;
|
spRegionsArea: TSplitter;
|
||||||
vstArea: TVirtualStringTree;
|
vstArea: TLazVirtualStringTree;
|
||||||
vstRegions: TVirtualStringTree;
|
vstRegions: TLazVirtualStringTree;
|
||||||
procedure btnGrab1Click(Sender: TObject);
|
procedure btnGrab1Click(Sender: TObject);
|
||||||
procedure FormClose(Sender: TObject; var CloseAction: TCloseAction);
|
procedure FormClose(Sender: TObject; var CloseAction: TCloseAction);
|
||||||
procedure mnuAddRegionClick(Sender: TObject);
|
procedure mnuAddRegionClick(Sender: TObject);
|
||||||
@@ -105,6 +105,7 @@ type
|
|||||||
FLastY: Integer;
|
FLastY: Integer;
|
||||||
FAreaMove: TAreaMove;
|
FAreaMove: TAreaMove;
|
||||||
FTempRegionNode: PVirtualNode;
|
FTempRegionNode: PVirtualNode;
|
||||||
|
FEditedRegionNode: PVirtualNode;
|
||||||
FOnRegionModified: TRegionModifiedEvent;
|
FOnRegionModified: TRegionModifiedEvent;
|
||||||
FOnRegionDeleted: TRegionDeletedEvent;
|
FOnRegionDeleted: TRegionDeletedEvent;
|
||||||
FOnRegionList: TRegionListEvent;
|
FOnRegionList: TRegionListEvent;
|
||||||
@@ -162,7 +163,7 @@ begin
|
|||||||
inherited Create($03, 0); //Admin Packet
|
inherited Create($03, 0); //Admin Packet
|
||||||
FStream.WriteByte($08); //Admin PacketID
|
FStream.WriteByte($08); //Admin PacketID
|
||||||
FStream.WriteStringNull(ARegionInfo.Name);
|
FStream.WriteStringNull(ARegionInfo.Name);
|
||||||
count := Min(ARegionInfo.Areas.Count, 256);
|
count := Min(ARegionInfo.Areas.Count, 255);
|
||||||
FStream.WriteByte(count);
|
FStream.WriteByte(count);
|
||||||
for i := 0 to count - 1 do
|
for i := 0 to count - 1 do
|
||||||
begin
|
begin
|
||||||
@@ -220,6 +221,7 @@ end;
|
|||||||
procedure TfrmRegionControl.FormDestroy(Sender: TObject);
|
procedure TfrmRegionControl.FormDestroy(Sender: TObject);
|
||||||
begin
|
begin
|
||||||
frmRadarMap.Dependencies.Remove(pbArea);
|
frmRadarMap.Dependencies.Remove(pbArea);
|
||||||
|
frmMain.UnregisterAccessChangedListener(@OnAccessChanged);
|
||||||
FreeAndNil(AdminPacketHandlers[$08]);
|
FreeAndNil(AdminPacketHandlers[$08]);
|
||||||
FreeAndNil(AdminPacketHandlers[$09]);
|
FreeAndNil(AdminPacketHandlers[$09]);
|
||||||
FreeAndNil(AdminPacketHandlers[$0A]);
|
FreeAndNil(AdminPacketHandlers[$0A]);
|
||||||
@@ -244,7 +246,7 @@ begin
|
|||||||
if FTempRegionNode <> nil then
|
if FTempRegionNode <> nil then
|
||||||
regionNode := FTempRegionNode
|
regionNode := FTempRegionNode
|
||||||
else
|
else
|
||||||
regionNode := vstRegions.GetFirstSelected;
|
regionNode := FEditedRegionNode;
|
||||||
if regionNode <> nil then
|
if regionNode <> nil then
|
||||||
begin
|
begin
|
||||||
regionInfo := vstRegions.GetNodeData(regionNode);
|
regionInfo := vstRegions.GetNodeData(regionNode);
|
||||||
@@ -286,6 +288,7 @@ begin
|
|||||||
regionInfo^.Areas := TRectList.Create;
|
regionInfo^.Areas := TRectList.Create;
|
||||||
vstRegions.ClearSelection;
|
vstRegions.ClearSelection;
|
||||||
vstRegions.Selected[FTempRegionNode] := True;
|
vstRegions.Selected[FTempRegionNode] := True;
|
||||||
|
FEditedRegionNode := FTempRegionNode;
|
||||||
btnSave.Enabled := True;
|
btnSave.Enabled := True;
|
||||||
end else
|
end else
|
||||||
begin
|
begin
|
||||||
@@ -401,6 +404,7 @@ begin
|
|||||||
areaInfo^.Bottom := p.y;
|
areaInfo^.Bottom := p.y;
|
||||||
pbArea.Repaint;
|
pbArea.Repaint;
|
||||||
FAreaMove := [amRight, amBottom];
|
FAreaMove := [amRight, amBottom];
|
||||||
|
btnSave.Enabled := True;
|
||||||
end;
|
end;
|
||||||
vstArea.ClearSelection;
|
vstArea.ClearSelection;
|
||||||
vstArea.Selected[match] := True;
|
vstArea.Selected[match] := True;
|
||||||
@@ -460,7 +464,7 @@ var
|
|||||||
node: PVirtualNode;
|
node: PVirtualNode;
|
||||||
areaInfo: PRect;
|
areaInfo: PRect;
|
||||||
begin
|
begin
|
||||||
node := vstArea.GetFirstSelected;
|
node := vstArea.GetFirstSelected;
|
||||||
if node <> nil then
|
if node <> nil then
|
||||||
begin
|
begin
|
||||||
areaInfo := vstArea.GetNodeData(node);
|
areaInfo := vstArea.GetNodeData(node);
|
||||||
@@ -494,10 +498,18 @@ begin
|
|||||||
if selected then
|
if selected then
|
||||||
begin
|
begin
|
||||||
areaInfo := Sender.GetNodeData(Node);
|
areaInfo := Sender.GetNodeData(Node);
|
||||||
|
seX1.OnChange := nil;
|
||||||
|
seX2.OnChange := nil;
|
||||||
|
seY1.OnChange := nil;
|
||||||
|
seY2.OnChange := nil;
|
||||||
seX1.Value := areaInfo^.Left;
|
seX1.Value := areaInfo^.Left;
|
||||||
seX2.Value := areaInfo^.Right;
|
seX2.Value := areaInfo^.Right;
|
||||||
seY1.Value := areaInfo^.Top;
|
seY1.Value := areaInfo^.Top;
|
||||||
seY2.Value := areaInfo^.Bottom;
|
seY2.Value := areaInfo^.Bottom;
|
||||||
|
seX1.OnChange := @seX1Change;
|
||||||
|
seX2.OnChange := @seX1Change;
|
||||||
|
seY1.OnChange := @seX1Change;
|
||||||
|
seY2.OnChange := @seX1Change;
|
||||||
end;
|
end;
|
||||||
pbArea.Repaint;
|
pbArea.Repaint;
|
||||||
end;
|
end;
|
||||||
@@ -557,6 +569,7 @@ begin
|
|||||||
vstArea.EndUpdate;
|
vstArea.EndUpdate;
|
||||||
pbArea.Repaint;
|
pbArea.Repaint;
|
||||||
|
|
||||||
|
FEditedRegionNode := selected;
|
||||||
btnSave.Enabled := False; //no changes to be saved
|
btnSave.Enabled := False; //no changes to be saved
|
||||||
end;
|
end;
|
||||||
|
|
||||||
@@ -688,6 +701,9 @@ var
|
|||||||
regionInfo: PRegionInfo;
|
regionInfo: PRegionInfo;
|
||||||
begin
|
begin
|
||||||
vstRegions.BeginUpdate;
|
vstRegions.BeginUpdate;
|
||||||
|
FTempRegionNode := nil;
|
||||||
|
FEditedRegionNode := nil;
|
||||||
|
btnSave.Enabled := False;
|
||||||
vstRegions.Clear;
|
vstRegions.Clear;
|
||||||
regionCount := ABuffer.ReadByte;
|
regionCount := ABuffer.ReadByte;
|
||||||
for i := 0 to regionCount - 1 do
|
for i := 0 to regionCount - 1 do
|
||||||
|
|||||||
@@ -0,0 +1,36 @@
|
|||||||
|
FROM ubuntu:jammy
|
||||||
|
|
||||||
|
RUN apt update && \
|
||||||
|
apt install -y libgtk2.0-dev libgl-dev binutils-mingw-w64-i686 git wget zip && \
|
||||||
|
rm -rf /var/lib/apt/lists/* && \
|
||||||
|
ln -s /usr/bin/i686-w64-mingw32-windres /usr/bin/i386-win32-windres && \
|
||||||
|
ln -s /usr/bin/i686-w64-mingw32-windres /usr/bin/windres
|
||||||
|
|
||||||
|
RUN cd /root && \
|
||||||
|
export FPCVERSION=3.2.2 && \
|
||||||
|
export LAZVERSION=2.2.4 && \
|
||||||
|
wget --content-disposition https://sourceforge.net/projects/freepascal/files/Linux/$FPCVERSION/fpc-$FPCVERSION.x86_64-linux.tar/download && \
|
||||||
|
wget --content-disposition https://sourceforge.net/projects/freepascal/files/Source/$FPCVERSION/fpc-$FPCVERSION.source.tar.gz/download && \
|
||||||
|
tar xf fpc-$FPCVERSION.x86_64-linux.tar && \
|
||||||
|
cd fpc-$FPCVERSION.x86_64-linux && \
|
||||||
|
echo "/usr" | ./install.sh && \
|
||||||
|
cd .. && \
|
||||||
|
tar xf fpc-$FPCVERSION.source.tar.gz && \
|
||||||
|
cd fpc-$FPCVERSION && \
|
||||||
|
make crossinstall INSTALL_PREFIX=/usr OS_TARGET=win32 CPU_TARGET=i386 && \
|
||||||
|
make clean && \
|
||||||
|
ln -s /usr/lib/fpc/$FPCVERSION/ppcross386 /usr/bin/ppcross386 && \
|
||||||
|
cd .. && \
|
||||||
|
wget --content-disposition https://sourceforge.net/projects/lazarus/files/Lazarus%20Zip%20_%20GZip/Lazarus%20$LAZVERSION/lazarus-$LAZVERSION-0.tar.gz/download && \
|
||||||
|
tar xf lazarus-$LAZVERSION-0.tar.gz && \
|
||||||
|
cd lazarus && \
|
||||||
|
make lazbuild && \
|
||||||
|
cd /root && \
|
||||||
|
rm -rf *.tar.gz fpc-$FPCVERSION*
|
||||||
|
|
||||||
|
RUN cd /root && \
|
||||||
|
git clone --depth 1 https://github.com/blikblum/multilog && \
|
||||||
|
git clone --depth 1 https://github.com/almindor/lnet && \
|
||||||
|
~/lazarus/lazbuild --lazarusdir=~/lazarus --add-package-link ~/multilog/multiloglaz.lpk && \
|
||||||
|
~/lazarus/lazbuild --lazarusdir=~/lazarus --add-package-link ~/lnet/lazaruspackage/lnetbase.lpk && \
|
||||||
|
~/lazarus/lazbuild --lazarusdir=~/lazarus --add-package-link ~/lnet/lazaruspackage/lnetvisual.lpk
|
||||||
+1079
-267
File diff suppressed because it is too large
Load Diff
+46
-63
@@ -1,32 +1,17 @@
|
|||||||
{
|
{
|
||||||
$Id: ImagingBitmap.pas 129 2008-08-06 20:01:30Z galfar $
|
|
||||||
Vampyre Imaging Library
|
Vampyre Imaging Library
|
||||||
by Marek Mauder
|
by Marek Mauder
|
||||||
http://imaginglib.sourceforge.net
|
https://github.com/galfar/imaginglib
|
||||||
|
https://imaginglib.sourceforge.io
|
||||||
The contents of this file are used with permission, subject to the Mozilla
|
- - - - -
|
||||||
Public License Version 1.1 (the "License"); you may not use this file except
|
This Source Code Form is subject to the terms of the Mozilla Public
|
||||||
in compliance with the License. You may obtain a copy of the License at
|
License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||||
http://www.mozilla.org/MPL/MPL-1.1.html
|
file, You can obtain one at https://mozilla.org/MPL/2.0.
|
||||||
|
|
||||||
Software distributed under the License is distributed on an "AS IS" basis,
|
|
||||||
WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License for
|
|
||||||
the specific language governing rights and limitations under the License.
|
|
||||||
|
|
||||||
Alternatively, the contents of this file may be used under the terms of the
|
|
||||||
GNU Lesser General Public License (the "LGPL License"), in which case the
|
|
||||||
provisions of the LGPL License are applicable instead of those above.
|
|
||||||
If you wish to allow use of your version of this file only under the terms
|
|
||||||
of the LGPL License and not to allow others to use your version of this file
|
|
||||||
under the MPL, indicate your decision by deleting the provisions above and
|
|
||||||
replace them with the notice and other provisions required by the LGPL
|
|
||||||
License. If you do not delete the provisions above, a recipient may use
|
|
||||||
your version of this file under either the MPL or the LGPL License.
|
|
||||||
|
|
||||||
For more information about the LGPL: http://www.gnu.org/copyleft/lesser.html
|
|
||||||
}
|
}
|
||||||
|
|
||||||
{ This unit contains image format loader/saver for Windows Bitmap images.}
|
{
|
||||||
|
This unit contains image format loader/saver for Windows Bitmap images.
|
||||||
|
}
|
||||||
unit ImagingBitmap;
|
unit ImagingBitmap;
|
||||||
|
|
||||||
{$I ImagingOptions.inc}
|
{$I ImagingOptions.inc}
|
||||||
@@ -44,6 +29,7 @@ type
|
|||||||
TBitmapFileFormat = class(TImageFileFormat)
|
TBitmapFileFormat = class(TImageFileFormat)
|
||||||
protected
|
protected
|
||||||
FUseRLE: LongBool;
|
FUseRLE: LongBool;
|
||||||
|
procedure Define; override;
|
||||||
function LoadData(Handle: TImagingHandle; var Images: TDynImageDataArray;
|
function LoadData(Handle: TImagingHandle; var Images: TDynImageDataArray;
|
||||||
OnlyFirstLevel: Boolean): Boolean; override;
|
OnlyFirstLevel: Boolean): Boolean; override;
|
||||||
function SaveData(Handle: TImagingHandle; const Images: TDynImageDataArray;
|
function SaveData(Handle: TImagingHandle; const Images: TDynImageDataArray;
|
||||||
@@ -51,7 +37,6 @@ type
|
|||||||
procedure ConvertToSupported(var Image: TImageData;
|
procedure ConvertToSupported(var Image: TImageData;
|
||||||
const Info: TImageFormatInfo); override;
|
const Info: TImageFormatInfo); override;
|
||||||
public
|
public
|
||||||
constructor Create; override;
|
|
||||||
function TestFormat(Handle: TImagingHandle): Boolean; override;
|
function TestFormat(Handle: TImagingHandle): Boolean; override;
|
||||||
published
|
published
|
||||||
{ Controls that RLE compression is used during saving. Accessible trough
|
{ Controls that RLE compression is used during saving. Accessible trough
|
||||||
@@ -85,39 +70,39 @@ type
|
|||||||
{ File Header for Windows/OS2 bitmap file.}
|
{ File Header for Windows/OS2 bitmap file.}
|
||||||
TBitmapFileHeader = packed record
|
TBitmapFileHeader = packed record
|
||||||
ID: Word; // Is always 19778 : 'BM'
|
ID: Word; // Is always 19778 : 'BM'
|
||||||
Size: LongWord; // Filesize
|
Size: UInt32; // File size
|
||||||
Reserved1: Word;
|
Reserved1: Word;
|
||||||
Reserved2: Word;
|
Reserved2: Word;
|
||||||
Offset: LongWord; // Offset from start pos to beginning of image bits
|
Offset: UInt32; // Offset from start pos to beginning of image bits
|
||||||
end;
|
end;
|
||||||
|
|
||||||
{ Info Header for Windows bitmap file version 4.}
|
{ Info Header for Windows bitmap file version 4.}
|
||||||
TBitmapInfoHeader = packed record
|
TBitmapInfoHeader = packed record
|
||||||
Size: LongWord;
|
Size: UInt32;
|
||||||
Width: LongInt;
|
Width: Int32;
|
||||||
Height: LongInt;
|
Height: Int32;
|
||||||
Planes: Word;
|
Planes: Word;
|
||||||
BitCount: Word;
|
BitCount: Word;
|
||||||
Compression: LongWord;
|
Compression: UInt32;
|
||||||
SizeImage: LongWord;
|
SizeImage: UInt32;
|
||||||
XPelsPerMeter: LongInt;
|
XPelsPerMeter: Int32;
|
||||||
YPelsPerMeter: LongInt;
|
YPelsPerMeter: Int32;
|
||||||
ClrUsed: LongInt;
|
ClrUsed: UInt32;
|
||||||
ClrImportant: LongInt;
|
ClrImportant: UInt32;
|
||||||
RedMask: LongWord;
|
RedMask: UInt32;
|
||||||
GreenMask: LongWord;
|
GreenMask: UInt32;
|
||||||
BlueMask: LongWord;
|
BlueMask: UInt32;
|
||||||
AlphaMask: LongWord;
|
AlphaMask: UInt32;
|
||||||
CSType: LongWord;
|
CSType: UInt32;
|
||||||
EndPoints: array[0..8] of LongWord;
|
EndPoints: array[0..8] of UInt32;
|
||||||
GammaRed: LongWord;
|
GammaRed: UInt32;
|
||||||
GammaGreen: LongWord;
|
GammaGreen: UInt32;
|
||||||
GammaBlue: LongWord;
|
GammaBlue: UInt32;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
{ Info Header for OS2 bitmaps.}
|
{ Info Header for OS2 bitmaps.}
|
||||||
TBitmapCoreHeader = packed record
|
TBitmapCoreHeader = packed record
|
||||||
Size: LongWord;
|
Size: UInt32;
|
||||||
Width: Word;
|
Width: Word;
|
||||||
Height: Word;
|
Height: Word;
|
||||||
Planes: Word;
|
Planes: Word;
|
||||||
@@ -133,13 +118,11 @@ type
|
|||||||
|
|
||||||
{ TBitmapFileFormat class implementation }
|
{ TBitmapFileFormat class implementation }
|
||||||
|
|
||||||
constructor TBitmapFileFormat.Create;
|
procedure TBitmapFileFormat.Define;
|
||||||
begin
|
begin
|
||||||
inherited Create;
|
inherited;
|
||||||
FName := SBitmapFormatName;
|
FName := SBitmapFormatName;
|
||||||
FCanLoad := True;
|
FFeatures := [ffLoad, ffSave];
|
||||||
FCanSave := True;
|
|
||||||
FIsMultiImageFormat := False;
|
|
||||||
FSupportedFormats := BitmapSupportedFormats;
|
FSupportedFormats := BitmapSupportedFormats;
|
||||||
|
|
||||||
FUseRLE := BitmapDefaultRLE;
|
FUseRLE := BitmapDefaultRLE;
|
||||||
@@ -211,8 +194,8 @@ var
|
|||||||
procedure LoadRLE4;
|
procedure LoadRLE4;
|
||||||
var
|
var
|
||||||
RLESrc: PByteArray;
|
RLESrc: PByteArray;
|
||||||
Row, Col, WriteRow, I: LongInt;
|
Row, Col, WriteRow, I: Integer;
|
||||||
SrcPos: LongWord;
|
SrcPos: UInt32;
|
||||||
DeltaX, DeltaY, Low, High: Byte;
|
DeltaX, DeltaY, Low, High: Byte;
|
||||||
Pixels: PByteArray;
|
Pixels: PByteArray;
|
||||||
OpCode: TRLEOpcode;
|
OpCode: TRLEOpcode;
|
||||||
@@ -228,7 +211,7 @@ var
|
|||||||
NegHeightBitmap := BI.Height < 0;
|
NegHeightBitmap := BI.Height < 0;
|
||||||
Row := 0; // Current row in dest image
|
Row := 0; // Current row in dest image
|
||||||
Col := 0; // Current column in dest image
|
Col := 0; // Current column in dest image
|
||||||
// Row in dest image where actuall writting will be done
|
// Row in dest image where actual writing will be done
|
||||||
WriteRow := Iff(NegHeightBitmap, Row, Height - 1 - Row);
|
WriteRow := Iff(NegHeightBitmap, Row, Height - 1 - Row);
|
||||||
while (Row < Height) and (SrcPos < BI.SizeImage) do
|
while (Row < Height) and (SrcPos < BI.SizeImage) do
|
||||||
begin
|
begin
|
||||||
@@ -308,8 +291,8 @@ var
|
|||||||
procedure LoadRLE8;
|
procedure LoadRLE8;
|
||||||
var
|
var
|
||||||
RLESrc: PByteArray;
|
RLESrc: PByteArray;
|
||||||
SrcCount, Row, Col, WriteRow: LongInt;
|
SrcCount, Row, Col, WriteRow: Integer;
|
||||||
SrcPos: LongWord;
|
SrcPos: UInt32;
|
||||||
DeltaX, DeltaY: Byte;
|
DeltaX, DeltaY: Byte;
|
||||||
Pixels: PByteArray;
|
Pixels: PByteArray;
|
||||||
OpCode: TRLEOpcode;
|
OpCode: TRLEOpcode;
|
||||||
@@ -324,7 +307,7 @@ var
|
|||||||
NegHeightBitmap := BI.Height < 0;
|
NegHeightBitmap := BI.Height < 0;
|
||||||
Row := 0; // Current row in dest image
|
Row := 0; // Current row in dest image
|
||||||
Col := 0; // Current column in dest image
|
Col := 0; // Current column in dest image
|
||||||
// Row in dest image where actuall writting will be done
|
// Row in dest image where actual writing will be done
|
||||||
WriteRow := Iff(NegHeightBitmap, Row, Height - 1 - Row);
|
WriteRow := Iff(NegHeightBitmap, Row, Height - 1 - Row);
|
||||||
while (Row < Height) and (SrcPos < BI.SizeImage) do
|
while (Row < Height) and (SrcPos < BI.SizeImage) do
|
||||||
begin
|
begin
|
||||||
@@ -425,7 +408,7 @@ begin
|
|||||||
BI.SizeImage := BF.Size - BF.Offset;
|
BI.SizeImage := BF.Size - BF.Offset;
|
||||||
end;
|
end;
|
||||||
// Bit mask reading. Only read it if there is V3 header, V4 header has
|
// Bit mask reading. Only read it if there is V3 header, V4 header has
|
||||||
// masks laoded already (only masks for RGB in V3).
|
// masks loaded already (only masks for RGB in V3).
|
||||||
if (BI.Compression = BI_BITFIELDS) and (BI.Size = V3InfoHeaderSize) then
|
if (BI.Compression = BI_BITFIELDS) and (BI.Size = V3InfoHeaderSize) then
|
||||||
Read(Handle, @BI.RedMask, SizeOf(BI.RedMask) * 3);
|
Read(Handle, @BI.RedMask, SizeOf(BI.RedMask) * 3);
|
||||||
|
|
||||||
@@ -455,7 +438,7 @@ begin
|
|||||||
// Palette settings and reading
|
// Palette settings and reading
|
||||||
if BI.BitCount <= 8 then
|
if BI.BitCount <= 8 then
|
||||||
begin
|
begin
|
||||||
// Seek to the begining of palette
|
// Seek to the beginning of palette
|
||||||
Seek(Handle, StartPos + SizeOf(TBitmapFileHeader) + LongInt(BI.Size),
|
Seek(Handle, StartPos + SizeOf(TBitmapFileHeader) + LongInt(BI.Size),
|
||||||
smFromBeginning);
|
smFromBeginning);
|
||||||
if IsOS2 then
|
if IsOS2 then
|
||||||
@@ -523,12 +506,12 @@ begin
|
|||||||
// 1 and 4 bpp images are supported only for loading which is now
|
// 1 and 4 bpp images are supported only for loading which is now
|
||||||
// so we now convert them to 8bpp (and unalign scanlines).
|
// so we now convert them to 8bpp (and unalign scanlines).
|
||||||
case BI.BitCount of
|
case BI.BitCount of
|
||||||
1: Convert1To8(Data, Bits, Width, Height, AlignedWidthBytes);
|
1: Convert1To8(Data, Bits, Width, Height, AlignedWidthBytes, False);
|
||||||
4:
|
4:
|
||||||
begin
|
begin
|
||||||
// RLE4 bitmaps are translated to 8bit during RLE decoding
|
// RLE4 bitmaps are translated to 8bit during RLE decoding
|
||||||
if BI.Compression <> BI_RLE4 then
|
if BI.Compression <> BI_RLE4 then
|
||||||
Convert4To8(Data, Bits, Width, Height, AlignedWidthBytes);
|
Convert4To8(Data, Bits, Width, Height, AlignedWidthBytes, False);
|
||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
// Enlarge palette
|
// Enlarge palette
|
||||||
@@ -829,7 +812,7 @@ initialization
|
|||||||
Should be less buggy an more readable (load inspired by Colosseum Builders' code).
|
Should be less buggy an more readable (load inspired by Colosseum Builders' code).
|
||||||
- Made public properties for options registered to SetOption/GetOption
|
- Made public properties for options registered to SetOption/GetOption
|
||||||
functions.
|
functions.
|
||||||
- Addded alpha check to 32b bitmap loading too (teh same as in 16b
|
- Added alpha check to 32b bitmap loading too (teh same as in 16b
|
||||||
bitmap loading).
|
bitmap loading).
|
||||||
- Moved Convert1To8 and Convert4To8 to ImagingFormats
|
- Moved Convert1To8 and Convert4To8 to ImagingFormats
|
||||||
- Changed extensions to filename masks.
|
- Changed extensions to filename masks.
|
||||||
@@ -849,7 +832,7 @@ initialization
|
|||||||
|
|
||||||
-- 0.13 Changes/Bug Fixes -----------------------------------
|
-- 0.13 Changes/Bug Fixes -----------------------------------
|
||||||
- when loading 1/4 bit images with dword aligned dimensions
|
- when loading 1/4 bit images with dword aligned dimensions
|
||||||
there was ugly memory rewritting bug causing image corruption
|
there was ugly memory rewriting bug causing image corruption
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
+103
-166
@@ -1,34 +1,15 @@
|
|||||||
{
|
{
|
||||||
$Id: ImagingCanvases.pas 174 2009-09-08 09:37:59Z galfar $
|
|
||||||
Vampyre Imaging Library
|
Vampyre Imaging Library
|
||||||
by Marek Mauder
|
by Marek Mauder
|
||||||
http://imaginglib.sourceforge.net
|
https://github.com/galfar/imaginglib
|
||||||
|
https://imaginglib.sourceforge.io
|
||||||
The contents of this file are used with permission, subject to the Mozilla
|
- - - - -
|
||||||
Public License Version 1.1 (the "License"); you may not use this file except
|
This Source Code Form is subject to the terms of the Mozilla Public
|
||||||
in compliance with the License. You may obtain a copy of the License at
|
License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||||
http://www.mozilla.org/MPL/MPL-1.1.html
|
file, You can obtain one at https://mozilla.org/MPL/2.0.
|
||||||
|
|
||||||
Software distributed under the License is distributed on an "AS IS" basis,
|
|
||||||
WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License for
|
|
||||||
the specific language governing rights and limitations under the License.
|
|
||||||
|
|
||||||
Alternatively, the contents of this file may be used under the terms of the
|
|
||||||
GNU Lesser General Public License (the "LGPL License"), in which case the
|
|
||||||
provisions of the LGPL License are applicable instead of those above.
|
|
||||||
If you wish to allow use of your version of this file only under the terms
|
|
||||||
of the LGPL License and not to allow others to use your version of this file
|
|
||||||
under the MPL, indicate your decision by deleting the provisions above and
|
|
||||||
replace them with the notice and other provisions required by the LGPL
|
|
||||||
License. If you do not delete the provisions above, a recipient may use
|
|
||||||
your version of this file under either the MPL or the LGPL License.
|
|
||||||
|
|
||||||
For more information about the LGPL: http://www.gnu.org/copyleft/lesser.html
|
|
||||||
}
|
}
|
||||||
|
|
||||||
{
|
{ This unit contains canvas classes for drawing and applying effects.}
|
||||||
This unit contains canvas classes for drawing and applying effects.
|
|
||||||
}
|
|
||||||
unit ImagingCanvases;
|
unit ImagingCanvases;
|
||||||
|
|
||||||
{$I ImagingOptions.inc}
|
{$I ImagingOptions.inc}
|
||||||
@@ -132,7 +113,7 @@ type
|
|||||||
TImagingCanvas works for all image data formats except special ones
|
TImagingCanvas works for all image data formats except special ones
|
||||||
(compressed). Because of this its methods are quite slow (they usually work
|
(compressed). Because of this its methods are quite slow (they usually work
|
||||||
with colors in ifA32R32G32B32F format). If you want fast drawing you
|
with colors in ifA32R32G32B32F format). If you want fast drawing you
|
||||||
can use one of fast canvas clases. These descendants of TImagingCanvas
|
can use one of fast canvas classes. These descendants of TImagingCanvas
|
||||||
work only for few select formats (or only one) but they are optimized thus
|
work only for few select formats (or only one) but they are optimized thus
|
||||||
much faster.
|
much faster.
|
||||||
}
|
}
|
||||||
@@ -179,7 +160,7 @@ type
|
|||||||
procedure HorzLineInternal(X1, X2, Y: LongInt; Color: Pointer; Bpp: LongInt); virtual;
|
procedure HorzLineInternal(X1, X2, Y: LongInt; Color: Pointer; Bpp: LongInt); virtual;
|
||||||
procedure CopyPixelInternal(X, Y: LongInt; Pixel: Pointer; Bpp: LongInt); {$IFDEF USE_INLINE}inline;{$ENDIF}
|
procedure CopyPixelInternal(X, Y: LongInt; Pixel: Pointer; Bpp: LongInt); {$IFDEF USE_INLINE}inline;{$ENDIF}
|
||||||
procedure DrawInternal(const SrcRect: TRect; DestCanvas: TImagingCanvas;
|
procedure DrawInternal(const SrcRect: TRect; DestCanvas: TImagingCanvas;
|
||||||
DestX, DestY: Integer; SrcFactor, DestFactor: TBlendingFactor; PixelWriteProc: TPixelWriteProc);
|
DestX, DestY: LongInt; SrcFactor, DestFactor: TBlendingFactor; PixelWriteProc: TPixelWriteProc);
|
||||||
procedure StretchDrawInternal(const SrcRect: TRect; DestCanvas: TImagingCanvas;
|
procedure StretchDrawInternal(const SrcRect: TRect; DestCanvas: TImagingCanvas;
|
||||||
const DestRect: TRect; SrcFactor, DestFactor: TBlendingFactor;
|
const DestRect: TRect; SrcFactor, DestFactor: TBlendingFactor;
|
||||||
Filter: TResizeFilter; PixelWriteProc: TPixelWriteProc);
|
Filter: TResizeFilter; PixelWriteProc: TPixelWriteProc);
|
||||||
@@ -230,13 +211,13 @@ type
|
|||||||
Resulting destination pixel color is:
|
Resulting destination pixel color is:
|
||||||
SrcColor * SrcFactor + DstColor * DstFactor}
|
SrcColor * SrcFactor + DstColor * DstFactor}
|
||||||
procedure DrawBlend(const SrcRect: TRect; DestCanvas: TImagingCanvas;
|
procedure DrawBlend(const SrcRect: TRect; DestCanvas: TImagingCanvas;
|
||||||
DestX, DestY: Integer; SrcFactor, DestFactor: TBlendingFactor);
|
DestX, DestY: LongInt; SrcFactor, DestFactor: TBlendingFactor);
|
||||||
{ Draws contents of this canvas onto another one with typical alpha
|
{ Draws contents of this canvas onto another one with typical alpha
|
||||||
blending (Src 'over' Dest, factors are bfSrcAlpha and bfOneMinusSrcAlpha.)}
|
blending (Src 'over' Dest, factors are bfSrcAlpha and bfOneMinusSrcAlpha.)}
|
||||||
procedure DrawAlpha(const SrcRect: TRect; DestCanvas: TImagingCanvas; DestX, DestY: Integer); virtual;
|
procedure DrawAlpha(const SrcRect: TRect; DestCanvas: TImagingCanvas; DestX, DestY: LongInt); virtual;
|
||||||
{ Draws contents of this canvas onto another one using additive blending
|
{ Draws contents of this canvas onto another one using additive blending
|
||||||
(source and dest factors are bfOne).}
|
(source and dest factors are bfOne).}
|
||||||
procedure DrawAdd(const SrcRect: TRect; DestCanvas: TImagingCanvas; DestX, DestY: Integer);
|
procedure DrawAdd(const SrcRect: TRect; DestCanvas: TImagingCanvas; DestX, DestY: LongInt);
|
||||||
{ Draws stretched and filtered contents of this canvas onto another canvas
|
{ Draws stretched and filtered contents of this canvas onto another canvas
|
||||||
with pixel blending. Blending factors are chosen using TBlendingFactor parameters.
|
with pixel blending. Blending factors are chosen using TBlendingFactor parameters.
|
||||||
Resulting destination pixel color is:
|
Resulting destination pixel color is:
|
||||||
@@ -293,7 +274,7 @@ type
|
|||||||
procedure ModifyContrastBrightness(Contrast, Brightness: Single);
|
procedure ModifyContrastBrightness(Contrast, Brightness: Single);
|
||||||
{ Gamma correction of individual color channels. Range is (0, +inf),
|
{ Gamma correction of individual color channels. Range is (0, +inf),
|
||||||
1.0 means no change.}
|
1.0 means no change.}
|
||||||
procedure GammaCorection(Red, Green, Blue: Single);
|
procedure GammaCorrection(Red, Green, Blue: Single);
|
||||||
{ Inverts colors of all image pixels, makes negative image. Ignores alpha channel.}
|
{ Inverts colors of all image pixels, makes negative image. Ignores alpha channel.}
|
||||||
procedure InvertColors; virtual;
|
procedure InvertColors; virtual;
|
||||||
{ Simple single level thresholding with threshold level (in range [0, 1])
|
{ Simple single level thresholding with threshold level (in range [0, 1])
|
||||||
@@ -350,11 +331,11 @@ type
|
|||||||
property PixelsFP[X, Y: LongInt]: TColorFPRec read GetPixelFP write SetPixelFP;
|
property PixelsFP[X, Y: LongInt]: TColorFPRec read GetPixelFP write SetPixelFP;
|
||||||
{ Clipping rectangle of this canvas. No pixels outside this rectangle are
|
{ Clipping rectangle of this canvas. No pixels outside this rectangle are
|
||||||
altered by canvas methods if Clipping property is True. Clip rect gets
|
altered by canvas methods if Clipping property is True. Clip rect gets
|
||||||
reseted when UpdateCanvasState is called.}
|
reset when UpdateCanvasState is called.}
|
||||||
property ClipRect: TRect read FClipRect write SetClipRect;
|
property ClipRect: TRect read FClipRect write SetClipRect;
|
||||||
{ Extended format information.}
|
{ Extended format information.}
|
||||||
property FormatInfo: TImageFormatInfo read FFormatInfo;
|
property FormatInfo: TImageFormatInfo read FFormatInfo;
|
||||||
{ Indicates that this canvas is in valid state. If False canvas oprations
|
{ Indicates that this canvas is in valid state. If False canvas operations
|
||||||
may crash.}
|
may crash.}
|
||||||
property Valid: Boolean read GetValid;
|
property Valid: Boolean read GetValid;
|
||||||
|
|
||||||
@@ -379,7 +360,7 @@ type
|
|||||||
|
|
||||||
procedure UpdateCanvasState; override;
|
procedure UpdateCanvasState; override;
|
||||||
|
|
||||||
procedure DrawAlpha(const SrcRect: TRect; DestCanvas: TImagingCanvas; DestX, DestY: Integer); override;
|
procedure DrawAlpha(const SrcRect: TRect; DestCanvas: TImagingCanvas; DestX, DestY: LongInt); override;
|
||||||
procedure StretchDrawAlpha(const SrcRect: TRect; DestCanvas: TImagingCanvas;
|
procedure StretchDrawAlpha(const SrcRect: TRect; DestCanvas: TImagingCanvas;
|
||||||
const DestRect: TRect; Filter: TResizeFilter = rfBilinear); override;
|
const DestRect: TRect; Filter: TResizeFilter = rfBilinear); override;
|
||||||
procedure InvertColors; override;
|
procedure InvertColors; override;
|
||||||
@@ -395,7 +376,8 @@ const
|
|||||||
Kernel: ((1, 1, 1),
|
Kernel: ((1, 1, 1),
|
||||||
(1, 1, 1),
|
(1, 1, 1),
|
||||||
(1, 1, 1));
|
(1, 1, 1));
|
||||||
Divisor: 9);
|
Divisor: 9;
|
||||||
|
Bias: 0);
|
||||||
|
|
||||||
{ Kernel for 5x5 average smoothing filter.}
|
{ Kernel for 5x5 average smoothing filter.}
|
||||||
FilterAverage5x5: TConvolutionFilter5x5 = (
|
FilterAverage5x5: TConvolutionFilter5x5 = (
|
||||||
@@ -404,14 +386,16 @@ const
|
|||||||
(1, 1, 1, 1, 1),
|
(1, 1, 1, 1, 1),
|
||||||
(1, 1, 1, 1, 1),
|
(1, 1, 1, 1, 1),
|
||||||
(1, 1, 1, 1, 1));
|
(1, 1, 1, 1, 1));
|
||||||
Divisor: 25);
|
Divisor: 25;
|
||||||
|
Bias: 0);
|
||||||
|
|
||||||
{ Kernel for 3x3 Gaussian smoothing filter.}
|
{ Kernel for 3x3 Gaussian smoothing filter.}
|
||||||
FilterGaussian3x3: TConvolutionFilter3x3 = (
|
FilterGaussian3x3: TConvolutionFilter3x3 = (
|
||||||
Kernel: ((1, 2, 1),
|
Kernel: ((1, 2, 1),
|
||||||
(2, 4, 2),
|
(2, 4, 2),
|
||||||
(1, 2, 1));
|
(1, 2, 1));
|
||||||
Divisor: 16);
|
Divisor: 16;
|
||||||
|
Bias: 0);
|
||||||
|
|
||||||
{ Kernel for 5x5 Gaussian smoothing filter.}
|
{ Kernel for 5x5 Gaussian smoothing filter.}
|
||||||
FilterGaussian5x5: TConvolutionFilter5x5 = (
|
FilterGaussian5x5: TConvolutionFilter5x5 = (
|
||||||
@@ -420,49 +404,56 @@ const
|
|||||||
(6, 24, 36, 24, 6),
|
(6, 24, 36, 24, 6),
|
||||||
(4, 16, 24, 16, 4),
|
(4, 16, 24, 16, 4),
|
||||||
(1, 4, 6, 4, 1));
|
(1, 4, 6, 4, 1));
|
||||||
Divisor: 256);
|
Divisor: 256;
|
||||||
|
Bias: 0);
|
||||||
|
|
||||||
{ Kernel for 3x3 Sobel horizontal edge detection filter (1st derivative approximation).}
|
{ Kernel for 3x3 Sobel horizontal edge detection filter (1st derivative approximation).}
|
||||||
FilterSobelHorz3x3: TConvolutionFilter3x3 = (
|
FilterSobelHorz3x3: TConvolutionFilter3x3 = (
|
||||||
Kernel: (( 1, 2, 1),
|
Kernel: (( 1, 2, 1),
|
||||||
( 0, 0, 0),
|
( 0, 0, 0),
|
||||||
(-1, -2, -1));
|
(-1, -2, -1));
|
||||||
Divisor: 1);
|
Divisor: 1;
|
||||||
|
Bias: 0);
|
||||||
|
|
||||||
{ Kernel for 3x3 Sobel vertical edge detection filter (1st derivative approximation).}
|
{ Kernel for 3x3 Sobel vertical edge detection filter (1st derivative approximation).}
|
||||||
FilterSobelVert3x3: TConvolutionFilter3x3 = (
|
FilterSobelVert3x3: TConvolutionFilter3x3 = (
|
||||||
Kernel: ((-1, 0, 1),
|
Kernel: ((-1, 0, 1),
|
||||||
(-2, 0, 2),
|
(-2, 0, 2),
|
||||||
(-1, 0, 1));
|
(-1, 0, 1));
|
||||||
Divisor: 1);
|
Divisor: 1;
|
||||||
|
Bias: 0);
|
||||||
|
|
||||||
{ Kernel for 3x3 Prewitt horizontal edge detection filter.}
|
{ Kernel for 3x3 Prewitt horizontal edge detection filter.}
|
||||||
FilterPrewittHorz3x3: TConvolutionFilter3x3 = (
|
FilterPrewittHorz3x3: TConvolutionFilter3x3 = (
|
||||||
Kernel: (( 1, 1, 1),
|
Kernel: (( 1, 1, 1),
|
||||||
( 0, 0, 0),
|
( 0, 0, 0),
|
||||||
(-1, -1, -1));
|
(-1, -1, -1));
|
||||||
Divisor: 1);
|
Divisor: 1;
|
||||||
|
Bias: 0);
|
||||||
|
|
||||||
{ Kernel for 3x3 Prewitt vertical edge detection filter.}
|
{ Kernel for 3x3 Prewitt vertical edge detection filter.}
|
||||||
FilterPrewittVert3x3: TConvolutionFilter3x3 = (
|
FilterPrewittVert3x3: TConvolutionFilter3x3 = (
|
||||||
Kernel: ((-1, 0, 1),
|
Kernel: ((-1, 0, 1),
|
||||||
(-1, 0, 1),
|
(-1, 0, 1),
|
||||||
(-1, 0, 1));
|
(-1, 0, 1));
|
||||||
Divisor: 1);
|
Divisor: 1;
|
||||||
|
Bias: 0);
|
||||||
|
|
||||||
{ Kernel for 3x3 Kirsh horizontal edge detection filter.}
|
{ Kernel for 3x3 Kirsh horizontal edge detection filter.}
|
||||||
FilterKirshHorz3x3: TConvolutionFilter3x3 = (
|
FilterKirshHorz3x3: TConvolutionFilter3x3 = (
|
||||||
Kernel: (( 5, 5, 5),
|
Kernel: (( 5, 5, 5),
|
||||||
(-3, 0, -3),
|
(-3, 0, -3),
|
||||||
(-3, -3, -3));
|
(-3, -3, -3));
|
||||||
Divisor: 1);
|
Divisor: 1;
|
||||||
|
Bias: 0);
|
||||||
|
|
||||||
{ Kernel for 3x3 Kirsh vertical edge detection filter.}
|
{ Kernel for 3x3 Kirsh vertical edge detection filter.}
|
||||||
FilterKirshVert3x3: TConvolutionFilter3x3 = (
|
FilterKirshVert3x3: TConvolutionFilter3x3 = (
|
||||||
Kernel: ((5, -3, -3),
|
Kernel: ((5, -3, -3),
|
||||||
(5, 0, -3),
|
(5, 0, -3),
|
||||||
(5, -3, -3));
|
(5, -3, -3));
|
||||||
Divisor: 1);
|
Divisor: 1;
|
||||||
|
Bias: 0);
|
||||||
|
|
||||||
{ Kernel for 3x3 Laplace omni-directional edge detection filter
|
{ Kernel for 3x3 Laplace omni-directional edge detection filter
|
||||||
(2nd derivative approximation).}
|
(2nd derivative approximation).}
|
||||||
@@ -470,7 +461,8 @@ const
|
|||||||
Kernel: ((-1, -1, -1),
|
Kernel: ((-1, -1, -1),
|
||||||
(-1, 8, -1),
|
(-1, 8, -1),
|
||||||
(-1, -1, -1));
|
(-1, -1, -1));
|
||||||
Divisor: 1);
|
Divisor: 1;
|
||||||
|
Bias: 0);
|
||||||
|
|
||||||
{ Kernel for 5x5 Laplace omni-directional edge detection filter
|
{ Kernel for 5x5 Laplace omni-directional edge detection filter
|
||||||
(2nd derivative approximation).}
|
(2nd derivative approximation).}
|
||||||
@@ -480,23 +472,26 @@ const
|
|||||||
(-1, -1, 24, -1, -1),
|
(-1, -1, 24, -1, -1),
|
||||||
(-1, -1, -1, -1, -1),
|
(-1, -1, -1, -1, -1),
|
||||||
(-1, -1, -1, -1, -1));
|
(-1, -1, -1, -1, -1));
|
||||||
Divisor: 1);
|
Divisor: 1;
|
||||||
|
Bias: 0);
|
||||||
|
|
||||||
{ Kernel for 3x3 spharpening filter (Laplacian + original color).}
|
{ Kernel for 3x3 sharpening filter (Laplacian + original color).}
|
||||||
FilterSharpen3x3: TConvolutionFilter3x3 = (
|
FilterSharpen3x3: TConvolutionFilter3x3 = (
|
||||||
Kernel: ((-1, -1, -1),
|
Kernel: ((-1, -1, -1),
|
||||||
(-1, 9, -1),
|
(-1, 9, -1),
|
||||||
(-1, -1, -1));
|
(-1, -1, -1));
|
||||||
Divisor: 1);
|
Divisor: 1;
|
||||||
|
Bias: 0);
|
||||||
|
|
||||||
{ Kernel for 5x5 spharpening filter (Laplacian + original color).}
|
{ Kernel for 5x5 sharpening filter (Laplacian + original color).}
|
||||||
FilterSharpen5x5: TConvolutionFilter5x5 = (
|
FilterSharpen5x5: TConvolutionFilter5x5 = (
|
||||||
Kernel: ((-1, -1, -1, -1, -1),
|
Kernel: ((-1, -1, -1, -1, -1),
|
||||||
(-1, -1, -1, -1, -1),
|
(-1, -1, -1, -1, -1),
|
||||||
(-1, -1, 25, -1, -1),
|
(-1, -1, 25, -1, -1),
|
||||||
(-1, -1, -1, -1, -1),
|
(-1, -1, -1, -1, -1),
|
||||||
(-1, -1, -1, -1, -1));
|
(-1, -1, -1, -1, -1));
|
||||||
Divisor: 1);
|
Divisor: 1;
|
||||||
|
Bias: 0);
|
||||||
|
|
||||||
{ Kernel for 5x5 glow filter.}
|
{ Kernel for 5x5 glow filter.}
|
||||||
FilterGlow5x5: TConvolutionFilter5x5 = (
|
FilterGlow5x5: TConvolutionFilter5x5 = (
|
||||||
@@ -505,17 +500,19 @@ const
|
|||||||
( 2, 0, -20, 0, 2),
|
( 2, 0, -20, 0, 2),
|
||||||
( 2, 0, 0, 0, 2),
|
( 2, 0, 0, 0, 2),
|
||||||
( 1, 2, 2, 2, 1));
|
( 1, 2, 2, 2, 1));
|
||||||
Divisor: 8);
|
Divisor: 8;
|
||||||
|
Bias: 0);
|
||||||
|
|
||||||
{ Kernel for 3x3 edge enhancement filter.}
|
{ Kernel for 3x3 edge enhancement filter.}
|
||||||
FilterEdgeEnhance3x3: TConvolutionFilter3x3 = (
|
FilterEdgeEnhance3x3: TConvolutionFilter3x3 = (
|
||||||
Kernel: ((-1, -2, -1),
|
Kernel: ((-1, -2, -1),
|
||||||
(-2, 16, -2),
|
(-2, 16, -2),
|
||||||
(-1, -2, -1));
|
(-1, -2, -1));
|
||||||
Divisor: 4);
|
Divisor: 4;
|
||||||
|
Bias: 0);
|
||||||
|
|
||||||
{ Kernel for 3x3 contour enhancement filter.}
|
{ Kernel for 3x3 contour enhancement filter.}
|
||||||
FilterTraceControur3x3: TConvolutionFilter3x3 = (
|
FilterTraceContour3x3: TConvolutionFilter3x3 = (
|
||||||
Kernel: ((-6, -6, -2),
|
Kernel: ((-6, -6, -2),
|
||||||
(-1, 32, -1),
|
(-1, 32, -1),
|
||||||
(-6, -2, -6));
|
(-6, -2, -6));
|
||||||
@@ -616,6 +613,8 @@ begin
|
|||||||
bfOneMinusDstAlpha: FSrc := ColorFP(1 - DestPix.A, 1 - DestPix.A, 1 - DestPix.A, 1 - DestPix.A);
|
bfOneMinusDstAlpha: FSrc := ColorFP(1 - DestPix.A, 1 - DestPix.A, 1 - DestPix.A, 1 - DestPix.A);
|
||||||
bfDstColor: FSrc := ColorFP(DestPix.A, DestPix.R, DestPix.G, DestPix.B);
|
bfDstColor: FSrc := ColorFP(DestPix.A, DestPix.R, DestPix.G, DestPix.B);
|
||||||
bfOneMinusDstColor: FSrc := ColorFP(1 - DestPix.A, 1 - DestPix.R, 1 - DestPix.G, 1 - DestPix.B);
|
bfOneMinusDstColor: FSrc := ColorFP(1 - DestPix.A, 1 - DestPix.R, 1 - DestPix.G, 1 - DestPix.B);
|
||||||
|
else
|
||||||
|
Assert(False);
|
||||||
end;
|
end;
|
||||||
case DestFactor of
|
case DestFactor of
|
||||||
bfZero: FDst := ColorFP(0, 0, 0, 0);
|
bfZero: FDst := ColorFP(0, 0, 0, 0);
|
||||||
@@ -626,6 +625,8 @@ begin
|
|||||||
bfOneMinusDstAlpha: FDst := ColorFP(1 - DestPix.A, 1 - DestPix.A, 1 - DestPix.A, 1 - DestPix.A);
|
bfOneMinusDstAlpha: FDst := ColorFP(1 - DestPix.A, 1 - DestPix.A, 1 - DestPix.A, 1 - DestPix.A);
|
||||||
bfSrcColor: FDst := ColorFP(SrcPix.A, SrcPix.R, SrcPix.G, SrcPix.B);
|
bfSrcColor: FDst := ColorFP(SrcPix.A, SrcPix.R, SrcPix.G, SrcPix.B);
|
||||||
bfOneMinusSrcColor: FDst := ColorFP(1 - SrcPix.A, 1 - SrcPix.R, 1 - SrcPix.G, 1 - SrcPix.B);
|
bfOneMinusSrcColor: FDst := ColorFP(1 - SrcPix.A, 1 - SrcPix.R, 1 - SrcPix.G, 1 - SrcPix.B);
|
||||||
|
else
|
||||||
|
Assert(False);
|
||||||
end;
|
end;
|
||||||
// Compute blending formula
|
// Compute blending formula
|
||||||
DestPix.R := SrcPix.R * FSrc.R + DestPix.R * FDst.R;
|
DestPix.R := SrcPix.R * FSrc.R + DestPix.R * FDst.R;
|
||||||
@@ -645,7 +646,10 @@ begin
|
|||||||
DestPix := DestInfo.GetPixelFP(DestPtr, DestInfo, nil);
|
DestPix := DestInfo.GetPixelFP(DestPtr, DestInfo, nil);
|
||||||
// Blend the two pixels (Src 'over' Dest alpha composition operation)
|
// Blend the two pixels (Src 'over' Dest alpha composition operation)
|
||||||
DestPix.A := SrcPix.A + DestPix.A - SrcPix.A * DestPix.A;
|
DestPix.A := SrcPix.A + DestPix.A - SrcPix.A * DestPix.A;
|
||||||
SrcAlpha := IffFloat(DestPix.A = 0, 0, SrcPix.A / DestPix.A);
|
if DestPix.A = 0 then
|
||||||
|
SrcAlpha := 0
|
||||||
|
else
|
||||||
|
SrcAlpha := SrcPix.A / DestPix.A;
|
||||||
DestAlpha := 1.0 - SrcAlpha;
|
DestAlpha := 1.0 - SrcAlpha;
|
||||||
DestPix.R := SrcPix.R * SrcAlpha + DestPix.R * DestAlpha;
|
DestPix.R := SrcPix.R * SrcAlpha + DestPix.R * DestAlpha;
|
||||||
DestPix.G := SrcPix.G * SrcAlpha + DestPix.G * DestAlpha;
|
DestPix.G := SrcPix.G * SrcAlpha + DestPix.G * DestAlpha;
|
||||||
@@ -786,9 +790,9 @@ end;
|
|||||||
function TransformPremultiplyAlpha(const Pixel: TColorFPRec; P1, P2, P3: Single): TColorFPRec;
|
function TransformPremultiplyAlpha(const Pixel: TColorFPRec; P1, P2, P3: Single): TColorFPRec;
|
||||||
begin
|
begin
|
||||||
Result.A := Pixel.A;
|
Result.A := Pixel.A;
|
||||||
Result.R := Result.R * Pixel.A;
|
Result.R := Pixel.R * Pixel.A;
|
||||||
Result.G := Result.G * Pixel.A;
|
Result.G := Pixel.G * Pixel.A;
|
||||||
Result.B := Result.B * Pixel.A;
|
Result.B := Pixel.B * Pixel.A;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
function TransformUnPremultiplyAlpha(const Pixel: TColorFPRec; P1, P2, P3: Single): TColorFPRec;
|
function TransformUnPremultiplyAlpha(const Pixel: TColorFPRec; P1, P2, P3: Single): TColorFPRec;
|
||||||
@@ -796,9 +800,9 @@ begin
|
|||||||
Result.A := Pixel.A;
|
Result.A := Pixel.A;
|
||||||
if Pixel.A <> 0.0 then
|
if Pixel.A <> 0.0 then
|
||||||
begin
|
begin
|
||||||
Result.R := Result.R / Pixel.A;
|
Result.R := Pixel.R / Pixel.A;
|
||||||
Result.G := Result.G / Pixel.A;
|
Result.G := Pixel.G / Pixel.A;
|
||||||
Result.B := Result.B / Pixel.A;
|
Result.B := Pixel.B / Pixel.A;
|
||||||
end
|
end
|
||||||
else
|
else
|
||||||
begin
|
begin
|
||||||
@@ -906,8 +910,7 @@ end;
|
|||||||
procedure TImagingCanvas.SetClipRect(const Value: TRect);
|
procedure TImagingCanvas.SetClipRect(const Value: TRect);
|
||||||
begin
|
begin
|
||||||
FClipRect := Value;
|
FClipRect := Value;
|
||||||
SwapMin(FClipRect.Left, FClipRect.Right);
|
NormalizeRect(FClipRect);
|
||||||
SwapMin(FClipRect.Top, FClipRect.Bottom);
|
|
||||||
IntersectRect(FClipRect, FClipRect, Rect(0, 0, FPData.Width, FPData.Height));
|
IntersectRect(FClipRect, FClipRect, Rect(0, 0, FPData.Width, FPData.Height));
|
||||||
end;
|
end;
|
||||||
|
|
||||||
@@ -987,7 +990,7 @@ begin
|
|||||||
case Bpp of
|
case Bpp of
|
||||||
1: FillMemoryByte(PixelPtr, WidthBytes, PByte(Color)^);
|
1: FillMemoryByte(PixelPtr, WidthBytes, PByte(Color)^);
|
||||||
2: FillMemoryWord(PixelPtr, WidthBytes, PWord(Color)^);
|
2: FillMemoryWord(PixelPtr, WidthBytes, PWord(Color)^);
|
||||||
4: FillMemoryLongWord(PixelPtr, WidthBytes, PLongWord(Color)^);
|
4: FillMemoryUInt32(PixelPtr, WidthBytes, PUInt32(Color)^);
|
||||||
else
|
else
|
||||||
for I := X1 to X2 do
|
for I := X1 to X2 do
|
||||||
begin
|
begin
|
||||||
@@ -1046,16 +1049,16 @@ begin
|
|||||||
if FPenMode = pmClear then Exit;
|
if FPenMode = pmClear then Exit;
|
||||||
|
|
||||||
// If line is vertical or horizontal just call appropriate method
|
// If line is vertical or horizontal just call appropriate method
|
||||||
if X2 - X1 = 0 then
|
if X2 = X1 then
|
||||||
begin
|
|
||||||
HorzLine(X1, X2, Y1);
|
|
||||||
Exit;
|
|
||||||
end;
|
|
||||||
if Y2 - Y1 = 0 then
|
|
||||||
begin
|
begin
|
||||||
VertLine(X1, Y1, Y2);
|
VertLine(X1, Y1, Y2);
|
||||||
Exit;
|
Exit;
|
||||||
end;
|
end;
|
||||||
|
if Y2 = Y1 then
|
||||||
|
begin
|
||||||
|
HorzLine(X1, X2, Y1);
|
||||||
|
Exit;
|
||||||
|
end;
|
||||||
|
|
||||||
// Determine if line is steep (angle with X-axis > 45 degrees)
|
// Determine if line is steep (angle with X-axis > 45 degrees)
|
||||||
Steep := Abs(Y2 - Y1) > Abs(X2 - X1);
|
Steep := Abs(Y2 - Y1) > Abs(X2 - X1);
|
||||||
@@ -1354,10 +1357,10 @@ begin
|
|||||||
end;
|
end;
|
||||||
|
|
||||||
procedure TImagingCanvas.DrawInternal(const SrcRect: TRect;
|
procedure TImagingCanvas.DrawInternal(const SrcRect: TRect;
|
||||||
DestCanvas: TImagingCanvas; DestX, DestY: Integer; SrcFactor,
|
DestCanvas: TImagingCanvas; DestX, DestY: LongInt; SrcFactor,
|
||||||
DestFactor: TBlendingFactor; PixelWriteProc: TPixelWriteProc);
|
DestFactor: TBlendingFactor; PixelWriteProc: TPixelWriteProc);
|
||||||
var
|
var
|
||||||
X, Y, SrcX, SrcY, Width, Height, SrcBpp, DestBpp: Integer;
|
X, Y, SrcX, SrcY, Width, Height, SrcBpp, DestBpp: LongInt;
|
||||||
PSrc: TColorFPRec;
|
PSrc: TColorFPRec;
|
||||||
SrcPointer, DestPointer: PByte;
|
SrcPointer, DestPointer: PByte;
|
||||||
begin
|
begin
|
||||||
@@ -1391,19 +1394,19 @@ begin
|
|||||||
end;
|
end;
|
||||||
|
|
||||||
procedure TImagingCanvas.DrawBlend(const SrcRect: TRect; DestCanvas: TImagingCanvas;
|
procedure TImagingCanvas.DrawBlend(const SrcRect: TRect; DestCanvas: TImagingCanvas;
|
||||||
DestX, DestY: Integer; SrcFactor, DestFactor: TBlendingFactor);
|
DestX, DestY: LongInt; SrcFactor, DestFactor: TBlendingFactor);
|
||||||
begin
|
begin
|
||||||
DrawInternal(SrcRect, DestCanvas, DestX, DestY, SrcFactor, DestFactor, PixelBlendProc);
|
DrawInternal(SrcRect, DestCanvas, DestX, DestY, SrcFactor, DestFactor, PixelBlendProc);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
procedure TImagingCanvas.DrawAlpha(const SrcRect: TRect; DestCanvas: TImagingCanvas;
|
procedure TImagingCanvas.DrawAlpha(const SrcRect: TRect; DestCanvas: TImagingCanvas;
|
||||||
DestX, DestY: Integer);
|
DestX, DestY: LongInt);
|
||||||
begin
|
begin
|
||||||
DrawInternal(SrcRect, DestCanvas, DestX, DestY, bfIgnore, bfIgnore, PixelAlphaProc);
|
DrawInternal(SrcRect, DestCanvas, DestX, DestY, bfIgnore, bfIgnore, PixelAlphaProc);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
procedure TImagingCanvas.DrawAdd(const SrcRect: TRect;
|
procedure TImagingCanvas.DrawAdd(const SrcRect: TRect;
|
||||||
DestCanvas: TImagingCanvas; DestX, DestY: Integer);
|
DestCanvas: TImagingCanvas; DestX, DestY: LongInt);
|
||||||
begin
|
begin
|
||||||
DrawInternal(SrcRect, DestCanvas, DestX, DestY, bfIgnore, bfIgnore, PixelAddProc);
|
DrawInternal(SrcRect, DestCanvas, DestX, DestY, bfIgnore, bfIgnore, PixelAddProc);
|
||||||
end;
|
end;
|
||||||
@@ -1414,13 +1417,13 @@ procedure TImagingCanvas.StretchDrawInternal(const SrcRect: TRect;
|
|||||||
PixelWriteProc: TPixelWriteProc);
|
PixelWriteProc: TPixelWriteProc);
|
||||||
const
|
const
|
||||||
FilterMapping: array[TResizeFilter] of TSamplingFilter =
|
FilterMapping: array[TResizeFilter] of TSamplingFilter =
|
||||||
(sfNearest, sfLinear, DefaultCubicFilter);
|
(sfNearest, sfLinear, DefaultCubicFilter, sfLanczos);
|
||||||
var
|
var
|
||||||
X, Y, I, J, SrcX, SrcY, SrcWidth, SrcHeight: Integer;
|
X, Y, I, J, SrcX, SrcY, SrcWidth, SrcHeight: LongInt;
|
||||||
DestX, DestY, DestWidth, DestHeight, SrcBpp, DestBpp: Integer;
|
DestX, DestY, DestWidth, DestHeight, SrcBpp, DestBpp: LongInt;
|
||||||
SrcPix, PDest: TColorFPRec;
|
SrcPix: TColorFPRec;
|
||||||
MapX, MapY: TMappingTable;
|
MapX, MapY: TMappingTable;
|
||||||
XMinimum, XMaximum: Integer;
|
XMinimum, XMaximum: LongInt;
|
||||||
LineBuffer: array of TColorFPRec;
|
LineBuffer: array of TColorFPRec;
|
||||||
ClusterX, ClusterY: TCluster;
|
ClusterX, ClusterY: TCluster;
|
||||||
Weight, AccumA, AccumR, AccumG, AccumB: Single;
|
Weight, AccumA, AccumR, AccumG, AccumB: Single;
|
||||||
@@ -1572,10 +1575,10 @@ begin
|
|||||||
PosX := ClampInt(X + I - SizeDiv2, FClipRect.Left, FClipRect.Right - 1);
|
PosX := ClampInt(X + I - SizeDiv2, FClipRect.Left, FClipRect.Right - 1);
|
||||||
SrcPointer := @PByteArray(TempImage.Bits)[PosY * WidthBytes + PosX * Bpp];
|
SrcPointer := @PByteArray(TempImage.Bits)[PosY * WidthBytes + PosX * Bpp];
|
||||||
|
|
||||||
// Get pixels from neighbourhood of current pixel and add their
|
// Get pixels from neighborhood of current pixel and add their
|
||||||
// colors to accumulators weighted by filter kernel values
|
// colors to accumulators weighted by filter kernel values
|
||||||
Pixel := FFormatInfo.GetPixelFP(SrcPointer, @FFormatInfo, TempImage.Palette);
|
Pixel := FFormatInfo.GetPixelFP(SrcPointer, @FFormatInfo, TempImage.Palette);
|
||||||
KernelValue := PLongIntArray(Kernel)[J * KernelSize + I];
|
KernelValue := PUInt32Array(Kernel)[J * KernelSize + I];
|
||||||
|
|
||||||
R := R + Pixel.R * KernelValue;
|
R := R + Pixel.R * KernelValue;
|
||||||
G := G + Pixel.G * KernelValue;
|
G := G + Pixel.G * KernelValue;
|
||||||
@@ -1714,7 +1717,7 @@ begin
|
|||||||
Brightness / 100, 0);
|
Brightness / 100, 0);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
procedure TImagingCanvas.GammaCorection(Red, Green, Blue: Single);
|
procedure TImagingCanvas.GammaCorrection(Red, Green, Blue: Single);
|
||||||
begin
|
begin
|
||||||
PointTransform(TransformGamma, Red, Green, Blue);
|
PointTransform(TransformGamma, Red, Green, Blue);
|
||||||
end;
|
end;
|
||||||
@@ -1852,9 +1855,9 @@ begin
|
|||||||
end;
|
end;
|
||||||
|
|
||||||
procedure TFastARGB32Canvas.DrawAlpha(const SrcRect: TRect;
|
procedure TFastARGB32Canvas.DrawAlpha(const SrcRect: TRect;
|
||||||
DestCanvas: TImagingCanvas; DestX, DestY: Integer);
|
DestCanvas: TImagingCanvas; DestX, DestY: LongInt);
|
||||||
var
|
var
|
||||||
X, Y, SrcX, SrcY, Width, Height: Integer;
|
X, Y, SrcX, SrcY, Width, Height: LongInt;
|
||||||
SrcPix, DestPix: PColor32Rec;
|
SrcPix, DestPix: PColor32Rec;
|
||||||
begin
|
begin
|
||||||
if DestCanvas.ClassType <> Self.ClassType then
|
if DestCanvas.ClassType <> Self.ClassType then
|
||||||
@@ -1900,10 +1903,10 @@ end;
|
|||||||
procedure TFastARGB32Canvas.StretchDrawAlpha(const SrcRect: TRect;
|
procedure TFastARGB32Canvas.StretchDrawAlpha(const SrcRect: TRect;
|
||||||
DestCanvas: TImagingCanvas; const DestRect: TRect; Filter: TResizeFilter);
|
DestCanvas: TImagingCanvas; const DestRect: TRect; Filter: TResizeFilter);
|
||||||
var
|
var
|
||||||
X, Y, ScaleX, ScaleY, Yp, Xp, Weight1, Weight2, Weight3, Weight4,
|
X, Y, ScaleX, ScaleY, Yp, Xp, Weight1, Weight2, Weight3, Weight4, InvFracY, T1, T2: Integer;
|
||||||
FracX, FracY, InvFracY, T1, T2: Integer;
|
FracX, FracY: Cardinal;
|
||||||
SrcX, SrcY, SrcWidth, SrcHeight: Integer;
|
SrcX, SrcY, SrcWidth, SrcHeight: LongInt;
|
||||||
DestX, DestY, DestWidth, DestHeight: Integer;
|
DestX, DestY, DestWidth, DestHeight: LongInt;
|
||||||
SrcLine, SrcLine2: PColor32RecArray;
|
SrcLine, SrcLine2: PColor32RecArray;
|
||||||
DestPix: PColor32Rec;
|
DestPix: PColor32Rec;
|
||||||
Accum: TColor32Rec;
|
Accum: TColor32Rec;
|
||||||
@@ -1985,9 +1988,9 @@ begin
|
|||||||
end;
|
end;
|
||||||
|
|
||||||
T2 := Iff(T1 < SrcWidth - 1, T1 + 1, T1);
|
T2 := Iff(T1 < SrcWidth - 1, T1 + 1, T1);
|
||||||
Weight2:= (Cardinal(InvFracY) * FracX) shr 16; // cast to Card, Int can overflow gere
|
Weight2:= Integer((Cardinal(InvFracY) * FracX) shr 16); // cast to Card, Int can overflow here
|
||||||
Weight1:= InvFracY - Weight2;
|
Weight1:= InvFracY - Weight2;
|
||||||
Weight4:= (Cardinal(FracY) * FracX) shr 16;
|
Weight4:= Integer((Cardinal(FracY) * FracX) shr 16);
|
||||||
Weight3:= FracY - Weight4;
|
Weight3:= FracY - Weight4;
|
||||||
|
|
||||||
Accum.B := (SrcLine[T1].B * Weight1 + SrcLine[T2].B * Weight2 +
|
Accum.B := (SrcLine[T1].B * Weight1 + SrcLine[T2].B * Weight2 +
|
||||||
@@ -2007,83 +2010,12 @@ begin
|
|||||||
Inc(Yp, ScaleY);
|
Inc(Yp, ScaleY);
|
||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
{
|
|
||||||
|
|
||||||
// Generate mapping tables
|
|
||||||
MapX := BuildMappingTable(DestX, DestX + DestWidth, SrcX, SrcX + SrcWidth,
|
|
||||||
FPData.Width, FilterFunction, Radius, False);
|
|
||||||
MapY := BuildMappingTable(DestY, DestY + DestHeight, SrcY, SrcY + SrcHeight,
|
|
||||||
FPData.Height, FilterFunction, Radius, False);
|
|
||||||
FindExtremes(MapX, XMinimum, XMaximum);
|
|
||||||
SetLength(LineBuffer, XMaximum - XMinimum + 1);
|
|
||||||
|
|
||||||
for J := 0 to DestHeight - 1 do
|
|
||||||
begin
|
|
||||||
ClusterY := MapY[J];
|
|
||||||
for X := XMinimum to XMaximum do
|
|
||||||
begin
|
|
||||||
AccumA := 0;
|
|
||||||
AccumR := 0;
|
|
||||||
AccumG := 0;
|
|
||||||
AccumB := 0;
|
|
||||||
for Y := 0 to Length(ClusterY) - 1 do
|
|
||||||
begin
|
|
||||||
Weight := Round(ClusterY[Y].Weight * 256);
|
|
||||||
SrcColor := FScanlines[ClusterY[Y].Pos, X];
|
|
||||||
|
|
||||||
AccumB := AccumB + SrcColor.B * Weight;
|
|
||||||
AccumG := AccumG + SrcColor.G * Weight;
|
|
||||||
AccumR := AccumR + SrcColor.R * Weight;
|
|
||||||
AccumA := AccumA + SrcColor.A * Weight;
|
|
||||||
end;
|
|
||||||
with LineBuffer[X - XMinimum] do
|
|
||||||
begin
|
|
||||||
A := AccumA;
|
|
||||||
R := AccumR;
|
|
||||||
G := AccumG;
|
|
||||||
B := AccumB;
|
|
||||||
end;
|
|
||||||
end;
|
|
||||||
|
|
||||||
DestPtr := @TFastARGB32Canvas(DestCanvas).FScanlines[DestY + J, DestX];
|
|
||||||
|
|
||||||
for I := 0 to DestWidth - 1 do
|
|
||||||
begin
|
|
||||||
ClusterX := MapX[I];
|
|
||||||
AccumA := 0;
|
|
||||||
AccumR := 0;
|
|
||||||
AccumG := 0;
|
|
||||||
AccumB := 0;
|
|
||||||
for X := 0 to Length(ClusterX) - 1 do
|
|
||||||
begin
|
|
||||||
Weight := Round(ClusterX[X].Weight * 256);
|
|
||||||
with LineBuffer[ClusterX[X].Pos - XMinimum] do
|
|
||||||
begin
|
|
||||||
AccumB := AccumB + B * Weight;
|
|
||||||
AccumG := AccumG + G * Weight;
|
|
||||||
AccumR := AccumR + R * Weight;
|
|
||||||
AccumA := AccumA + A * Weight;
|
|
||||||
end;
|
|
||||||
end;
|
|
||||||
|
|
||||||
AccumA := ClampInt(AccumA, 0, $00FF0000);
|
|
||||||
AccumR := ClampInt(AccumR, 0, $00FF0000);
|
|
||||||
AccumG := ClampInt(AccumG, 0, $00FF0000);
|
|
||||||
AccumB := ClampInt(AccumB, 0, $00FF0000);
|
|
||||||
SrcColor.Color := (Cardinal(AccumA and $00FF0000) shl 8) or
|
|
||||||
(AccumR and $00FF0000) or ((AccumG and $00FF0000) shr 8) or ((AccumB and $00FF0000) shr 16);
|
|
||||||
|
|
||||||
AlphaBlendPixels(@SrcColor, DestPtr);
|
|
||||||
|
|
||||||
Inc(DestPtr);
|
|
||||||
end;
|
|
||||||
end; }
|
|
||||||
end;
|
end;
|
||||||
|
|
||||||
procedure TFastARGB32Canvas.UpdateCanvasState;
|
procedure TFastARGB32Canvas.UpdateCanvasState;
|
||||||
var
|
var
|
||||||
I: LongInt;
|
I: LongInt;
|
||||||
ScanPos: PLongWord;
|
ScanPos: PUInt32;
|
||||||
begin
|
begin
|
||||||
inherited UpdateCanvasState;
|
inherited UpdateCanvasState;
|
||||||
|
|
||||||
@@ -2133,9 +2065,14 @@ finalization
|
|||||||
-- TODOS ----------------------------------------------------
|
-- TODOS ----------------------------------------------------
|
||||||
- more more more ...
|
- more more more ...
|
||||||
- implement pen width everywhere
|
- implement pen width everywhere
|
||||||
- add blending (*image and object drawing)
|
|
||||||
- more objects (arc, polygon)
|
- more objects (arc, polygon)
|
||||||
|
|
||||||
|
-- 0.26.5 Changes/Bug Fixes ---------------------------------
|
||||||
|
- Fixed bug that could raise floating point error in DrawAlpha
|
||||||
|
and StretchDrawAlpha.
|
||||||
|
- Fixed bug in TImagingCanvas.Line that caused not drawing
|
||||||
|
of horz or vert lines.
|
||||||
|
|
||||||
-- 0.26.3 Changes/Bug Fixes ---------------------------------
|
-- 0.26.3 Changes/Bug Fixes ---------------------------------
|
||||||
- Added some methods to TFastARGB32Canvas (InvertColors, DrawAlpha/StretchDrawAlpha)
|
- Added some methods to TFastARGB32Canvas (InvertColors, DrawAlpha/StretchDrawAlpha)
|
||||||
- Fixed DrawAlpha/StretchDrawAlpha destination alpha calculation.
|
- Fixed DrawAlpha/StretchDrawAlpha destination alpha calculation.
|
||||||
@@ -2146,7 +2083,7 @@ finalization
|
|||||||
- Added FloodFill method.
|
- Added FloodFill method.
|
||||||
- Added GetHistogram method.
|
- Added GetHistogram method.
|
||||||
- Fixed "Invalid FP operation" in AdjustColorLevels in FPC compiled exes
|
- Fixed "Invalid FP operation" in AdjustColorLevels in FPC compiled exes
|
||||||
(thanks to Carlos González).
|
(thanks to Carlos Gonzalez).
|
||||||
- Added TImagingCanvas.AdjustColorLevels method.
|
- Added TImagingCanvas.AdjustColorLevels method.
|
||||||
|
|
||||||
-- 0.25.0 Changes/Bug Fixes ---------------------------------
|
-- 0.25.0 Changes/Bug Fixes ---------------------------------
|
||||||
@@ -2169,7 +2106,7 @@ finalization
|
|||||||
-- 0.19 Changes/Bug Fixes -----------------------------------
|
-- 0.19 Changes/Bug Fixes -----------------------------------
|
||||||
- added TFastARGB32Canvas
|
- added TFastARGB32Canvas
|
||||||
- added convolutions, hline, vline
|
- added convolutions, hline, vline
|
||||||
- unit created, intial stuff added
|
- unit created, initial stuff added
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
+296
-198
@@ -1,29 +1,12 @@
|
|||||||
{
|
{
|
||||||
$Id: ImagingClasses.pas 173 2009-09-04 17:05:52Z galfar $
|
|
||||||
Vampyre Imaging Library
|
Vampyre Imaging Library
|
||||||
by Marek Mauder
|
by Marek Mauder
|
||||||
http://imaginglib.sourceforge.net
|
https://github.com/galfar/imaginglib
|
||||||
|
https://imaginglib.sourceforge.io
|
||||||
The contents of this file are used with permission, subject to the Mozilla
|
- - - - -
|
||||||
Public License Version 1.1 (the "License"); you may not use this file except
|
This Source Code Form is subject to the terms of the Mozilla Public
|
||||||
in compliance with the License. You may obtain a copy of the License at
|
License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||||
http://www.mozilla.org/MPL/MPL-1.1.html
|
file, You can obtain one at https://mozilla.org/MPL/2.0.
|
||||||
|
|
||||||
Software distributed under the License is distributed on an "AS IS" basis,
|
|
||||||
WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License for
|
|
||||||
the specific language governing rights and limitations under the License.
|
|
||||||
|
|
||||||
Alternatively, the contents of this file may be used under the terms of the
|
|
||||||
GNU Lesser General Public License (the "LGPL License"), in which case the
|
|
||||||
provisions of the LGPL License are applicable instead of those above.
|
|
||||||
If you wish to allow use of your version of this file only under the terms
|
|
||||||
of the LGPL License and not to allow others to use your version of this file
|
|
||||||
under the MPL, indicate your decision by deleting the provisions above and
|
|
||||||
replace them with the notice and other provisions required by the LGPL
|
|
||||||
License. If you do not delete the provisions above, a recipient may use
|
|
||||||
your version of this file under either the MPL or the LGPL License.
|
|
||||||
|
|
||||||
For more information about the LGPL: http://www.gnu.org/copyleft/lesser.html
|
|
||||||
}
|
}
|
||||||
|
|
||||||
{ This unit contains class based wrapper to Imaging library.}
|
{ This unit contains class based wrapper to Imaging library.}
|
||||||
@@ -40,41 +23,52 @@ type
|
|||||||
{ Base abstract high level class wrapper to low level Imaging structures and
|
{ Base abstract high level class wrapper to low level Imaging structures and
|
||||||
functions.}
|
functions.}
|
||||||
TBaseImage = class(TPersistent)
|
TBaseImage = class(TPersistent)
|
||||||
|
private
|
||||||
|
function GetEmpty: Boolean;
|
||||||
protected
|
protected
|
||||||
FPData: PImageData;
|
FPData: PImageData;
|
||||||
FOnDataSizeChanged: TNotifyEvent;
|
FOnDataSizeChanged: TNotifyEvent;
|
||||||
FOnPixelsChanged: TNotifyEvent;
|
FOnPixelsChanged: TNotifyEvent;
|
||||||
function GetFormat: TImageFormat; {$IFDEF USE_INLINE}inline;{$ENDIF}
|
function GetFormat: TImageFormat; {$IFDEF USE_INLINE}inline;{$ENDIF}
|
||||||
function GetHeight: LongInt; {$IFDEF USE_INLINE}inline;{$ENDIF}
|
function GetHeight: Integer; {$IFDEF USE_INLINE}inline;{$ENDIF}
|
||||||
function GetSize: LongInt; {$IFDEF USE_INLINE}inline;{$ENDIF}
|
function GetSize: Integer; {$IFDEF USE_INLINE}inline;{$ENDIF}
|
||||||
function GetWidth: LongInt; {$IFDEF USE_INLINE}inline;{$ENDIF}
|
function GetWidth: Integer; {$IFDEF USE_INLINE}inline;{$ENDIF}
|
||||||
function GetBits: Pointer; {$IFDEF USE_INLINE}inline;{$ENDIF}
|
function GetBits: Pointer; {$IFDEF USE_INLINE}inline;{$ENDIF}
|
||||||
function GetPalette: PPalette32; {$IFDEF USE_INLINE}inline;{$ENDIF}
|
function GetPalette: PPalette32; {$IFDEF USE_INLINE}inline;{$ENDIF}
|
||||||
function GetPaletteEntries: LongInt; {$IFDEF USE_INLINE}inline;{$ENDIF}
|
function GetPaletteEntries: Integer; {$IFDEF USE_INLINE}inline;{$ENDIF}
|
||||||
function GetScanLine(Index: LongInt): Pointer; {$IFDEF USE_INLINE}inline;{$ENDIF}
|
function GetScanline(Index: Integer): Pointer;
|
||||||
function GetPixelPointer(X, Y: LongInt): Pointer; {$IFDEF USE_INLINE}inline;{$ENDIF}
|
function GetPixelPointer(X, Y: Integer): Pointer; {$IFDEF USE_INLINE}inline;{$ENDIF}
|
||||||
|
function GetScanlineSize: Integer; {$IFDEF USE_INLINE}inline;{$ENDIF}
|
||||||
function GetFormatInfo: TImageFormatInfo; {$IFDEF USE_INLINE}inline;{$ENDIF}
|
function GetFormatInfo: TImageFormatInfo; {$IFDEF USE_INLINE}inline;{$ENDIF}
|
||||||
function GetValid: Boolean; {$IFDEF USE_INLINE}inline;{$ENDIF}
|
function GetValid: Boolean; {$IFDEF USE_INLINE}inline;{$ENDIF}
|
||||||
function GetBoundsRect: TRect;
|
function GetBoundsRect: TRect;
|
||||||
procedure SetFormat(const Value: TImageFormat); {$IFDEF USE_INLINE}inline;{$ENDIF}
|
procedure SetFormat(const Value: TImageFormat); {$IFDEF USE_INLINE}inline;{$ENDIF}
|
||||||
procedure SetHeight(const Value: LongInt); {$IFDEF USE_INLINE}inline;{$ENDIF}
|
procedure SetHeight(const Value: Integer); {$IFDEF USE_INLINE}inline;{$ENDIF}
|
||||||
procedure SetWidth(const Value: LongInt); {$IFDEF USE_INLINE}inline;{$ENDIF}
|
procedure SetWidth(const Value: Integer); {$IFDEF USE_INLINE}inline;{$ENDIF}
|
||||||
procedure SetPointer; virtual; abstract;
|
procedure SetPointer; virtual; abstract;
|
||||||
procedure DoDataSizeChanged; virtual;
|
procedure DoDataSizeChanged; virtual;
|
||||||
procedure DoPixelsChanged; virtual;
|
procedure DoPixelsChanged; virtual;
|
||||||
published
|
|
||||||
public
|
public
|
||||||
constructor Create; virtual;
|
constructor Create; virtual;
|
||||||
constructor CreateFromImage(AImage: TBaseImage);
|
constructor CreateFromImage(AImage: TBaseImage);
|
||||||
destructor Destroy; override;
|
destructor Destroy; override;
|
||||||
{ Returns info about current image.}
|
{ Returns info about current image.}
|
||||||
function ToString: string; {$IF Defined(DCC) and (CompilerVersion >= 20.0)}override;{$IFEND}
|
function ToString: string; {$IF (Defined(DCC) and (CompilerVersion >= 20.0)) or Defined(FPC)}override;{$IFEND}
|
||||||
|
|
||||||
{ Creates a new image data with the given size and format. Old image
|
{ Creates a new image data with the given size and format. Old image
|
||||||
data is lost. Works only for the current image of TMultiImage.}
|
data is lost. Works only for the current image of TMultiImage.}
|
||||||
procedure RecreateImageData(AWidth, AHeight: LongInt; AFormat: TImageFormat);
|
procedure RecreateImageData(AWidth, AHeight: Integer; AFormat: TImageFormat);
|
||||||
|
{ Maps underlying image data to given TImageData record. Both TBaseImage and
|
||||||
|
TImageData now share some image memory (bits). So don't call FreeImage
|
||||||
|
on TImageData afterwards since this TBaseImage would get really broken.}
|
||||||
|
procedure MapImageData(const ImageData: TImageData);
|
||||||
|
{ Deletes current image.}
|
||||||
|
procedure Clear;
|
||||||
|
|
||||||
{ Resizes current image with optional resampling.}
|
{ Resizes current image with optional resampling.}
|
||||||
procedure Resize(NewWidth, NewHeight: LongInt; Filter: TResizeFilter);
|
procedure Resize(NewWidth, NewHeight: Integer; Filter: TResizeFilter);
|
||||||
|
{ Resizes current image proportionally to fit the given width and height. }
|
||||||
|
procedure ResizeToFit(FitWidth, FitHeight: Integer; Filter: TResizeFilter; DstImage: TBaseImage);
|
||||||
{ Flips current image. Reverses the image along its horizontal axis the top
|
{ Flips current image. Reverses the image along its horizontal axis the top
|
||||||
becomes the bottom and vice versa.}
|
becomes the bottom and vice versa.}
|
||||||
procedure Flip;
|
procedure Flip;
|
||||||
@@ -88,21 +82,27 @@ type
|
|||||||
negative X and Y coordinates.
|
negative X and Y coordinates.
|
||||||
Note that copying is fastest for images in the same data format
|
Note that copying is fastest for images in the same data format
|
||||||
(and slowest for images in special formats).}
|
(and slowest for images in special formats).}
|
||||||
procedure CopyTo(SrcX, SrcY, Width, Height: LongInt; DstImage: TBaseImage; DstX, DstY: LongInt);
|
procedure CopyTo(SrcX, SrcY, Width, Height: Integer; DstImage: TBaseImage; DstX, DstY: Integer); overload;
|
||||||
|
{ Copies whole image to DstImage. No blending is performed -
|
||||||
|
alpha is simply copied to destination image. Operates also with
|
||||||
|
negative X and Y coordinates.
|
||||||
|
Note that copying is fastest for images in the same data format
|
||||||
|
(and slowest for images in special formats).}
|
||||||
|
procedure CopyTo(DstImage: TBaseImage; DstX, DstY: Integer); overload;
|
||||||
{ Stretches the contents of the source rectangle to the destination rectangle
|
{ Stretches the contents of the source rectangle to the destination rectangle
|
||||||
with optional resampling. No blending is performed - alpha is
|
with optional resampling. No blending is performed - alpha is
|
||||||
simply copied/resampled to destination image. Note that stretching is
|
simply copied/resampled to destination image. Note that stretching is
|
||||||
fastest for images in the same data format (and slowest for
|
fastest for images in the same data format (and slowest for
|
||||||
images in special formats).}
|
images in special formats).}
|
||||||
procedure StretchTo(SrcX, SrcY, SrcWidth, SrcHeight: LongInt; DstImage: TBaseImage; DstX, DstY, DstWidth, DstHeight: LongInt; Filter: TResizeFilter);
|
procedure StretchTo(SrcX, SrcY, SrcWidth, SrcHeight: Integer; DstImage: TBaseImage; DstX, DstY, DstWidth, DstHeight: Integer; Filter: TResizeFilter);
|
||||||
{ Replaces pixels with OldPixel in the given rectangle by NewPixel.
|
{ Replaces pixels with OldPixel in the given rectangle by NewPixel.
|
||||||
OldPixel and NewPixel should point to the pixels in the same format
|
OldPixel and NewPixel should point to the pixels in the same format
|
||||||
as the given image is in.}
|
as the given image is in.}
|
||||||
procedure ReplaceColor(X, Y, Width, Height: LongInt; OldColor, NewColor: Pointer);
|
procedure ReplaceColor(X, Y, Width, Height: Integer; OldColor, NewColor: Pointer);
|
||||||
{ Swaps SrcChannel and DstChannel color or alpha channels of image.
|
{ Swaps SrcChannel and DstChannel color or alpha channels of image.
|
||||||
Use ChannelRed, ChannelBlue, ChannelGreen, ChannelAlpha constants to
|
Use ChannelRed, ChannelBlue, ChannelGreen, ChannelAlpha constants to
|
||||||
identify channels.}
|
identify channels.}
|
||||||
procedure SwapChannels(SrcChannel, DstChannel: LongInt);
|
procedure SwapChannels(SrcChannel, DstChannel: Integer);
|
||||||
|
|
||||||
{ Loads current image data from file.}
|
{ Loads current image data from file.}
|
||||||
procedure LoadFromFile(const FileName: string); virtual;
|
procedure LoadFromFile(const FileName: string); virtual;
|
||||||
@@ -110,31 +110,33 @@ type
|
|||||||
procedure LoadFromStream(Stream: TStream); virtual;
|
procedure LoadFromStream(Stream: TStream); virtual;
|
||||||
|
|
||||||
{ Saves current image data to file.}
|
{ Saves current image data to file.}
|
||||||
procedure SaveToFile(const FileName: string);
|
function SaveToFile(const FileName: string): Boolean;
|
||||||
{ Saves current image data to stream. Ext identifies desired image file
|
{ Saves current image data to stream. Ext identifies desired image file
|
||||||
format (jpg, png, dds, ...)}
|
format (jpg, png, dds, ...).}
|
||||||
procedure SaveToStream(const Ext: string; Stream: TStream);
|
function SaveToStream(const Ext: string; Stream: TStream): Boolean;
|
||||||
|
|
||||||
{ Width of current image in pixels.}
|
{ Width of current image in pixels.}
|
||||||
property Width: LongInt read GetWidth write SetWidth;
|
property Width: Integer read GetWidth write SetWidth;
|
||||||
{ Height of current image in pixels.}
|
{ Height of current image in pixels.}
|
||||||
property Height: LongInt read GetHeight write SetHeight;
|
property Height: Integer read GetHeight write SetHeight;
|
||||||
{ Image data format of current image.}
|
{ Image data format of current image.}
|
||||||
property Format: TImageFormat read GetFormat write SetFormat;
|
property Format: TImageFormat read GetFormat write SetFormat;
|
||||||
{ Size in bytes of current image's data.}
|
{ Size in bytes of current image's data.}
|
||||||
property Size: LongInt read GetSize;
|
property Size: Integer read GetSize;
|
||||||
{ Pointer to memory containing image bits.}
|
{ Pointer to memory containing image bits.}
|
||||||
property Bits: Pointer read GetBits;
|
property Bits: Pointer read GetBits;
|
||||||
{ Pointer to palette for indexed format images. It is nil for others.
|
{ Pointer to palette for indexed format images. It is nil for others.
|
||||||
Max palette entry is at index [PaletteEntries - 1].}
|
Max palette entry is at index [PaletteEntries - 1].}
|
||||||
property Palette: PPalette32 read GetPalette;
|
property Palette: PPalette32 read GetPalette;
|
||||||
{ Number of entries in image's palette}
|
{ Number of entries in image's palette}
|
||||||
property PaletteEntries: LongInt read GetPaletteEntries;
|
property PaletteEntries: Integer read GetPaletteEntries;
|
||||||
{ Provides indexed access to each line of pixels. Does not work with special
|
{ Provides indexed access to each line of pixels. Does not work with special
|
||||||
format images (like DXT).}
|
format images (like DXT).}
|
||||||
property ScanLine[Index: LongInt]: Pointer read GetScanLine;
|
property Scanline[Index: Integer]: Pointer read GetScanline;
|
||||||
{ Returns pointer to image pixel at [X, Y] coordinates.}
|
{ Returns pointer to image pixel at [X, Y] coordinates.}
|
||||||
property PixelPointers[X, Y: LongInt]: Pointer read GetPixelPointer;
|
property PixelPointer[X, Y: Integer]: Pointer read GetPixelPointer;
|
||||||
|
{ Size/length of one image scanline in bytes.}
|
||||||
|
property ScanlineSize: Integer read GetScanlineSize;
|
||||||
{ Extended image format information.}
|
{ Extended image format information.}
|
||||||
property FormatInfo: TImageFormatInfo read GetFormatInfo;
|
property FormatInfo: TImageFormatInfo read GetFormatInfo;
|
||||||
{ This gives complete access to underlying TImageData record.
|
{ This gives complete access to underlying TImageData record.
|
||||||
@@ -144,7 +146,9 @@ type
|
|||||||
{ Indicates whether the current image is valid (proper format,
|
{ Indicates whether the current image is valid (proper format,
|
||||||
allowed dimensions, right size, ...).}
|
allowed dimensions, right size, ...).}
|
||||||
property Valid: Boolean read GetValid;
|
property Valid: Boolean read GetValid;
|
||||||
{{ Specifies the bounding rectangle of the image.}
|
{ Indicates whether image contains any data (size in bytes > 0).}
|
||||||
|
property Empty: Boolean read GetEmpty;
|
||||||
|
{ Specifies the bounding rectangle of the image.}
|
||||||
property BoundsRect: TRect read GetBoundsRect;
|
property BoundsRect: TRect read GetBoundsRect;
|
||||||
{ This event occurs when the image data size has just changed. That means
|
{ This event occurs when the image data size has just changed. That means
|
||||||
image width, height, or format has been changed.}
|
image width, height, or format has been changed.}
|
||||||
@@ -161,13 +165,15 @@ type
|
|||||||
procedure SetPointer; override;
|
procedure SetPointer; override;
|
||||||
public
|
public
|
||||||
constructor Create; override;
|
constructor Create; override;
|
||||||
constructor CreateFromParams(AWidth, AHeight: LongInt; AFormat: TImageFormat = ifDefault);
|
constructor CreateFromParams(AWidth, AHeight: Integer; AFormat: TImageFormat = ifDefault);
|
||||||
constructor CreateFromData(const AData: TImageData);
|
constructor CreateFromData(const AData: TImageData);
|
||||||
constructor CreateFromFile(const FileName: string);
|
constructor CreateFromFile(const FileName: string);
|
||||||
constructor CreateFromStream(Stream: TStream);
|
constructor CreateFromStream(Stream: TStream);
|
||||||
destructor Destroy; override;
|
destructor Destroy; override;
|
||||||
{ Assigns single image from another single image or multi image.}
|
{ Assigns single image from another single image or multi image.}
|
||||||
procedure Assign(Source: TPersistent); override;
|
procedure Assign(Source: TPersistent); override;
|
||||||
|
{ Assigns single image from image data record.}
|
||||||
|
procedure AssignFromImageData(const AImageData: TImageData);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
{ Extension of TBaseImage which uses array of TImageData records to
|
{ Extension of TBaseImage which uses array of TImageData records to
|
||||||
@@ -180,70 +186,74 @@ type
|
|||||||
TMultiImage = class(TBaseImage)
|
TMultiImage = class(TBaseImage)
|
||||||
protected
|
protected
|
||||||
FDataArray: TDynImageDataArray;
|
FDataArray: TDynImageDataArray;
|
||||||
FActiveImage: LongInt;
|
FActiveImage: Integer;
|
||||||
procedure SetActiveImage(Value: LongInt); {$IFDEF USE_INLINE}inline;{$ENDIF}
|
procedure SetActiveImage(Value: Integer); {$IFDEF USE_INLINE}inline;{$ENDIF}
|
||||||
function GetImageCount: LongInt; {$IFDEF USE_INLINE}inline;{$ENDIF}
|
function GetImageCount: Integer; {$IFDEF USE_INLINE}inline;{$ENDIF}
|
||||||
procedure SetImageCount(Value: LongInt);
|
procedure SetImageCount(Value: Integer);
|
||||||
function GetAllImagesValid: Boolean; {$IFDEF USE_INLINE}inline;{$ENDIF}
|
function GetAllImagesValid: Boolean; {$IFDEF USE_INLINE}inline;{$ENDIF}
|
||||||
function GetImage(Index: LongInt): TImageData; {$IFDEF USE_INLINE}inline;{$ENDIF}
|
function GetImage(Index: Integer): TImageData; {$IFDEF USE_INLINE}inline;{$ENDIF}
|
||||||
procedure SetImage(Index: LongInt; Value: TImageData); {$IFDEF USE_INLINE}inline;{$ENDIF}
|
procedure SetImage(Index: Integer; Value: TImageData); {$IFDEF USE_INLINE}inline;{$ENDIF}
|
||||||
procedure SetPointer; override;
|
procedure SetPointer; override;
|
||||||
function PrepareInsert(Index, Count: LongInt): Boolean;
|
function PrepareInsert(Index, InsertCount: Integer): Boolean;
|
||||||
procedure DoInsertImages(Index: LongInt; const Images: TDynImageDataArray);
|
procedure DoInsertImages(Index: Integer; const Images: TDynImageDataArray);
|
||||||
procedure DoInsertNew(Index: LongInt; AWidth, AHeight: LongInt; AFormat: TImageFormat);
|
procedure DoInsertNew(Index: Integer; AWidth, AHeight: Integer; AFormat: TImageFormat);
|
||||||
public
|
public
|
||||||
constructor Create; override;
|
constructor Create; override;
|
||||||
constructor CreateFromParams(AWidth, AHeight: LongInt; AFormat: TImageFormat; Images: LongInt);
|
constructor CreateFromParams(AWidth, AHeight: Integer; AFormat: TImageFormat; ImageCount: Integer);
|
||||||
constructor CreateFromArray(ADataArray: TDynImageDataArray);
|
constructor CreateFromArray(const ADataArray: TDynImageDataArray);
|
||||||
constructor CreateFromFile(const FileName: string);
|
constructor CreateFromFile(const FileName: string);
|
||||||
constructor CreateFromStream(Stream: TStream);
|
constructor CreateFromStream(Stream: TStream);
|
||||||
destructor Destroy; override;
|
destructor Destroy; override;
|
||||||
{ Assigns multi image from another multi image or single image.}
|
{ Assigns multi image from another multi image or single image.}
|
||||||
procedure Assign(Source: TPersistent); override;
|
procedure Assign(Source: TPersistent); override;
|
||||||
|
{ Assigns multi image from array of image data records.}
|
||||||
|
procedure AssignFromArray(const ADataArray: TDynImageDataArray);
|
||||||
|
|
||||||
{ Adds new image at the end of the image array. }
|
{ Adds new image at the end of the image array. Returns index of the added image.}
|
||||||
procedure AddImage(AWidth, AHeight: LongInt; AFormat: TImageFormat = ifDefault); overload;
|
function AddImage(AWidth, AHeight: Integer; AFormat: TImageFormat = ifDefault): Integer; overload;
|
||||||
{ Adds existing image at the end of the image array. }
|
{ Adds existing image at the end of the image array. Returns index of the added image.}
|
||||||
procedure AddImage(const Image: TImageData); overload;
|
function AddImage(const Image: TImageData): Integer; overload;
|
||||||
{ Adds existing image (Active image of a TmultiImage)
|
{ Adds existing image (or active image of a TMultiImage)
|
||||||
at the end of the image array. }
|
at the end of the image array. Returns index of the added image.}
|
||||||
procedure AddImage(Image: TBaseImage); overload;
|
function AddImage(Image: TBaseImage): Integer; overload;
|
||||||
{ Adds existing image array ((all images of a multi image))
|
{ Adds existing image array (all images of a multi image)
|
||||||
at the end of the image array. }
|
at the end of the image array.}
|
||||||
procedure AddImages(const Images: TDynImageDataArray); overload;
|
procedure AddImages(const Images: TDynImageDataArray); overload;
|
||||||
{ Adds existing MultiImage images at the end of the image array. }
|
{ Adds existing MultiImage images at the end of the image array.}
|
||||||
procedure AddImages(Images: TMultiImage); overload;
|
procedure AddImages(Images: TMultiImage); overload;
|
||||||
|
|
||||||
{ Inserts new image image at the given position in the image array. }
|
{ Inserts new image image at the given position in the image array. }
|
||||||
procedure InsertImage(Index, AWidth, AHeight: LongInt; AFormat: TImageFormat = ifDefault); overload;
|
procedure InsertImage(Index, AWidth, AHeight: Integer; AFormat: TImageFormat = ifDefault); overload;
|
||||||
{ Inserts existing image at the given position in the image array. }
|
{ Inserts existing image at the given position in the image array. }
|
||||||
procedure InsertImage(Index: LongInt; const Image: TImageData); overload;
|
procedure InsertImage(Index: Integer; const Image: TImageData); overload;
|
||||||
{ Inserts existing image (Active image of a TmultiImage)
|
{ Inserts existing image (Active image of a TMultiImage)
|
||||||
at the given position in the image array. }
|
at the given position in the image array. }
|
||||||
procedure InsertImage(Index: LongInt; Image: TBaseImage); overload;
|
procedure InsertImage(Index: Integer; Image: TBaseImage); overload;
|
||||||
{ Inserts existing image at the given position in the image array. }
|
{ Inserts existing image at the given position in the image array. }
|
||||||
procedure InsertImages(Index: LongInt; const Images: TDynImageDataArray); overload;
|
procedure InsertImages(Index: Integer; const Images: TDynImageDataArray); overload;
|
||||||
{ Inserts existing images (all images of a TmultiImage) at
|
{ Inserts existing images (all images of a TMultiImage) at
|
||||||
the given position in the image array. }
|
the given position in the image array. }
|
||||||
procedure InsertImages(Index: LongInt; Images: TMultiImage); overload;
|
procedure InsertImages(Index: Integer; Images: TMultiImage); overload;
|
||||||
|
|
||||||
{ Exchanges two images at the given positions in the image array. }
|
{ Exchanges two images at the given positions in the image array. }
|
||||||
procedure ExchangeImages(Index1, Index2: LongInt);
|
procedure ExchangeImages(Index1, Index2: Integer);
|
||||||
{ Deletes image at the given position in the image array.}
|
{ Deletes image at the given position in the image array.}
|
||||||
procedure DeleteImage(Index: LongInt);
|
procedure DeleteImage(Index: Integer);
|
||||||
{ Rearranges images so that the first image will become last and vice versa.}
|
{ Rearranges images so that the first image will become last and vice versa.}
|
||||||
procedure ReverseImages;
|
procedure ReverseImages;
|
||||||
|
{ Deletes all images.}
|
||||||
|
procedure ClearAll;
|
||||||
|
|
||||||
{ Converts all images to another image data format.}
|
{ Converts all images to another image data format.}
|
||||||
procedure ConvertImages(Format: TImageFormat);
|
procedure ConvertImages(Format: TImageFormat);
|
||||||
{ Resizes all images.}
|
{ Resizes all images.}
|
||||||
procedure ResizeImages(NewWidth, NewHeight: LongInt; Filter: TResizeFilter);
|
procedure ResizeImages(NewWidth, NewHeight: Integer; Filter: TResizeFilter);
|
||||||
|
|
||||||
{ Overloaded loading method that will add new image to multiimage if
|
{ Overloaded loading method that will add new image to multi-image if
|
||||||
image array is empty bero loading. }
|
image array is empty before loading. If it's not empty the active image is replaced.}
|
||||||
procedure LoadFromFile(const FileName: string); override;
|
procedure LoadFromFile(const FileName: string); override;
|
||||||
{ Overloaded loading method that will add new image to multiimage if
|
{ Overloaded loading method that will add new image to multi-image if
|
||||||
image array is empty bero loading. }
|
image array is empty before loading. If it's not empty the active image is replaced.}
|
||||||
procedure LoadFromStream(Stream: TStream); override;
|
procedure LoadFromStream(Stream: TStream); override;
|
||||||
|
|
||||||
{ Loads whole multi image from file.}
|
{ Loads whole multi image from file.}
|
||||||
@@ -251,16 +261,16 @@ type
|
|||||||
{ Loads whole multi image from stream.}
|
{ Loads whole multi image from stream.}
|
||||||
procedure LoadMultiFromStream(Stream: TStream);
|
procedure LoadMultiFromStream(Stream: TStream);
|
||||||
{ Saves whole multi image to file.}
|
{ Saves whole multi image to file.}
|
||||||
procedure SaveMultiToFile(const FileName: string);
|
function SaveMultiToFile(const FileName: string): Boolean;
|
||||||
{ Saves whole multi image to stream. Ext identifies desired
|
{ Saves whole multi image to stream. Ext identifies desired
|
||||||
image file format (jpg, png, dds, ...).}
|
image file format (jpg, png, dds, ...).}
|
||||||
procedure SaveMultiToStream(const Ext: string; Stream: TStream);
|
function SaveMultiToStream(const Ext: string; Stream: TStream): Boolean;
|
||||||
|
|
||||||
{ Indicates active image of this multi image. All methods inherited
|
{ Indicates active image of this multi image. All methods inherited
|
||||||
from TBaseImage operate on this image only.}
|
from TBaseImage operate on this image only.}
|
||||||
property ActiveImage: LongInt read FActiveImage write SetActiveImage;
|
property ActiveImage: Integer read FActiveImage write SetActiveImage;
|
||||||
{ Number of images of this multi image.}
|
{ Number of images of this multi image.}
|
||||||
property ImageCount: LongInt read GetImageCount write SetImageCount;
|
property ImageCount: Integer read GetImageCount write SetImageCount;
|
||||||
{ This value is True if all images of this TMultiImage are valid.}
|
{ This value is True if all images of this TMultiImage are valid.}
|
||||||
property AllImagesValid: Boolean read GetAllImagesValid;
|
property AllImagesValid: Boolean read GetAllImagesValid;
|
||||||
{ This gives complete access to underlying TDynImageDataArray.
|
{ This gives complete access to underlying TDynImageDataArray.
|
||||||
@@ -269,15 +279,14 @@ type
|
|||||||
property DataArray: TDynImageDataArray read FDataArray;
|
property DataArray: TDynImageDataArray read FDataArray;
|
||||||
{ Array property for accessing individual images of TMultiImage. When you
|
{ Array property for accessing individual images of TMultiImage. When you
|
||||||
set image at given index the old image is freed and the source is cloned.}
|
set image at given index the old image is freed and the source is cloned.}
|
||||||
property Images[Index: LongInt]: TImageData read GetImage write SetImage; default;
|
property Images[Index: Integer]: TImageData read GetImage write SetImage; default;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
implementation
|
implementation
|
||||||
|
|
||||||
const
|
const
|
||||||
DefaultWidth = 16;
|
DefaultWidth = 16;
|
||||||
DefaultHeight = 16;
|
DefaultHeight = 16;
|
||||||
DefaultImages = 1;
|
|
||||||
|
|
||||||
function GetArrayFromImageData(const ImageData: TImageData): TDynImageDataArray;
|
function GetArrayFromImageData(const ImageData: TImageData): TDynImageDataArray;
|
||||||
begin
|
begin
|
||||||
@@ -303,7 +312,7 @@ begin
|
|||||||
inherited Destroy;
|
inherited Destroy;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
function TBaseImage.GetWidth: LongInt;
|
function TBaseImage.GetWidth: Integer;
|
||||||
begin
|
begin
|
||||||
if Valid then
|
if Valid then
|
||||||
Result := FPData.Width
|
Result := FPData.Width
|
||||||
@@ -311,7 +320,7 @@ begin
|
|||||||
Result := 0;
|
Result := 0;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
function TBaseImage.GetHeight: LongInt;
|
function TBaseImage.GetHeight: Integer;
|
||||||
begin
|
begin
|
||||||
if Valid then
|
if Valid then
|
||||||
Result := FPData.Height
|
Result := FPData.Height
|
||||||
@@ -327,7 +336,7 @@ begin
|
|||||||
Result := ifUnknown;
|
Result := ifUnknown;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
function TBaseImage.GetScanLine(Index: LongInt): Pointer;
|
function TBaseImage.GetScanline(Index: Integer): Pointer;
|
||||||
var
|
var
|
||||||
Info: TImageFormatInfo;
|
Info: TImageFormatInfo;
|
||||||
begin
|
begin
|
||||||
@@ -343,7 +352,15 @@ begin
|
|||||||
Result := nil;
|
Result := nil;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
function TBaseImage.GetPixelPointer(X, Y: LongInt): Pointer;
|
function TBaseImage.GetScanlineSize: Integer;
|
||||||
|
begin
|
||||||
|
if Valid then
|
||||||
|
Result := FormatInfo.GetPixelsSize(Format, Width, 1)
|
||||||
|
else
|
||||||
|
Result := 0;
|
||||||
|
end;
|
||||||
|
|
||||||
|
function TBaseImage.GetPixelPointer(X, Y: Integer): Pointer;
|
||||||
begin
|
begin
|
||||||
if Valid then
|
if Valid then
|
||||||
Result := @PByteArray(FPData.Bits)[(Y * FPData.Width + X) * GetFormatInfo.BytesPerPixel]
|
Result := @PByteArray(FPData.Bits)[(Y * FPData.Width + X) * GetFormatInfo.BytesPerPixel]
|
||||||
@@ -351,7 +368,7 @@ begin
|
|||||||
Result := nil;
|
Result := nil;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
function TBaseImage.GetSize: LongInt;
|
function TBaseImage.GetSize: Integer;
|
||||||
begin
|
begin
|
||||||
if Valid then
|
if Valid then
|
||||||
Result := FPData.Size
|
Result := FPData.Size
|
||||||
@@ -375,7 +392,7 @@ begin
|
|||||||
Result := nil;
|
Result := nil;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
function TBaseImage.GetPaletteEntries: LongInt;
|
function TBaseImage.GetPaletteEntries: Integer;
|
||||||
begin
|
begin
|
||||||
Result := GetFormatInfo.PaletteEntries;
|
Result := GetFormatInfo.PaletteEntries;
|
||||||
end;
|
end;
|
||||||
@@ -398,12 +415,17 @@ begin
|
|||||||
Result := Rect(0, 0, GetWidth, GetHeight);
|
Result := Rect(0, 0, GetWidth, GetHeight);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
procedure TBaseImage.SetWidth(const Value: LongInt);
|
function TBaseImage.GetEmpty: Boolean;
|
||||||
|
begin
|
||||||
|
Result := FPData.Size = 0;
|
||||||
|
end;
|
||||||
|
|
||||||
|
procedure TBaseImage.SetWidth(const Value: Integer);
|
||||||
begin
|
begin
|
||||||
Resize(Value, GetHeight, rfNearest);
|
Resize(Value, GetHeight, rfNearest);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
procedure TBaseImage.SetHeight(const Value: LongInt);
|
procedure TBaseImage.SetHeight(const Value: Integer);
|
||||||
begin
|
begin
|
||||||
Resize(GetWidth, Value, rfNearest);
|
Resize(GetWidth, Value, rfNearest);
|
||||||
end;
|
end;
|
||||||
@@ -427,18 +449,45 @@ begin
|
|||||||
FOnPixelsChanged(Self);
|
FOnPixelsChanged(Self);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
procedure TBaseImage.RecreateImageData(AWidth, AHeight: LongInt; AFormat: TImageFormat);
|
procedure TBaseImage.RecreateImageData(AWidth, AHeight: Integer; AFormat: TImageFormat);
|
||||||
begin
|
begin
|
||||||
if Assigned(FPData) and Imaging.NewImage(AWidth, AHeight, AFormat, FPData^) then
|
if Assigned(FPData) and Imaging.NewImage(AWidth, AHeight, AFormat, FPData^) then
|
||||||
DoDataSizeChanged;
|
DoDataSizeChanged;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
procedure TBaseImage.Resize(NewWidth, NewHeight: LongInt; Filter: TResizeFilter);
|
procedure TBaseImage.MapImageData(const ImageData: TImageData);
|
||||||
|
begin
|
||||||
|
Clear;
|
||||||
|
FPData.Width := ImageData.Width;
|
||||||
|
FPData.Height := ImageData.Height;
|
||||||
|
FPData.Format := ImageData.Format;
|
||||||
|
FPData.Size := ImageData.Size;
|
||||||
|
FPData.Bits := ImageData.Bits;
|
||||||
|
FPData.Palette := ImageData.Palette;
|
||||||
|
end;
|
||||||
|
|
||||||
|
procedure TBaseImage.Clear;
|
||||||
|
begin
|
||||||
|
FreeImage(FPData^);
|
||||||
|
end;
|
||||||
|
|
||||||
|
procedure TBaseImage.Resize(NewWidth, NewHeight: Integer; Filter: TResizeFilter);
|
||||||
begin
|
begin
|
||||||
if Valid and Imaging.ResizeImage(FPData^, NewWidth, NewHeight, Filter) then
|
if Valid and Imaging.ResizeImage(FPData^, NewWidth, NewHeight, Filter) then
|
||||||
DoDataSizeChanged;
|
DoDataSizeChanged;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
procedure TBaseImage.ResizeToFit(FitWidth, FitHeight: Integer;
|
||||||
|
Filter: TResizeFilter; DstImage: TBaseImage);
|
||||||
|
begin
|
||||||
|
if Valid and Assigned(DstImage) then
|
||||||
|
begin
|
||||||
|
Imaging.ResizeImageToFit(FPData^, FitWidth, FitHeight, Filter,
|
||||||
|
DstImage.FPData^);
|
||||||
|
DstImage.DoDataSizeChanged;
|
||||||
|
end;
|
||||||
|
end;
|
||||||
|
|
||||||
procedure TBaseImage.Flip;
|
procedure TBaseImage.Flip;
|
||||||
begin
|
begin
|
||||||
if Valid and Imaging.FlipImage(FPData^) then
|
if Valid and Imaging.FlipImage(FPData^) then
|
||||||
@@ -453,12 +502,15 @@ end;
|
|||||||
|
|
||||||
procedure TBaseImage.Rotate(Angle: Single);
|
procedure TBaseImage.Rotate(Angle: Single);
|
||||||
begin
|
begin
|
||||||
if Valid and Imaging.RotateImage(FPData^, Angle) then
|
if Valid then
|
||||||
|
begin
|
||||||
|
Imaging.RotateImage(FPData^, Angle);
|
||||||
DoPixelsChanged;
|
DoPixelsChanged;
|
||||||
|
end;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
procedure TBaseImage.CopyTo(SrcX, SrcY, Width, Height: LongInt;
|
procedure TBaseImage.CopyTo(SrcX, SrcY, Width, Height: Integer;
|
||||||
DstImage: TBaseImage; DstX, DstY: LongInt);
|
DstImage: TBaseImage; DstX, DstY: Integer);
|
||||||
begin
|
begin
|
||||||
if Valid and Assigned(DstImage) and DstImage.Valid then
|
if Valid and Assigned(DstImage) and DstImage.Valid then
|
||||||
begin
|
begin
|
||||||
@@ -467,8 +519,17 @@ begin
|
|||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
procedure TBaseImage.StretchTo(SrcX, SrcY, SrcWidth, SrcHeight: LongInt;
|
procedure TBaseImage.CopyTo(DstImage: TBaseImage; DstX, DstY: Integer);
|
||||||
DstImage: TBaseImage; DstX, DstY, DstWidth, DstHeight: LongInt; Filter: TResizeFilter);
|
begin
|
||||||
|
if Valid and Assigned(DstImage) and DstImage.Valid then
|
||||||
|
begin
|
||||||
|
Imaging.CopyRect(FPData^, 0, 0, Width, Height, DstImage.FPData^, DstX, DstY);
|
||||||
|
DstImage.DoPixelsChanged;
|
||||||
|
end;
|
||||||
|
end;
|
||||||
|
|
||||||
|
procedure TBaseImage.StretchTo(SrcX, SrcY, SrcWidth, SrcHeight: Integer;
|
||||||
|
DstImage: TBaseImage; DstX, DstY, DstWidth, DstHeight: Integer; Filter: TResizeFilter);
|
||||||
begin
|
begin
|
||||||
if Valid and Assigned(DstImage) and DstImage.Valid then
|
if Valid and Assigned(DstImage) and DstImage.Valid then
|
||||||
begin
|
begin
|
||||||
@@ -514,16 +575,20 @@ begin
|
|||||||
DoDataSizeChanged;
|
DoDataSizeChanged;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
procedure TBaseImage.SaveToFile(const FileName: string);
|
function TBaseImage.SaveToFile(const FileName: string): Boolean;
|
||||||
begin
|
begin
|
||||||
if Valid then
|
if Valid then
|
||||||
Imaging.SaveImageToFile(FileName, FPData^);
|
Result := Imaging.SaveImageToFile(FileName, FPData^)
|
||||||
|
else
|
||||||
|
Result := False;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
procedure TBaseImage.SaveToStream(const Ext: string; Stream: TStream);
|
function TBaseImage.SaveToStream(const Ext: string; Stream: TStream): Boolean;
|
||||||
begin
|
begin
|
||||||
if Valid then
|
if Valid then
|
||||||
Imaging.SaveImageToStream(Ext, Stream, FPData^);
|
Result := Imaging.SaveImageToStream(Ext, Stream, FPData^)
|
||||||
|
else
|
||||||
|
Result := False;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
|
||||||
@@ -532,10 +597,10 @@ end;
|
|||||||
constructor TSingleImage.Create;
|
constructor TSingleImage.Create;
|
||||||
begin
|
begin
|
||||||
inherited Create;
|
inherited Create;
|
||||||
RecreateImageData(DefaultWidth, DefaultHeight, ifDefault);
|
Clear;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
constructor TSingleImage.CreateFromParams(AWidth, AHeight: LongInt; AFormat: TImageFormat);
|
constructor TSingleImage.CreateFromParams(AWidth, AHeight: Integer; AFormat: TImageFormat);
|
||||||
begin
|
begin
|
||||||
inherited Create;
|
inherited Create;
|
||||||
RecreateImageData(AWidth, AHeight, AFormat);
|
RecreateImageData(AWidth, AHeight, AFormat);
|
||||||
@@ -544,13 +609,7 @@ end;
|
|||||||
constructor TSingleImage.CreateFromData(const AData: TImageData);
|
constructor TSingleImage.CreateFromData(const AData: TImageData);
|
||||||
begin
|
begin
|
||||||
inherited Create;
|
inherited Create;
|
||||||
if Imaging.TestImage(AData) then
|
AssignFromImageData(AData);
|
||||||
begin
|
|
||||||
Imaging.CloneImage(AData, FImageData);
|
|
||||||
DoDataSizeChanged;
|
|
||||||
end
|
|
||||||
else
|
|
||||||
Create;
|
|
||||||
end;
|
end;
|
||||||
|
|
||||||
constructor TSingleImage.CreateFromFile(const FileName: string);
|
constructor TSingleImage.CreateFromFile(const FileName: string);
|
||||||
@@ -580,59 +639,57 @@ procedure TSingleImage.Assign(Source: TPersistent);
|
|||||||
begin
|
begin
|
||||||
if Source = nil then
|
if Source = nil then
|
||||||
begin
|
begin
|
||||||
Create;
|
Clear;
|
||||||
end
|
end
|
||||||
else if Source is TSingleImage then
|
else if Source is TSingleImage then
|
||||||
begin
|
begin
|
||||||
CreateFromData(TSingleImage(Source).FImageData);
|
AssignFromImageData(TSingleImage(Source).FImageData);
|
||||||
end
|
end
|
||||||
else if Source is TMultiImage then
|
else if Source is TMultiImage then
|
||||||
begin
|
begin
|
||||||
if TMultiImage(Source).Valid then
|
if TMultiImage(Source).Valid then
|
||||||
CreateFromData(TMultiImage(Source).FPData^)
|
AssignFromImageData(TMultiImage(Source).FPData^)
|
||||||
else
|
else
|
||||||
Assign(nil);
|
Clear;
|
||||||
end
|
end
|
||||||
else
|
else
|
||||||
inherited Assign(Source);
|
inherited Assign(Source);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
procedure TSingleImage.AssignFromImageData(const AImageData: TImageData);
|
||||||
|
begin
|
||||||
|
if Imaging.TestImage(AImageData) then
|
||||||
|
begin
|
||||||
|
Imaging.CloneImage(AImageData, FImageData);
|
||||||
|
DoDataSizeChanged;
|
||||||
|
end
|
||||||
|
else
|
||||||
|
Clear;
|
||||||
|
end;
|
||||||
|
|
||||||
{ TMultiImage class implementation }
|
{ TMultiImage class implementation }
|
||||||
|
|
||||||
constructor TMultiImage.Create;
|
constructor TMultiImage.Create;
|
||||||
begin
|
begin
|
||||||
SetImageCount(DefaultImages);
|
inherited Create;
|
||||||
SetActiveImage(0);
|
|
||||||
end;
|
end;
|
||||||
|
|
||||||
constructor TMultiImage.CreateFromParams(AWidth, AHeight: LongInt;
|
constructor TMultiImage.CreateFromParams(AWidth, AHeight: Integer;
|
||||||
AFormat: TImageFormat; Images: LongInt);
|
AFormat: TImageFormat; ImageCount: Integer);
|
||||||
var
|
var
|
||||||
I: LongInt;
|
I: Integer;
|
||||||
begin
|
begin
|
||||||
Imaging.FreeImagesInArray(FDataArray);
|
Imaging.FreeImagesInArray(FDataArray);
|
||||||
SetLength(FDataArray, Images);
|
SetLength(FDataArray, ImageCount);
|
||||||
for I := 0 to GetImageCount - 1 do
|
for I := 0 to GetImageCount - 1 do
|
||||||
Imaging.NewImage(AWidth, AHeight, AFormat, FDataArray[I]);
|
Imaging.NewImage(AWidth, AHeight, AFormat, FDataArray[I]);
|
||||||
SetActiveImage(0);
|
if GetImageCount > 0 then
|
||||||
|
SetActiveImage(0);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
constructor TMultiImage.CreateFromArray(ADataArray: TDynImageDataArray);
|
constructor TMultiImage.CreateFromArray(const ADataArray: TDynImageDataArray);
|
||||||
var
|
|
||||||
I: LongInt;
|
|
||||||
begin
|
begin
|
||||||
Imaging.FreeImagesInArray(FDataArray);
|
AssignFromArray(ADataArray);
|
||||||
SetLength(FDataArray, Length(ADataArray));
|
|
||||||
for I := 0 to GetImageCount - 1 do
|
|
||||||
begin
|
|
||||||
// Clone only valid images
|
|
||||||
if Imaging.TestImage(ADataArray[I]) then
|
|
||||||
Imaging.CloneImage(ADataArray[I], FDataArray[I])
|
|
||||||
else
|
|
||||||
Imaging.NewImage(DefaultWidth, DefaultHeight, ifDefault, FDataArray[I]);
|
|
||||||
end;
|
|
||||||
SetActiveImage(0);
|
|
||||||
end;
|
end;
|
||||||
|
|
||||||
constructor TMultiImage.CreateFromFile(const FileName: string);
|
constructor TMultiImage.CreateFromFile(const FileName: string);
|
||||||
@@ -651,20 +708,20 @@ begin
|
|||||||
inherited Destroy;
|
inherited Destroy;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
procedure TMultiImage.SetActiveImage(Value: LongInt);
|
procedure TMultiImage.SetActiveImage(Value: Integer);
|
||||||
begin
|
begin
|
||||||
FActiveImage := Value;
|
FActiveImage := Value;
|
||||||
SetPointer;
|
SetPointer;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
function TMultiImage.GetImageCount: LongInt;
|
function TMultiImage.GetImageCount: Integer;
|
||||||
begin
|
begin
|
||||||
Result := Length(FDataArray);
|
Result := Length(FDataArray);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
procedure TMultiImage.SetImageCount(Value: LongInt);
|
procedure TMultiImage.SetImageCount(Value: Integer);
|
||||||
var
|
var
|
||||||
I, OldCount: LongInt;
|
I, OldCount: Integer;
|
||||||
begin
|
begin
|
||||||
if Value > GetImageCount then
|
if Value > GetImageCount then
|
||||||
begin
|
begin
|
||||||
@@ -689,13 +746,13 @@ begin
|
|||||||
Result := (GetImageCount > 0) and TestImagesInArray(FDataArray);
|
Result := (GetImageCount > 0) and TestImagesInArray(FDataArray);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
function TMultiImage.GetImage(Index: LongInt): TImageData;
|
function TMultiImage.GetImage(Index: Integer): TImageData;
|
||||||
begin
|
begin
|
||||||
if (Index >= 0) and (Index < GetImageCount) then
|
if (Index >= 0) and (Index < GetImageCount) then
|
||||||
Result := FDataArray[Index];
|
Result := FDataArray[Index];
|
||||||
end;
|
end;
|
||||||
|
|
||||||
procedure TMultiImage.SetImage(Index: LongInt; Value: TImageData);
|
procedure TMultiImage.SetImage(Index: Integer; Value: TImageData);
|
||||||
begin
|
begin
|
||||||
if (Index >= 0) and (Index < GetImageCount) then
|
if (Index >= 0) and (Index < GetImageCount) then
|
||||||
Imaging.CloneImage(Value, FDataArray[Index]);
|
Imaging.CloneImage(Value, FDataArray[Index]);
|
||||||
@@ -715,24 +772,27 @@ begin
|
|||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
function TMultiImage.PrepareInsert(Index, Count: LongInt): Boolean;
|
function TMultiImage.PrepareInsert(Index, InsertCount: Integer): Boolean;
|
||||||
var
|
var
|
||||||
I: LongInt;
|
I: Integer;
|
||||||
|
OldImageCount, MoveCount: Integer;
|
||||||
begin
|
begin
|
||||||
|
OldImageCount := GetImageCount;
|
||||||
|
|
||||||
// Inserting to empty image will add image at index 0
|
// Inserting to empty image will add image at index 0
|
||||||
if GetImageCount = 0 then
|
if OldImageCount = 0 then
|
||||||
Index := 0;
|
Index := 0;
|
||||||
|
|
||||||
if (Index >= 0) and (Index <= GetImageCount) and (Count > 0) then
|
if (Index >= 0) and (Index <= OldImageCount) and (InsertCount > 0) then
|
||||||
begin
|
begin
|
||||||
SetLength(FDataArray, GetImageCount + Count);
|
SetLength(FDataArray, OldImageCount + InsertCount);
|
||||||
if Index < GetImageCount - 1 then
|
if Index < OldImageCount then
|
||||||
begin
|
begin
|
||||||
// Move imges to new position
|
// Move images to new position
|
||||||
System.Move(FDataArray[Index], FDataArray[Index + Count],
|
MoveCount := OldImageCount - Index;
|
||||||
(GetImageCount - Count - Index) * SizeOf(TImageData));
|
System.Move(FDataArray[Index], FDataArray[Index + InsertCount], MoveCount * SizeOf(TImageData));
|
||||||
// Null old images, not free them!
|
// Null old images, not free them!
|
||||||
for I := Index to Index + Count - 1 do
|
for I := Index to Index + InsertCount - 1 do
|
||||||
InitImage(FDataArray[I]);
|
InitImage(FDataArray[I]);
|
||||||
end;
|
end;
|
||||||
Result := True;
|
Result := True;
|
||||||
@@ -741,9 +801,9 @@ begin
|
|||||||
Result := False;
|
Result := False;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
procedure TMultiImage.DoInsertImages(Index: LongInt; const Images: TDynImageDataArray);
|
procedure TMultiImage.DoInsertImages(Index: Integer; const Images: TDynImageDataArray);
|
||||||
var
|
var
|
||||||
I, Len: LongInt;
|
I, Len: Integer;
|
||||||
begin
|
begin
|
||||||
Len := Length(Images);
|
Len := Length(Images);
|
||||||
if PrepareInsert(Index, Len) then
|
if PrepareInsert(Index, Len) then
|
||||||
@@ -753,7 +813,7 @@ begin
|
|||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
procedure TMultiImage.DoInsertNew(Index, AWidth, AHeight: LongInt;
|
procedure TMultiImage.DoInsertNew(Index, AWidth, AHeight: Integer;
|
||||||
AFormat: TImageFormat);
|
AFormat: TImageFormat);
|
||||||
begin
|
begin
|
||||||
if PrepareInsert(Index, 1) then
|
if PrepareInsert(Index, 1) then
|
||||||
@@ -766,38 +826,62 @@ var
|
|||||||
begin
|
begin
|
||||||
if Source = nil then
|
if Source = nil then
|
||||||
begin
|
begin
|
||||||
Create;
|
ClearAll;
|
||||||
end
|
end
|
||||||
else if Source is TMultiImage then
|
else if Source is TMultiImage then
|
||||||
begin
|
begin
|
||||||
CreateFromArray(TMultiImage(Source).FDataArray);
|
AssignFromArray(TMultiImage(Source).FDataArray);
|
||||||
SetActiveImage(TMultiImage(Source).ActiveImage);
|
SetActiveImage(TMultiImage(Source).ActiveImage);
|
||||||
end
|
end
|
||||||
else if Source is TSingleImage then
|
else if Source is TSingleImage then
|
||||||
begin
|
begin
|
||||||
SetLength(Arr, 1);
|
SetLength(Arr, 1);
|
||||||
Arr[0] := TSingleImage(Source).FImageData;
|
Arr[0] := TSingleImage(Source).FImageData;
|
||||||
CreateFromArray(Arr);
|
AssignFromArray(Arr);
|
||||||
Arr := nil;
|
|
||||||
end
|
end
|
||||||
else
|
else
|
||||||
inherited Assign(Source);
|
inherited Assign(Source);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
procedure TMultiImage.AddImage(AWidth, AHeight: LongInt; AFormat: TImageFormat);
|
procedure TMultiImage.AssignFromArray(const ADataArray: TDynImageDataArray);
|
||||||
|
var
|
||||||
|
I: Integer;
|
||||||
begin
|
begin
|
||||||
DoInsertNew(GetImageCount, AWidth, AHeight, AFormat);
|
Imaging.FreeImagesInArray(FDataArray);
|
||||||
|
SetLength(FDataArray, Length(ADataArray));
|
||||||
|
for I := 0 to GetImageCount - 1 do
|
||||||
|
begin
|
||||||
|
// Clone only valid images
|
||||||
|
if Imaging.TestImage(ADataArray[I]) then
|
||||||
|
Imaging.CloneImage(ADataArray[I], FDataArray[I])
|
||||||
|
else
|
||||||
|
Imaging.NewImage(DefaultWidth, DefaultHeight, ifDefault, FDataArray[I]);
|
||||||
|
end;
|
||||||
|
if GetImageCount > 0 then
|
||||||
|
SetActiveImage(0);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
procedure TMultiImage.AddImage(const Image: TImageData);
|
function TMultiImage.AddImage(AWidth, AHeight: Integer; AFormat: TImageFormat): Integer;
|
||||||
begin
|
begin
|
||||||
DoInsertImages(GetImageCount, GetArrayFromImageData(Image));
|
Result := GetImageCount;
|
||||||
|
DoInsertNew(Result, AWidth, AHeight, AFormat);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
procedure TMultiImage.AddImage(Image: TBaseImage);
|
function TMultiImage.AddImage(const Image: TImageData): Integer;
|
||||||
|
begin
|
||||||
|
Result := GetImageCount;
|
||||||
|
DoInsertImages(Result, GetArrayFromImageData(Image));
|
||||||
|
end;
|
||||||
|
|
||||||
|
function TMultiImage.AddImage(Image: TBaseImage): Integer;
|
||||||
begin
|
begin
|
||||||
if Assigned(Image) and Image.Valid then
|
if Assigned(Image) and Image.Valid then
|
||||||
DoInsertImages(GetImageCount, GetArrayFromImageData(Image.FPData^));
|
begin
|
||||||
|
Result := GetImageCount;
|
||||||
|
DoInsertImages(Result, GetArrayFromImageData(Image.FPData^));
|
||||||
|
end
|
||||||
|
else
|
||||||
|
Result := -1;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
procedure TMultiImage.AddImages(const Images: TDynImageDataArray);
|
procedure TMultiImage.AddImages(const Images: TDynImageDataArray);
|
||||||
@@ -810,35 +894,35 @@ begin
|
|||||||
DoInsertImages(GetImageCount, Images.FDataArray);
|
DoInsertImages(GetImageCount, Images.FDataArray);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
procedure TMultiImage.InsertImage(Index, AWidth, AHeight: LongInt;
|
procedure TMultiImage.InsertImage(Index, AWidth, AHeight: Integer;
|
||||||
AFormat: TImageFormat);
|
AFormat: TImageFormat);
|
||||||
begin
|
begin
|
||||||
DoInsertNew(Index, AWidth, AHeight, AFormat);
|
DoInsertNew(Index, AWidth, AHeight, AFormat);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
procedure TMultiImage.InsertImage(Index: LongInt; const Image: TImageData);
|
procedure TMultiImage.InsertImage(Index: Integer; const Image: TImageData);
|
||||||
begin
|
begin
|
||||||
DoInsertImages(Index, GetArrayFromImageData(Image));
|
DoInsertImages(Index, GetArrayFromImageData(Image));
|
||||||
end;
|
end;
|
||||||
|
|
||||||
procedure TMultiImage.InsertImage(Index: LongInt; Image: TBaseImage);
|
procedure TMultiImage.InsertImage(Index: Integer; Image: TBaseImage);
|
||||||
begin
|
begin
|
||||||
if Assigned(Image) and Image.Valid then
|
if Assigned(Image) and Image.Valid then
|
||||||
DoInsertImages(Index, GetArrayFromImageData(Image.FPData^));
|
DoInsertImages(Index, GetArrayFromImageData(Image.FPData^));
|
||||||
end;
|
end;
|
||||||
|
|
||||||
procedure TMultiImage.InsertImages(Index: LongInt;
|
procedure TMultiImage.InsertImages(Index: Integer;
|
||||||
const Images: TDynImageDataArray);
|
const Images: TDynImageDataArray);
|
||||||
begin
|
begin
|
||||||
DoInsertImages(Index, FDataArray);
|
DoInsertImages(Index, Images);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
procedure TMultiImage.InsertImages(Index: LongInt; Images: TMultiImage);
|
procedure TMultiImage.InsertImages(Index: Integer; Images: TMultiImage);
|
||||||
begin
|
begin
|
||||||
DoInsertImages(Index, Images.FDataArray);
|
DoInsertImages(Index, Images.FDataArray);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
procedure TMultiImage.ExchangeImages(Index1, Index2: LongInt);
|
procedure TMultiImage.ExchangeImages(Index1, Index2: Integer);
|
||||||
var
|
var
|
||||||
TempData: TImageData;
|
TempData: TImageData;
|
||||||
begin
|
begin
|
||||||
@@ -851,9 +935,9 @@ begin
|
|||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
procedure TMultiImage.DeleteImage(Index: LongInt);
|
procedure TMultiImage.DeleteImage(Index: Integer);
|
||||||
var
|
var
|
||||||
I: LongInt;
|
I: Integer;
|
||||||
begin
|
begin
|
||||||
if (Index >= 0) and (Index < GetImageCount) then
|
if (Index >= 0) and (Index < GetImageCount) then
|
||||||
begin
|
begin
|
||||||
@@ -871,20 +955,25 @@ begin
|
|||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
procedure TMultiImage.ClearAll;
|
||||||
|
begin
|
||||||
|
ImageCount := 0;
|
||||||
|
end;
|
||||||
|
|
||||||
procedure TMultiImage.ConvertImages(Format: TImageFormat);
|
procedure TMultiImage.ConvertImages(Format: TImageFormat);
|
||||||
var
|
var
|
||||||
I: LongInt;
|
I: Integer;
|
||||||
begin
|
begin
|
||||||
for I := 0 to GetImageCount - 1 do
|
for I := 0 to GetImageCount - 1 do
|
||||||
Imaging.ConvertImage(FDataArray[I], Format);
|
Imaging.ConvertImage(FDataArray[I], Format);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
procedure TMultiImage.ResizeImages(NewWidth, NewHeight: LongInt;
|
procedure TMultiImage.ResizeImages(NewWidth, NewHeight: Integer;
|
||||||
Filter: TResizeFilter);
|
Filter: TResizeFilter);
|
||||||
var
|
var
|
||||||
I: LongInt;
|
I: Integer;
|
||||||
begin
|
begin
|
||||||
for I := 0 to GetImageCount do
|
for I := 0 to GetImageCount - 1 do
|
||||||
Imaging.ResizeImage(FDataArray[I], NewWidth, NewHeight, Filter);
|
Imaging.ResizeImage(FDataArray[I], NewWidth, NewHeight, Filter);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
@@ -922,24 +1011,33 @@ begin
|
|||||||
SetActiveImage(0);
|
SetActiveImage(0);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
procedure TMultiImage.SaveMultiToFile(const FileName: string);
|
function TMultiImage.SaveMultiToFile(const FileName: string): Boolean;
|
||||||
begin
|
begin
|
||||||
Imaging.SaveMultiImageToFile(FileName, FDataArray);
|
Result := Imaging.SaveMultiImageToFile(FileName, FDataArray);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
procedure TMultiImage.SaveMultiToStream(const Ext: string; Stream: TStream);
|
function TMultiImage.SaveMultiToStream(const Ext: string; Stream: TStream): Boolean;
|
||||||
begin
|
begin
|
||||||
Imaging.SaveMultiImageToStream(Ext, Stream, FDataArray);
|
Result := Imaging.SaveMultiImageToStream(Ext, Stream, FDataArray);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
{
|
{
|
||||||
File Notes:
|
File Notes (obsolete):
|
||||||
|
|
||||||
-- TODOS ----------------------------------------------------
|
-- 0.77.1 ---------------------------------------------------
|
||||||
- nothing now
|
- Added TSingleImage.AssignFromData and TMultiImage.AssignFromArray
|
||||||
- add SetPalette, create some pal wrapper first
|
as a replacement for constructors used as methods (that is
|
||||||
- put all low level stuff here like ReplaceColor etc, change
|
compiler error in Delphi XE3).
|
||||||
CopyTo to Copy, and add overload Copy(SrcRect, DstX, DstY) ...
|
- Added TBaseImage.ResizeToFit method.
|
||||||
|
- Changed TMultiImage to have default state with no images.
|
||||||
|
- TMultiImage.AddImage now returns index of newly added image.
|
||||||
|
- Fixed img index bug in TMultiImage.ResizeImages
|
||||||
|
|
||||||
|
-- 0.26.5 Changes/Bug Fixes ---------------------------------
|
||||||
|
- Added MapImageData method to TBaseImage
|
||||||
|
- Added Empty property to TBaseImage.
|
||||||
|
- Added Clear method to TBaseImage.
|
||||||
|
- Added ScanlineSize property to TBaseImage.
|
||||||
|
|
||||||
-- 0.24.3 Changes/Bug Fixes ---------------------------------
|
-- 0.24.3 Changes/Bug Fixes ---------------------------------
|
||||||
- Added TMultiImage.ReverseImages method.
|
- Added TMultiImage.ReverseImages method.
|
||||||
@@ -978,7 +1076,7 @@ end;
|
|||||||
|
|
||||||
-- 0.17 Changes/Bug Fixes -----------------------------------
|
-- 0.17 Changes/Bug Fixes -----------------------------------
|
||||||
- added props PaletteEntries and ScanLine to TBaseImage
|
- added props PaletteEntries and ScanLine to TBaseImage
|
||||||
- aded new constructor to TBaseImage that take TBaseImage source
|
- added new constructor to TBaseImage that take TBaseImage source
|
||||||
- TMultiImage levels adding and inserting rewritten internally
|
- TMultiImage levels adding and inserting rewritten internally
|
||||||
- added some new functions to TMultiImage: AddLevels, InsertLevels
|
- added some new functions to TMultiImage: AddLevels, InsertLevels
|
||||||
- added some new functions to TBaseImage: Flip, Mirror, Rotate,
|
- added some new functions to TBaseImage: Flip, Mirror, Rotate,
|
||||||
|
|||||||
@@ -1,29 +1,12 @@
|
|||||||
{
|
{
|
||||||
$Id: ImagingColors.pas 173 2009-09-04 17:05:52Z galfar $
|
|
||||||
Vampyre Imaging Library
|
Vampyre Imaging Library
|
||||||
by Marek Mauder
|
by Marek Mauder
|
||||||
http://imaginglib.sourceforge.net
|
https://github.com/galfar/imaginglib
|
||||||
|
https://imaginglib.sourceforge.io
|
||||||
The contents of this file are used with permission, subject to the Mozilla
|
- - - - -
|
||||||
Public License Version 1.1 (the "License"); you may not use this file except
|
This Source Code Form is subject to the terms of the Mozilla Public
|
||||||
in compliance with the License. You may obtain a copy of the License at
|
License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||||
http://www.mozilla.org/MPL/MPL-1.1.html
|
file, You can obtain one at https://mozilla.org/MPL/2.0.
|
||||||
|
|
||||||
Software distributed under the License is distributed on an "AS IS" basis,
|
|
||||||
WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License for
|
|
||||||
the specific language governing rights and limitations under the License.
|
|
||||||
|
|
||||||
Alternatively, the contents of this file may be used under the terms of the
|
|
||||||
GNU Lesser General Public License (the "LGPL License"), in which case the
|
|
||||||
provisions of the LGPL License are applicable instead of those above.
|
|
||||||
If you wish to allow use of your version of this file only under the terms
|
|
||||||
of the LGPL License and not to allow others to use your version of this file
|
|
||||||
under the MPL, indicate your decision by deleting the provisions above and
|
|
||||||
replace them with the notice and other provisions required by the LGPL
|
|
||||||
License. If you do not delete the provisions above, a recipient may use
|
|
||||||
your version of this file under either the MPL or the LGPL License.
|
|
||||||
|
|
||||||
For more information about the LGPL: http://www.gnu.org/copyleft/lesser.html
|
|
||||||
}
|
}
|
||||||
|
|
||||||
{ This unit contains functions for manipulating and converting color values.}
|
{ This unit contains functions for manipulating and converting color values.}
|
||||||
@@ -73,6 +56,8 @@ procedure RGBToYCoCg(R, G, B: Byte; var Y, Co, Cg: Byte);
|
|||||||
{ Converts YCoCg to RGB color.}
|
{ Converts YCoCg to RGB color.}
|
||||||
procedure YCoCgToRGB(Y, Co, Cg: Byte; var R, G, B: Byte);
|
procedure YCoCgToRGB(Y, Co, Cg: Byte; var R, G, B: Byte);
|
||||||
|
|
||||||
|
//procedure RGBToHSL(R, G, B: Byte; var H, S, L: Byte);
|
||||||
|
//procedure HSLToRGB(H, S, L: Byte; var R, G, B: Byte);
|
||||||
|
|
||||||
implementation
|
implementation
|
||||||
|
|
||||||
@@ -231,7 +216,7 @@ end;
|
|||||||
- Fixed RGB>>CMYK conversions.
|
- Fixed RGB>>CMYK conversions.
|
||||||
|
|
||||||
-- 0.23 Changes/Bug Fixes -----------------------------------
|
-- 0.23 Changes/Bug Fixes -----------------------------------
|
||||||
- Added RGB<>CMY(K) converion functions for 16 bit channels
|
- Added RGB<>CMY(K) conversion functions for 16 bit channels
|
||||||
(needed by PSD loading code).
|
(needed by PSD loading code).
|
||||||
|
|
||||||
-- 0.21 Changes/Bug Fixes -----------------------------------
|
-- 0.21 Changes/Bug Fixes -----------------------------------
|
||||||
|
|||||||
+262
-110
@@ -1,29 +1,12 @@
|
|||||||
{
|
{
|
||||||
$Id: ImagingComponents.pas 171 2009-09-02 01:34:19Z galfar $
|
|
||||||
Vampyre Imaging Library
|
Vampyre Imaging Library
|
||||||
by Marek Mauder
|
by Marek Mauder
|
||||||
http://imaginglib.sourceforge.net
|
https://github.com/galfar/imaginglib
|
||||||
|
https://imaginglib.sourceforge.io
|
||||||
The contents of this file are used with permission, subject to the Mozilla
|
- - - - -
|
||||||
Public License Version 1.1 (the "License"); you may not use this file except
|
This Source Code Form is subject to the terms of the Mozilla Public
|
||||||
in compliance with the License. You may obtain a copy of the License at
|
License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||||
http://www.mozilla.org/MPL/MPL-1.1.html
|
file, You can obtain one at https://mozilla.org/MPL/2.0.
|
||||||
|
|
||||||
Software distributed under the License is distributed on an "AS IS" basis,
|
|
||||||
WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License for
|
|
||||||
the specific language governing rights and limitations under the License.
|
|
||||||
|
|
||||||
Alternatively, the contents of this file may be used under the terms of the
|
|
||||||
GNU Lesser General Public License (the "LGPL License"), in which case the
|
|
||||||
provisions of the LGPL License are applicable instead of those above.
|
|
||||||
If you wish to allow use of your version of this file only under the terms
|
|
||||||
of the LGPL License and not to allow others to use your version of this file
|
|
||||||
under the MPL, indicate your decision by deleting the provisions above and
|
|
||||||
replace them with the notice and other provisions required by the LGPL
|
|
||||||
License. If you do not delete the provisions above, a recipient may use
|
|
||||||
your version of this file under either the MPL or the LGPL License.
|
|
||||||
|
|
||||||
For more information about the LGPL: http://www.gnu.org/copyleft/lesser.html
|
|
||||||
}
|
}
|
||||||
|
|
||||||
{ This unit contains VCL/LCL TGraphic descendant which uses Imaging library
|
{ This unit contains VCL/LCL TGraphic descendant which uses Imaging library
|
||||||
@@ -34,27 +17,26 @@ unit ImagingComponents;
|
|||||||
|
|
||||||
interface
|
interface
|
||||||
|
|
||||||
{$IFDEF LCL}
|
{$IF Defined(FPC) and Defined(LCL)}
|
||||||
{$DEFINE COMPONENT_SET_LCL}
|
{$DEFINE COMPONENT_SET_LCL}
|
||||||
{$ENDIF}
|
{$ELSEIF Defined(DELPHI)}
|
||||||
|
{$DEFINE COMPONENT_SET_VCL}
|
||||||
|
{$IFEND}
|
||||||
|
|
||||||
{$IF not Defined(COMPONENT_SET_LCL) and not Defined(COMPONENT_SET_VCL)}
|
{$IF not Defined(COMPONENT_SET_LCL) and not Defined(COMPONENT_SET_VCL)}
|
||||||
// If no component sets should be used just include empty unit.
|
// If no component sets should be used just include empty unit.
|
||||||
//DOC-IGNORE-BEGIN
|
|
||||||
implementation
|
implementation
|
||||||
//DOC-IGNORE-END
|
|
||||||
{$ELSE}
|
{$ELSE}
|
||||||
|
|
||||||
uses
|
uses
|
||||||
SysUtils, Types, Classes,
|
|
||||||
{$IFDEF MSWINDOWS}
|
{$IFDEF MSWINDOWS}
|
||||||
Windows,
|
Windows,
|
||||||
{$ENDIF}
|
{$ENDIF}
|
||||||
|
SysUtils, Types, Classes,
|
||||||
{$IFDEF COMPONENT_SET_VCL}
|
{$IFDEF COMPONENT_SET_VCL}
|
||||||
Graphics,
|
Graphics,
|
||||||
{$ENDIF}
|
{$ENDIF}
|
||||||
{$IFDEF COMPONENT_SET_LCL}
|
{$IFDEF COMPONENT_SET_LCL}
|
||||||
InterfaceBase,
|
|
||||||
GraphType,
|
GraphType,
|
||||||
Graphics,
|
Graphics,
|
||||||
LCLType,
|
LCLType,
|
||||||
@@ -65,18 +47,27 @@ uses
|
|||||||
type
|
type
|
||||||
{ Graphic class which uses Imaging to load images.
|
{ Graphic class which uses Imaging to load images.
|
||||||
It has standard TBitmap class as ancestor and it can
|
It has standard TBitmap class as ancestor and it can
|
||||||
Assign also to/from TImageData structres and TBaseImage
|
Assign also to/from TImageData structures and TBaseImage
|
||||||
classes. For saving is uses inherited TBitmap methods.
|
classes. If you want to perfectly preserve the original pixel format
|
||||||
|
of the source image then these classes may not for you.
|
||||||
|
|
||||||
This class is automatically registered to TPicture for all
|
This class is automatically registered to TPicture for all
|
||||||
file extensions supported by Imaging (useful only for loading).
|
file extensions supported by Imaging (useful only for loading).
|
||||||
If you just want to load images in various formats you can use this
|
If you just want to load images in various formats you can use this
|
||||||
class or simply use TPicture.LoadFromXXX which will create this class
|
class or simply use TPicture.LoadFromXXX which will create this class
|
||||||
automatically. For TGraphic class that saves with Imaging look
|
automatically.
|
||||||
|
|
||||||
|
For saving it always uses PNG fallback.
|
||||||
|
For TGraphic classes that save in different formats look
|
||||||
at TImagingGraphicForSave class.}
|
at TImagingGraphicForSave class.}
|
||||||
TImagingGraphic = class(TBitmap)
|
TImagingGraphic = class(TBitmap)
|
||||||
protected
|
protected
|
||||||
procedure ReadDataFromStream(Stream: TStream); virtual;
|
|
||||||
procedure AssignTo(Dest: TPersistent); override;
|
procedure AssignTo(Dest: TPersistent); override;
|
||||||
|
{ Called by TFiler when reading and writing TPicture.Data property.
|
||||||
|
We need to override ReadData+WriteData otherwise inherited ones from
|
||||||
|
TBitmap would be called resulting in errors.}
|
||||||
|
procedure ReadData(Stream: TStream); override;
|
||||||
|
procedure WriteData(Stream: TStream); override;
|
||||||
public
|
public
|
||||||
constructor Create; override;
|
constructor Create; override;
|
||||||
|
|
||||||
@@ -85,6 +76,8 @@ type
|
|||||||
even though it is called by descendant class capable of
|
even though it is called by descendant class capable of
|
||||||
saving only one file format.}
|
saving only one file format.}
|
||||||
procedure LoadFromStream(Stream: TStream); override;
|
procedure LoadFromStream(Stream: TStream); override;
|
||||||
|
{ Always saves as PNG.}
|
||||||
|
procedure SaveToStream(Stream: TStream); override;
|
||||||
{ Copies the image contained in Source to this graphic object.
|
{ Copies the image contained in Source to this graphic object.
|
||||||
Supports also TBaseImage descendants from ImagingClasses unit. }
|
Supports also TBaseImage descendants from ImagingClasses unit. }
|
||||||
procedure Assign(Source: TPersistent); override;
|
procedure Assign(Source: TPersistent); override;
|
||||||
@@ -96,21 +89,32 @@ type
|
|||||||
procedure AssignFromImageData(const ImageData: TImageData);
|
procedure AssignFromImageData(const ImageData: TImageData);
|
||||||
{ Copies the current image to TImageData structure.}
|
{ Copies the current image to TImageData structure.}
|
||||||
procedure AssignToImageData(var ImageData: TImageData);
|
procedure AssignToImageData(var ImageData: TImageData);
|
||||||
|
|
||||||
|
{$IFDEF COMPONENT_SET_LCL}
|
||||||
|
{ Needed for TGraphic.LoadFromResourceName() to work.
|
||||||
|
We return RT_RCDATA here. Also for TImagingBitmap since
|
||||||
|
RT_BITMAP is stored differently than bitmap on disk (no BITMAPFILEHEADER).}
|
||||||
|
function GetResourceType: TResourceType; override;
|
||||||
|
{ Used by TPicture.LoadFromStream to find the right TGraphic class for streams. }
|
||||||
|
class function IsStreamFormatSupported(Stream: TStream): boolean; override;
|
||||||
|
{$ENDIF}
|
||||||
end;
|
end;
|
||||||
|
|
||||||
TImagingGraphicClass = class of TImagingGraphic;
|
TImagingGraphicClass = class of TImagingGraphic;
|
||||||
|
|
||||||
{ Base class for file format specific TGraphic classes that use
|
{ Base (abstract) class for file format specific TGraphic classes that use
|
||||||
Imaging for saving. Each descendant class can load all file formats
|
Imaging for saving. Each descendant class can load all file formats
|
||||||
supported by Imaging but save only one format (TImagingBitmap
|
supported by Imaging but save only one format (TImagingBitmap
|
||||||
for *.bmp, TImagingJpeg for *.jpg). Format specific classes also
|
for *.bmp, TImagingJpeg for *.jpg). The image is saved in this one file
|
||||||
allow easy access to Imaging options that affect saving of files
|
format regardless of the extension you request).
|
||||||
(they are properties here).}
|
|
||||||
|
Format specific classes also allow easy access to Imaging options that
|
||||||
|
affect saving of files (they are properties here).}
|
||||||
TImagingGraphicForSave = class(TImagingGraphic)
|
TImagingGraphicForSave = class(TImagingGraphic)
|
||||||
protected
|
protected
|
||||||
FDefaultFileExt: string;
|
FDefaultFileExt: string;
|
||||||
FSavingFormat: TImageFormat;
|
FSavingFormat: TImageFormat;
|
||||||
procedure WriteDataToStream(Stream: TStream); virtual;
|
procedure WriteData(Stream: TStream); override;
|
||||||
public
|
public
|
||||||
constructor Create; override;
|
constructor Create; override;
|
||||||
{ Saves the current image to the stream. It is saved in the
|
{ Saves the current image to the stream. It is saved in the
|
||||||
@@ -133,7 +137,7 @@ type
|
|||||||
|
|
||||||
{$IFNDEF DONT_LINK_BITMAP}
|
{$IFNDEF DONT_LINK_BITMAP}
|
||||||
{ TImagingGraphic descendant for loading/saving Windows bitmaps.
|
{ TImagingGraphic descendant for loading/saving Windows bitmaps.
|
||||||
VCL/CLX/LCL all have native support for bitmaps so you might
|
VCL/LCL both have native support for bitmaps so you might
|
||||||
want to disable this class (although you can save bitmaps with
|
want to disable this class (although you can save bitmaps with
|
||||||
RLE compression with this class).}
|
RLE compression with this class).}
|
||||||
TImagingBitmap = class(TImagingGraphicForSave)
|
TImagingBitmap = class(TImagingGraphicForSave)
|
||||||
@@ -208,20 +212,20 @@ type
|
|||||||
{$ENDIF}
|
{$ENDIF}
|
||||||
|
|
||||||
{$IFNDEF DONT_LINK_DDS}
|
{$IFNDEF DONT_LINK_DDS}
|
||||||
{ Compresssion type used when saving DDS files by TImagingDds.}
|
{ Compression type used when saving DDS files by TImagingDds.}
|
||||||
TDDSCompresion = (dcNone, dcDXT1, dcDXT3, dcDXT5);
|
TDDSCompression = (dcNone, dcDXT1, dcDXT3, dcDXT5);
|
||||||
|
|
||||||
{ TImagingGraphic descendant for loading/saving DDS images.}
|
{ TImagingGraphic descendant for loading/saving DDS images.}
|
||||||
TImagingDDS = class(TImagingGraphicForSave)
|
TImagingDDS = class(TImagingGraphicForSave)
|
||||||
protected
|
protected
|
||||||
FCompression: TDDSCompresion;
|
FCompression: TDDSCompression;
|
||||||
public
|
public
|
||||||
constructor Create; override;
|
constructor Create; override;
|
||||||
procedure SaveToStream(Stream: TStream); override;
|
procedure SaveToStream(Stream: TStream); override;
|
||||||
class function GetFileFormat: TImageFileFormat; override;
|
class function GetFileFormat: TImageFileFormat; override;
|
||||||
{ You can choose compression type used when saving DDS file.
|
{ You can choose compression type used when saving DDS file.
|
||||||
dcNone means that file will be saved in the current bitmaps pixel format.}
|
dcNone means that file will be saved in the current bitmaps pixel format.}
|
||||||
property Compression: TDDSCompresion read FCompression write FCompression;
|
property Compression: TDDSCompression read FCompression write FCompression;
|
||||||
end;
|
end;
|
||||||
{$ENDIF}
|
{$ENDIF}
|
||||||
|
|
||||||
@@ -299,13 +303,19 @@ procedure ConvertImageToBitmap(Image: TBaseImage; Bitmap: TBitmap);
|
|||||||
When Image is TMultiImage only the current image level is overwritten.}
|
When Image is TMultiImage only the current image level is overwritten.}
|
||||||
procedure ConvertBitmapToImage(Bitmap: TBitmap; Image: TBaseImage);
|
procedure ConvertBitmapToImage(Bitmap: TBitmap; Image: TBaseImage);
|
||||||
|
|
||||||
|
{ Displays image onto TCanvas to rectangle DstRect. This procedure
|
||||||
|
draws image without converting from Imaging format to TBitmap.
|
||||||
|
Only [ifA8R8G8B8, ifX8R8G8B8] image formats are supported. Use this
|
||||||
|
when you want displaying images that change frequently (because converting to
|
||||||
|
TBitmap by ConvertImageDataToBitmap is generally slow).}
|
||||||
|
procedure DisplayImageData(DstCanvas: TCanvas; const DstRect: TRect; const ImageData: TImageData); overload;
|
||||||
{ Displays image stored in TImageData structure onto TCanvas. This procedure
|
{ Displays image stored in TImageData structure onto TCanvas. This procedure
|
||||||
draws image without converting from Imaging format to TBitmap.
|
draws image without converting from Imaging format to TBitmap.
|
||||||
Only [ifA8R8G8B8, ifX8R8G8B8] image formats are supported. Use this
|
Only [ifA8R8G8B8, ifX8R8G8B8] image formats are supported. Use this
|
||||||
when you want displaying images that change frequently (because converting to
|
when you want displaying images that change frequently (because converting to
|
||||||
TBitmap by ConvertImageDataToBitmap is generally slow). Dest and Src
|
TBitmap by ConvertImageDataToBitmap is generally slow). Dest and Src
|
||||||
rectangles represent coordinates in the form (X1, Y1, X2, Y2).}
|
rectangles represent coordinates in the form (X1, Y1, X2, Y2).}
|
||||||
procedure DisplayImageData(DstCanvas: TCanvas; const DstRect: TRect; const ImageData: TImageData; const SrcRect: TRect);
|
procedure DisplayImageData(DstCanvas: TCanvas; const DstRect: TRect; const ImageData: TImageData; const SrcRect: TRect); overload;
|
||||||
{ Displays image onto TCanvas at position [DstX, DstY]. This procedure
|
{ Displays image onto TCanvas at position [DstX, DstY]. This procedure
|
||||||
draws image without converting from Imaging format to TBitmap.
|
draws image without converting from Imaging format to TBitmap.
|
||||||
Only [ifA8R8G8B8, ifX8R8G8B8] image formats are supported. Use this
|
Only [ifA8R8G8B8, ifX8R8G8B8] image formats are supported. Use this
|
||||||
@@ -331,14 +341,21 @@ procedure DisplayImage(DstCanvas: TCanvas; const DstRect: TRect; Image: TBaseIma
|
|||||||
procedure DisplayImageDataOnDC(DC: HDC; const DstRect: TRect; const ImageData: TImageData; const SrcRect: TRect);
|
procedure DisplayImageDataOnDC(DC: HDC; const DstRect: TRect; const ImageData: TImageData; const SrcRect: TRect);
|
||||||
{$ENDIF}
|
{$ENDIF}
|
||||||
|
|
||||||
|
procedure RegisterTypes;
|
||||||
|
|
||||||
implementation
|
implementation
|
||||||
|
|
||||||
uses
|
uses
|
||||||
{$IF Defined(LCL)}
|
{$IF Defined(LCL)}
|
||||||
|
InterfaceBase,
|
||||||
{$IF Defined(LCLGTK2)}
|
{$IF Defined(LCLGTK2)}
|
||||||
GLib2, GDK2, GTK2, GTKDef, GTKProc,
|
GLib2, GDK2, GTK2, GTK2Def, GTK2Proc,
|
||||||
{$ELSEIF Defined(LCLGTK)}
|
{$ELSEIF Defined(LCLqt5)}
|
||||||
GDK, GTK, GTKDef, GTKProc,
|
Qt5, qtobjects,
|
||||||
|
{$ELSEIF Defined(LCLqt6)}
|
||||||
|
Qt6, qtobjects,
|
||||||
|
{$ELSEIF Defined(LCLcocoa)}
|
||||||
|
CocoaGDIObjects, CocoaUtils,
|
||||||
{$IFEND}
|
{$IFEND}
|
||||||
{$IFEND}
|
{$IFEND}
|
||||||
{$IFNDEF DONT_LINK_BITMAP}
|
{$IFNDEF DONT_LINK_BITMAP}
|
||||||
@@ -359,7 +376,7 @@ uses
|
|||||||
{$IF not Defined(DONT_LINK_PNG) or not Defined(DONT_LINK_MNG) or not Defined(DONT_LINK_JNG)}
|
{$IF not Defined(DONT_LINK_PNG) or not Defined(DONT_LINK_MNG) or not Defined(DONT_LINK_JNG)}
|
||||||
ImagingNetworkGraphics,
|
ImagingNetworkGraphics,
|
||||||
{$IFEND}
|
{$IFEND}
|
||||||
ImagingUtility;
|
ImagingFormats, ImagingUtility;
|
||||||
|
|
||||||
resourcestring
|
resourcestring
|
||||||
SBadFormatDataToBitmap = 'Cannot find compatible bitmap format for image %s';
|
SBadFormatDataToBitmap = 'Cannot find compatible bitmap format for image %s';
|
||||||
@@ -368,7 +385,13 @@ resourcestring
|
|||||||
SUnsupportedLCLWidgetSet = 'This function is not implemented for current LCL widget set';
|
SUnsupportedLCLWidgetSet = 'This function is not implemented for current LCL widget set';
|
||||||
SImagingGraphicName = 'Imaging Graphic AllInOne';
|
SImagingGraphicName = 'Imaging Graphic AllInOne';
|
||||||
|
|
||||||
{ Registers types to VCL/LCL.}
|
var
|
||||||
|
RegisteredFormats: TList;
|
||||||
|
RegisteredGraphicsClasses: Boolean = False;
|
||||||
|
|
||||||
|
{ Registers types to VCL/LCL.
|
||||||
|
In some cases (base+ext package installed in Lazarus) RegisterTypes can be
|
||||||
|
called twice so must keep track of which formats were already registered. }
|
||||||
procedure RegisterTypes;
|
procedure RegisterTypes;
|
||||||
var
|
var
|
||||||
I: LongInt;
|
I: LongInt;
|
||||||
@@ -377,9 +400,15 @@ var
|
|||||||
var
|
var
|
||||||
I: LongInt;
|
I: LongInt;
|
||||||
begin
|
begin
|
||||||
|
if RegisteredFormats.IndexOf(Format) >= 0 then
|
||||||
|
Exit;
|
||||||
|
|
||||||
for I := 0 to Format.Extensions.Count - 1 do
|
for I := 0 to Format.Extensions.Count - 1 do
|
||||||
|
begin
|
||||||
TPicture.RegisterFileFormat(Format.Extensions[I], SImagingGraphicName,
|
TPicture.RegisterFileFormat(Format.Extensions[I], SImagingGraphicName,
|
||||||
TImagingGraphic);
|
TImagingGraphic);
|
||||||
|
end;
|
||||||
|
RegisteredFormats.Add(Format);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
procedure RegisterFileFormat(AClass: TImagingGraphicForSaveClass);
|
procedure RegisterFileFormat(AClass: TImagingGraphicForSaveClass);
|
||||||
@@ -396,6 +425,9 @@ begin
|
|||||||
RegisterFileFormatAllInOne(Imaging.GetFileFormatAtIndex(I));
|
RegisterFileFormatAllInOne(Imaging.GetFileFormatAtIndex(I));
|
||||||
Classes.RegisterClass(TImagingGraphic);
|
Classes.RegisterClass(TImagingGraphic);
|
||||||
|
|
||||||
|
if RegisteredGraphicsClasses then
|
||||||
|
Exit;
|
||||||
|
|
||||||
{$IFNDEF DONT_LINK_TARGA}
|
{$IFNDEF DONT_LINK_TARGA}
|
||||||
RegisterFileFormat(TImagingTarga);
|
RegisterFileFormat(TImagingTarga);
|
||||||
Classes.RegisterClass(TImagingTarga);
|
Classes.RegisterClass(TImagingTarga);
|
||||||
@@ -418,7 +450,7 @@ begin
|
|||||||
{$ENDIF}
|
{$ENDIF}
|
||||||
{$IFNDEF DONT_LINK_PNG}
|
{$IFNDEF DONT_LINK_PNG}
|
||||||
{$IFDEF COMPONENT_SET_LCL}
|
{$IFDEF COMPONENT_SET_LCL}
|
||||||
// Unregister Lazarus´ default PNG loader which crashes on some PNG files
|
// Unregister Lazarus default PNG loader which crashes on some PNG files
|
||||||
TPicture.UnregisterGraphicClass(TPortableNetworkGraphic);
|
TPicture.UnregisterGraphicClass(TPortableNetworkGraphic);
|
||||||
{$ENDIF}
|
{$ENDIF}
|
||||||
RegisterFileFormat(TImagingPNG);
|
RegisterFileFormat(TImagingPNG);
|
||||||
@@ -432,6 +464,8 @@ begin
|
|||||||
RegisterFileFormat(TImagingBitmap);
|
RegisterFileFormat(TImagingBitmap);
|
||||||
Classes.RegisterClass(TImagingBitmap);
|
Classes.RegisterClass(TImagingBitmap);
|
||||||
{$ENDIF}
|
{$ENDIF}
|
||||||
|
|
||||||
|
RegisteredGraphicsClasses := True;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
{ Unregisters types from VCL/LCL.}
|
{ Unregisters types from VCL/LCL.}
|
||||||
@@ -495,11 +529,11 @@ end;
|
|||||||
|
|
||||||
procedure ConvertDataToBitmap(const Data: TImageData; Bitmap: TBitmap);
|
procedure ConvertDataToBitmap(const Data: TImageData; Bitmap: TBitmap);
|
||||||
var
|
var
|
||||||
I, LineBytes: LongInt;
|
|
||||||
PF: TPixelFormat;
|
PF: TPixelFormat;
|
||||||
Info: TImageFormatInfo;
|
Info: TImageFormatInfo;
|
||||||
WorkData: TImageData;
|
WorkData: TImageData;
|
||||||
{$IFDEF COMPONENT_SET_VCL}
|
{$IFDEF COMPONENT_SET_VCL}
|
||||||
|
I, LineBytes: LongInt;
|
||||||
LogPalette: TMaxLogPalette;
|
LogPalette: TMaxLogPalette;
|
||||||
{$ENDIF}
|
{$ENDIF}
|
||||||
{$IFDEF COMPONENT_SET_LCL}
|
{$IFDEF COMPONENT_SET_LCL}
|
||||||
@@ -509,6 +543,14 @@ var
|
|||||||
begin
|
begin
|
||||||
PF := DataFormatToPixelFormat(Data.Format);
|
PF := DataFormatToPixelFormat(Data.Format);
|
||||||
GetImageFormatInfo(Data.Format, Info);
|
GetImageFormatInfo(Data.Format, Info);
|
||||||
|
|
||||||
|
if (PF = pf8bit) and PaletteHasAlpha(Data.Palette, Info.PaletteEntries) then
|
||||||
|
begin
|
||||||
|
// Some indexed images may have valid alpha data, don't lose it!
|
||||||
|
// (e.g. transparent 8bit PNG or GIF images)
|
||||||
|
PF := pfCustom;
|
||||||
|
end;
|
||||||
|
|
||||||
if PF = pfCustom then
|
if PF = pfCustom then
|
||||||
begin
|
begin
|
||||||
// Convert from formats not supported by Graphics unit
|
// Convert from formats not supported by Graphics unit
|
||||||
@@ -517,6 +559,7 @@ begin
|
|||||||
if Info.IsFloatingPoint or Info.HasAlphaChannel or Info.IsSpecial then
|
if Info.IsFloatingPoint or Info.HasAlphaChannel or Info.IsSpecial then
|
||||||
Imaging.ConvertImage(WorkData, ifA8R8G8B8)
|
Imaging.ConvertImage(WorkData, ifA8R8G8B8)
|
||||||
else
|
else
|
||||||
|
begin
|
||||||
{$IFDEF COMPONENT_SET_VCL}
|
{$IFDEF COMPONENT_SET_VCL}
|
||||||
if Info.IsIndexed or Info.HasGrayChannel then
|
if Info.IsIndexed or Info.HasGrayChannel then
|
||||||
Imaging.ConvertImage(WorkData, ifIndex8)
|
Imaging.ConvertImage(WorkData, ifIndex8)
|
||||||
@@ -527,6 +570,7 @@ begin
|
|||||||
{$ELSE}
|
{$ELSE}
|
||||||
Imaging.ConvertImage(WorkData, ifA8R8G8B8);
|
Imaging.ConvertImage(WorkData, ifA8R8G8B8);
|
||||||
{$ENDIF}
|
{$ENDIF}
|
||||||
|
end;
|
||||||
|
|
||||||
PF := DataFormatToPixelFormat(WorkData.Format);
|
PF := DataFormatToPixelFormat(WorkData.Format);
|
||||||
GetImageFormatInfo(WorkData.Format, Info);
|
GetImageFormatInfo(WorkData.Format, Info);
|
||||||
@@ -537,8 +581,6 @@ begin
|
|||||||
if PF = pfCustom then
|
if PF = pfCustom then
|
||||||
RaiseImaging(SBadFormatDataToBitmap, [ImageToStr(WorkData)]);
|
RaiseImaging(SBadFormatDataToBitmap, [ImageToStr(WorkData)]);
|
||||||
|
|
||||||
LineBytes := WorkData.Width * Info.BytesPerPixel;
|
|
||||||
|
|
||||||
{$IFDEF COMPONENT_SET_VCL}
|
{$IFDEF COMPONENT_SET_VCL}
|
||||||
Bitmap.Width := WorkData.Width;
|
Bitmap.Width := WorkData.Width;
|
||||||
Bitmap.Height := WorkData.Height;
|
Bitmap.Height := WorkData.Height;
|
||||||
@@ -559,17 +601,19 @@ begin
|
|||||||
end;
|
end;
|
||||||
Bitmap.Palette := CreatePalette(PLogPalette(@LogPalette)^);
|
Bitmap.Palette := CreatePalette(PLogPalette(@LogPalette)^);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
// Copy scanlines
|
// Copy scanlines
|
||||||
|
LineBytes := WorkData.Width * Info.BytesPerPixel;
|
||||||
for I := 0 to WorkData.Height - 1 do
|
for I := 0 to WorkData.Height - 1 do
|
||||||
Move(PByteArray(WorkData.Bits)[I * LineBytes], Bitmap.Scanline[I]^, LineBytes);
|
Move(PByteArray(WorkData.Bits)[I * LineBytes], Bitmap.Scanline[I]^, LineBytes);
|
||||||
|
|
||||||
// Delphi 2009 and newer support alpha transparency fro TBitmap
|
// Delphi 2009 and newer support alpha transparency for TBitmap
|
||||||
{$IF Defined(DELPHI) and (CompilerVersion >= 20.0)}
|
{$IF Defined(DELPHI) and (CompilerVersion >= 20.0)}
|
||||||
if Bitmap.PixelFormat = pf32bit then
|
if Bitmap.PixelFormat = pf32bit then
|
||||||
Bitmap.AlphaFormat := afDefined;
|
Bitmap.AlphaFormat := afDefined;
|
||||||
{$IFEND}
|
{$IFEND}
|
||||||
|
|
||||||
{$ENDIF}
|
{$ENDIF}
|
||||||
|
|
||||||
{$IFDEF COMPONENT_SET_LCL}
|
{$IFDEF COMPONENT_SET_LCL}
|
||||||
// Create 32bit raw image from image data
|
// Create 32bit raw image from image data
|
||||||
FillChar(RawImage, SizeOf(RawImage), 0);
|
FillChar(RawImage, SizeOf(RawImage), 0);
|
||||||
@@ -621,13 +665,14 @@ var
|
|||||||
LineLazBytes: LongInt;
|
LineLazBytes: LongInt;
|
||||||
{$ENDIF}
|
{$ENDIF}
|
||||||
begin
|
begin
|
||||||
|
Format := ifUnknown;
|
||||||
{$IFDEF COMPONENT_SET_LCL}
|
{$IFDEF COMPONENT_SET_LCL}
|
||||||
// In the current Lazarus 0.9.10 Bitmap.PixelFormat property is useless.
|
// In the current Lazarus 0.9.10 Bitmap.PixelFormat property is useless.
|
||||||
// We cannot change bitmap's format by changing it (it will just release
|
// We cannot change bitmap's format by changing it (it will just release
|
||||||
// old image but not convert it to new format) nor we can determine bitmaps's
|
// old image but not convert it to new format) nor we can determine bitmaps's
|
||||||
// current format (it is usually set to pfDevice). So bitmap's format is obtained
|
// current format (it is usually set to pfDevice). So bitmap's format is obtained
|
||||||
// trough RawImage api and cannot be changed to mirror some Imaging format
|
// trough RawImage api and cannot be changed to mirror some Imaging format
|
||||||
// (so formats with no coresponding Imaging format cannot be saved now).
|
// (so formats with no corresponding Imaging format cannot be saved now).
|
||||||
|
|
||||||
if RawImage_DescriptionFromBitmap(Bitmap.Handle, RawImage.Description) then
|
if RawImage_DescriptionFromBitmap(Bitmap.Handle, RawImage.Description) then
|
||||||
case RawImage.Description.BitsPerPixel of
|
case RawImage.Description.BitsPerPixel of
|
||||||
@@ -641,8 +686,6 @@ begin
|
|||||||
32: Format := ifA8R8G8B8;
|
32: Format := ifA8R8G8B8;
|
||||||
48: Format := ifR16G16B16;
|
48: Format := ifR16G16B16;
|
||||||
64: Format := ifA16R16G16B16;
|
64: Format := ifA16R16G16B16;
|
||||||
else
|
|
||||||
Format := ifUnknown;
|
|
||||||
end;
|
end;
|
||||||
{$ELSE}
|
{$ELSE}
|
||||||
Format := PixelFormatToDataFormat(Bitmap.PixelFormat);
|
Format := PixelFormatToDataFormat(Bitmap.PixelFormat);
|
||||||
@@ -693,9 +736,14 @@ begin
|
|||||||
RawImage.Description.LineEnd);
|
RawImage.Description.LineEnd);
|
||||||
// Copy scanlines
|
// Copy scanlines
|
||||||
for I := 0 to Data.Height - 1 do
|
for I := 0 to Data.Height - 1 do
|
||||||
|
begin
|
||||||
Move(PByteArray(RawImage.Data)[I * LineLazBytes],
|
Move(PByteArray(RawImage.Data)[I * LineLazBytes],
|
||||||
PByteArray(Data.Bits)[I * LineBytes], LineBytes);
|
PByteArray(Data.Bits)[I * LineBytes], LineBytes);
|
||||||
{ If you get complitation error here upgrade to Lazarus 0.9.24+ }
|
end;
|
||||||
|
// May need to swap RB order, depends on widget set
|
||||||
|
if RawImage.Description.BlueShift > RawImage.Description.RedShift then
|
||||||
|
SwapChannels(Data, ChannelRed, ChannelBlue);
|
||||||
|
|
||||||
RawImage.FreeData;
|
RawImage.FreeData;
|
||||||
end;
|
end;
|
||||||
{$ENDIF}
|
{$ENDIF}
|
||||||
@@ -745,7 +793,7 @@ begin
|
|||||||
DstRect.Right - DstRect.Left, DstRect.Bottom - DstRect.Top, Left,
|
DstRect.Right - DstRect.Left, DstRect.Bottom - DstRect.Top, Left,
|
||||||
Top, Right - Left, Bottom - Top, Bits, BitmapInfo, DIB_RGB_COLORS, SRCCOPY) <> Height then
|
Top, Right - Left, Bottom - Top, Bits, BitmapInfo, DIB_RGB_COLORS, SRCCOPY) <> Height then
|
||||||
begin
|
begin
|
||||||
// StretchDIBits may fail on some ocassions (error 487, http://support.microsoft.com/kb/269585).
|
// StretchDIBits may fail on some occasions (error 487, http://support.microsoft.com/kb/269585).
|
||||||
// This fallback is slow but works every time. Thanks to Sergey Galezdinov for the fix.
|
// This fallback is slow but works every time. Thanks to Sergey Galezdinov for the fix.
|
||||||
Bmp := TBitmap.Create;
|
Bmp := TBitmap.Create;
|
||||||
try
|
try
|
||||||
@@ -763,13 +811,17 @@ begin
|
|||||||
end;
|
end;
|
||||||
{$ENDIF}
|
{$ENDIF}
|
||||||
|
|
||||||
|
procedure DisplayImageData(DstCanvas: TCanvas; const DstRect: TRect; const ImageData: TImageData);
|
||||||
|
begin
|
||||||
|
DisplayImageData(DstCanvas, DstRect, ImageData, Rect(0, 0, ImageData.Width, ImageData.Height));
|
||||||
|
end;
|
||||||
|
|
||||||
procedure DisplayImageData(DstCanvas: TCanvas; const DstRect: TRect; const ImageData: TImageData; const SrcRect: TRect);
|
procedure DisplayImageData(DstCanvas: TCanvas; const DstRect: TRect; const ImageData: TImageData; const SrcRect: TRect);
|
||||||
{$IF Defined(DCC) or Defined(LCLWIN32)} // Delphi or LCL Win32
|
{$IF Defined(DCC) or Defined(LCLWIN32)} // Delphi or LCL Win32
|
||||||
begin
|
begin
|
||||||
DisplayImageDataOnDC(DstCanvas.Handle, DstRect, ImageData, SrcRect);
|
DisplayImageDataOnDC(DstCanvas.Handle, DstRect, ImageData, SrcRect);
|
||||||
end;
|
end;
|
||||||
{$ELSEIF Defined(LCLGTK) or Defined(LCLGTK2)}
|
{$ELSEIF Defined(LCLGTK2)}
|
||||||
|
|
||||||
procedure GDKDrawBitmap(Dest: HDC; DstX, DstY: Integer; SrcX, SrcY,
|
procedure GDKDrawBitmap(Dest: HDC; DstX, DstY: Integer; SrcX, SrcY,
|
||||||
SrcWidth, SrcHeight: Integer; ImageData: TImageData);
|
SrcWidth, SrcHeight: Integer; ImageData: TImageData);
|
||||||
var
|
var
|
||||||
@@ -778,9 +830,19 @@ end;
|
|||||||
P := TGtkDeviceContext(Dest).Offset;
|
P := TGtkDeviceContext(Dest).Offset;
|
||||||
Inc(DstX, P.X);
|
Inc(DstX, P.X);
|
||||||
Inc(DstY, P.Y);
|
Inc(DstY, P.Y);
|
||||||
gdk_draw_rgb_32_image(TGtkDeviceContext(Dest).Drawable, TGtkDeviceContext(Dest).GC,
|
|
||||||
DstX, DstY, SrcWidth, SrcHeight, GDK_RGB_DITHER_NONE,
|
if ImageData.Format = ifR8G8B8 then
|
||||||
@PLongWordArray(ImageData.Bits)[SrcY * ImageData.Width + SrcX], ImageData.Width * 4);
|
begin
|
||||||
|
gdk_draw_rgb_image(TGtkDeviceContext(Dest).Drawable, TGtkDeviceContext(Dest).GC,
|
||||||
|
DstX, DstY, SrcWidth, SrcHeight, GDK_RGB_DITHER_NONE,
|
||||||
|
@PUInt32Array(ImageData.Bits)[SrcY * ImageData.Width + SrcX], ImageData.Width * 3);
|
||||||
|
end
|
||||||
|
else
|
||||||
|
begin
|
||||||
|
gdk_draw_rgb_32_image(TGtkDeviceContext(Dest).Drawable, TGtkDeviceContext(Dest).GC,
|
||||||
|
DstX, DstY, SrcWidth, SrcHeight, GDK_RGB_DITHER_NONE,
|
||||||
|
@PUInt32Array(ImageData.Bits)[SrcY * ImageData.Width + SrcX], ImageData.Width * 4);
|
||||||
|
end;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
var
|
var
|
||||||
@@ -790,9 +852,10 @@ var
|
|||||||
begin
|
begin
|
||||||
if TestImage(ImageData) then
|
if TestImage(ImageData) then
|
||||||
begin
|
begin
|
||||||
Assert(ImageData.Format in [ifA8R8G8B8, ifX8R8G8B8], SBadFormatDisplay);
|
if not (ImageData.Format in [ifR8G8B8, ifA8R8G8B8, ifX8R8G8B8]) then
|
||||||
InitImage(DisplayImage);
|
raise EImagingError.Create(SBadFormatDisplay);
|
||||||
|
|
||||||
|
InitImage(DisplayImage);
|
||||||
SrcBounds := RectToBounds(SrcRect);
|
SrcBounds := RectToBounds(SrcRect);
|
||||||
DstBounds := RectToBounds(DstRect);
|
DstBounds := RectToBounds(DstRect);
|
||||||
WidgetSet.GetClipBox(DstCanvas.Handle, @DstClip);
|
WidgetSet.GetClipBox(DstCanvas.Handle, @DstClip);
|
||||||
@@ -809,7 +872,7 @@ begin
|
|||||||
if (SrcBounds.Right = NewWidth) and (SrcBounds.Bottom = NewHeight) then
|
if (SrcBounds.Right = NewWidth) and (SrcBounds.Bottom = NewHeight) then
|
||||||
try
|
try
|
||||||
CloneImage(ImageData, DisplayImage);
|
CloneImage(ImageData, DisplayImage);
|
||||||
// Swap R-B channels for GTK display compatability!
|
// Swap R-B channels for GTK display compatibility!
|
||||||
SwapChannels(DisplayImage, ChannelRed, ChannelBlue);
|
SwapChannels(DisplayImage, ChannelRed, ChannelBlue);
|
||||||
GDKDrawBitmap(DstCanvas.Handle, DstBounds.Left, DstBounds.Top,
|
GDKDrawBitmap(DstCanvas.Handle, DstBounds.Left, DstBounds.Top,
|
||||||
SrcBounds.Left, SrcBounds.Top, NewWidth, NewHeight, DisplayImage);
|
SrcBounds.Left, SrcBounds.Top, NewWidth, NewHeight, DisplayImage);
|
||||||
@@ -823,7 +886,7 @@ begin
|
|||||||
// Stretch pixels from old image to new one TResizeFilter = (rfNearest, rfBilinear, rfBicubic);
|
// Stretch pixels from old image to new one TResizeFilter = (rfNearest, rfBilinear, rfBicubic);
|
||||||
StretchRect(ImageData, SrcBounds.Left, SrcBounds.Top, SrcBounds.Right,
|
StretchRect(ImageData, SrcBounds.Left, SrcBounds.Top, SrcBounds.Right,
|
||||||
SrcBounds.Bottom, DisplayImage, 0, 0, NewWidth, NewHeight, rfNearest);
|
SrcBounds.Bottom, DisplayImage, 0, 0, NewWidth, NewHeight, rfNearest);
|
||||||
// Swap R-B channels for GTK display compatability!
|
// Swap R-B channels for GTK display compatibility!
|
||||||
SwapChannels(DisplayImage, ChannelRed, ChannelBlue);
|
SwapChannels(DisplayImage, ChannelRed, ChannelBlue);
|
||||||
GDKDrawBitmap(DstCanvas.Handle, DstBounds.Left, DstBounds.Top, 0, 0,
|
GDKDrawBitmap(DstCanvas.Handle, DstBounds.Left, DstBounds.Top, 0, 0,
|
||||||
NewWidth, NewHeight, DisplayImage);
|
NewWidth, NewHeight, DisplayImage);
|
||||||
@@ -833,9 +896,75 @@ begin
|
|||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
|
{$ELSEIF Defined(LCLqt5)}
|
||||||
|
var
|
||||||
|
QImage: TQtImage;
|
||||||
|
Context: TQtDeviceContext;
|
||||||
|
begin
|
||||||
|
if TestImage(ImageData) then
|
||||||
|
begin
|
||||||
|
if not (ImageData.Format in [ifA8R8G8B8, ifX8R8G8B8]) then
|
||||||
|
raise EImagingError.Create(SBadFormatDisplay);
|
||||||
|
|
||||||
|
Context := TQtDeviceContext(DstCanvas.Handle);
|
||||||
|
|
||||||
|
// QImage directly uses the image memory, there is no copy done
|
||||||
|
QImage := TQtImage.Create(ImageData.Bits, ImageData.Width, ImageData.Height,
|
||||||
|
ImageData.Width * 4, QImageFormat_ARGB32, False);
|
||||||
|
try
|
||||||
|
QPainter_drawImage(Context.Widget, PRect(@DstRect), QImage.Handle, @SrcRect, QtAutoColor);
|
||||||
|
finally
|
||||||
|
QImage.Free;
|
||||||
|
end;
|
||||||
|
end;
|
||||||
|
end;
|
||||||
|
{$ELSEIF Defined(LCLqt6)}
|
||||||
|
var
|
||||||
|
QImage: TQtImage;
|
||||||
|
Context: TQtDeviceContext;
|
||||||
|
begin
|
||||||
|
if TestImage(ImageData) then
|
||||||
|
begin
|
||||||
|
if not (ImageData.Format in [ifA8R8G8B8, ifX8R8G8B8]) then
|
||||||
|
raise EImagingError.Create(SBadFormatDisplay);
|
||||||
|
|
||||||
|
Context := TQtDeviceContext(DstCanvas.Handle);
|
||||||
|
|
||||||
|
// QImage directly uses the image memory, there is no copy done
|
||||||
|
QImage := TQtImage.Create(ImageData.Bits, ImageData.Width, ImageData.Height,
|
||||||
|
ImageData.Width * 4, QImageFormat_ARGB32, False);
|
||||||
|
try
|
||||||
|
QPainter_drawImage(Context.Widget, PRect(@DstRect), QImage.Handle, @SrcRect, QtAutoColor);
|
||||||
|
finally
|
||||||
|
QImage.Free;
|
||||||
|
end;
|
||||||
|
end;
|
||||||
|
end;
|
||||||
|
{$ELSEIF Defined(LCLcocoa)}
|
||||||
|
var
|
||||||
|
CocoaBmp: TCocoaBitmap;
|
||||||
|
Context: TCocoaContext;
|
||||||
|
begin
|
||||||
|
if TestImage(ImageData) then
|
||||||
|
begin
|
||||||
|
if not (ImageData.Format in [ifA8R8G8B8, ifX8R8G8B8]) then
|
||||||
|
raise EImagingError.Create(SBadFormatDisplay);
|
||||||
|
|
||||||
|
Context := CheckDC(DstCanvas.Handle);
|
||||||
|
|
||||||
|
// We copy the data since it needs R/B swap and potentially alpha pre-multiply
|
||||||
|
CocoaBmp := TCocoaBitmap.Create(ImageData.Width, ImageData.Height, 32, 32,
|
||||||
|
cbaDWord, cbtBGRA, ImageData.Bits, True);
|
||||||
|
try
|
||||||
|
Context.DrawImageRep(RectToNSRect(DstRect), RectToNSRect(SrcRect), CocoaBmp.ImageRep);
|
||||||
|
finally
|
||||||
|
CocoaBmp.Free;
|
||||||
|
end;
|
||||||
|
end;
|
||||||
|
end;
|
||||||
{$ELSE}
|
{$ELSE}
|
||||||
begin
|
begin
|
||||||
raise Exception.Create(SUnsupportedLCLWidgetSet);
|
raise EImagingError.Create(SUnsupportedLCLWidgetSet);
|
||||||
end;
|
end;
|
||||||
{$IFEND}
|
{$IFEND}
|
||||||
|
|
||||||
@@ -864,12 +993,27 @@ begin
|
|||||||
PixelFormat := pf24Bit;
|
PixelFormat := pf24Bit;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
procedure TImagingGraphic.LoadFromStream(Stream: TStream);
|
procedure TImagingGraphic.ReadData(Stream: TStream);
|
||||||
begin
|
begin
|
||||||
ReadDataFromStream(Stream);
|
// Here we need to skip ReadData+WriteData of TBitmap (and LCL TRasterBitmap)
|
||||||
|
// and go to the basics in TGraphic's ReadData+WriteData with just LoadFromStream
|
||||||
|
// and SaveToStream.
|
||||||
|
// Some VCL/LCL TGraphic classes also store size of the written data
|
||||||
|
// before the stream contents. However, the stream passed here
|
||||||
|
// from TReader.DefineBinaryProperty is already
|
||||||
|
// a memory stream capped to the size of binary property data.
|
||||||
|
// Picture.Data = <vaBinary><Size(TWriter)><TGraphicClassName(TPicture)><ImageBits(TImagingGraphicForSave)>
|
||||||
|
LoadFromStream(Stream);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
procedure TImagingGraphic.ReadDataFromStream(Stream: TStream);
|
procedure TImagingGraphic.WriteData(Stream: TStream);
|
||||||
|
begin
|
||||||
|
// This can happen when streaming some of the formats that don't have
|
||||||
|
// TImagingGraphicForSave descendant.
|
||||||
|
SaveToStream(Stream);
|
||||||
|
end;
|
||||||
|
|
||||||
|
procedure TImagingGraphic.LoadFromStream(Stream: TStream);
|
||||||
var
|
var
|
||||||
Image: TSingleImage;
|
Image: TSingleImage;
|
||||||
begin
|
begin
|
||||||
@@ -882,6 +1026,19 @@ begin
|
|||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
procedure TImagingGraphic.SaveToStream(Stream: TStream);
|
||||||
|
var
|
||||||
|
Image: TSingleImage;
|
||||||
|
begin
|
||||||
|
Image := TSingleImage.Create;
|
||||||
|
try
|
||||||
|
Image.Assign(Self);
|
||||||
|
Image.SaveToStream('png', Stream);
|
||||||
|
finally
|
||||||
|
Image.Free;
|
||||||
|
end;
|
||||||
|
end;
|
||||||
|
|
||||||
procedure TImagingGraphic.AssignTo(Dest: TPersistent);
|
procedure TImagingGraphic.AssignTo(Dest: TPersistent);
|
||||||
var
|
var
|
||||||
Arr: TDynImageDataArray;
|
Arr: TDynImageDataArray;
|
||||||
@@ -901,6 +1058,18 @@ begin
|
|||||||
inherited AssignTo(Dest);
|
inherited AssignTo(Dest);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
{$IFDEF COMPONENT_SET_LCL}
|
||||||
|
function TImagingGraphic.GetResourceType: TResourceType;
|
||||||
|
begin
|
||||||
|
Result := RT_RCDATA;
|
||||||
|
end;
|
||||||
|
|
||||||
|
class function TImagingGraphic.IsStreamFormatSupported(Stream: TStream): Boolean;
|
||||||
|
begin
|
||||||
|
Result := DetermineStreamFormat(Stream) <> '';
|
||||||
|
end;
|
||||||
|
{$ENDIF}
|
||||||
|
|
||||||
procedure TImagingGraphic.Assign(Source: TPersistent);
|
procedure TImagingGraphic.Assign(Source: TPersistent);
|
||||||
begin
|
begin
|
||||||
if Source is TBaseImage then
|
if Source is TBaseImage then
|
||||||
@@ -933,7 +1102,6 @@ begin
|
|||||||
ConvertBitmapToData(Self, ImageData);
|
ConvertBitmapToData(Self, ImageData);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
|
||||||
{ TImagingGraphicForSave class implementation }
|
{ TImagingGraphicForSave class implementation }
|
||||||
|
|
||||||
constructor TImagingGraphicForSave.Create;
|
constructor TImagingGraphicForSave.Create;
|
||||||
@@ -944,7 +1112,12 @@ begin
|
|||||||
GetFileFormat.CheckOptionsValidity;
|
GetFileFormat.CheckOptionsValidity;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
procedure TImagingGraphicForSave.WriteDataToStream(Stream: TStream);
|
procedure TImagingGraphicForSave.WriteData(Stream: TStream);
|
||||||
|
begin
|
||||||
|
SaveToStream(Stream);
|
||||||
|
end;
|
||||||
|
|
||||||
|
procedure TImagingGraphicForSave.SaveToStream(Stream: TStream);
|
||||||
var
|
var
|
||||||
Image: TSingleImage;
|
Image: TSingleImage;
|
||||||
begin
|
begin
|
||||||
@@ -962,11 +1135,6 @@ begin
|
|||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
procedure TImagingGraphicForSave.SaveToStream(Stream: TStream);
|
|
||||||
begin
|
|
||||||
WriteDataToStream(Stream);
|
|
||||||
end;
|
|
||||||
|
|
||||||
{$IFDEF COMPONENT_SET_LCL}
|
{$IFDEF COMPONENT_SET_LCL}
|
||||||
class function TImagingGraphicForSave.GetFileExtensions: string;
|
class function TImagingGraphicForSave.GetFileExtensions: string;
|
||||||
begin
|
begin
|
||||||
@@ -980,9 +1148,6 @@ end;
|
|||||||
{$ENDIF}
|
{$ENDIF}
|
||||||
|
|
||||||
{$IFNDEF DONT_LINK_BITMAP}
|
{$IFNDEF DONT_LINK_BITMAP}
|
||||||
|
|
||||||
{ TImagingBitmap class implementation }
|
|
||||||
|
|
||||||
constructor TImagingBitmap.Create;
|
constructor TImagingBitmap.Create;
|
||||||
begin
|
begin
|
||||||
inherited Create;
|
inherited Create;
|
||||||
@@ -1004,9 +1169,6 @@ end;
|
|||||||
{$ENDIF}
|
{$ENDIF}
|
||||||
|
|
||||||
{$IFNDEF DONT_LINK_JPEG}
|
{$IFNDEF DONT_LINK_JPEG}
|
||||||
|
|
||||||
{ TImagingJpeg class implementation }
|
|
||||||
|
|
||||||
constructor TImagingJpeg.Create;
|
constructor TImagingJpeg.Create;
|
||||||
begin
|
begin
|
||||||
inherited Create;
|
inherited Create;
|
||||||
@@ -1038,9 +1200,6 @@ end;
|
|||||||
{$ENDIF}
|
{$ENDIF}
|
||||||
|
|
||||||
{$IFNDEF DONT_LINK_PNG}
|
{$IFNDEF DONT_LINK_PNG}
|
||||||
|
|
||||||
{ TImagingPNG class implementation }
|
|
||||||
|
|
||||||
constructor TImagingPNG.Create;
|
constructor TImagingPNG.Create;
|
||||||
begin
|
begin
|
||||||
inherited Create;
|
inherited Create;
|
||||||
@@ -1064,20 +1223,13 @@ end;
|
|||||||
{$ENDIF}
|
{$ENDIF}
|
||||||
|
|
||||||
{$IFNDEF DONT_LINK_GIF}
|
{$IFNDEF DONT_LINK_GIF}
|
||||||
|
|
||||||
{ TImagingGIF class implementation}
|
|
||||||
|
|
||||||
class function TImagingGIF.GetFileFormat: TImageFileFormat;
|
class function TImagingGIF.GetFileFormat: TImageFileFormat;
|
||||||
begin
|
begin
|
||||||
Result := FindImageFileFormatByClass(TGIFFileFormat);
|
Result := FindImageFileFormatByClass(TGIFFileFormat);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
{$ENDIF}
|
{$ENDIF}
|
||||||
|
|
||||||
{$IFNDEF DONT_LINK_TARGA}
|
{$IFNDEF DONT_LINK_TARGA}
|
||||||
|
|
||||||
{ TImagingTarga class implementation }
|
|
||||||
|
|
||||||
constructor TImagingTarga.Create;
|
constructor TImagingTarga.Create;
|
||||||
begin
|
begin
|
||||||
inherited Create;
|
inherited Create;
|
||||||
@@ -1099,9 +1251,6 @@ end;
|
|||||||
{$ENDIF}
|
{$ENDIF}
|
||||||
|
|
||||||
{$IFNDEF DONT_LINK_DDS}
|
{$IFNDEF DONT_LINK_DDS}
|
||||||
|
|
||||||
{ TImagingDDS class implementation }
|
|
||||||
|
|
||||||
constructor TImagingDDS.Create;
|
constructor TImagingDDS.Create;
|
||||||
begin
|
begin
|
||||||
inherited Create;
|
inherited Create;
|
||||||
@@ -1132,9 +1281,6 @@ end;
|
|||||||
{$ENDIF}
|
{$ENDIF}
|
||||||
|
|
||||||
{$IFNDEF DONT_LINK_MNG}
|
{$IFNDEF DONT_LINK_MNG}
|
||||||
|
|
||||||
{ TImagingMNG class implementation }
|
|
||||||
|
|
||||||
constructor TImagingMNG.Create;
|
constructor TImagingMNG.Create;
|
||||||
begin
|
begin
|
||||||
inherited Create;
|
inherited Create;
|
||||||
@@ -1173,9 +1319,6 @@ end;
|
|||||||
{$ENDIF}
|
{$ENDIF}
|
||||||
|
|
||||||
{$IFNDEF DONT_LINK_JNG}
|
{$IFNDEF DONT_LINK_JNG}
|
||||||
|
|
||||||
{ TImagingJNG class implementation }
|
|
||||||
|
|
||||||
constructor TImagingJNG.Create;
|
constructor TImagingJNG.Create;
|
||||||
begin
|
begin
|
||||||
inherited Create;
|
inherited Create;
|
||||||
@@ -1205,17 +1348,26 @@ end;
|
|||||||
{$ENDIF}
|
{$ENDIF}
|
||||||
|
|
||||||
initialization
|
initialization
|
||||||
|
RegisteredFormats := TList.Create;
|
||||||
RegisterTypes;
|
RegisterTypes;
|
||||||
finalization
|
finalization
|
||||||
UnRegisterTypes;
|
UnRegisterTypes;
|
||||||
|
RegisteredFormats.Free;
|
||||||
|
|
||||||
{$IFEND} // {$IF not Defined(COMPONENT_SET_LCL) and not Defined(COMPONENT_SET_VCL)}
|
{$IFEND} // {$IF not Defined(COMPONENT_SET_LCL) and not Defined(COMPONENT_SET_VCL)}
|
||||||
|
|
||||||
{
|
{
|
||||||
File Notes:
|
File Notes:
|
||||||
|
|
||||||
-- TODOS ----------------------------------------------------
|
-- 0.77.1 ---------------------------------------------------
|
||||||
- nothing now
|
- Fixed bug in ConvertBitmapToData causing images from GTK2 bitmaps
|
||||||
|
to have swapped RB channels.
|
||||||
|
- LCL: Removed GTK1 support (deprecated).
|
||||||
|
|
||||||
|
-- 0.26.3 Changes/Bug Fixes ---------------------------------
|
||||||
|
- Transparency of 8bit images (like loaded from 8bit PNG or GIF) is
|
||||||
|
kept intact during conversion to TBitmap in ConvertDataToBitmap
|
||||||
|
(32bit bitmap is created).
|
||||||
|
|
||||||
-- 0.26.3 Changes/Bug Fixes ---------------------------------
|
-- 0.26.3 Changes/Bug Fixes ---------------------------------
|
||||||
- Setting AlphaFormat property of TBitmap in ConvertDataToBitmap
|
- Setting AlphaFormat property of TBitmap in ConvertDataToBitmap
|
||||||
@@ -1236,7 +1388,7 @@ finalization
|
|||||||
-- 0.24.1 Changes/Bug Fixes ---------------------------------
|
-- 0.24.1 Changes/Bug Fixes ---------------------------------
|
||||||
- Fixed wrong IFDEF causing that Imaging wouldn't compile in Lazarus
|
- Fixed wrong IFDEF causing that Imaging wouldn't compile in Lazarus
|
||||||
with GTK2 target.
|
with GTK2 target.
|
||||||
- Added commnets with code for Lazarus rev. 11861+ regarding
|
- Added comments with code for Lazarus rev. 11861+ regarding
|
||||||
RawImage interface. Replace current code with that in comments
|
RawImage interface. Replace current code with that in comments
|
||||||
if you use Lazarus from SVN. New RawImage interface will be used by
|
if you use Lazarus from SVN. New RawImage interface will be used by
|
||||||
default after next Lazarus release.
|
default after next Lazarus release.
|
||||||
@@ -1258,7 +1410,7 @@ finalization
|
|||||||
- added procedures: ConvertImageToBitmap and ConvertBitmapToImage
|
- added procedures: ConvertImageToBitmap and ConvertBitmapToImage
|
||||||
|
|
||||||
-- 0.17 Changes/Bug Fixes -----------------------------------
|
-- 0.17 Changes/Bug Fixes -----------------------------------
|
||||||
- LCL data to bitmap conversion didn´t work in Linux, fixed
|
- LCL data to bitmap conversion didn't work in Linux, fixed
|
||||||
- added MNG file format
|
- added MNG file format
|
||||||
- added JNG file format
|
- added JNG file format
|
||||||
|
|
||||||
|
|||||||
+359
-94
@@ -1,29 +1,12 @@
|
|||||||
{
|
{
|
||||||
$Id: ImagingDds.pas 129 2008-08-06 20:01:30Z galfar $
|
|
||||||
Vampyre Imaging Library
|
Vampyre Imaging Library
|
||||||
by Marek Mauder
|
by Marek Mauder
|
||||||
http://imaginglib.sourceforge.net
|
https://github.com/galfar/imaginglib
|
||||||
|
https://imaginglib.sourceforge.io
|
||||||
The contents of this file are used with permission, subject to the Mozilla
|
- - - - -
|
||||||
Public License Version 1.1 (the "License"); you may not use this file except
|
This Source Code Form is subject to the terms of the Mozilla Public
|
||||||
in compliance with the License. You may obtain a copy of the License at
|
License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||||
http://www.mozilla.org/MPL/MPL-1.1.html
|
file, You can obtain one at https://mozilla.org/MPL/2.0.
|
||||||
|
|
||||||
Software distributed under the License is distributed on an "AS IS" basis,
|
|
||||||
WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License for
|
|
||||||
the specific language governing rights and limitations under the License.
|
|
||||||
|
|
||||||
Alternatively, the contents of this file may be used under the terms of the
|
|
||||||
GNU Lesser General Public License (the "LGPL License"), in which case the
|
|
||||||
provisions of the LGPL License are applicable instead of those above.
|
|
||||||
If you wish to allow use of your version of this file only under the terms
|
|
||||||
of the LGPL License and not to allow others to use your version of this file
|
|
||||||
under the MPL, indicate your decision by deleting the provisions above and
|
|
||||||
replace them with the notice and other provisions required by the LGPL
|
|
||||||
License. If you do not delete the provisions above, a recipient may use
|
|
||||||
your version of this file under either the MPL or the LGPL License.
|
|
||||||
|
|
||||||
For more information about the LGPL: http://www.gnu.org/copyleft/lesser.html
|
|
||||||
}
|
}
|
||||||
|
|
||||||
{ This unit contains image format loader/saver for DirectDraw Surface images.}
|
{ This unit contains image format loader/saver for DirectDraw Surface images.}
|
||||||
@@ -38,11 +21,11 @@ uses
|
|||||||
|
|
||||||
type
|
type
|
||||||
{ Class for loading and saving Microsoft DirectDraw surfaces.
|
{ Class for loading and saving Microsoft DirectDraw surfaces.
|
||||||
It can load/save all D3D formats which have coresponding
|
It can load/save all D3D formats which have corresponding
|
||||||
TImageFormat. It supports plain textures, cube textures and
|
TImageFormat. It supports plain textures, cube textures and
|
||||||
volume textures, all of these can have mipmaps. It can also
|
volume textures, all of these can have mipmaps. It can also
|
||||||
load some formats which have no exact TImageFormat, but can be easily
|
load some formats which have no exact TImageFormat, but can be easily
|
||||||
converted to one (bump map formats).
|
converted to one (bump map formats, etc.).
|
||||||
You can get some information about last loaded DDS file by calling
|
You can get some information about last loaded DDS file by calling
|
||||||
GetOption with ImagingDDSLoadedXXX options and you can set some
|
GetOption with ImagingDDSLoadedXXX options and you can set some
|
||||||
saving options by calling SetOption with ImagingDDSSaveXXX or you can
|
saving options by calling SetOption with ImagingDDSSaveXXX or you can
|
||||||
@@ -51,7 +34,7 @@ type
|
|||||||
at least number of images to build cube/volume based on current
|
at least number of images to build cube/volume based on current
|
||||||
Depth and MipMapCount settings.}
|
Depth and MipMapCount settings.}
|
||||||
TDDSFileFormat = class(TImageFileFormat)
|
TDDSFileFormat = class(TImageFileFormat)
|
||||||
protected
|
private
|
||||||
FLoadedCubeMap: LongBool;
|
FLoadedCubeMap: LongBool;
|
||||||
FLoadedVolume: LongBool;
|
FLoadedVolume: LongBool;
|
||||||
FLoadedMipMapCount: LongInt;
|
FLoadedMipMapCount: LongInt;
|
||||||
@@ -62,6 +45,8 @@ type
|
|||||||
FSaveDepth: LongInt;
|
FSaveDepth: LongInt;
|
||||||
procedure ComputeSubDimensions(Idx, Width, Height, MipMaps, Depth: LongInt;
|
procedure ComputeSubDimensions(Idx, Width, Height, MipMaps, Depth: LongInt;
|
||||||
IsCubeMap, IsVolume: Boolean; var CurWidth, CurHeight: LongInt);
|
IsCubeMap, IsVolume: Boolean; var CurWidth, CurHeight: LongInt);
|
||||||
|
protected
|
||||||
|
procedure Define; override;
|
||||||
function LoadData(Handle: TImagingHandle; var Images: TDynImageDataArray;
|
function LoadData(Handle: TImagingHandle; var Images: TDynImageDataArray;
|
||||||
OnlyFirstLevel: Boolean): Boolean; override;
|
OnlyFirstLevel: Boolean): Boolean; override;
|
||||||
function SaveData(Handle: TImagingHandle; const Images: TDynImageDataArray;
|
function SaveData(Handle: TImagingHandle; const Images: TDynImageDataArray;
|
||||||
@@ -69,7 +54,6 @@ type
|
|||||||
procedure ConvertToSupported(var Image: TImageData;
|
procedure ConvertToSupported(var Image: TImageData;
|
||||||
const Info: TImageFormatInfo); override;
|
const Info: TImageFormatInfo); override;
|
||||||
public
|
public
|
||||||
constructor Create; override;
|
|
||||||
function TestFormat(Handle: TImagingHandle): Boolean; override;
|
function TestFormat(Handle: TImagingHandle): Boolean; override;
|
||||||
procedure CheckOptionsValidity; override;
|
procedure CheckOptionsValidity; override;
|
||||||
published
|
published
|
||||||
@@ -94,6 +78,17 @@ type
|
|||||||
property SaveDepth: LongInt read FSaveDepth write FSaveDepth;
|
property SaveDepth: LongInt read FSaveDepth write FSaveDepth;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
const
|
||||||
|
{ DDS related metadata Ids }
|
||||||
|
|
||||||
|
{ DXGI format of textures stored in DDS files with DX10 extension. Type is
|
||||||
|
Enum (value corresponding to DXGI_FORMAT enum from DX SDK).}
|
||||||
|
SMetaDdsDxgiFormat = 'DdsDxgiFormat';
|
||||||
|
{ Number of mipmaps for each main image in DDS file.}
|
||||||
|
SMetaDdsMipMapCount = 'DdsMipMapCount';
|
||||||
|
{ Texture array size stored in DDS file (DX10 extension).}
|
||||||
|
SMetaDdsArraySize = 'DdsArraySize';
|
||||||
|
|
||||||
implementation
|
implementation
|
||||||
|
|
||||||
const
|
const
|
||||||
@@ -106,18 +101,20 @@ const
|
|||||||
|
|
||||||
const
|
const
|
||||||
{ Four character codes.}
|
{ Four character codes.}
|
||||||
DDSMagic = LongWord(Byte('D') or (Byte('D') shl 8) or (Byte('S') shl 16) or
|
DDSMagic = UInt32(Byte('D') or (Byte('D') shl 8) or (Byte('S') shl 16) or
|
||||||
(Byte(' ') shl 24));
|
(Byte(' ') shl 24));
|
||||||
FOURCC_DXT1 = LongWord(Byte('D') or (Byte('X') shl 8) or (Byte('T') shl 16) or
|
FOURCC_DXT1 = UInt32(Byte('D') or (Byte('X') shl 8) or (Byte('T') shl 16) or
|
||||||
(Byte('1') shl 24));
|
(Byte('1') shl 24));
|
||||||
FOURCC_DXT3 = LongWord(Byte('D') or (Byte('X') shl 8) or (Byte('T') shl 16) or
|
FOURCC_DXT3 = UInt32(Byte('D') or (Byte('X') shl 8) or (Byte('T') shl 16) or
|
||||||
(Byte('3') shl 24));
|
(Byte('3') shl 24));
|
||||||
FOURCC_DXT5 = LongWord(Byte('D') or (Byte('X') shl 8) or (Byte('T') shl 16) or
|
FOURCC_DXT5 = UInt32(Byte('D') or (Byte('X') shl 8) or (Byte('T') shl 16) or
|
||||||
(Byte('5') shl 24));
|
(Byte('5') shl 24));
|
||||||
FOURCC_ATI1 = LongWord(Byte('A') or (Byte('T') shl 8) or (Byte('I') shl 16) or
|
FOURCC_ATI1 = UInt32(Byte('A') or (Byte('T') shl 8) or (Byte('I') shl 16) or
|
||||||
(Byte('1') shl 24));
|
(Byte('1') shl 24));
|
||||||
FOURCC_ATI2 = LongWord(Byte('A') or (Byte('T') shl 8) or (Byte('I') shl 16) or
|
FOURCC_ATI2 = UInt32(Byte('A') or (Byte('T') shl 8) or (Byte('I') shl 16) or
|
||||||
(Byte('2') shl 24));
|
(Byte('2') shl 24));
|
||||||
|
FOURCC_DX10 = UInt32(Byte('D') or (Byte('X') shl 8) or (Byte('1') shl 16) or
|
||||||
|
(Byte('0') shl 24));
|
||||||
|
|
||||||
{ Some D3DFORMAT values used in DDS files as FourCC value.}
|
{ Some D3DFORMAT values used in DDS files as FourCC value.}
|
||||||
D3DFMT_A16B16G16R16 = 36;
|
D3DFMT_A16B16G16R16 = 36;
|
||||||
@@ -126,7 +123,7 @@ const
|
|||||||
D3DFMT_R16F = 111;
|
D3DFMT_R16F = 111;
|
||||||
D3DFMT_A16B16G16R16F = 113;
|
D3DFMT_A16B16G16R16F = 113;
|
||||||
|
|
||||||
{ Constans used by TDDSurfaceDesc2.Flags.}
|
{ Constants used by TDDSurfaceDesc2.Flags.}
|
||||||
DDSD_CAPS = $00000001;
|
DDSD_CAPS = $00000001;
|
||||||
DDSD_HEIGHT = $00000002;
|
DDSD_HEIGHT = $00000002;
|
||||||
DDSD_WIDTH = $00000004;
|
DDSD_WIDTH = $00000004;
|
||||||
@@ -136,7 +133,7 @@ const
|
|||||||
DDSD_LINEARSIZE = $00080000;
|
DDSD_LINEARSIZE = $00080000;
|
||||||
DDSD_DEPTH = $00800000;
|
DDSD_DEPTH = $00800000;
|
||||||
|
|
||||||
{ Constans used by TDDSPixelFormat.Flags.}
|
{ Constants used by TDDSPixelFormat.Flags.}
|
||||||
DDPF_ALPHAPIXELS = $00000001; // used by formats which contain alpha
|
DDPF_ALPHAPIXELS = $00000001; // used by formats which contain alpha
|
||||||
DDPF_FOURCC = $00000004; // used by DXT and large ARGB formats
|
DDPF_FOURCC = $00000004; // used by DXT and large ARGB formats
|
||||||
DDPF_RGB = $00000040; // used by RGB formats
|
DDPF_RGB = $00000040; // used by RGB formats
|
||||||
@@ -144,12 +141,12 @@ const
|
|||||||
DDPF_BUMPLUMINANCE = $00040000; // used by mixed signed-unsigned formats
|
DDPF_BUMPLUMINANCE = $00040000; // used by mixed signed-unsigned formats
|
||||||
DDPF_BUMPDUDV = $00080000; // used by signed formats
|
DDPF_BUMPDUDV = $00080000; // used by signed formats
|
||||||
|
|
||||||
{ Constans used by TDDSCaps.Caps1.}
|
{ Constants used by TDDSCaps.Caps1.}
|
||||||
DDSCAPS_COMPLEX = $00000008;
|
DDSCAPS_COMPLEX = $00000008;
|
||||||
DDSCAPS_TEXTURE = $00001000;
|
DDSCAPS_TEXTURE = $00001000;
|
||||||
DDSCAPS_MIPMAP = $00400000;
|
DDSCAPS_MIPMAP = $00400000;
|
||||||
|
|
||||||
{ Constans used by TDDSCaps.Caps2.}
|
{ Constants used by TDDSCaps.Caps2.}
|
||||||
DDSCAPS2_CUBEMAP = $00000200;
|
DDSCAPS2_CUBEMAP = $00000200;
|
||||||
DDSCAPS2_POSITIVEX = $00000400;
|
DDSCAPS2_POSITIVEX = $00000400;
|
||||||
DDSCAPS2_NEGATIVEX = $00000800;
|
DDSCAPS2_NEGATIVEX = $00000800;
|
||||||
@@ -166,56 +163,191 @@ const
|
|||||||
type
|
type
|
||||||
{ Stores the pixel format information.}
|
{ Stores the pixel format information.}
|
||||||
TDDPixelFormat = packed record
|
TDDPixelFormat = packed record
|
||||||
Size: LongWord; // Size of the structure = 32 bytes
|
Size: UInt32; // Size of the structure = 32 bytes
|
||||||
Flags: LongWord; // Flags to indicate valid fields
|
Flags: UInt32; // Flags to indicate valid fields
|
||||||
FourCC: LongWord; // Four-char code for compressed textures (DXT)
|
FourCC: UInt32; // Four-char code for compressed textures (DXT)
|
||||||
BitCount: LongWord; // Bits per pixel if uncomp. usually 16,24 or 32
|
BitCount: UInt32; // Bits per pixel if uncomp. usually 16,24 or 32
|
||||||
RedMask: LongWord; // Bit mask for the Red component
|
RedMask: UInt32; // Bit mask for the Red component
|
||||||
GreenMask: LongWord; // Bit mask for the Green component
|
GreenMask: UInt32; // Bit mask for the Green component
|
||||||
BlueMask: LongWord; // Bit mask for the Blue component
|
BlueMask: UInt32; // Bit mask for the Blue component
|
||||||
AlphaMask: LongWord; // Bit mask for the Alpha component
|
AlphaMask: UInt32; // Bit mask for the Alpha component
|
||||||
end;
|
end;
|
||||||
|
|
||||||
{ Specifies capabilities of surface.}
|
{ Specifies capabilities of surface.}
|
||||||
TDDSCaps = packed record
|
TDDSCaps = packed record
|
||||||
Caps1: LongWord; // Should always include DDSCAPS_TEXTURE
|
Caps1: UInt32; // Should always include DDSCAPS_TEXTURE
|
||||||
Caps2: LongWord; // For cubic environment maps
|
Caps2: UInt32; // For cubic environment maps
|
||||||
Reserved: array[0..1] of LongWord; // Reserved
|
Reserved: array[0..1] of UInt32; // Reserved
|
||||||
end;
|
end;
|
||||||
|
|
||||||
{ Record describing DDS file contents.}
|
{ Record describing DDS file contents.}
|
||||||
TDDSurfaceDesc2 = packed record
|
TDDSurfaceDesc2 = packed record
|
||||||
Size: LongWord; // Size of the structure = 124 Bytes
|
Size: UInt32; // Size of the structure = 124 Bytes
|
||||||
Flags: LongWord; // Flags to indicate valid fields
|
Flags: UInt32; // Flags to indicate valid fields
|
||||||
Height: LongWord; // Height of the main image in pixels
|
Height: UInt32; // Height of the main image in pixels
|
||||||
Width: LongWord; // Width of the main image in pixels
|
Width: UInt32; // Width of the main image in pixels
|
||||||
PitchOrLinearSize: LongWord; // For uncomp formats number of bytes per
|
PitchOrLinearSize: UInt32; // For uncomp formats number of bytes per
|
||||||
// scanline. For comp it is the size in
|
// scanline. For comp it is the size in
|
||||||
// bytes of the main image
|
// bytes of the main image
|
||||||
Depth: LongWord; // Only for volume text depth of the volume
|
Depth: UInt32; // Only for volume text depth of the volume
|
||||||
MipMaps: LongInt; // Total number of levels in the mipmap chain
|
MipMaps: Int32; // Total number of levels in the mipmap chain
|
||||||
Reserved1: array[0..10] of LongWord; // Reserved
|
Reserved1: array[0..10] of UInt32; // Reserved
|
||||||
PixelFormat: TDDPixelFormat; // Format of the pixel data
|
PixelFormat: TDDPixelFormat; // Format of the pixel data
|
||||||
Caps: TDDSCaps; // Capabilities
|
Caps: TDDSCaps; // Capabilities
|
||||||
Reserved2: LongWord; // Reserved
|
Reserved2: UInt32; // Reserved
|
||||||
end;
|
end;
|
||||||
|
|
||||||
{ DDS file header.}
|
{ DDS file header.}
|
||||||
TDDSFileHeader = packed record
|
TDDSFileHeader = packed record
|
||||||
Magic: LongWord; // File format magic
|
Magic: UInt32; // File format magic
|
||||||
Desc: TDDSurfaceDesc2; // Surface description
|
Desc: TDDSurfaceDesc2; // Surface description
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
{ Resource types for D3D 10+ }
|
||||||
|
TD3D10ResourceDimension = (
|
||||||
|
D3D10_RESOURCE_DIMENSION_UNKNOWN = 0,
|
||||||
|
D3D10_RESOURCE_DIMENSION_BUFFER = 1,
|
||||||
|
D3D10_RESOURCE_DIMENSION_TEXTURE1D = 2,
|
||||||
|
D3D10_RESOURCE_DIMENSION_TEXTURE2D = 3,
|
||||||
|
D3D10_RESOURCE_DIMENSION_TEXTURE3D = 4
|
||||||
|
);
|
||||||
|
|
||||||
|
{ Texture formats for D3D 10+ }
|
||||||
|
TDXGIFormat = (
|
||||||
|
DXGI_FORMAT_UNKNOWN = 0,
|
||||||
|
DXGI_FORMAT_R32G32B32A32_TYPELESS = 1,
|
||||||
|
DXGI_FORMAT_R32G32B32A32_FLOAT = 2,
|
||||||
|
DXGI_FORMAT_R32G32B32A32_UINT = 3,
|
||||||
|
DXGI_FORMAT_R32G32B32A32_SINT = 4,
|
||||||
|
DXGI_FORMAT_R32G32B32_TYPELESS = 5,
|
||||||
|
DXGI_FORMAT_R32G32B32_FLOAT = 6,
|
||||||
|
DXGI_FORMAT_R32G32B32_UINT = 7,
|
||||||
|
DXGI_FORMAT_R32G32B32_SINT = 8,
|
||||||
|
DXGI_FORMAT_R16G16B16A16_TYPELESS = 9,
|
||||||
|
DXGI_FORMAT_R16G16B16A16_FLOAT = 10,
|
||||||
|
DXGI_FORMAT_R16G16B16A16_UNORM = 11,
|
||||||
|
DXGI_FORMAT_R16G16B16A16_UINT = 12,
|
||||||
|
DXGI_FORMAT_R16G16B16A16_SNORM = 13,
|
||||||
|
DXGI_FORMAT_R16G16B16A16_SINT = 14,
|
||||||
|
DXGI_FORMAT_R32G32_TYPELESS = 15,
|
||||||
|
DXGI_FORMAT_R32G32_FLOAT = 16,
|
||||||
|
DXGI_FORMAT_R32G32_UINT = 17,
|
||||||
|
DXGI_FORMAT_R32G32_SINT = 18,
|
||||||
|
DXGI_FORMAT_R32G8X24_TYPELESS = 19,
|
||||||
|
DXGI_FORMAT_D32_FLOAT_S8X24_UINT = 20,
|
||||||
|
DXGI_FORMAT_R32_FLOAT_X8X24_TYPELESS = 21,
|
||||||
|
DXGI_FORMAT_X32_TYPELESS_G8X24_UINT = 22,
|
||||||
|
DXGI_FORMAT_R10G10B10A2_TYPELESS = 23,
|
||||||
|
DXGI_FORMAT_R10G10B10A2_UNORM = 24,
|
||||||
|
DXGI_FORMAT_R10G10B10A2_UINT = 25,
|
||||||
|
DXGI_FORMAT_R11G11B10_FLOAT = 26,
|
||||||
|
DXGI_FORMAT_R8G8B8A8_TYPELESS = 27,
|
||||||
|
DXGI_FORMAT_R8G8B8A8_UNORM = 28,
|
||||||
|
DXGI_FORMAT_R8G8B8A8_UNORM_SRGB = 29,
|
||||||
|
DXGI_FORMAT_R8G8B8A8_UINT = 30,
|
||||||
|
DXGI_FORMAT_R8G8B8A8_SNORM = 31,
|
||||||
|
DXGI_FORMAT_R8G8B8A8_SINT = 32,
|
||||||
|
DXGI_FORMAT_R16G16_TYPELESS = 33,
|
||||||
|
DXGI_FORMAT_R16G16_FLOAT = 34,
|
||||||
|
DXGI_FORMAT_R16G16_UNORM = 35,
|
||||||
|
DXGI_FORMAT_R16G16_UINT = 36,
|
||||||
|
DXGI_FORMAT_R16G16_SNORM = 37,
|
||||||
|
DXGI_FORMAT_R16G16_SINT = 38,
|
||||||
|
DXGI_FORMAT_R32_TYPELESS = 39,
|
||||||
|
DXGI_FORMAT_D32_FLOAT = 40,
|
||||||
|
DXGI_FORMAT_R32_FLOAT = 41,
|
||||||
|
DXGI_FORMAT_R32_UINT = 42,
|
||||||
|
DXGI_FORMAT_R32_SINT = 43,
|
||||||
|
DXGI_FORMAT_R24G8_TYPELESS = 44,
|
||||||
|
DXGI_FORMAT_D24_UNORM_S8_UINT = 45,
|
||||||
|
DXGI_FORMAT_R24_UNORM_X8_TYPELESS = 46,
|
||||||
|
DXGI_FORMAT_X24_TYPELESS_G8_UINT = 47,
|
||||||
|
DXGI_FORMAT_R8G8_TYPELESS = 48,
|
||||||
|
DXGI_FORMAT_R8G8_UNORM = 49,
|
||||||
|
DXGI_FORMAT_R8G8_UINT = 50,
|
||||||
|
DXGI_FORMAT_R8G8_SNORM = 51,
|
||||||
|
DXGI_FORMAT_R8G8_SINT = 52,
|
||||||
|
DXGI_FORMAT_R16_TYPELESS = 53,
|
||||||
|
DXGI_FORMAT_R16_FLOAT = 54,
|
||||||
|
DXGI_FORMAT_D16_UNORM = 55,
|
||||||
|
DXGI_FORMAT_R16_UNORM = 56,
|
||||||
|
DXGI_FORMAT_R16_UINT = 57,
|
||||||
|
DXGI_FORMAT_R16_SNORM = 58,
|
||||||
|
DXGI_FORMAT_R16_SINT = 59,
|
||||||
|
DXGI_FORMAT_R8_TYPELESS = 60,
|
||||||
|
DXGI_FORMAT_R8_UNORM = 61,
|
||||||
|
DXGI_FORMAT_R8_UINT = 62,
|
||||||
|
DXGI_FORMAT_R8_SNORM = 63,
|
||||||
|
DXGI_FORMAT_R8_SINT = 64,
|
||||||
|
DXGI_FORMAT_A8_UNORM = 65,
|
||||||
|
DXGI_FORMAT_R1_UNORM = 66,
|
||||||
|
DXGI_FORMAT_R9G9B9E5_SHAREDEXP = 67,
|
||||||
|
DXGI_FORMAT_R8G8_B8G8_UNORM = 68,
|
||||||
|
DXGI_FORMAT_G8R8_G8B8_UNORM = 69,
|
||||||
|
DXGI_FORMAT_BC1_TYPELESS = 70,
|
||||||
|
DXGI_FORMAT_BC1_UNORM = 71,
|
||||||
|
DXGI_FORMAT_BC1_UNORM_SRGB = 72,
|
||||||
|
DXGI_FORMAT_BC2_TYPELESS = 73,
|
||||||
|
DXGI_FORMAT_BC2_UNORM = 74,
|
||||||
|
DXGI_FORMAT_BC2_UNORM_SRGB = 75,
|
||||||
|
DXGI_FORMAT_BC3_TYPELESS = 76,
|
||||||
|
DXGI_FORMAT_BC3_UNORM = 77,
|
||||||
|
DXGI_FORMAT_BC3_UNORM_SRGB = 78,
|
||||||
|
DXGI_FORMAT_BC4_TYPELESS = 79,
|
||||||
|
DXGI_FORMAT_BC4_UNORM = 80,
|
||||||
|
DXGI_FORMAT_BC4_SNORM = 81,
|
||||||
|
DXGI_FORMAT_BC5_TYPELESS = 82,
|
||||||
|
DXGI_FORMAT_BC5_UNORM = 83,
|
||||||
|
DXGI_FORMAT_BC5_SNORM = 84,
|
||||||
|
DXGI_FORMAT_B5G6R5_UNORM = 85,
|
||||||
|
DXGI_FORMAT_B5G5R5A1_UNORM = 86,
|
||||||
|
DXGI_FORMAT_B8G8R8A8_UNORM = 87,
|
||||||
|
DXGI_FORMAT_B8G8R8X8_UNORM = 88,
|
||||||
|
DXGI_FORMAT_R10G10B10_XR_BIAS_A2_UNORM = 89,
|
||||||
|
DXGI_FORMAT_B8G8R8A8_TYPELESS = 90,
|
||||||
|
DXGI_FORMAT_B8G8R8A8_UNORM_SRGB = 91,
|
||||||
|
DXGI_FORMAT_B8G8R8X8_TYPELESS = 92,
|
||||||
|
DXGI_FORMAT_B8G8R8X8_UNORM_SRGB = 93,
|
||||||
|
DXGI_FORMAT_BC6H_TYPELESS = 94,
|
||||||
|
DXGI_FORMAT_BC6H_UF16 = 95,
|
||||||
|
DXGI_FORMAT_BC6H_SF16 = 96,
|
||||||
|
DXGI_FORMAT_BC7_TYPELESS = 97,
|
||||||
|
DXGI_FORMAT_BC7_UNORM = 98,
|
||||||
|
DXGI_FORMAT_BC7_UNORM_SRGB = 99,
|
||||||
|
DXGI_FORMAT_AYUV = 100,
|
||||||
|
DXGI_FORMAT_Y410 = 101,
|
||||||
|
DXGI_FORMAT_Y416 = 102,
|
||||||
|
DXGI_FORMAT_NV12 = 103,
|
||||||
|
DXGI_FORMAT_P010 = 104,
|
||||||
|
DXGI_FORMAT_P016 = 105,
|
||||||
|
DXGI_FORMAT_420_OPAQUE = 106,
|
||||||
|
DXGI_FORMAT_YUY2 = 107,
|
||||||
|
DXGI_FORMAT_Y210 = 108,
|
||||||
|
DXGI_FORMAT_Y216 = 109,
|
||||||
|
DXGI_FORMAT_NV11 = 110,
|
||||||
|
DXGI_FORMAT_AI44 = 111,
|
||||||
|
DXGI_FORMAT_IA44 = 112,
|
||||||
|
DXGI_FORMAT_P8 = 113,
|
||||||
|
DXGI_FORMAT_A8P8 = 114,
|
||||||
|
DXGI_FORMAT_B4G4R4A4_UNORM = 115
|
||||||
|
);
|
||||||
|
|
||||||
|
{ DX10 extension header for DDS file format }
|
||||||
|
TDX10Header = packed record
|
||||||
|
DXGIFormat: TDXGIFormat;
|
||||||
|
ResourceDimension: TD3D10ResourceDimension;
|
||||||
|
MiscFlags: UInt32;
|
||||||
|
ArraySize: UInt32;
|
||||||
|
Reserved: UInt32;
|
||||||
|
end;
|
||||||
|
|
||||||
{ TDDSFileFormat class implementation }
|
{ TDDSFileFormat class implementation }
|
||||||
|
|
||||||
constructor TDDSFileFormat.Create;
|
procedure TDDSFileFormat.Define;
|
||||||
begin
|
begin
|
||||||
inherited Create;
|
inherited;
|
||||||
FName := SDDSFormatName;
|
FName := SDDSFormatName;
|
||||||
FCanLoad := True;
|
FFeatures := [ffLoad, ffSave, ffMultiImage];
|
||||||
FCanSave := True;
|
|
||||||
FIsMultiImageFormat := True;
|
|
||||||
FSupportedFormats := DDSSupportedFormats;
|
FSupportedFormats := DDSSupportedFormats;
|
||||||
|
|
||||||
FSaveCubeMap := False;
|
FSaveCubeMap := False;
|
||||||
@@ -261,7 +393,7 @@ begin
|
|||||||
if IsCubeMap then
|
if IsCubeMap then
|
||||||
begin
|
begin
|
||||||
// Cube maps are stored like this
|
// Cube maps are stored like this
|
||||||
// Face 0 mimap 0
|
// Face 0 mipmap 0
|
||||||
// Face 0 mipmap 1
|
// Face 0 mipmap 1
|
||||||
// ...
|
// ...
|
||||||
// Face 1 mipmap 0
|
// Face 1 mipmap 0
|
||||||
@@ -307,10 +439,12 @@ function TDDSFileFormat.LoadData(Handle: TImagingHandle;
|
|||||||
var Images: TDynImageDataArray; OnlyFirstLevel: Boolean): Boolean;
|
var Images: TDynImageDataArray; OnlyFirstLevel: Boolean): Boolean;
|
||||||
var
|
var
|
||||||
Hdr: TDDSFileHeader;
|
Hdr: TDDSFileHeader;
|
||||||
|
HdrDX10: TDX10Header;
|
||||||
SrcFormat: TImageFormat;
|
SrcFormat: TImageFormat;
|
||||||
FmtInfo: TImageFormatInfo;
|
FmtInfo: TImageFormatInfo;
|
||||||
NeedsSwapChannels: Boolean;
|
NeedsSwapChannels: Boolean;
|
||||||
CurrentWidth, CurrentHeight, ImageCount, LoadSize, I, PitchOrLinear: LongInt;
|
CurrentWidth, CurrentHeight, ImageCount, LoadSize, I,
|
||||||
|
PitchOrLinear, MainImageLinearSize: LongInt;
|
||||||
Data: PByte;
|
Data: PByte;
|
||||||
UseAsPitch: Boolean;
|
UseAsPitch: Boolean;
|
||||||
UseAsLinear: Boolean;
|
UseAsLinear: Boolean;
|
||||||
@@ -322,6 +456,128 @@ var
|
|||||||
(DDPF.BlueMask = PF.BBitMask);
|
(DDPF.BlueMask = PF.BBitMask);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
function FindFourCCFormat(FourCC: UInt32): TImageFormat;
|
||||||
|
begin
|
||||||
|
// Handle FourCC and large ARGB formats
|
||||||
|
case FourCC of
|
||||||
|
D3DFMT_A16B16G16R16: Result := ifA16B16G16R16;
|
||||||
|
D3DFMT_R32F: Result := ifR32F;
|
||||||
|
D3DFMT_A32B32G32R32F: Result := ifA32B32G32R32F;
|
||||||
|
D3DFMT_R16F: Result := ifR16F;
|
||||||
|
D3DFMT_A16B16G16R16F: Result := ifA16B16G16R16F;
|
||||||
|
FOURCC_DXT1: Result := ifDXT1;
|
||||||
|
FOURCC_DXT3: Result := ifDXT3;
|
||||||
|
FOURCC_DXT5: Result := ifDXT5;
|
||||||
|
FOURCC_ATI1: Result := ifATI1N;
|
||||||
|
FOURCC_ATI2: Result := ifATI2N;
|
||||||
|
else
|
||||||
|
Result := ifUnknown;
|
||||||
|
end;
|
||||||
|
end;
|
||||||
|
|
||||||
|
function FindDX10Format(DXGIFormat: TDXGIFormat; var NeedsSwapChannels: Boolean): TImageFormat;
|
||||||
|
begin
|
||||||
|
Result := ifUnknown;
|
||||||
|
NeedsSwapChannels := False;
|
||||||
|
|
||||||
|
case DXGIFormat of
|
||||||
|
DXGI_FORMAT_UNKNOWN: ;
|
||||||
|
DXGI_FORMAT_R32G32B32A32_TYPELESS, DXGI_FORMAT_R32G32B32A32_FLOAT:
|
||||||
|
Result := ifA32B32G32R32F;
|
||||||
|
DXGI_FORMAT_R32G32B32A32_UINT: ;
|
||||||
|
DXGI_FORMAT_R32G32B32A32_SINT: ;
|
||||||
|
DXGI_FORMAT_R32G32B32_TYPELESS, DXGI_FORMAT_R32G32B32_FLOAT:
|
||||||
|
Result := ifB32G32R32F;
|
||||||
|
DXGI_FORMAT_R32G32B32_UINT: ;
|
||||||
|
DXGI_FORMAT_R32G32B32_SINT: ;
|
||||||
|
DXGI_FORMAT_R16G16B16A16_FLOAT:
|
||||||
|
Result := ifA16B16G16R16F;
|
||||||
|
DXGI_FORMAT_R16G16B16A16_TYPELESS, DXGI_FORMAT_R16G16B16A16_UNORM,
|
||||||
|
DXGI_FORMAT_R16G16B16A16_UINT, DXGI_FORMAT_R16G16B16A16_SNORM,
|
||||||
|
DXGI_FORMAT_R16G16B16A16_SINT:
|
||||||
|
Result := ifA16B16G16R16;
|
||||||
|
DXGI_FORMAT_R32G32_TYPELESS: ;
|
||||||
|
DXGI_FORMAT_R32G32_FLOAT: ;
|
||||||
|
DXGI_FORMAT_R32G32_UINT: ;
|
||||||
|
DXGI_FORMAT_R32G32_SINT: ;
|
||||||
|
DXGI_FORMAT_R32G8X24_TYPELESS: ;
|
||||||
|
DXGI_FORMAT_D32_FLOAT_S8X24_UINT: ;
|
||||||
|
DXGI_FORMAT_R32_FLOAT_X8X24_TYPELESS: ;
|
||||||
|
DXGI_FORMAT_X32_TYPELESS_G8X24_UINT: ;
|
||||||
|
DXGI_FORMAT_R10G10B10A2_TYPELESS: ;
|
||||||
|
DXGI_FORMAT_R10G10B10A2_UNORM: ;
|
||||||
|
DXGI_FORMAT_R10G10B10A2_UINT: ;
|
||||||
|
DXGI_FORMAT_R11G11B10_FLOAT: ;
|
||||||
|
DXGI_FORMAT_R8G8B8A8_TYPELESS, DXGI_FORMAT_R8G8B8A8_UNORM,
|
||||||
|
DXGI_FORMAT_R8G8B8A8_UINT, DXGI_FORMAT_R8G8B8A8_SNORM,DXGI_FORMAT_R8G8B8A8_SINT,
|
||||||
|
DXGI_FORMAT_R8G8B8A8_UNORM_SRGB:
|
||||||
|
begin
|
||||||
|
Result := ifA8R8G8B8;
|
||||||
|
NeedsSwapChannels := True;
|
||||||
|
end;
|
||||||
|
DXGI_FORMAT_R16G16_TYPELESS: ;
|
||||||
|
DXGI_FORMAT_R16G16_FLOAT: ;
|
||||||
|
DXGI_FORMAT_R16G16_UNORM: ;
|
||||||
|
DXGI_FORMAT_R16G16_UINT: ;
|
||||||
|
DXGI_FORMAT_R16G16_SNORM: ;
|
||||||
|
DXGI_FORMAT_R16G16_SINT: ;
|
||||||
|
DXGI_FORMAT_R32_TYPELESS, DXGI_FORMAT_R32_UINT, DXGI_FORMAT_R32_SINT:
|
||||||
|
Result := ifGray32;
|
||||||
|
DXGI_FORMAT_D32_FLOAT, DXGI_FORMAT_R32_FLOAT:
|
||||||
|
Result := ifR32F;
|
||||||
|
DXGI_FORMAT_R24G8_TYPELESS: ;
|
||||||
|
DXGI_FORMAT_D24_UNORM_S8_UINT: ;
|
||||||
|
DXGI_FORMAT_R24_UNORM_X8_TYPELESS: ;
|
||||||
|
DXGI_FORMAT_X24_TYPELESS_G8_UINT: ;
|
||||||
|
DXGI_FORMAT_R8G8_TYPELESS, DXGI_FORMAT_R8G8_UNORM, DXGI_FORMAT_R8G8_UINT,
|
||||||
|
DXGI_FORMAT_R8G8_SNORM, DXGI_FORMAT_R8G8_SINT:
|
||||||
|
Result := ifA8Gray8;
|
||||||
|
DXGI_FORMAT_R16_TYPELESS, DXGI_FORMAT_D16_UNORM, DXGI_FORMAT_R16_UNORM,
|
||||||
|
DXGI_FORMAT_R16_UINT, DXGI_FORMAT_R16_SNORM, DXGI_FORMAT_R16_SINT:
|
||||||
|
Result := ifGray16;
|
||||||
|
DXGI_FORMAT_R16_FLOAT:
|
||||||
|
Result := ifR16F;
|
||||||
|
DXGI_FORMAT_R8_TYPELESS, DXGI_FORMAT_R8_UNORM, DXGI_FORMAT_R8_UINT,
|
||||||
|
DXGI_FORMAT_R8_SNORM, DXGI_FORMAT_R8_SINT, DXGI_FORMAT_A8_UNORM:
|
||||||
|
Result := ifGray8;
|
||||||
|
DXGI_FORMAT_R1_UNORM: ;
|
||||||
|
DXGI_FORMAT_R9G9B9E5_SHAREDEXP: ;
|
||||||
|
DXGI_FORMAT_R8G8_B8G8_UNORM: ;
|
||||||
|
DXGI_FORMAT_G8R8_G8B8_UNORM: ;
|
||||||
|
DXGI_FORMAT_BC1_TYPELESS, DXGI_FORMAT_BC1_UNORM, DXGI_FORMAT_BC1_UNORM_SRGB:
|
||||||
|
Result := ifDXT1;
|
||||||
|
DXGI_FORMAT_BC2_TYPELESS, DXGI_FORMAT_BC2_UNORM, DXGI_FORMAT_BC2_UNORM_SRGB:
|
||||||
|
Result := ifDXT3;
|
||||||
|
DXGI_FORMAT_BC3_TYPELESS, DXGI_FORMAT_BC3_UNORM, DXGI_FORMAT_BC3_UNORM_SRGB:
|
||||||
|
Result := ifDXT5;
|
||||||
|
DXGI_FORMAT_BC4_TYPELESS, DXGI_FORMAT_BC4_UNORM, DXGI_FORMAT_BC4_SNORM:
|
||||||
|
Result := ifATI1N;
|
||||||
|
DXGI_FORMAT_BC5_TYPELESS, DXGI_FORMAT_BC5_UNORM, DXGI_FORMAT_BC5_SNORM:
|
||||||
|
Result := ifATI2N;
|
||||||
|
DXGI_FORMAT_B5G6R5_UNORM:
|
||||||
|
Result := ifR5G6B5;
|
||||||
|
DXGI_FORMAT_B5G5R5A1_UNORM:
|
||||||
|
Result := ifA1R5G5B5;
|
||||||
|
DXGI_FORMAT_B8G8R8A8_UNORM, DXGI_FORMAT_B8G8R8A8_TYPELESS:
|
||||||
|
Result := ifA8R8G8B8;
|
||||||
|
DXGI_FORMAT_B8G8R8X8_UNORM, DXGI_FORMAT_B8G8R8X8_TYPELESS:
|
||||||
|
Result := ifX8R8G8B8;
|
||||||
|
DXGI_FORMAT_R10G10B10_XR_BIAS_A2_UNORM: ;
|
||||||
|
DXGI_FORMAT_B8G8R8A8_UNORM_SRGB: ;
|
||||||
|
DXGI_FORMAT_B8G8R8X8_UNORM_SRGB: ;
|
||||||
|
DXGI_FORMAT_BC6H_TYPELESS: ;
|
||||||
|
DXGI_FORMAT_BC6H_UF16: ;
|
||||||
|
DXGI_FORMAT_BC6H_SF16: ;
|
||||||
|
DXGI_FORMAT_BC7_TYPELESS: ;
|
||||||
|
DXGI_FORMAT_BC7_UNORM: ;
|
||||||
|
DXGI_FORMAT_BC7_UNORM_SRGB: ;
|
||||||
|
DXGI_FORMAT_P8: ;
|
||||||
|
DXGI_FORMAT_A8P8: ;
|
||||||
|
DXGI_FORMAT_B4G4R4A4_UNORM:
|
||||||
|
Result := ifA4R4G4B4;
|
||||||
|
end;
|
||||||
|
end;
|
||||||
|
|
||||||
begin
|
begin
|
||||||
Result := False;
|
Result := False;
|
||||||
ImageCount := 1;
|
ImageCount := 1;
|
||||||
@@ -329,34 +585,27 @@ begin
|
|||||||
FLoadedDepth := 1;
|
FLoadedDepth := 1;
|
||||||
FLoadedVolume := False;
|
FLoadedVolume := False;
|
||||||
FLoadedCubeMap := False;
|
FLoadedCubeMap := False;
|
||||||
|
ZeroMemory(@HdrDX10, SizeOf(HdrDX10));
|
||||||
|
|
||||||
with GetIO, Hdr, Hdr.Desc.PixelFormat do
|
with GetIO, Hdr, Hdr.Desc.PixelFormat do
|
||||||
begin
|
begin
|
||||||
Read(Handle, @Hdr, SizeOF(Hdr));
|
Read(Handle, @Hdr, SizeOf(Hdr));
|
||||||
{
|
|
||||||
// Set position to the end of the header (for possible future versions
|
|
||||||
// ith larger header)
|
|
||||||
Seek(Handle, Hdr.Desc.Size + SizeOf(Hdr.Magic) - SizeOf(Hdr),
|
|
||||||
smFromCurrent);
|
|
||||||
}
|
|
||||||
SrcFormat := ifUnknown;
|
SrcFormat := ifUnknown;
|
||||||
NeedsSwapChannels := False;
|
NeedsSwapChannels := False;
|
||||||
|
|
||||||
// Get image data format
|
// Get image data format
|
||||||
if (Flags and DDPF_FOURCC) = DDPF_FOURCC then
|
if (Flags and DDPF_FOURCC) = DDPF_FOURCC then
|
||||||
begin
|
begin
|
||||||
// Handle FourCC and large ARGB formats
|
if FourCC = FOURCC_DX10 then
|
||||||
case FourCC of
|
begin
|
||||||
D3DFMT_A16B16G16R16: SrcFormat := ifA16B16G16R16;
|
Read(Handle, @HdrDX10, SizeOf(HdrDX10));
|
||||||
D3DFMT_R32F: SrcFormat := ifR32F;
|
SrcFormat := FindDX10Format(HdrDX10.DXGIFormat, NeedsSwapChannels);
|
||||||
D3DFMT_A32B32G32R32F: SrcFormat := ifA32B32G32R32F;
|
FMetadata.SetMetaItem(SMetaDdsDxgiFormat, HdrDX10.DXGIFormat);
|
||||||
D3DFMT_R16F: SrcFormat := ifR16F;
|
FMetadata.SetMetaItem(SMetaDdsArraySize, HdrDX10.ArraySize);
|
||||||
D3DFMT_A16B16G16R16F: SrcFormat := ifA16B16G16R16F;
|
end
|
||||||
FOURCC_DXT1: SrcFormat := ifDXT1;
|
else
|
||||||
FOURCC_DXT3: SrcFormat := ifDXT3;
|
SrcFormat := FindFourCCFormat(FourCC);
|
||||||
FOURCC_DXT5: SrcFormat := ifDXT5;
|
|
||||||
FOURCC_ATI1: SrcFormat := ifATI1N;
|
|
||||||
FOURCC_ATI2: SrcFormat := ifATI2N;
|
|
||||||
end;
|
|
||||||
end
|
end
|
||||||
else if (Flags and DDPF_RGB) = DDPF_RGB then
|
else if (Flags and DDPF_RGB) = DDPF_RGB then
|
||||||
begin
|
begin
|
||||||
@@ -367,11 +616,9 @@ begin
|
|||||||
case BitCount of
|
case BitCount of
|
||||||
16:
|
16:
|
||||||
begin
|
begin
|
||||||
if MasksEqual(Desc.PixelFormat,
|
if MasksEqual(Desc.PixelFormat, GetFormatInfo(ifA4R4G4B4).PixelFormat) then
|
||||||
GetFormatInfo(ifA4R4G4B4).PixelFormat) then
|
|
||||||
SrcFormat := ifA4R4G4B4;
|
SrcFormat := ifA4R4G4B4;
|
||||||
if MasksEqual(Desc.PixelFormat,
|
if MasksEqual(Desc.PixelFormat, GetFormatInfo(ifA1R5G5B5).PixelFormat) then
|
||||||
GetFormatInfo(ifA1R5G5B5).PixelFormat) then
|
|
||||||
SrcFormat := ifA1R5G5B5;
|
SrcFormat := ifA1R5G5B5;
|
||||||
end;
|
end;
|
||||||
32:
|
32:
|
||||||
@@ -458,7 +705,8 @@ begin
|
|||||||
end;
|
end;
|
||||||
|
|
||||||
// If DDS format is not supported we will exit
|
// If DDS format is not supported we will exit
|
||||||
if SrcFormat = ifUnknown then Exit;
|
if SrcFormat = ifUnknown then
|
||||||
|
Exit;
|
||||||
|
|
||||||
// File contains mipmaps for each subimage.
|
// File contains mipmaps for each subimage.
|
||||||
{ Some DDS writers ignore setting proper Caps and Flags so
|
{ Some DDS writers ignore setting proper Caps and Flags so
|
||||||
@@ -468,6 +716,7 @@ begin
|
|||||||
if Desc.MipMaps > 1 then
|
if Desc.MipMaps > 1 then
|
||||||
begin
|
begin
|
||||||
FLoadedMipMapCount := Desc.MipMaps;
|
FLoadedMipMapCount := Desc.MipMaps;
|
||||||
|
FMetadata.SetMetaItem(SMetaDdsMipMapCount, Desc.MipMaps);
|
||||||
ImageCount := Desc.MipMaps;
|
ImageCount := Desc.MipMaps;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
@@ -508,12 +757,21 @@ begin
|
|||||||
// Main image pitch or linear size
|
// Main image pitch or linear size
|
||||||
PitchOrLinear := Desc.PitchOrLinearSize;
|
PitchOrLinear := Desc.PitchOrLinearSize;
|
||||||
|
|
||||||
|
// Check: some writers just write garbage to pitch/linear size fields and flags
|
||||||
|
MainImageLinearSize := FmtInfo.GetPixelsSize(SrcFormat, Desc.Width, Desc.Height);
|
||||||
|
if UseAsLinear and ((PitchOrLinear < MainImageLinearSize) or
|
||||||
|
(PitchOrLinear * Integer(Desc.Height) = MainImageLinearSize)) then
|
||||||
|
begin
|
||||||
|
// Explicitly set linear size
|
||||||
|
PitchOrLinear := MainImageLinearSize;
|
||||||
|
end;
|
||||||
|
|
||||||
for I := 0 to ImageCount - 1 do
|
for I := 0 to ImageCount - 1 do
|
||||||
begin
|
begin
|
||||||
// Compute dimensions of surrent subimage based on texture type and
|
// Compute dimensions of surrent subimage based on texture type and
|
||||||
// number of mipmaps
|
// number of mipmaps
|
||||||
ComputeSubDimensions(I, Desc.Width, Desc.Height, Desc.MipMaps, Desc.Depth,
|
ComputeSubDimensions(I, Desc.Width, Desc.Height, Desc.MipMaps, Desc.Depth,
|
||||||
FloadedCubeMap, FLoadedVolume, CurrentWidth, CurrentHeight);
|
FLoadedCubeMap, FLoadedVolume, CurrentWidth, CurrentHeight);
|
||||||
NewImage(CurrentWidth, CurrentHeight, SrcFormat, Images[I]);
|
NewImage(CurrentWidth, CurrentHeight, SrcFormat, Images[I]);
|
||||||
|
|
||||||
if (I > 0) or (PitchOrLinear = 0) then
|
if (I > 0) or (PitchOrLinear = 0) then
|
||||||
@@ -563,7 +821,7 @@ var
|
|||||||
Hdr: TDDSFileHeader;
|
Hdr: TDDSFileHeader;
|
||||||
MainImage, ImageToSave: TImageData;
|
MainImage, ImageToSave: TImageData;
|
||||||
I, MainIdx, Len, ImageCount: LongInt;
|
I, MainIdx, Len, ImageCount: LongInt;
|
||||||
J: LongWord;
|
J: UInt32;
|
||||||
FmtInfo: TImageFormatInfo;
|
FmtInfo: TImageFormatInfo;
|
||||||
MustBeFreed: Boolean;
|
MustBeFreed: Boolean;
|
||||||
Is2DTexture, IsCubeMap, IsVolume: Boolean;
|
Is2DTexture, IsCubeMap, IsVolume: Boolean;
|
||||||
@@ -823,6 +1081,13 @@ initialization
|
|||||||
-- TODOS ----------------------------------------------------
|
-- TODOS ----------------------------------------------------
|
||||||
- nothing now
|
- nothing now
|
||||||
|
|
||||||
|
-- 0.77.1 ----------------------------------------------------
|
||||||
|
- Texture and D3D specific info stored in DDS is now available as metadata
|
||||||
|
(loading).
|
||||||
|
- Added support for loading DDS files with DX10 extension
|
||||||
|
(http://msdn.microsoft.com/en-us/library/windows/desktop/bb943991(v=vs.85).aspx)
|
||||||
|
and few compatibility fixes.
|
||||||
|
|
||||||
-- 0.25.0 Changes/Bug Fixes ---------------------------------
|
-- 0.25.0 Changes/Bug Fixes ---------------------------------
|
||||||
- Added support for 3Dc ATI1/2 formats.
|
- Added support for 3Dc ATI1/2 formats.
|
||||||
|
|
||||||
|
|||||||
@@ -1,891 +0,0 @@
|
|||||||
{
|
|
||||||
$Id: ImagingExport.pas 173 2009-09-04 17:05:52Z galfar $
|
|
||||||
Vampyre Imaging Library
|
|
||||||
by Marek Mauder
|
|
||||||
http://imaginglib.sourceforge.net
|
|
||||||
|
|
||||||
The contents of this file are used with permission, subject to the Mozilla
|
|
||||||
Public License Version 1.1 (the "License"); you may not use this file except
|
|
||||||
in compliance with the License. You may obtain a copy of the License at
|
|
||||||
http://www.mozilla.org/MPL/MPL-1.1.html
|
|
||||||
|
|
||||||
Software distributed under the License is distributed on an "AS IS" basis,
|
|
||||||
WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License for
|
|
||||||
the specific language governing rights and limitations under the License.
|
|
||||||
|
|
||||||
Alternatively, the contents of this file may be used under the terms of the
|
|
||||||
GNU Lesser General Public License (the "LGPL License"), in which case the
|
|
||||||
provisions of the LGPL License are applicable instead of those above.
|
|
||||||
If you wish to allow use of your version of this file only under the terms
|
|
||||||
of the LGPL License and not to allow others to use your version of this file
|
|
||||||
under the MPL, indicate your decision by deleting the provisions above and
|
|
||||||
replace them with the notice and other provisions required by the LGPL
|
|
||||||
License. If you do not delete the provisions above, a recipient may use
|
|
||||||
your version of this file under either the MPL or the LGPL License.
|
|
||||||
|
|
||||||
For more information about the LGPL: http://www.gnu.org/copyleft/lesser.html
|
|
||||||
}
|
|
||||||
|
|
||||||
{ This function contains functions exported from Imaging dynamic link library.
|
|
||||||
All string are exported as PChars and all var parameters are exported
|
|
||||||
as pointers. All posible exceptions getting out of dll are catched.}
|
|
||||||
unit ImagingExport;
|
|
||||||
|
|
||||||
{$I ImagingOptions.inc}
|
|
||||||
|
|
||||||
interface
|
|
||||||
|
|
||||||
uses
|
|
||||||
ImagingTypes,
|
|
||||||
Imaging;
|
|
||||||
|
|
||||||
{ Returns version of Imaging library. }
|
|
||||||
procedure ImGetVersion(var Major, Minor, Patch: LongInt); cdecl;
|
|
||||||
{ Look at InitImage for details.}
|
|
||||||
procedure ImInitImage(var Image: TImageData); cdecl;
|
|
||||||
{ Look at NewImage for details.}
|
|
||||||
function ImNewImage(Width, Height: LongInt; Format: TImageFormat;
|
|
||||||
var Image: TImageData): Boolean; cdecl;
|
|
||||||
{ Look at TestImage for details.}
|
|
||||||
function ImTestImage(var Image: TImageData): Boolean; cdecl;
|
|
||||||
{ Look at FreeImage for details.}
|
|
||||||
function ImFreeImage(var Image: TImageData): Boolean; cdecl;
|
|
||||||
{ Look at DetermineFileFormat for details. Ext should have enough space for
|
|
||||||
result file extension.}
|
|
||||||
function ImDetermineFileFormat(FileName, Ext: PAnsiChar): Boolean; cdecl;
|
|
||||||
{ Look at DetermineMemoryFormat for details. Ext should have enough space for
|
|
||||||
result file extension.}
|
|
||||||
function ImDetermineMemoryFormat(Data: Pointer; Size: LongInt; Ext: PAnsiChar): Boolean; cdecl;
|
|
||||||
{ Look at IsFileFormatSupported for details.}
|
|
||||||
function ImIsFileFormatSupported(FileName: PAnsiChar): Boolean; cdecl;
|
|
||||||
{ Look at EnumFileFormats for details.}
|
|
||||||
function ImEnumFileFormats(var Index: LongInt; Name, DefaultExt, Masks: PAnsiChar;
|
|
||||||
var CanSave, IsMultiImageFormat: Boolean): Boolean; cdecl;
|
|
||||||
|
|
||||||
{ Inits image list.}
|
|
||||||
function ImInitImageList(Size: LongInt; var ImageList: TImageDataList): Boolean; cdecl;
|
|
||||||
{ Returns size of image list.}
|
|
||||||
function ImGetImageListSize(ImageList: TImageDataList): LongInt; cdecl;
|
|
||||||
{ Returns image list's element at given index. Output image is not cloned it's
|
|
||||||
Bits point to Bits in list => do not free OutImage.}
|
|
||||||
function ImGetImageListElement(ImageList: TImageDataList; Index: LongInt;
|
|
||||||
var OutImage: TImageData): Boolean; cdecl;
|
|
||||||
{ Sets size of image list.}
|
|
||||||
function ImSetImageListSize(ImageList: TImageDataList; NewSize: LongInt): Boolean; cdecl;
|
|
||||||
{ Sets image list element at given index. Input image is not cloned - image in
|
|
||||||
list will point to InImage's Bits.}
|
|
||||||
function ImSetImageListElement(ImageList: TImageDataList; Index: LongInt;
|
|
||||||
const InImage: TImageData): Boolean; cdecl;
|
|
||||||
{ Returns True if all images in list pass ImTestImage test. }
|
|
||||||
function ImTestImagesInList(ImageList: TImageDataList): Boolean; cdecl;
|
|
||||||
{ Frees image list and all images in it.}
|
|
||||||
function ImFreeImageList(var ImageList: TImageDataList): Boolean; cdecl;
|
|
||||||
|
|
||||||
{ Look at LoadImageFromFile for details.}
|
|
||||||
function ImLoadImageFromFile(FileName: PAnsiChar; var Image: TImageData): Boolean; cdecl;
|
|
||||||
{ Look at LoadImageFromMemory for details.}
|
|
||||||
function ImLoadImageFromMemory(Data: Pointer; Size: LongInt; var Image: TImageData): Boolean; cdecl;
|
|
||||||
{ Look at LoadMultiImageFromFile for details.}
|
|
||||||
function ImLoadMultiImageFromFile(FileName: PAnsiChar; var ImageList: TImageDataList): Boolean; cdecl;
|
|
||||||
{ Look at LoadMultiImageFromMemory for details.}
|
|
||||||
function ImLoadMultiImageFromMemory(Data: Pointer; Size: LongInt;
|
|
||||||
var ImageList: TImageDataList): Boolean; cdecl;
|
|
||||||
|
|
||||||
{ Look at SaveImageToFile for details.}
|
|
||||||
function ImSaveImageToFile(FileName: PAnsiChar; const Image: TImageData): Boolean; cdecl;
|
|
||||||
{ Look at SaveImageToMemory for details.}
|
|
||||||
function ImSaveImageToMemory(Ext: PAnsiChar; Data: Pointer; var Size: LongInt;
|
|
||||||
const Image: TImageData): Boolean; cdecl;
|
|
||||||
{ Look at SaveMultiImageToFile for details.}
|
|
||||||
function ImSaveMultiImageToFile(FileName: PAnsiChar; ImageList: TImageDataList): Boolean; cdecl;
|
|
||||||
{ Look at SaveMultiImageToMemory for details.}
|
|
||||||
function ImSaveMultiImageToMemory(Ext: PAnsiChar; Data: Pointer; Size: PLongInt;
|
|
||||||
ImageList: TImageDataList): Boolean; cdecl;
|
|
||||||
|
|
||||||
{ Look at CloneImage for details.}
|
|
||||||
function ImCloneImage(const Image: TImageData; var Clone: TImageData): Boolean; cdecl;
|
|
||||||
{ Look at ConvertImage for details.}
|
|
||||||
function ImConvertImage(var Image: TImageData; DestFormat: TImageFormat): Boolean; cdecl;
|
|
||||||
{ Look at FlipImage for details.}
|
|
||||||
function ImFlipImage(var Image: TImageData): Boolean; cdecl;
|
|
||||||
{ Look at MirrorImage for details.}
|
|
||||||
function ImMirrorImage(var Image: TImageData): Boolean; cdecl;
|
|
||||||
{ Look at ResizeImage for details.}
|
|
||||||
function ImResizeImage(var Image: TImageData; NewWidth, NewHeight: LongInt;
|
|
||||||
Filter: TResizeFilter): Boolean; cdecl;
|
|
||||||
{ Look at SwapChannels for details.}
|
|
||||||
function ImSwapChannels(var Image: TImageData; SrcChannel, DstChannel: LongInt): Boolean; cdecl;
|
|
||||||
{ Look at ReduceColors for details.}
|
|
||||||
function ImReduceColors(var Image: TImageData; MaxColors: LongInt): Boolean; cdecl;
|
|
||||||
{ Look at GenerateMipMaps for details.}
|
|
||||||
function ImGenerateMipMaps(const Image: TImageData; Levels: LongInt;
|
|
||||||
var MipMaps: TImageDataList): Boolean; cdecl;
|
|
||||||
{ Look at MapImageToPalette for details.}
|
|
||||||
function ImMapImageToPalette(var Image: TImageData; Pal: PPalette32;
|
|
||||||
Entries: LongInt): Boolean; cdecl;
|
|
||||||
{ Look at SplitImage for details.}
|
|
||||||
function ImSplitImage(var Image: TImageData; var Chunks: TImageDataList;
|
|
||||||
ChunkWidth, ChunkHeight: LongInt; var XChunks, YChunks: LongInt;
|
|
||||||
PreserveSize: Boolean; Fill: Pointer): Boolean; cdecl;
|
|
||||||
{ Look at MakePaletteForImages for details.}
|
|
||||||
function ImMakePaletteForImages(Images: TImageDataList; Pal: PPalette32;
|
|
||||||
MaxColors: LongInt; ConvertImages: Boolean): Boolean; cdecl;
|
|
||||||
{ Look at RotateImage for details.}
|
|
||||||
function ImRotateImage(var Image: TImageData; Angle: Single): Boolean; cdecl;
|
|
||||||
|
|
||||||
{ Look at CopyRect for details.}
|
|
||||||
function ImCopyRect(const SrcImage: TImageData; SrcX, SrcY, Width, Height: LongInt;
|
|
||||||
var DstImage: TImageData; DstX, DstY: LongInt): Boolean; cdecl;
|
|
||||||
{ Look at FillRect for details.}
|
|
||||||
function ImFillRect(var Image: TImageData; X, Y, Width, Height: LongInt;
|
|
||||||
Fill: Pointer): Boolean; cdecl;
|
|
||||||
{ Look at ReplaceColor for details.}
|
|
||||||
function ImReplaceColor(var Image: TImageData; X, Y, Width, Height: LongInt;
|
|
||||||
OldPixel, NewPixel: Pointer): Boolean; cdecl;
|
|
||||||
{ Look at StretchRect for details.}
|
|
||||||
function ImStretchRect(const SrcImage: TImageData; SrcX, SrcY, SrcWidth,
|
|
||||||
SrcHeight: LongInt; var DstImage: TImageData; DstX, DstY, DstWidth,
|
|
||||||
DstHeight: LongInt; Filter: TResizeFilter): Boolean; cdecl;
|
|
||||||
{ Look at GetPixelDirect for details.}
|
|
||||||
procedure ImGetPixelDirect(const Image: TImageData; X, Y: LongInt; Pixel: Pointer); cdecl;
|
|
||||||
{ Look at SetPixelDirect for details.}
|
|
||||||
procedure ImSetPixelDirect(const Image: TImageData; X, Y: LongInt; Pixel: Pointer); cdecl;
|
|
||||||
{ Look at GetPixel32 for details.}
|
|
||||||
function ImGetPixel32(const Image: TImageData; X, Y: LongInt): TColor32Rec; cdecl;
|
|
||||||
{ Look at SetPixel32 for details.}
|
|
||||||
procedure ImSetPixel32(const Image: TImageData; X, Y: LongInt; const Color: TColor32Rec); cdecl;
|
|
||||||
{ Look at GetPixelFP for details.}
|
|
||||||
function ImGetPixelFP(const Image: TImageData; X, Y: LongInt): TColorFPRec; cdecl;
|
|
||||||
{ Look at SetPixelFP for details.}
|
|
||||||
procedure ImSetPixelFP(const Image: TImageData; X, Y: LongInt; const Color: TColorFPRec); cdecl;
|
|
||||||
|
|
||||||
{ Look at NewPalette for details.}
|
|
||||||
function ImNewPalette(Entries: LongInt; var Pal: PPalette32): Boolean; cdecl;
|
|
||||||
{ Look at FreePalette for details.}
|
|
||||||
function ImFreePalette(var Pal: PPalette32): Boolean; cdecl;
|
|
||||||
{ Look at CopyPalette for details.}
|
|
||||||
function ImCopyPalette(SrcPal, DstPal: PPalette32; SrcIdx, DstIdx, Count: LongInt): Boolean; cdecl;
|
|
||||||
{ Look at FindColor for details.}
|
|
||||||
function ImFindColor(Pal: PPalette32; Entries: LongInt; Color: TColor32): LongInt; cdecl;
|
|
||||||
{ Look at FillGrayscalePalette for details.}
|
|
||||||
function ImFillGrayscalePalette(Pal: PPalette32; Entries: LongInt): Boolean; cdecl;
|
|
||||||
{ Look at FillCustomPalette for details.}
|
|
||||||
function ImFillCustomPalette(Pal: PPalette32; Entries: LongInt; RBits, GBits,
|
|
||||||
BBits: Byte; Alpha: Byte): Boolean; cdecl;
|
|
||||||
{ Look at SwapChannelsOfPalette for details.}
|
|
||||||
function ImSwapChannelsOfPalette(Pal: PPalette32; Entries, SrcChannel,
|
|
||||||
DstChannel: LongInt): Boolean; cdecl;
|
|
||||||
|
|
||||||
{ Look at SetOption for details.}
|
|
||||||
function ImSetOption(OptionId, Value: LongInt): Boolean; cdecl;
|
|
||||||
{ Look at GetOption for details.}
|
|
||||||
function ImGetOption(OptionId: LongInt): LongInt; cdecl;
|
|
||||||
{ Look at PushOptions for details.}
|
|
||||||
function ImPushOptions: Boolean; cdecl;
|
|
||||||
{ Look at PopOptions for details.}
|
|
||||||
function ImPopOptions: Boolean; cdecl;
|
|
||||||
|
|
||||||
{ Look at GetImageFormatInfo for details.}
|
|
||||||
function ImGetImageFormatInfo(Format: TImageFormat; var Info: TImageFormatInfo): Boolean; cdecl;
|
|
||||||
{ Look at GetPixelsSize for details.}
|
|
||||||
function ImGetPixelsSize(Format: TImageFormat; Width, Height: LongInt): LongInt; cdecl;
|
|
||||||
|
|
||||||
{ Look at SetUserFileIO for details.}
|
|
||||||
procedure ImSetUserFileIO(OpenReadProc: TOpenReadProc; OpenWriteProc:
|
|
||||||
TOpenWriteProc; CloseProc: TCloseProc; EofProc: TEofProc; SeekProc: TSeekProc;
|
|
||||||
TellProc: TTellProc; ReadProc: TReadProc; WriteProc: TWriteProc); cdecl;
|
|
||||||
{ Look at ResetFileIO for details.}
|
|
||||||
procedure ImResetFileIO; cdecl;
|
|
||||||
|
|
||||||
{ These are only for documentation generation reasons.}
|
|
||||||
{ Loads Imaging functions from dll/so library.}
|
|
||||||
function ImLoadLibrary: Boolean;
|
|
||||||
{ Frees Imaging functions loaded from dll/so and releases library.}
|
|
||||||
function ImFreeLibrary: Boolean;
|
|
||||||
|
|
||||||
implementation
|
|
||||||
|
|
||||||
uses
|
|
||||||
SysUtils,
|
|
||||||
ImagingUtility;
|
|
||||||
|
|
||||||
function ImLoadLibrary: Boolean; begin Result := True; end;
|
|
||||||
function ImFreeLibrary: Boolean; begin Result := True; end;
|
|
||||||
|
|
||||||
type
|
|
||||||
TInternalList = record
|
|
||||||
List: TDynImageDataArray;
|
|
||||||
end;
|
|
||||||
PInternalList = ^TInternalList;
|
|
||||||
|
|
||||||
procedure ImGetVersion(var Major, Minor, Patch: LongInt);
|
|
||||||
begin
|
|
||||||
Major := ImagingVersionMajor;
|
|
||||||
Minor := ImagingVersionMinor;
|
|
||||||
Patch := ImagingVersionPatch;
|
|
||||||
end;
|
|
||||||
|
|
||||||
procedure ImInitImage(var Image: TImageData);
|
|
||||||
begin
|
|
||||||
try
|
|
||||||
Imaging.InitImage(Image);
|
|
||||||
except
|
|
||||||
end;
|
|
||||||
end;
|
|
||||||
|
|
||||||
function ImNewImage(Width, Height: LongInt; Format: TImageFormat;
|
|
||||||
var Image: TImageData): Boolean;
|
|
||||||
begin
|
|
||||||
try
|
|
||||||
Result := Imaging.NewImage(Width, Height, Format, Image);
|
|
||||||
except
|
|
||||||
Result := False;
|
|
||||||
end;
|
|
||||||
end;
|
|
||||||
|
|
||||||
function ImTestImage(var Image: TImageData): Boolean;
|
|
||||||
begin
|
|
||||||
try
|
|
||||||
Result := Imaging.TestImage(Image);
|
|
||||||
except
|
|
||||||
Result := False;
|
|
||||||
end;
|
|
||||||
end;
|
|
||||||
|
|
||||||
function ImFreeImage(var Image: TImageData): Boolean;
|
|
||||||
begin
|
|
||||||
try
|
|
||||||
Imaging.FreeImage(Image);
|
|
||||||
Result := True;
|
|
||||||
except
|
|
||||||
Result := False;
|
|
||||||
end;
|
|
||||||
end;
|
|
||||||
|
|
||||||
function ImDetermineFileFormat(FileName, Ext: PAnsiChar): Boolean;
|
|
||||||
var
|
|
||||||
S: string;
|
|
||||||
begin
|
|
||||||
try
|
|
||||||
S := Imaging.DetermineFileFormat(FileName);
|
|
||||||
Result := S <> '';
|
|
||||||
StrCopy(Ext, PAnsiChar(AnsiString(S)));
|
|
||||||
except
|
|
||||||
Result := False;
|
|
||||||
end;
|
|
||||||
end;
|
|
||||||
|
|
||||||
function ImDetermineMemoryFormat(Data: Pointer; Size: LongInt; Ext: PAnsiChar): Boolean;
|
|
||||||
var
|
|
||||||
S: string;
|
|
||||||
begin
|
|
||||||
try
|
|
||||||
S := Imaging.DetermineMemoryFormat(Data, Size);
|
|
||||||
Result := S <> '';
|
|
||||||
StrCopy(Ext, PAnsiChar(AnsiString(S)));
|
|
||||||
except
|
|
||||||
Result := False;
|
|
||||||
end;
|
|
||||||
end;
|
|
||||||
|
|
||||||
function ImIsFileFormatSupported(FileName: PAnsiChar): Boolean;
|
|
||||||
begin
|
|
||||||
try
|
|
||||||
Result := Imaging.IsFileFormatSupported(FileName);
|
|
||||||
except
|
|
||||||
Result := False;
|
|
||||||
end;
|
|
||||||
end;
|
|
||||||
|
|
||||||
function ImEnumFileFormats(var Index: LongInt; Name, DefaultExt, Masks: PAnsiChar;
|
|
||||||
var CanSave, IsMultiImageFormat: Boolean): Boolean;
|
|
||||||
var
|
|
||||||
StrName, StrDefaultExt, StrMasks: string;
|
|
||||||
begin
|
|
||||||
try
|
|
||||||
Result := Imaging.EnumFileFormats(Index, StrName, StrDefaultExt, StrMasks, CanSave,
|
|
||||||
IsMultiImageFormat);
|
|
||||||
StrCopy(Name, PAnsiChar(AnsiString(StrName)));
|
|
||||||
StrCopy(DefaultExt, PAnsiChar(AnsiString(StrDefaultExt)));
|
|
||||||
StrCopy(Masks, PAnsiChar(AnsiString(StrMasks)));
|
|
||||||
except
|
|
||||||
Result := False;
|
|
||||||
end;
|
|
||||||
end;
|
|
||||||
|
|
||||||
function ImInitImageList(Size: LongInt; var ImageList: TImageDataList): Boolean;
|
|
||||||
var
|
|
||||||
Int: PInternalList;
|
|
||||||
begin
|
|
||||||
try
|
|
||||||
try
|
|
||||||
ImFreeImageList(ImageList);
|
|
||||||
except
|
|
||||||
end;
|
|
||||||
New(Int);
|
|
||||||
SetLength(Int.List, Size);
|
|
||||||
ImageList := TImageDataList(Int);
|
|
||||||
Result := True;
|
|
||||||
except
|
|
||||||
Result := False;
|
|
||||||
ImageList := nil;
|
|
||||||
end;
|
|
||||||
end;
|
|
||||||
|
|
||||||
function ImGetImageListSize(ImageList: TImageDataList): LongInt;
|
|
||||||
begin
|
|
||||||
try
|
|
||||||
Result := Length(PInternalList(ImageList).List);
|
|
||||||
except
|
|
||||||
Result := -1;
|
|
||||||
end;
|
|
||||||
end;
|
|
||||||
|
|
||||||
function ImGetImageListElement(ImageList: TImageDataList; Index: LongInt;
|
|
||||||
var OutImage: TImageData): Boolean;
|
|
||||||
begin
|
|
||||||
try
|
|
||||||
Index := ClampInt(Index, 0, Length(PInternalList(ImageList).List) - 1);
|
|
||||||
ImCloneImage(PInternalList(ImageList).List[Index], OutImage);
|
|
||||||
Result := True;
|
|
||||||
except
|
|
||||||
Result := False;
|
|
||||||
end;
|
|
||||||
end;
|
|
||||||
|
|
||||||
function ImSetImageListSize(ImageList: TImageDataList; NewSize: LongInt):
|
|
||||||
Boolean;
|
|
||||||
var
|
|
||||||
I, OldSize: LongInt;
|
|
||||||
begin
|
|
||||||
try
|
|
||||||
OldSize := Length(PInternalList(ImageList).List);
|
|
||||||
if NewSize < OldSize then
|
|
||||||
for I := NewSize to OldSize - 1 do
|
|
||||||
Imaging.FreeImage(PInternalList(ImageList).List[I]);
|
|
||||||
SetLength(PInternalList(ImageList).List, NewSize);
|
|
||||||
Result := True;
|
|
||||||
except
|
|
||||||
Result := False;
|
|
||||||
end;
|
|
||||||
end;
|
|
||||||
|
|
||||||
function ImSetImageListElement(ImageList: TImageDataList; Index: LongInt;
|
|
||||||
const InImage: TImageData): Boolean;
|
|
||||||
begin
|
|
||||||
try
|
|
||||||
Index := ClampInt(Index, 0, Length(PInternalList(ImageList).List) - 1);
|
|
||||||
ImCloneImage(InImage, PInternalList(ImageList).List[Index]);
|
|
||||||
Result := True;
|
|
||||||
except
|
|
||||||
Result := False;
|
|
||||||
end;
|
|
||||||
end;
|
|
||||||
|
|
||||||
function ImTestImagesInList(ImageList: TImageDataList): Boolean;
|
|
||||||
var
|
|
||||||
I: LongInt;
|
|
||||||
Arr: TDynImageDataArray;
|
|
||||||
begin
|
|
||||||
Arr := nil;
|
|
||||||
try
|
|
||||||
Arr := PInternalList(ImageList).List;
|
|
||||||
Result := True;
|
|
||||||
for I := 0 to Length(Arr) - 1 do
|
|
||||||
begin
|
|
||||||
Result := Result and Imaging.TestImage(Arr[I]);
|
|
||||||
if not Result then Break;
|
|
||||||
end;
|
|
||||||
except
|
|
||||||
Result := False;
|
|
||||||
end;
|
|
||||||
end;
|
|
||||||
|
|
||||||
function ImFreeImageList(var ImageList: TImageDataList): Boolean;
|
|
||||||
var
|
|
||||||
Int: PInternalList;
|
|
||||||
begin
|
|
||||||
try
|
|
||||||
if ImageList <> nil then
|
|
||||||
begin
|
|
||||||
Int := PInternalList(ImageList);
|
|
||||||
FreeImagesInArray(Int.List);
|
|
||||||
Dispose(Int);
|
|
||||||
ImageList := nil;
|
|
||||||
end;
|
|
||||||
Result := True;
|
|
||||||
except
|
|
||||||
Result := False;
|
|
||||||
end;
|
|
||||||
end;
|
|
||||||
|
|
||||||
function ImLoadImageFromFile(FileName: PAnsiChar; var Image: TImageData): Boolean;
|
|
||||||
begin
|
|
||||||
try
|
|
||||||
Result := Imaging.LoadImageFromFile(FileName, Image);
|
|
||||||
except
|
|
||||||
Result := False;
|
|
||||||
end;
|
|
||||||
end;
|
|
||||||
|
|
||||||
function ImLoadImageFromMemory(Data: Pointer; Size: LongInt; var Image: TImageData): Boolean;
|
|
||||||
begin
|
|
||||||
try
|
|
||||||
Result := Imaging.LoadImageFromMemory(Data, Size, Image);
|
|
||||||
except
|
|
||||||
Result := False;
|
|
||||||
end;
|
|
||||||
end;
|
|
||||||
|
|
||||||
function ImLoadMultiImageFromFile(FileName: PAnsiChar; var ImageList: TImageDataList):
|
|
||||||
Boolean;
|
|
||||||
begin
|
|
||||||
try
|
|
||||||
ImInitImageList(0, ImageList);
|
|
||||||
Result := Imaging.LoadMultiImageFromFile(FileName,
|
|
||||||
PInternalList(ImageList).List);
|
|
||||||
except
|
|
||||||
Result := False;
|
|
||||||
end;
|
|
||||||
end;
|
|
||||||
|
|
||||||
function ImLoadMultiImageFromMemory(Data: Pointer; Size: LongInt;
|
|
||||||
var ImageList: TImageDataList): Boolean;
|
|
||||||
begin
|
|
||||||
try
|
|
||||||
ImInitImageList(0, ImageList);
|
|
||||||
Result := Imaging.LoadMultiImageFromMemory(Data, Size, PInternalList(ImageList).List);
|
|
||||||
except
|
|
||||||
Result := False;
|
|
||||||
end;
|
|
||||||
end;
|
|
||||||
|
|
||||||
function ImSaveImageToFile(FileName: PAnsiChar; const Image: TImageData): Boolean;
|
|
||||||
begin
|
|
||||||
try
|
|
||||||
Result := Imaging.SaveImageToFile(FileName, Image);
|
|
||||||
except
|
|
||||||
Result := False;
|
|
||||||
end;
|
|
||||||
end;
|
|
||||||
|
|
||||||
function ImSaveImageToMemory(Ext: PAnsiChar; Data: Pointer; var Size: LongInt;
|
|
||||||
const Image: TImageData): Boolean;
|
|
||||||
begin
|
|
||||||
try
|
|
||||||
Result := Imaging.SaveImageToMemory(Ext, Data, Size, Image);
|
|
||||||
except
|
|
||||||
Result := False;
|
|
||||||
end;
|
|
||||||
end;
|
|
||||||
|
|
||||||
function ImSaveMultiImageToFile(FileName: PAnsiChar;
|
|
||||||
ImageList: TImageDataList): Boolean;
|
|
||||||
begin
|
|
||||||
try
|
|
||||||
Result := Imaging.SaveMultiImageToFile(FileName,
|
|
||||||
PInternalList(ImageList).List);
|
|
||||||
except
|
|
||||||
Result := False;
|
|
||||||
end;
|
|
||||||
end;
|
|
||||||
|
|
||||||
function ImSaveMultiImageToMemory(Ext: PAnsiChar; Data: Pointer; Size: PLongInt;
|
|
||||||
ImageList: TImageDataList): Boolean;
|
|
||||||
begin
|
|
||||||
try
|
|
||||||
Result := Imaging.SaveMultiImageToMemory(Ext, Data, Size^,
|
|
||||||
PInternalList(ImageList).List);
|
|
||||||
except
|
|
||||||
Result := False;
|
|
||||||
end;
|
|
||||||
end;
|
|
||||||
|
|
||||||
function ImCloneImage(const Image: TImageData; var Clone: TImageData): Boolean;
|
|
||||||
begin
|
|
||||||
try
|
|
||||||
Result := Imaging.CloneImage(Image, Clone);
|
|
||||||
except
|
|
||||||
Result := False;
|
|
||||||
end;
|
|
||||||
end;
|
|
||||||
|
|
||||||
function ImConvertImage(var Image: TImageData; DestFormat: TImageFormat): Boolean;
|
|
||||||
begin
|
|
||||||
try
|
|
||||||
Result := Imaging.ConvertImage(Image, DestFormat);
|
|
||||||
except
|
|
||||||
Result := False;
|
|
||||||
end;
|
|
||||||
end;
|
|
||||||
|
|
||||||
function ImFlipImage(var Image: TImageData): Boolean;
|
|
||||||
begin
|
|
||||||
try
|
|
||||||
Result := Imaging.FlipImage(Image);
|
|
||||||
except
|
|
||||||
Result := False;
|
|
||||||
end;
|
|
||||||
end;
|
|
||||||
|
|
||||||
function ImMirrorImage(var Image: TImageData): Boolean;
|
|
||||||
begin
|
|
||||||
try
|
|
||||||
Result := Imaging.MirrorImage(Image);
|
|
||||||
except
|
|
||||||
Result := False;
|
|
||||||
end;
|
|
||||||
end;
|
|
||||||
|
|
||||||
function ImResizeImage(var Image: TImageData; NewWidth, NewHeight: LongInt;
|
|
||||||
Filter: TResizeFilter): Boolean;
|
|
||||||
begin
|
|
||||||
try
|
|
||||||
Result := Imaging.ResizeImage(Image, NewWidth, NewHeight, Filter);
|
|
||||||
except
|
|
||||||
Result := False;
|
|
||||||
end;
|
|
||||||
end;
|
|
||||||
|
|
||||||
function ImSwapChannels(var Image: TImageData; SrcChannel, DstChannel: LongInt):
|
|
||||||
Boolean;
|
|
||||||
begin
|
|
||||||
try
|
|
||||||
Result := Imaging.SwapChannels(Image, SrcChannel, DstChannel);
|
|
||||||
except
|
|
||||||
Result := False;
|
|
||||||
end;
|
|
||||||
end;
|
|
||||||
|
|
||||||
function ImReduceColors(var Image: TImageData; MaxColors: LongInt): Boolean;
|
|
||||||
begin
|
|
||||||
try
|
|
||||||
Result := Imaging.ReduceColors(Image, MaxColors);
|
|
||||||
except
|
|
||||||
Result := False;
|
|
||||||
end;
|
|
||||||
end;
|
|
||||||
|
|
||||||
function ImGenerateMipMaps(const Image: TImageData; Levels: LongInt;
|
|
||||||
var MipMaps: TImageDataList): Boolean;
|
|
||||||
begin
|
|
||||||
try
|
|
||||||
ImInitImageList(0, MipMaps);
|
|
||||||
Result := Imaging.GenerateMipMaps(Image, Levels,
|
|
||||||
PInternalList(MipMaps).List);
|
|
||||||
except
|
|
||||||
Result := False;
|
|
||||||
end;
|
|
||||||
end;
|
|
||||||
|
|
||||||
function ImMapImageToPalette(var Image: TImageData; Pal: PPalette32;
|
|
||||||
Entries: LongInt): Boolean;
|
|
||||||
begin
|
|
||||||
try
|
|
||||||
Result := Imaging.MapImageToPalette(Image, Pal, Entries);
|
|
||||||
except
|
|
||||||
Result := False;
|
|
||||||
end;
|
|
||||||
end;
|
|
||||||
|
|
||||||
function ImSplitImage(var Image: TImageData; var Chunks: TImageDataList;
|
|
||||||
ChunkWidth, ChunkHeight: LongInt; var XChunks, YChunks: LongInt;
|
|
||||||
PreserveSize: Boolean; Fill: Pointer): Boolean;
|
|
||||||
begin
|
|
||||||
try
|
|
||||||
ImInitImageList(0, Chunks);
|
|
||||||
Result := Imaging.SplitImage(Image, PInternalList(Chunks).List,
|
|
||||||
ChunkWidth, ChunkHeight, XChunks, YChunks, PreserveSize, Fill);
|
|
||||||
except
|
|
||||||
Result := False;
|
|
||||||
end;
|
|
||||||
end;
|
|
||||||
|
|
||||||
function ImMakePaletteForImages(Images: TImageDataList; Pal: PPalette32;
|
|
||||||
MaxColors: LongInt; ConvertImages: Boolean): Boolean;
|
|
||||||
begin
|
|
||||||
try
|
|
||||||
Result := Imaging.MakePaletteForImages(PInternalList(Images).List,
|
|
||||||
Pal, MaxColors, ConvertImages);
|
|
||||||
except
|
|
||||||
Result := False;
|
|
||||||
end;
|
|
||||||
end;
|
|
||||||
|
|
||||||
function ImRotateImage(var Image: TImageData; Angle: Single): Boolean;
|
|
||||||
begin
|
|
||||||
try
|
|
||||||
Result := Imaging.RotateImage(Image, Angle);
|
|
||||||
except
|
|
||||||
Result := False;
|
|
||||||
end;
|
|
||||||
end;
|
|
||||||
|
|
||||||
function ImCopyRect(const SrcImage: TImageData; SrcX, SrcY, Width, Height: LongInt;
|
|
||||||
var DstImage: TImageData; DstX, DstY: LongInt): Boolean; cdecl;
|
|
||||||
begin
|
|
||||||
try
|
|
||||||
Result := Imaging.CopyRect(SrcImage, SrcX, SrcY, Width, Height,
|
|
||||||
DstImage, DstX, DstY);
|
|
||||||
except
|
|
||||||
Result := False;
|
|
||||||
end;
|
|
||||||
end;
|
|
||||||
|
|
||||||
function ImFillRect(var Image: TImageData; X, Y, Width, Height: LongInt;
|
|
||||||
Fill: Pointer): Boolean;
|
|
||||||
begin
|
|
||||||
try
|
|
||||||
Result := Imaging.FillRect(Image, X, Y, Width, Height, Fill);
|
|
||||||
except
|
|
||||||
Result := False;
|
|
||||||
end;
|
|
||||||
end;
|
|
||||||
|
|
||||||
function ImReplaceColor(var Image: TImageData; X, Y, Width, Height: LongInt;
|
|
||||||
OldPixel, NewPixel: Pointer): Boolean;
|
|
||||||
begin
|
|
||||||
try
|
|
||||||
Result := Imaging.ReplaceColor(Image, X, Y, Width, Height, OldPixel, NewPixel);
|
|
||||||
except
|
|
||||||
Result := False;
|
|
||||||
end;
|
|
||||||
end;
|
|
||||||
|
|
||||||
function ImStretchRect(const SrcImage: TImageData; SrcX, SrcY, SrcWidth,
|
|
||||||
SrcHeight: LongInt; var DstImage: TImageData; DstX, DstY, DstWidth,
|
|
||||||
DstHeight: LongInt; Filter: TResizeFilter): Boolean; cdecl;
|
|
||||||
begin
|
|
||||||
try
|
|
||||||
Result := Imaging.StretchRect(SrcImage, SrcX, SrcY, SrcWidth, SrcHeight,
|
|
||||||
DstImage, DstX, DstY, DstWidth, DstHeight, Filter);
|
|
||||||
except
|
|
||||||
Result := False;
|
|
||||||
end;
|
|
||||||
end;
|
|
||||||
|
|
||||||
procedure ImGetPixelDirect(const Image: TImageData; X, Y: LongInt; Pixel: Pointer);
|
|
||||||
begin
|
|
||||||
try
|
|
||||||
Imaging.GetPixelDirect(Image, X, Y, Pixel);
|
|
||||||
except
|
|
||||||
end;
|
|
||||||
end;
|
|
||||||
|
|
||||||
procedure ImSetPixelDirect(const Image: TImageData; X, Y: LongInt; Pixel: Pointer);
|
|
||||||
begin
|
|
||||||
try
|
|
||||||
Imaging.SetPixelDirect(Image, X, Y, Pixel);
|
|
||||||
except
|
|
||||||
end;
|
|
||||||
end;
|
|
||||||
|
|
||||||
function ImGetPixel32(const Image: TImageData; X, Y: LongInt): TColor32Rec; cdecl;
|
|
||||||
begin
|
|
||||||
try
|
|
||||||
Result := Imaging.GetPixel32(Image, X, Y);
|
|
||||||
except
|
|
||||||
Result.Color := 0;
|
|
||||||
end;
|
|
||||||
end;
|
|
||||||
|
|
||||||
procedure ImSetPixel32(const Image: TImageData; X, Y: LongInt; const Color: TColor32Rec);
|
|
||||||
begin
|
|
||||||
try
|
|
||||||
Imaging.SetPixel32(Image, X, Y, Color);
|
|
||||||
except
|
|
||||||
end;
|
|
||||||
end;
|
|
||||||
|
|
||||||
function ImGetPixelFP(const Image: TImageData; X, Y: LongInt): TColorFPRec; cdecl;
|
|
||||||
begin
|
|
||||||
try
|
|
||||||
Result := Imaging.GetPixelFP(Image, X, Y);
|
|
||||||
except
|
|
||||||
FillChar(Result, SizeOf(Result), 0);
|
|
||||||
end;
|
|
||||||
end;
|
|
||||||
|
|
||||||
procedure ImSetPixelFP(const Image: TImageData; X, Y: LongInt; const Color: TColorFPRec);
|
|
||||||
begin
|
|
||||||
try
|
|
||||||
Imaging.SetPixelFP(Image, X, Y, Color);
|
|
||||||
except
|
|
||||||
end;
|
|
||||||
end;
|
|
||||||
|
|
||||||
function ImNewPalette(Entries: LongInt; var Pal: PPalette32): Boolean;
|
|
||||||
begin
|
|
||||||
try
|
|
||||||
Imaging.NewPalette(Entries, Pal);
|
|
||||||
Result := True;
|
|
||||||
except
|
|
||||||
Result := False;
|
|
||||||
end;
|
|
||||||
end;
|
|
||||||
|
|
||||||
function ImFreePalette(var Pal: PPalette32): Boolean;
|
|
||||||
begin
|
|
||||||
try
|
|
||||||
Imaging.FreePalette(Pal);
|
|
||||||
Result := True;
|
|
||||||
except
|
|
||||||
Result := False;
|
|
||||||
end;
|
|
||||||
end;
|
|
||||||
|
|
||||||
function ImCopyPalette(SrcPal, DstPal: PPalette32; SrcIdx, DstIdx, Count: LongInt): Boolean;
|
|
||||||
begin
|
|
||||||
try
|
|
||||||
Imaging.CopyPalette(SrcPal, DstPal, SrcIdx, DstIdx, Count);
|
|
||||||
Result := True;
|
|
||||||
except
|
|
||||||
Result := False;
|
|
||||||
end;
|
|
||||||
end;
|
|
||||||
|
|
||||||
function ImFindColor(Pal: PPalette32; Entries: LongInt; Color: TColor32): LongInt;
|
|
||||||
begin
|
|
||||||
try
|
|
||||||
Result := Imaging.FindColor(Pal, Entries, Color);
|
|
||||||
except
|
|
||||||
Result := 0;
|
|
||||||
end;
|
|
||||||
end;
|
|
||||||
|
|
||||||
function ImFillGrayscalePalette(Pal: PPalette32; Entries: LongInt): Boolean;
|
|
||||||
begin
|
|
||||||
try
|
|
||||||
Imaging.FillGrayscalePalette(Pal, Entries);
|
|
||||||
Result := True;
|
|
||||||
except
|
|
||||||
Result := False;
|
|
||||||
end;
|
|
||||||
end;
|
|
||||||
|
|
||||||
function ImFillCustomPalette(Pal: PPalette32; Entries: LongInt; RBits, GBits,
|
|
||||||
BBits: Byte; Alpha: Byte): Boolean;
|
|
||||||
begin
|
|
||||||
try
|
|
||||||
Imaging.FillCustomPalette(Pal, Entries, RBits, GBits, BBits, Alpha);
|
|
||||||
Result := True;
|
|
||||||
except
|
|
||||||
Result := False;
|
|
||||||
end;
|
|
||||||
end;
|
|
||||||
|
|
||||||
function ImSwapChannelsOfPalette(Pal: PPalette32; Entries, SrcChannel,
|
|
||||||
DstChannel: LongInt): Boolean;
|
|
||||||
begin
|
|
||||||
try
|
|
||||||
Imaging.SwapChannelsOfPalette(Pal, Entries, SrcChannel, DstChannel);
|
|
||||||
Result := True;
|
|
||||||
except
|
|
||||||
Result := False;
|
|
||||||
end;
|
|
||||||
end;
|
|
||||||
|
|
||||||
function ImSetOption(OptionId, Value: LongInt): Boolean;
|
|
||||||
begin
|
|
||||||
try
|
|
||||||
Result := Imaging.SetOption(OptionId, Value);
|
|
||||||
except
|
|
||||||
Result := False;
|
|
||||||
end;
|
|
||||||
end;
|
|
||||||
|
|
||||||
function ImGetOption(OptionId: LongInt): LongInt;
|
|
||||||
begin
|
|
||||||
try
|
|
||||||
Result := GetOption(OptionId);
|
|
||||||
except
|
|
||||||
Result := InvalidOption;
|
|
||||||
end;
|
|
||||||
end;
|
|
||||||
|
|
||||||
function ImPushOptions: Boolean;
|
|
||||||
begin
|
|
||||||
try
|
|
||||||
Result := Imaging.PushOptions;
|
|
||||||
except
|
|
||||||
Result := False;
|
|
||||||
end;
|
|
||||||
end;
|
|
||||||
|
|
||||||
function ImPopOptions: Boolean;
|
|
||||||
begin
|
|
||||||
try
|
|
||||||
Result := Imaging.PopOptions;
|
|
||||||
except
|
|
||||||
Result := False;
|
|
||||||
end;
|
|
||||||
end;
|
|
||||||
|
|
||||||
function ImGetImageFormatInfo(Format: TImageFormat; var Info: TImageFormatInfo): Boolean;
|
|
||||||
begin
|
|
||||||
try
|
|
||||||
Result := Imaging.GetImageFormatInfo(Format, Info);
|
|
||||||
except
|
|
||||||
Result := False;
|
|
||||||
end;
|
|
||||||
end;
|
|
||||||
|
|
||||||
function ImGetPixelsSize(Format: TImageFormat; Width, Height: LongInt): LongInt;
|
|
||||||
begin
|
|
||||||
try
|
|
||||||
Result := Imaging.GetPixelsSize(Format, Width, Height);
|
|
||||||
except
|
|
||||||
Result := 0;
|
|
||||||
end;
|
|
||||||
end;
|
|
||||||
|
|
||||||
procedure ImSetUserFileIO(OpenReadProc: TOpenReadProc; OpenWriteProc:
|
|
||||||
TOpenWriteProc; CloseProc: TCloseProc; EofProc: TEofProc; SeekProc: TSeekProc;
|
|
||||||
TellProc: TTellProc; ReadProc: TReadProc; WriteProc: TWriteProc);
|
|
||||||
begin
|
|
||||||
try
|
|
||||||
Imaging.SetUserFileIO(OpenReadProc, OpenWriteProc, CloseProc, EofProc,
|
|
||||||
SeekProc, TellProc, ReadProc, WriteProc);
|
|
||||||
except
|
|
||||||
end;
|
|
||||||
end;
|
|
||||||
|
|
||||||
procedure ImResetFileIO;
|
|
||||||
begin
|
|
||||||
try
|
|
||||||
Imaging.ResetFileIO;
|
|
||||||
except
|
|
||||||
end;
|
|
||||||
end;
|
|
||||||
|
|
||||||
{
|
|
||||||
Changes/Bug Fixes:
|
|
||||||
|
|
||||||
-- TODOS ----------------------------------------------------
|
|
||||||
- nothing now
|
|
||||||
|
|
||||||
-- 0.26.3 ---------------------------------------------------
|
|
||||||
- changed PChars to PAnsiChars and some more D2009 friendly
|
|
||||||
casts.
|
|
||||||
|
|
||||||
-- 0.19 -----------------------------------------------------
|
|
||||||
- updated to reflect changes in low level interface (added pixel set/get, ...)
|
|
||||||
- changed ImInitImage to procedure to reflect change in Imaging.pas
|
|
||||||
- added ImIsFileFormatSupported
|
|
||||||
|
|
||||||
-- 0.15 -----------------------------------------------------
|
|
||||||
- behaviour of ImGetImageListElement and ImSetImageListElement
|
|
||||||
has changed - list items are now cloned rather than referenced,
|
|
||||||
because of this ImFreeImageListKeepImages was no longer needed
|
|
||||||
and was removed
|
|
||||||
- many function headers were changed - mainly pointers were
|
|
||||||
replaced with var and const parameters
|
|
||||||
|
|
||||||
-- 0.13 -----------------------------------------------------
|
|
||||||
- added TestImagesInList function and new 0.13 functions
|
|
||||||
- images were not freed when image list was resized in ImSetImageListSize
|
|
||||||
- ImSaveMultiImageTo* recreated the input image list with size = 0
|
|
||||||
|
|
||||||
}
|
|
||||||
end.
|
|
||||||
|
|
||||||
+533
-386
File diff suppressed because it is too large
Load Diff
+85
-49
@@ -1,29 +1,12 @@
|
|||||||
{
|
{
|
||||||
$Id: ImagingGif.pas 157 2009-02-15 14:24:58Z galfar $
|
|
||||||
Vampyre Imaging Library
|
Vampyre Imaging Library
|
||||||
by Marek Mauder
|
by Marek Mauder
|
||||||
http://imaginglib.sourceforge.net
|
https://github.com/galfar/imaginglib
|
||||||
|
https://imaginglib.sourceforge.io
|
||||||
The contents of this file are used with permission, subject to the Mozilla
|
- - - - -
|
||||||
Public License Version 1.1 (the "License"); you may not use this file except
|
This Source Code Form is subject to the terms of the Mozilla Public
|
||||||
in compliance with the License. You may obtain a copy of the License at
|
License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||||
http://www.mozilla.org/MPL/MPL-1.1.html
|
file, You can obtain one at https://mozilla.org/MPL/2.0.
|
||||||
|
|
||||||
Software distributed under the License is distributed on an "AS IS" basis,
|
|
||||||
WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License for
|
|
||||||
the specific language governing rights and limitations under the License.
|
|
||||||
|
|
||||||
Alternatively, the contents of this file may be used under the terms of the
|
|
||||||
GNU Lesser General Public License (the "LGPL License"), in which case the
|
|
||||||
provisions of the LGPL License are applicable instead of those above.
|
|
||||||
If you wish to allow use of your version of this file only under the terms
|
|
||||||
of the LGPL License and not to allow others to use your version of this file
|
|
||||||
under the MPL, indicate your decision by deleting the provisions above and
|
|
||||||
replace them with the notice and other provisions required by the LGPL
|
|
||||||
License. If you do not delete the provisions above, a recipient may use
|
|
||||||
your version of this file under either the MPL or the LGPL License.
|
|
||||||
|
|
||||||
For more information about the LGPL: http://www.gnu.org/copyleft/lesser.html
|
|
||||||
}
|
}
|
||||||
|
|
||||||
{ This unit contains image format loader/saver for GIF images.}
|
{ This unit contains image format loader/saver for GIF images.}
|
||||||
@@ -55,6 +38,7 @@ type
|
|||||||
procedure LZWCompress(const IO: TIOFunctions; Handle: TImagingHandle;
|
procedure LZWCompress(const IO: TIOFunctions; Handle: TImagingHandle;
|
||||||
Width, Height, BitCount: Integer; Interlaced: Boolean; Data: Pointer);
|
Width, Height, BitCount: Integer; Interlaced: Boolean; Data: Pointer);
|
||||||
protected
|
protected
|
||||||
|
procedure Define; override;
|
||||||
function LoadData(Handle: TImagingHandle; var Images: TDynImageDataArray;
|
function LoadData(Handle: TImagingHandle; var Images: TDynImageDataArray;
|
||||||
OnlyFirstLevel: Boolean): Boolean; override;
|
OnlyFirstLevel: Boolean): Boolean; override;
|
||||||
function SaveData(Handle: TImagingHandle; const Images: TDynImageDataArray;
|
function SaveData(Handle: TImagingHandle; const Images: TDynImageDataArray;
|
||||||
@@ -62,7 +46,6 @@ type
|
|||||||
procedure ConvertToSupported(var Image: TImageData;
|
procedure ConvertToSupported(var Image: TImageData;
|
||||||
const Info: TImageFormatInfo); override;
|
const Info: TImageFormatInfo); override;
|
||||||
public
|
public
|
||||||
constructor Create; override;
|
|
||||||
function TestFormat(Handle: TImagingHandle): Boolean; override;
|
function TestFormat(Handle: TImagingHandle): Boolean; override;
|
||||||
published
|
published
|
||||||
property LoadAnimated: LongBool read FLoadAnimated write FLoadAnimated;
|
property LoadAnimated: LongBool read FLoadAnimated write FLoadAnimated;
|
||||||
@@ -84,6 +67,7 @@ type
|
|||||||
const
|
const
|
||||||
GIFSignature: TChar3 = 'GIF';
|
GIFSignature: TChar3 = 'GIF';
|
||||||
GIFVersions: array[TGIFVersion] of TChar3 = ('87a', '89a');
|
GIFVersions: array[TGIFVersion] of TChar3 = ('87a', '89a');
|
||||||
|
GIFDefaultDelay = 65;
|
||||||
|
|
||||||
// Masks for accessing fields in PackedFields of TGIFHeader
|
// Masks for accessing fields in PackedFields of TGIFHeader
|
||||||
GIFGlobalColorTable = $80;
|
GIFGlobalColorTable = $80;
|
||||||
@@ -111,6 +95,11 @@ const
|
|||||||
GIFUserInput = $02;
|
GIFUserInput = $02;
|
||||||
GIFDisposalMethod = $1C;
|
GIFDisposalMethod = $1C;
|
||||||
|
|
||||||
|
const
|
||||||
|
// Netscape sub block types
|
||||||
|
GIFAppLoopExtension = 1;
|
||||||
|
GIFAppBufferExtension = 2;
|
||||||
|
|
||||||
type
|
type
|
||||||
TGIFHeader = packed record
|
TGIFHeader = packed record
|
||||||
// File header part
|
// File header part
|
||||||
@@ -149,11 +138,6 @@ type
|
|||||||
Terminator: Byte;
|
Terminator: Byte;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
const
|
|
||||||
// Netscape sub block types
|
|
||||||
GIFAppLoopExtension = 1;
|
|
||||||
GIFAppBufferExtension = 2;
|
|
||||||
|
|
||||||
type
|
type
|
||||||
TGIFIdentifierCode = array[0..7] of AnsiChar;
|
TGIFIdentifierCode = array[0..7] of AnsiChar;
|
||||||
TGIFAuthenticationCode = array[0..2] of AnsiChar;
|
TGIFAuthenticationCode = array[0..2] of AnsiChar;
|
||||||
@@ -216,13 +200,11 @@ resourcestring
|
|||||||
TGIFFileFormat implementation
|
TGIFFileFormat implementation
|
||||||
}
|
}
|
||||||
|
|
||||||
constructor TGIFFileFormat.Create;
|
procedure TGIFFileFormat.Define;
|
||||||
begin
|
begin
|
||||||
inherited Create;
|
inherited;
|
||||||
FName := SGIFFormatName;
|
FName := SGIFFormatName;
|
||||||
FCanLoad := True;
|
FFeatures := [ffLoad, ffSave, ffMultiImage];
|
||||||
FCanSave := True;
|
|
||||||
FIsMultiImageFormat := True;
|
|
||||||
FSupportedFormats := GIFSupportedFormats;
|
FSupportedFormats := GIFSupportedFormats;
|
||||||
FLoadAnimated := GIFDefaultLoadAnimated;
|
FLoadAnimated := GIFDefaultLoadAnimated;
|
||||||
|
|
||||||
@@ -265,7 +247,7 @@ begin
|
|||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
{ GIF LZW decompresion code is from JVCL JvGIF.pas unit.}
|
{ GIF LZW decompression code is from JVCL JvGIF.pas unit.}
|
||||||
procedure TGIFFileFormat.LZWDecompress(Stream: TStream; Handle: TImagingHandle; Width, Height: Integer;
|
procedure TGIFFileFormat.LZWDecompress(Stream: TStream; Handle: TImagingHandle; Width, Height: Integer;
|
||||||
Interlaced: Boolean; Data: Pointer);
|
Interlaced: Boolean; Data: Pointer);
|
||||||
var
|
var
|
||||||
@@ -304,7 +286,7 @@ var
|
|||||||
RawCode := Context.Buf[Word(ByteIndex)] +
|
RawCode := Context.Buf[Word(ByteIndex)] +
|
||||||
(Word(Context.Buf[Word(ByteIndex + 1)]) shl 8);
|
(Word(Context.Buf[Word(ByteIndex + 1)]) shl 8);
|
||||||
if Context.CodeSize > 8 then
|
if Context.CodeSize > 8 then
|
||||||
RawCode := RawCode + (LongInt(Context.Buf[ByteIndex + 2]) shl 16);
|
RawCode := RawCode + (Integer(Context.Buf[ByteIndex + 2]) shl 16);
|
||||||
RawCode := RawCode shr (Context.Inx and 7);
|
RawCode := RawCode shr (Context.Inx and 7);
|
||||||
Context.Inx := Context.Inx + Byte(Context.CodeSize);
|
Context.Inx := Context.Inx + Byte(Context.CodeSize);
|
||||||
Result := RawCode and Context.ReadMask;
|
Result := RawCode and Context.ReadMask;
|
||||||
@@ -374,7 +356,7 @@ begin
|
|||||||
ReadCtxt.Size := 0;
|
ReadCtxt.Size := 0;
|
||||||
ReadCtxt.CodeSize := MinCodeSize + 1;
|
ReadCtxt.CodeSize := MinCodeSize + 1;
|
||||||
ReadCtxt.ReadMask := (1 shl ReadCtxt.CodeSize) - 1;
|
ReadCtxt.ReadMask := (1 shl ReadCtxt.CodeSize) - 1;
|
||||||
// Initialise pixel-output context
|
// Initialize pixel-output context
|
||||||
OutCtxt.X := 0;
|
OutCtxt.X := 0;
|
||||||
OutCtxt.Y := 0;
|
OutCtxt.Y := 0;
|
||||||
OutCtxt.Pass := 0;
|
OutCtxt.Pass := 0;
|
||||||
@@ -470,7 +452,7 @@ begin
|
|||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
{ GIF LZW compresion code is from JVCL JvGIF.pas unit.}
|
{ GIF LZW compression code is from JVCL JvGIF.pas unit.}
|
||||||
procedure TGIFFileFormat.LZWCompress(const IO: TIOFunctions; Handle: TImagingHandle; Width, Height, BitCount: Integer;
|
procedure TGIFFileFormat.LZWCompress(const IO: TIOFunctions; Handle: TImagingHandle; Width, Height, BitCount: Integer;
|
||||||
Interlaced: Boolean; Data: Pointer);
|
Interlaced: Boolean; Data: Pointer);
|
||||||
var
|
var
|
||||||
@@ -541,7 +523,7 @@ begin
|
|||||||
for I := 0 to HashTableSize - 1 do
|
for I := 0 to HashTableSize - 1 do
|
||||||
HashTable.Add(nil);
|
HashTable.Add(nil);
|
||||||
|
|
||||||
// Initialise encoder variables
|
// Initialize encoder variables
|
||||||
InitCodeSize := BitCount + 1;
|
InitCodeSize := BitCount + 1;
|
||||||
if InitCodeSize = 2 then
|
if InitCodeSize = 2 then
|
||||||
Inc(InitCodeSize);
|
Inc(InitCodeSize);
|
||||||
@@ -735,7 +717,8 @@ var
|
|||||||
if BlockSize >= SizeOf(AppRec) then
|
if BlockSize >= SizeOf(AppRec) then
|
||||||
begin
|
begin
|
||||||
Read(Handle, @AppRec, SizeOf(AppRec));
|
Read(Handle, @AppRec, SizeOf(AppRec));
|
||||||
if (AppRec.Identifier = 'NETSCAPE') and (AppRec.Authentication = '2.0') then
|
if ((AppRec.Identifier = 'NETSCAPE') and (AppRec.Authentication = '2.0')) or
|
||||||
|
((AppRec.Identifier = 'ANIMEXTS') and (AppRec.Authentication = '1.0')) then
|
||||||
begin
|
begin
|
||||||
Read(Handle, @BlockSize, SizeOf(BlockSize));
|
Read(Handle, @BlockSize, SizeOf(BlockSize));
|
||||||
while BlockSize <> 0 do
|
while BlockSize <> 0 do
|
||||||
@@ -750,6 +733,9 @@ var
|
|||||||
// Read loop count
|
// Read loop count
|
||||||
Read(Handle, @LoopCount, SizeOf(LoopCount));
|
Read(Handle, @LoopCount, SizeOf(LoopCount));
|
||||||
Dec(BlockSize, SizeOf(LoopCount));
|
Dec(BlockSize, SizeOf(LoopCount));
|
||||||
|
if LoopCount > 0 then
|
||||||
|
Inc(LoopCount); // Netscape extension is really "repeats" not "loops"
|
||||||
|
FMetadata.SetMetaItem(SMetaAnimationLoops, LoopCount);
|
||||||
end;
|
end;
|
||||||
GIFAppBufferExtension:
|
GIFAppBufferExtension:
|
||||||
begin
|
begin
|
||||||
@@ -886,7 +872,7 @@ var
|
|||||||
Exit;
|
Exit;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
// If Grahic Control Extension is present make use of it
|
// If Graphic Control Extension is present make use of it
|
||||||
if HasGraphicExt then
|
if HasGraphicExt then
|
||||||
begin
|
begin
|
||||||
FrameInfos[Idx].HasTransparency := (GraphicExt.PackedFields and GIFTransparent) = GIFTransparent;
|
FrameInfos[Idx].HasTransparency := (GraphicExt.PackedFields and GIFTransparent) = GIFTransparent;
|
||||||
@@ -896,6 +882,7 @@ var
|
|||||||
FrameInfos[Idx].TransIndex := GraphicExt.TransparentColorIndex;
|
FrameInfos[Idx].TransIndex := GraphicExt.TransparentColorIndex;
|
||||||
Images[Idx].Palette[FrameInfos[Idx].TransIndex].A := 0;
|
Images[Idx].Palette[FrameInfos[Idx].TransIndex].A := 0;
|
||||||
end;
|
end;
|
||||||
|
FMetadata.SetMetaItem(SMetaFrameDelay, Integer(GraphicExt.DelayTime * 10), Idx);
|
||||||
end
|
end
|
||||||
else
|
else
|
||||||
FrameInfos[Idx].HasTransparency := False;
|
FrameInfos[Idx].HasTransparency := False;
|
||||||
@@ -972,7 +959,7 @@ var
|
|||||||
if FrameInfos[Index].HasTransparency then
|
if FrameInfos[Index].HasTransparency then
|
||||||
BGColor := Images[Index].Palette[FrameInfos[Index].TransIndex].Color;
|
BGColor := Images[Index].Palette[FrameInfos[Index].TransIndex].Color;
|
||||||
// Clear whole screen
|
// Clear whole screen
|
||||||
FillMemoryLongWord(AnimFrame.Bits, AnimFrame.Size, BGColor);
|
FillMemoryUInt32(AnimFrame.Bits, AnimFrame.Size, BGColor);
|
||||||
|
|
||||||
// Try to maximize First so we don't have to use all 0 to n raw frames
|
// Try to maximize First so we don't have to use all 0 to n raw frames
|
||||||
while First > 0 do
|
while First > 0 do
|
||||||
@@ -1101,7 +1088,7 @@ begin
|
|||||||
end;
|
end;
|
||||||
|
|
||||||
function TGIFFileFormat.SaveData(Handle: TImagingHandle;
|
function TGIFFileFormat.SaveData(Handle: TImagingHandle;
|
||||||
const Images: TDynImageDataArray; Index: Integer): Boolean;
|
const Images: TDynImageDataArray; Index: LongInt): Boolean;
|
||||||
var
|
var
|
||||||
Header: TGIFHeader;
|
Header: TGIFHeader;
|
||||||
ImageDesc: TImageDescriptor;
|
ImageDesc: TImageDescriptor;
|
||||||
@@ -1124,6 +1111,44 @@ var
|
|||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
procedure SetFrameDelay(Idx: Integer; var Ext: TGraphicControlExtension);
|
||||||
|
begin
|
||||||
|
if FMetadata.HasMetaItemForSaving(SMetaFrameDelay, Idx) then
|
||||||
|
Ext.DelayTime := FMetadata.MetaItemsForSavingMulti[SMetaFrameDelay, Idx] div 10
|
||||||
|
else
|
||||||
|
Ext.DelayTime := GIFDefaultDelay;
|
||||||
|
end;
|
||||||
|
|
||||||
|
procedure SaveGlobalMetadata;
|
||||||
|
var
|
||||||
|
AppExt: TGIFApplicationRec;
|
||||||
|
BlockSize, LoopExtId: Byte;
|
||||||
|
Repeats: Word;
|
||||||
|
begin
|
||||||
|
if FMetadata.HasMetaItemForSaving(SMetaAnimationLoops) then
|
||||||
|
with GetIO do
|
||||||
|
begin
|
||||||
|
FillChar(AppExt, SizeOf(AppExt), 0);
|
||||||
|
AppExt.Identifier := 'NETSCAPE';
|
||||||
|
AppExt.Authentication := '2.0';
|
||||||
|
Repeats := FMetadata.MetaItemsForSaving[SMetaAnimationLoops];
|
||||||
|
if Repeats > 0 then
|
||||||
|
Dec(Repeats);
|
||||||
|
LoopExtId := GIFAppLoopExtension;
|
||||||
|
|
||||||
|
Write(Handle, @GIFExtensionIntroducer, SizeOf(GIFExtensionIntroducer));
|
||||||
|
Write(Handle, @GIFApplicationExtension, SizeOf(GIFApplicationExtension));
|
||||||
|
BlockSize := 11;
|
||||||
|
Write(Handle, @BlockSize, SizeOf(BlockSize));
|
||||||
|
Write(Handle, @AppExt, SizeOf(AppExt));
|
||||||
|
BlockSize := 3;
|
||||||
|
Write(Handle, @BlockSize, SizeOf(BlockSize));
|
||||||
|
Write(Handle, @LoopExtId, SizeOf(LoopExtId));
|
||||||
|
Write(Handle, @Repeats, SizeOf(Repeats));
|
||||||
|
Write(Handle, @GIFBlockTerminator, SizeOf(GIFBlockTerminator));
|
||||||
|
end;
|
||||||
|
end;
|
||||||
|
|
||||||
begin
|
begin
|
||||||
// Fill header with data, select size of largest image in array as
|
// Fill header with data, select size of largest image in array as
|
||||||
// logical screen size
|
// logical screen size
|
||||||
@@ -1136,9 +1161,11 @@ begin
|
|||||||
|
|
||||||
// Prepare default GC extension with delay
|
// Prepare default GC extension with delay
|
||||||
FillChar(GraphicExt, Sizeof(GraphicExt), 0);
|
FillChar(GraphicExt, Sizeof(GraphicExt), 0);
|
||||||
GraphicExt.DelayTime := 65;
|
GraphicExt.DelayTime := GIFDefaultDelay;
|
||||||
GraphicExt.BlockSize := 4;
|
GraphicExt.BlockSize := 4;
|
||||||
|
|
||||||
|
SaveGlobalMetadata;
|
||||||
|
|
||||||
for I := FFirstIdx to FLastIdx do
|
for I := FFirstIdx to FLastIdx do
|
||||||
begin
|
begin
|
||||||
if MakeCompatible(Images[I], ImageToSave, MustBeFreed) then
|
if MakeCompatible(Images[I], ImageToSave, MustBeFreed) then
|
||||||
@@ -1147,13 +1174,14 @@ begin
|
|||||||
// Write Graphic Control Extension with default delay
|
// Write Graphic Control Extension with default delay
|
||||||
Write(Handle, @GIFExtensionIntroducer, SizeOf(GIFExtensionIntroducer));
|
Write(Handle, @GIFExtensionIntroducer, SizeOf(GIFExtensionIntroducer));
|
||||||
Write(Handle, @GIFGraphicControlExtension, SizeOf(GIFGraphicControlExtension));
|
Write(Handle, @GIFGraphicControlExtension, SizeOf(GIFGraphicControlExtension));
|
||||||
|
SetFrameDelay(I, GraphicExt);
|
||||||
Write(Handle, @GraphicExt, SizeOf(GraphicExt));
|
Write(Handle, @GraphicExt, SizeOf(GraphicExt));
|
||||||
// Write frame marker and fill and write image descriptor for this frame
|
// Write frame marker and fill and write image descriptor for this frame
|
||||||
Write(Handle, @GIFImageDescriptor, SizeOf(GIFImageDescriptor));
|
Write(Handle, @GIFImageDescriptor, SizeOf(GIFImageDescriptor));
|
||||||
FillChar(ImageDesc, Sizeof(ImageDesc), 0);
|
FillChar(ImageDesc, Sizeof(ImageDesc), 0);
|
||||||
ImageDesc.Width := Width;
|
ImageDesc.Width := Width;
|
||||||
ImageDesc.Height := Height;
|
ImageDesc.Height := Height;
|
||||||
ImageDesc.PackedFields := GIFLocalColorTable or GIFColorTableSize; // Use lccal color table with 256 entries
|
ImageDesc.PackedFields := GIFLocalColorTable or GIFColorTableSize; // Use local color table with 256 entries
|
||||||
Write(Handle, @ImageDesc, SizeOf(ImageDesc));
|
Write(Handle, @ImageDesc, SizeOf(ImageDesc));
|
||||||
|
|
||||||
// Write local color table for each frame
|
// Write local color table for each frame
|
||||||
@@ -1164,7 +1192,7 @@ begin
|
|||||||
Write(Handle, @Palette[J].B, SizeOf(Palette[J].B));
|
Write(Handle, @Palette[J].B, SizeOf(Palette[J].B));
|
||||||
end;
|
end;
|
||||||
|
|
||||||
// Fonally compress image data
|
// Finally compress image data
|
||||||
LZWCompress(GetIO, Handle, Width, Height, 8, False, Bits);
|
LZWCompress(GetIO, Handle, Width, Height, 8, False, Bits);
|
||||||
|
|
||||||
finally
|
finally
|
||||||
@@ -1186,7 +1214,7 @@ end;
|
|||||||
function TGIFFileFormat.TestFormat(Handle: TImagingHandle): Boolean;
|
function TGIFFileFormat.TestFormat(Handle: TImagingHandle): Boolean;
|
||||||
var
|
var
|
||||||
Header: TGIFHeader;
|
Header: TGIFHeader;
|
||||||
ReadCount: LongInt;
|
ReadCount: Integer;
|
||||||
begin
|
begin
|
||||||
Result := False;
|
Result := False;
|
||||||
if Handle <> nil then
|
if Handle <> nil then
|
||||||
@@ -1208,6 +1236,14 @@ initialization
|
|||||||
-- TODOS ----------------------------------------------------
|
-- TODOS ----------------------------------------------------
|
||||||
- nothing now
|
- nothing now
|
||||||
|
|
||||||
|
-- 0.77 Changes/Bug Fixes -----------------------------------
|
||||||
|
- Fixed crash when resaving GIF with animation metadata.
|
||||||
|
- Writes frame delays of GIF animations from metadata.
|
||||||
|
- Reads and writes looping of GIF animations stored into/from metadata.
|
||||||
|
|
||||||
|
-- 0.26.5 Changes/Bug Fixes ---------------------------------
|
||||||
|
- Reads frame delays from GIF animations into metadata.
|
||||||
|
|
||||||
-- 0.26.3 Changes/Bug Fixes ---------------------------------
|
-- 0.26.3 Changes/Bug Fixes ---------------------------------
|
||||||
- Fixed bug - loading of GIF with NETSCAPE app extensions
|
- Fixed bug - loading of GIF with NETSCAPE app extensions
|
||||||
failed with Delphi 2009.
|
failed with Delphi 2009.
|
||||||
@@ -1225,12 +1261,12 @@ initialization
|
|||||||
transparent by default.
|
transparent by default.
|
||||||
|
|
||||||
-- 0.24.1 Changes/Bug Fixes ---------------------------------
|
-- 0.24.1 Changes/Bug Fixes ---------------------------------
|
||||||
- Made backround color transparent by default (alpha = 0).
|
- Made background color transparent by default (alpha = 0).
|
||||||
|
|
||||||
-- 0.23 Changes/Bug Fixes -----------------------------------
|
-- 0.23 Changes/Bug Fixes -----------------------------------
|
||||||
- Fixed other loading bugs (local pal size, transparency).
|
- Fixed other loading bugs (local pal size, transparency).
|
||||||
- Added GIF saving.
|
- Added GIF saving.
|
||||||
- Fixed bug when loading multiframe GIFs and implemented few animation
|
- Fixed bug when loading multi-frame GIFs and implemented few animation
|
||||||
features (disposal methods, ...).
|
features (disposal methods, ...).
|
||||||
- Loading of GIFs working.
|
- Loading of GIFs working.
|
||||||
- Unit created with initial stuff!
|
- Unit created with initial stuff!
|
||||||
|
|||||||
+169
-74
@@ -1,32 +1,15 @@
|
|||||||
{
|
{
|
||||||
$Id: ImagingIO.pas 100 2007-06-28 21:09:52Z galfar $
|
|
||||||
Vampyre Imaging Library
|
Vampyre Imaging Library
|
||||||
by Marek Mauder
|
by Marek Mauder
|
||||||
http://imaginglib.sourceforge.net
|
https://github.com/galfar/imaginglib
|
||||||
|
https://imaginglib.sourceforge.io
|
||||||
The contents of this file are used with permission, subject to the Mozilla
|
- - - - -
|
||||||
Public License Version 1.1 (the "License"); you may not use this file except
|
This Source Code Form is subject to the terms of the Mozilla Public
|
||||||
in compliance with the License. You may obtain a copy of the License at
|
License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||||
http://www.mozilla.org/MPL/MPL-1.1.html
|
file, You can obtain one at https://mozilla.org/MPL/2.0.
|
||||||
|
|
||||||
Software distributed under the License is distributed on an "AS IS" basis,
|
|
||||||
WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License for
|
|
||||||
the specific language governing rights and limitations under the License.
|
|
||||||
|
|
||||||
Alternatively, the contents of this file may be used under the terms of the
|
|
||||||
GNU Lesser General Public License (the "LGPL License"), in which case the
|
|
||||||
provisions of the LGPL License are applicable instead of those above.
|
|
||||||
If you wish to allow use of your version of this file only under the terms
|
|
||||||
of the LGPL License and not to allow others to use your version of this file
|
|
||||||
under the MPL, indicate your decision by deleting the provisions above and
|
|
||||||
replace them with the notice and other provisions required by the LGPL
|
|
||||||
License. If you do not delete the provisions above, a recipient may use
|
|
||||||
your version of this file under either the MPL or the LGPL License.
|
|
||||||
|
|
||||||
For more information about the LGPL: http://www.gnu.org/copyleft/lesser.html
|
|
||||||
}
|
}
|
||||||
|
|
||||||
{ This unit contains default IO functions for reading from/writting to
|
{ This unit contains default IO functions for reading from/writing to
|
||||||
files, streams and memory.}
|
files, streams and memory.}
|
||||||
unit ImagingIO;
|
unit ImagingIO;
|
||||||
|
|
||||||
@@ -53,9 +36,30 @@ var
|
|||||||
|
|
||||||
{ Helper function that returns size of input (from current position to the end)
|
{ Helper function that returns size of input (from current position to the end)
|
||||||
represented by Handle (and opened and operated on by members of IOFunctions).}
|
represented by Handle (and opened and operated on by members of IOFunctions).}
|
||||||
function GetInputSize(IOFunctions: TIOFunctions; Handle: TImagingHandle): LongInt;
|
function GetInputSize(const IOFunctions: TIOFunctions; Handle: TImagingHandle): Int64;
|
||||||
{ Helper function that initializes TMemoryIORec with given params.}
|
{ Helper function that initializes TMemoryIORec with given params.}
|
||||||
function PrepareMemIO(Data: Pointer; Size: LongInt): TMemoryIORec;
|
function PrepareMemIO(Data: Pointer; Size: LongInt): TMemoryIORec;
|
||||||
|
{ Reads one text line from input (CR+LF, CR, or LF as line delimiter).}
|
||||||
|
function ReadLine(const IOFunctions: TIOFunctions; Handle: TImagingHandle;
|
||||||
|
out Line: AnsiString; FailOnControlChars: Boolean = False): Boolean;
|
||||||
|
{ Writes one text line to input with optional line delimiter.}
|
||||||
|
procedure WriteLine(const IOFunctions: TIOFunctions; Handle: TImagingHandle;
|
||||||
|
const Line: AnsiString; const LineEnding: AnsiString = sLineBreak);
|
||||||
|
|
||||||
|
type
|
||||||
|
TReadMemoryStream = class(TCustomMemoryStream)
|
||||||
|
public
|
||||||
|
constructor Create(Data: Pointer; Size: Integer);
|
||||||
|
class function CreateFromIOHandle(const IOFunctions: TIOFunctions; Handle: TImagingHandle): TReadMemoryStream;
|
||||||
|
end;
|
||||||
|
|
||||||
|
TImagingIOStream = class(TStream)
|
||||||
|
private
|
||||||
|
FIO: TIOFunctions;
|
||||||
|
FHandle: TImagingHandle;
|
||||||
|
public
|
||||||
|
constructor Create(const IOFunctions: TIOFunctions; Handle: TImagingHandle);
|
||||||
|
end;
|
||||||
|
|
||||||
implementation
|
implementation
|
||||||
|
|
||||||
@@ -65,7 +69,7 @@ const
|
|||||||
type
|
type
|
||||||
{ Based on TaaBufferedStream
|
{ Based on TaaBufferedStream
|
||||||
Copyright (c) Julian M Bucknall 1997, 1999 }
|
Copyright (c) Julian M Bucknall 1997, 1999 }
|
||||||
TBufferedStream = class(TObject)
|
TBufferedStream = class
|
||||||
private
|
private
|
||||||
FBuffer: PByteArray;
|
FBuffer: PByteArray;
|
||||||
FBufSize: Integer;
|
FBufSize: Integer;
|
||||||
@@ -135,7 +139,7 @@ procedure TBufferedStream.ReadBuffer;
|
|||||||
var
|
var
|
||||||
SeekResult: Integer;
|
SeekResult: Integer;
|
||||||
begin
|
begin
|
||||||
SeekResult := FStream.Seek(FBufStart, 0);
|
SeekResult := FStream.Seek(FBufStart, soBeginning);
|
||||||
if SeekResult = -1 then
|
if SeekResult = -1 then
|
||||||
raise Exception.Create('TBufferedStream.ReadBuffer: seek failed');
|
raise Exception.Create('TBufferedStream.ReadBuffer: seek failed');
|
||||||
FBytesInBuf := FStream.Read(FBuffer^, FBufSize);
|
FBytesInBuf := FStream.Read(FBuffer^, FBufSize);
|
||||||
@@ -148,7 +152,7 @@ var
|
|||||||
SeekResult: Integer;
|
SeekResult: Integer;
|
||||||
BytesWritten: Integer;
|
BytesWritten: Integer;
|
||||||
begin
|
begin
|
||||||
SeekResult := FStream.Seek(FBufStart, 0);
|
SeekResult := FStream.Seek(FBufStart, soBeginning);
|
||||||
if SeekResult = -1 then
|
if SeekResult = -1 then
|
||||||
raise Exception.Create('TBufferedStream.WriteBuffer: seek failed');
|
raise Exception.Create('TBufferedStream.WriteBuffer: seek failed');
|
||||||
BytesWritten := FStream.Write(FBuffer^, FBytesInBuf);
|
BytesWritten := FStream.Write(FBuffer^, FBytesInBuf);
|
||||||
@@ -167,7 +171,7 @@ end;
|
|||||||
|
|
||||||
function TBufferedStream.Read(var Buffer; Count: Integer): Integer;
|
function TBufferedStream.Read(var Buffer; Count: Integer): Integer;
|
||||||
var
|
var
|
||||||
BufAsBytes : TByteArray absolute Buffer;
|
BufAsBytes: TByteArray absolute Buffer;
|
||||||
BufIdx, BytesToGo, BytesToRead: Integer;
|
BufIdx, BytesToGo, BytesToRead: Integer;
|
||||||
begin
|
begin
|
||||||
// Calculate the actual number of bytes we can read - this depends on
|
// Calculate the actual number of bytes we can read - this depends on
|
||||||
@@ -215,7 +219,7 @@ begin
|
|||||||
BytesToRead := FBytesInBuf;
|
BytesToRead := FBytesInBuf;
|
||||||
if BytesToRead > BytesToGo then
|
if BytesToRead > BytesToGo then
|
||||||
BytesToRead := BytesToGo;
|
BytesToRead := BytesToGo;
|
||||||
// Ccopy from the stream buffer to the caller's buffer
|
// Copy from the stream buffer to the caller's buffer
|
||||||
Move(FBuffer^, BufAsBytes[BufIdx], BytesToRead);
|
Move(FBuffer^, BufAsBytes[BufIdx], BytesToRead);
|
||||||
// Calculate the number of bytes still to read
|
// Calculate the number of bytes still to read
|
||||||
Dec(BytesToGo, BytesToRead);
|
Dec(BytesToGo, BytesToRead);
|
||||||
@@ -338,14 +342,26 @@ end;
|
|||||||
|
|
||||||
{ File IO functions }
|
{ File IO functions }
|
||||||
|
|
||||||
function FileOpenRead(FileName: PChar): TImagingHandle; cdecl;
|
function FileOpen(FileName: PChar; Mode: TOpenMode): TImagingHandle; cdecl;
|
||||||
|
var
|
||||||
|
Stream: TStream;
|
||||||
begin
|
begin
|
||||||
Result := TBufferedStream.Create(TFileStream.Create(FileName, fmOpenRead or fmShareDenyWrite));
|
Stream := nil;
|
||||||
end;
|
|
||||||
|
|
||||||
function FileOpenWrite(FileName: PChar): TImagingHandle; cdecl;
|
case Mode of
|
||||||
begin
|
omReadOnly: Stream := TFileStream.Create(FileName, fmOpenRead or fmShareDenyWrite);
|
||||||
Result := TBufferedStream.Create(TFileStream.Create(FileName, fmCreate or fmShareDenyWrite));
|
omCreate: Stream := TFileStream.Create(FileName, fmCreate);
|
||||||
|
omReadWrite:
|
||||||
|
begin
|
||||||
|
if FileExists(FileName) then
|
||||||
|
Stream := TFileStream.Create(FileName, fmOpenReadWrite or fmShareExclusive)
|
||||||
|
else
|
||||||
|
Stream := TFileStream.Create(FileName, fmCreate);
|
||||||
|
end;
|
||||||
|
end;
|
||||||
|
|
||||||
|
Assert(Stream <> nil);
|
||||||
|
Result := TBufferedStream.Create(Stream);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
procedure FileClose(Handle: TImagingHandle); cdecl;
|
procedure FileClose(Handle: TImagingHandle); cdecl;
|
||||||
@@ -362,37 +378,29 @@ begin
|
|||||||
Result := TBufferedStream(Handle).Position = TBufferedStream(Handle).Size;
|
Result := TBufferedStream(Handle).Position = TBufferedStream(Handle).Size;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
function FileSeek(Handle: TImagingHandle; Offset: LongInt; Mode: TSeekMode):
|
function FileSeek(Handle: TImagingHandle; Offset: Int64; Mode: TSeekMode): Int64; cdecl;
|
||||||
LongInt; cdecl;
|
|
||||||
begin
|
begin
|
||||||
Result := TBufferedStream(Handle).Seek(Offset, LongInt(Mode));
|
Result := TBufferedStream(Handle).Seek(Offset, LongInt(Mode));
|
||||||
end;
|
end;
|
||||||
|
|
||||||
function FileTell(Handle: TImagingHandle): LongInt; cdecl;
|
function FileTell(Handle: TImagingHandle): Int64; cdecl;
|
||||||
begin
|
begin
|
||||||
Result := TBufferedStream(Handle).Position;
|
Result := TBufferedStream(Handle).Position;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
function FileRead(Handle: TImagingHandle; Buffer: Pointer; Count: LongInt):
|
function FileRead(Handle: TImagingHandle; Buffer: Pointer; Count: LongInt): LongInt; cdecl;
|
||||||
LongInt; cdecl;
|
|
||||||
begin
|
begin
|
||||||
Result := TBufferedStream(Handle).Read(Buffer^, Count);
|
Result := TBufferedStream(Handle).Read(Buffer^, Count);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
function FileWrite(Handle: TImagingHandle; Buffer: Pointer; Count: LongInt):
|
function FileWrite(Handle: TImagingHandle; Buffer: Pointer; Count: LongInt): LongInt; cdecl;
|
||||||
LongInt; cdecl;
|
|
||||||
begin
|
begin
|
||||||
Result := TBufferedStream(Handle).Write(Buffer^, Count);
|
Result := TBufferedStream(Handle).Write(Buffer^, Count);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
{ Stream IO functions }
|
{ Stream IO functions }
|
||||||
|
|
||||||
function StreamOpenRead(FileName: PChar): TImagingHandle; cdecl;
|
function StreamOpen(FileName: PChar; Mode: TOpenMode): TImagingHandle; cdecl;
|
||||||
begin
|
|
||||||
Result := FileName;
|
|
||||||
end;
|
|
||||||
|
|
||||||
function StreamOpenWrite(FileName: PChar): TImagingHandle; cdecl;
|
|
||||||
begin
|
begin
|
||||||
Result := FileName;
|
Result := FileName;
|
||||||
end;
|
end;
|
||||||
@@ -406,13 +414,12 @@ begin
|
|||||||
Result := TStream(Handle).Position = TStream(Handle).Size;
|
Result := TStream(Handle).Position = TStream(Handle).Size;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
function StreamSeek(Handle: TImagingHandle; Offset: LongInt; Mode: TSeekMode):
|
function StreamSeek(Handle: TImagingHandle; Offset: Int64; Mode: TSeekMode): Int64; cdecl;
|
||||||
LongInt; cdecl;
|
|
||||||
begin
|
begin
|
||||||
Result := TStream(Handle).Seek(Offset, LongInt(Mode));
|
Result := TStream(Handle).Seek(Offset, Word(Mode));
|
||||||
end;
|
end;
|
||||||
|
|
||||||
function StreamTell(Handle: TImagingHandle): LongInt; cdecl;
|
function StreamTell(Handle: TImagingHandle): Int64; cdecl;
|
||||||
begin
|
begin
|
||||||
Result := TStream(Handle).Position;
|
Result := TStream(Handle).Position;
|
||||||
end;
|
end;
|
||||||
@@ -423,20 +430,14 @@ begin
|
|||||||
Result := TStream(Handle).Read(Buffer^, Count);
|
Result := TStream(Handle).Read(Buffer^, Count);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
function StreamWrite(Handle: TImagingHandle; Buffer: Pointer; Count: LongInt):
|
function StreamWrite(Handle: TImagingHandle; Buffer: Pointer; Count: LongInt): LongInt; cdecl;
|
||||||
LongInt; cdecl;
|
|
||||||
begin
|
begin
|
||||||
Result := TStream(Handle).Write(Buffer^, Count);
|
Result := TStream(Handle).Write(Buffer^, Count);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
{ Memory IO functions }
|
{ Memory IO functions }
|
||||||
|
|
||||||
function MemoryOpenRead(FileName: PChar): TImagingHandle; cdecl;
|
function MemoryOpen(FileName: PChar; Mode: TOpenMode): TImagingHandle; cdecl;
|
||||||
begin
|
|
||||||
Result := FileName;
|
|
||||||
end;
|
|
||||||
|
|
||||||
function MemoryOpenWrite(FileName: PChar): TImagingHandle; cdecl;
|
|
||||||
begin
|
begin
|
||||||
Result := FileName;
|
Result := FileName;
|
||||||
end;
|
end;
|
||||||
@@ -450,8 +451,7 @@ begin
|
|||||||
Result := PMemoryIORec(Handle).Position = PMemoryIORec(Handle).Size;
|
Result := PMemoryIORec(Handle).Position = PMemoryIORec(Handle).Size;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
function MemorySeek(Handle: TImagingHandle; Offset: LongInt; Mode: TSeekMode):
|
function MemorySeek(Handle: TImagingHandle; Offset: Int64; Mode: TSeekMode): Int64; cdecl;
|
||||||
LongInt; cdecl;
|
|
||||||
begin
|
begin
|
||||||
Result := PMemoryIORec(Handle).Position;
|
Result := PMemoryIORec(Handle).Position;
|
||||||
case Mode of
|
case Mode of
|
||||||
@@ -463,7 +463,7 @@ begin
|
|||||||
PMemoryIORec(Handle).Position := Result;
|
PMemoryIORec(Handle).Position := Result;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
function MemoryTell(Handle: TImagingHandle): LongInt; cdecl;
|
function MemoryTell(Handle: TImagingHandle): Int64; cdecl;
|
||||||
begin
|
begin
|
||||||
Result := PMemoryIORec(Handle).Position;
|
Result := PMemoryIORec(Handle).Position;
|
||||||
end;
|
end;
|
||||||
@@ -481,8 +481,7 @@ begin
|
|||||||
Rec.Position := Rec.Position + Result;
|
Rec.Position := Rec.Position + Result;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
function MemoryWrite(Handle: TImagingHandle; Buffer: Pointer; Count: LongInt):
|
function MemoryWrite(Handle: TImagingHandle; Buffer: Pointer; Count: LongInt): LongInt; cdecl;
|
||||||
LongInt; cdecl;
|
|
||||||
var
|
var
|
||||||
Rec: PMemoryIORec;
|
Rec: PMemoryIORec;
|
||||||
begin
|
begin
|
||||||
@@ -496,7 +495,7 @@ end;
|
|||||||
|
|
||||||
{ Helper IO functions }
|
{ Helper IO functions }
|
||||||
|
|
||||||
function GetInputSize(IOFunctions: TIOFunctions; Handle: TImagingHandle): LongInt;
|
function GetInputSize(const IOFunctions: TIOFunctions; Handle: TImagingHandle): Int64;
|
||||||
var
|
var
|
||||||
OldPos: Int64;
|
OldPos: Int64;
|
||||||
begin
|
begin
|
||||||
@@ -513,9 +512,99 @@ begin
|
|||||||
Result.Size := Size;
|
Result.Size := Size;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
function ReadLine(const IOFunctions: TIOFunctions; Handle: TImagingHandle;
|
||||||
|
out Line: AnsiString; FailOnControlChars: Boolean): Boolean;
|
||||||
|
const
|
||||||
|
MaxLine = 1024;
|
||||||
|
var
|
||||||
|
EolPos, Pos: Integer;
|
||||||
|
C: AnsiChar;
|
||||||
|
EolReached: Boolean;
|
||||||
|
Endings: set of AnsiChar;
|
||||||
|
begin
|
||||||
|
Line := '';
|
||||||
|
Pos := 0;
|
||||||
|
EolPos := 0;
|
||||||
|
EolReached := False;
|
||||||
|
Endings := [#10, #13];
|
||||||
|
Result := True;
|
||||||
|
|
||||||
|
while not IOFunctions.Eof(Handle) do
|
||||||
|
begin
|
||||||
|
IOFunctions.Read(Handle, @C, SizeOf(C));
|
||||||
|
|
||||||
|
if FailOnControlChars and (Byte(C) < $20) then
|
||||||
|
begin
|
||||||
|
Break;
|
||||||
|
end;
|
||||||
|
|
||||||
|
if not (C in Endings) then
|
||||||
|
begin
|
||||||
|
if EolReached then
|
||||||
|
begin
|
||||||
|
IOFunctions.Seek(Handle, EolPos, smFromBeginning);
|
||||||
|
Exit;
|
||||||
|
end
|
||||||
|
else
|
||||||
|
begin
|
||||||
|
SetLength(Line, Length(Line) + 1);
|
||||||
|
Line[Length(Line)] := C;
|
||||||
|
end;
|
||||||
|
end
|
||||||
|
else if not EolReached then
|
||||||
|
begin
|
||||||
|
EolReached := True;
|
||||||
|
EolPos := IOFunctions.Tell(Handle);
|
||||||
|
end;
|
||||||
|
|
||||||
|
Inc(Pos);
|
||||||
|
if Pos >= MaxLine then
|
||||||
|
begin
|
||||||
|
Break;
|
||||||
|
end;
|
||||||
|
end;
|
||||||
|
|
||||||
|
Result := False;
|
||||||
|
IOFunctions.Seek(Handle, -Pos, smFromCurrent);
|
||||||
|
end;
|
||||||
|
|
||||||
|
procedure WriteLine(const IOFunctions: TIOFunctions; Handle: TImagingHandle;
|
||||||
|
const Line: AnsiString; const LineEnding: AnsiString);
|
||||||
|
var
|
||||||
|
ToWrite: AnsiString;
|
||||||
|
begin
|
||||||
|
ToWrite := Line + LineEnding;
|
||||||
|
IOFunctions.Write(Handle, @ToWrite[1], Length(ToWrite));
|
||||||
|
end;
|
||||||
|
|
||||||
|
{ TReadMemoryStream }
|
||||||
|
|
||||||
|
constructor TReadMemoryStream.Create(Data: Pointer; Size: Integer);
|
||||||
|
begin
|
||||||
|
SetPointer(Data, Size);
|
||||||
|
end;
|
||||||
|
|
||||||
|
class function TReadMemoryStream.CreateFromIOHandle(const IOFunctions: TIOFunctions; Handle: TImagingHandle): TReadMemoryStream;
|
||||||
|
var
|
||||||
|
Data: Pointer;
|
||||||
|
Size: Integer;
|
||||||
|
begin
|
||||||
|
Size := GetInputSize(IOFunctions, Handle);
|
||||||
|
GetMem(Data, Size);
|
||||||
|
IOFunctions.Read(Handle, Data, Size);
|
||||||
|
Result := TReadMemoryStream.Create(Data, Size);
|
||||||
|
end;
|
||||||
|
|
||||||
|
{ TImagingIOStream }
|
||||||
|
|
||||||
|
constructor TImagingIOStream.Create(const IOFunctions: TIOFunctions;
|
||||||
|
Handle: TImagingHandle);
|
||||||
|
begin
|
||||||
|
|
||||||
|
end;
|
||||||
|
|
||||||
initialization
|
initialization
|
||||||
OriginalFileIO.OpenRead := FileOpenRead;
|
OriginalFileIO.Open := FileOpen;
|
||||||
OriginalFileIO.OpenWrite := FileOpenWrite;
|
|
||||||
OriginalFileIO.Close := FileClose;
|
OriginalFileIO.Close := FileClose;
|
||||||
OriginalFileIO.Eof := FileEof;
|
OriginalFileIO.Eof := FileEof;
|
||||||
OriginalFileIO.Seek := FileSeek;
|
OriginalFileIO.Seek := FileSeek;
|
||||||
@@ -523,8 +612,7 @@ initialization
|
|||||||
OriginalFileIO.Read := FileRead;
|
OriginalFileIO.Read := FileRead;
|
||||||
OriginalFileIO.Write := FileWrite;
|
OriginalFileIO.Write := FileWrite;
|
||||||
|
|
||||||
StreamIO.OpenRead := StreamOpenRead;
|
StreamIO.Open := StreamOpen;
|
||||||
StreamIO.OpenWrite := StreamOpenWrite;
|
|
||||||
StreamIO.Close := StreamClose;
|
StreamIO.Close := StreamClose;
|
||||||
StreamIO.Eof := StreamEof;
|
StreamIO.Eof := StreamEof;
|
||||||
StreamIO.Seek := StreamSeek;
|
StreamIO.Seek := StreamSeek;
|
||||||
@@ -532,8 +620,7 @@ initialization
|
|||||||
StreamIO.Read := StreamRead;
|
StreamIO.Read := StreamRead;
|
||||||
StreamIO.Write := StreamWrite;
|
StreamIO.Write := StreamWrite;
|
||||||
|
|
||||||
MemoryIO.OpenRead := MemoryOpenRead;
|
MemoryIO.Open := MemoryOpen;
|
||||||
MemoryIO.OpenWrite := MemoryOpenWrite;
|
|
||||||
MemoryIO.Close := MemoryClose;
|
MemoryIO.Close := MemoryClose;
|
||||||
MemoryIO.Eof := MemoryEof;
|
MemoryIO.Eof := MemoryEof;
|
||||||
MemoryIO.Seek := MemorySeek;
|
MemoryIO.Seek := MemorySeek;
|
||||||
@@ -549,6 +636,14 @@ initialization
|
|||||||
-- TODOS ----------------------------------------------------
|
-- TODOS ----------------------------------------------------
|
||||||
- nothing now
|
- nothing now
|
||||||
|
|
||||||
|
-- 0.77.3 ---------------------------------------------------
|
||||||
|
- IO functions now have 64bit sizes and offsets.
|
||||||
|
- Added helper classes TReadMemoryStream and TImagingIOStream.
|
||||||
|
|
||||||
|
-- 0.77.1 ---------------------------------------------------
|
||||||
|
- Updated IO Open functions according to changes in ImagingTypes.
|
||||||
|
- Added ReadLine and WriteLine functions.
|
||||||
|
|
||||||
-- 0.23 Changes/Bug Fixes -----------------------------------
|
-- 0.23 Changes/Bug Fixes -----------------------------------
|
||||||
- Added merge between buffered read-only and write-only file
|
- Added merge between buffered read-only and write-only file
|
||||||
stream adapters - TIFF saving needed both reading and writing.
|
stream adapters - TIFF saving needed both reading and writing.
|
||||||
@@ -559,7 +654,7 @@ initialization
|
|||||||
- Removed TMemoryIORec.Written, use Position to get proper memory
|
- Removed TMemoryIORec.Written, use Position to get proper memory
|
||||||
position (Written didn't take Seeks into account).
|
position (Written didn't take Seeks into account).
|
||||||
- Added TBufferedReadFile and TBufferedWriteFile classes for
|
- Added TBufferedReadFile and TBufferedWriteFile classes for
|
||||||
buffered file reading/writting. File IO functions now use these
|
buffered file reading/writing. File IO functions now use these
|
||||||
classes resulting in performance increase mainly in file formats
|
classes resulting in performance increase mainly in file formats
|
||||||
that read/write many small chunks.
|
that read/write many small chunks.
|
||||||
- Added fmShareDenyWrite to FileOpenRead. You can now read
|
- Added fmShareDenyWrite to FileOpenRead. You can now read
|
||||||
|
|||||||
+193
-50
@@ -1,29 +1,12 @@
|
|||||||
{
|
{
|
||||||
$Id: ImagingJpeg.pas 180 2009-10-16 01:07:26Z galfar $
|
|
||||||
Vampyre Imaging Library
|
Vampyre Imaging Library
|
||||||
by Marek Mauder
|
by Marek Mauder
|
||||||
http://imaginglib.sourceforge.net
|
https://github.com/galfar/imaginglib
|
||||||
|
https://imaginglib.sourceforge.io
|
||||||
The contents of this file are used with permission, subject to the Mozilla
|
- - - - -
|
||||||
Public License Version 1.1 (the "License"); you may not use this file except
|
This Source Code Form is subject to the terms of the Mozilla Public
|
||||||
in compliance with the License. You may obtain a copy of the License at
|
License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||||
http://www.mozilla.org/MPL/MPL-1.1.html
|
file, You can obtain one at https://mozilla.org/MPL/2.0.
|
||||||
|
|
||||||
Software distributed under the License is distributed on an "AS IS" basis,
|
|
||||||
WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License for
|
|
||||||
the specific language governing rights and limitations under the License.
|
|
||||||
|
|
||||||
Alternatively, the contents of this file may be used under the terms of the
|
|
||||||
GNU Lesser General Public License (the "LGPL License"), in which case the
|
|
||||||
provisions of the LGPL License are applicable instead of those above.
|
|
||||||
If you wish to allow use of your version of this file only under the terms
|
|
||||||
of the LGPL License and not to allow others to use your version of this file
|
|
||||||
under the MPL, indicate your decision by deleting the provisions above and
|
|
||||||
replace them with the notice and other provisions required by the LGPL
|
|
||||||
License. If you do not delete the provisions above, a recipient may use
|
|
||||||
your version of this file under either the MPL or the LGPL License.
|
|
||||||
|
|
||||||
For more information about the LGPL: http://www.gnu.org/copyleft/lesser.html
|
|
||||||
}
|
}
|
||||||
|
|
||||||
{ This unit contains image format loader/saver for Jpeg images.}
|
{ This unit contains image format loader/saver for Jpeg images.}
|
||||||
@@ -43,13 +26,22 @@ unit ImagingJpeg;
|
|||||||
{$DEFINE IMJPEGLIB}
|
{$DEFINE IMJPEGLIB}
|
||||||
{ $DEFINE PASJPEG}
|
{ $DEFINE PASJPEG}
|
||||||
|
|
||||||
{ Automatically use FPC's PasJpeg when compiling with Lazarus. But not when
|
{ Automatically use FPC's PasJpeg when compiling with Lazarus. }
|
||||||
WINDOWS is defined. See http://galfar.vevb.net/imaging/smf/index.php/topic,90.0.html}
|
{$IF Defined(LCL)}
|
||||||
{$IF Defined(LCL) and not Defined(WINDOWS)}
|
|
||||||
{$UNDEF IMJPEGLIB}
|
{$UNDEF IMJPEGLIB}
|
||||||
{$DEFINE PASJPEG}
|
{$DEFINE PASJPEG}
|
||||||
{$IFEND}
|
{$IFEND}
|
||||||
|
|
||||||
|
{ We usually want to skip the rest of the corrupted file when loading JPEG files
|
||||||
|
instead of getting exception. JpegLib's error handler can only be
|
||||||
|
exited using setjmp/longjmp ("non-local goto") functions to get error
|
||||||
|
recovery when loading corrupted JPEG files. This is implemented in assembler
|
||||||
|
and currently available only for 32bit Delphi targets and FPC.}
|
||||||
|
{$DEFINE ErrorJmpRecovery}
|
||||||
|
{$IF Defined(DCC) and not Defined(CPUX86)}
|
||||||
|
{$UNDEF ErrorJmpRecovery}
|
||||||
|
{$IFEND}
|
||||||
|
|
||||||
interface
|
interface
|
||||||
|
|
||||||
uses
|
uses
|
||||||
@@ -64,7 +56,8 @@ uses
|
|||||||
ImagingUtility;
|
ImagingUtility;
|
||||||
|
|
||||||
{$IF Defined(FPC) and Defined(PASJPEG)}
|
{$IF Defined(FPC) and Defined(PASJPEG)}
|
||||||
{ When using FPC's pasjpeg in FPC the channel order is BGR instead of RGB}
|
{ When using FPC's pasjpeg the channel order is BGR instead of RGB.
|
||||||
|
See RGB_RED_IS_0 in jconfig.inc. }
|
||||||
{$DEFINE RGBSWAPPED}
|
{$DEFINE RGBSWAPPED}
|
||||||
{$IFEND}
|
{$IFEND}
|
||||||
|
|
||||||
@@ -81,6 +74,7 @@ type
|
|||||||
FQuality: LongInt;
|
FQuality: LongInt;
|
||||||
FProgressive: LongBool;
|
FProgressive: LongBool;
|
||||||
procedure SetJpegIO(const JpegIO: TIOFunctions); virtual;
|
procedure SetJpegIO(const JpegIO: TIOFunctions); virtual;
|
||||||
|
procedure Define; override;
|
||||||
function LoadData(Handle: TImagingHandle; var Images: TDynImageDataArray;
|
function LoadData(Handle: TImagingHandle; var Images: TDynImageDataArray;
|
||||||
OnlyFirstLevel: Boolean): Boolean; override;
|
OnlyFirstLevel: Boolean): Boolean; override;
|
||||||
function SaveData(Handle: TImagingHandle; const Images: TDynImageDataArray;
|
function SaveData(Handle: TImagingHandle; const Images: TDynImageDataArray;
|
||||||
@@ -88,7 +82,6 @@ type
|
|||||||
procedure ConvertToSupported(var Image: TImageData;
|
procedure ConvertToSupported(var Image: TImageData;
|
||||||
const Info: TImageFormatInfo); override;
|
const Info: TImageFormatInfo); override;
|
||||||
public
|
public
|
||||||
constructor Create; override;
|
|
||||||
function TestFormat(Handle: TImagingHandle): Boolean; override;
|
function TestFormat(Handle: TImagingHandle): Boolean; override;
|
||||||
procedure CheckOptionsValidity; override;
|
procedure CheckOptionsValidity; override;
|
||||||
published
|
published
|
||||||
@@ -145,15 +138,105 @@ var
|
|||||||
JIO: TIOFunctions;
|
JIO: TIOFunctions;
|
||||||
JpegErrorMgr: jpeg_error_mgr;
|
JpegErrorMgr: jpeg_error_mgr;
|
||||||
|
|
||||||
{ Intenal unit jpeglib support functions }
|
{ Internal unit jpeglib support functions }
|
||||||
|
|
||||||
|
{$IFDEF ErrorJmpRecovery}
|
||||||
|
{$IFDEF DCC}
|
||||||
|
type
|
||||||
|
jmp_buf = record
|
||||||
|
EBX,
|
||||||
|
ESI,
|
||||||
|
EDI,
|
||||||
|
ESP,
|
||||||
|
EBP,
|
||||||
|
EIP: UInt32;
|
||||||
|
end;
|
||||||
|
pjmp_buf = ^jmp_buf;
|
||||||
|
|
||||||
|
{ JmpLib SetJmp/LongJmp Library
|
||||||
|
(C)Copyright 2003, 2004 Will DeWitt Jr. <edge@boink.net> }
|
||||||
|
function SetJmp(out jmpb: jmp_buf): Integer;
|
||||||
|
asm
|
||||||
|
{ -> EAX jmpb }
|
||||||
|
{ <- EAX Result }
|
||||||
|
MOV EDX, [ESP] // Fetch return address (EIP)
|
||||||
|
// Save task state
|
||||||
|
MOV [EAX+jmp_buf.&EBX], EBX
|
||||||
|
MOV [EAX+jmp_buf.&ESI], ESI
|
||||||
|
MOV [EAX+jmp_buf.&EDI], EDI
|
||||||
|
MOV [EAX+jmp_buf.&ESP], ESP
|
||||||
|
MOV [EAX+jmp_buf.&EBP], EBP
|
||||||
|
MOV [EAX+jmp_buf.&EIP], EDX
|
||||||
|
|
||||||
|
SUB EAX, EAX
|
||||||
|
@@1:
|
||||||
|
end;
|
||||||
|
|
||||||
|
procedure LongJmp(const jmpb: jmp_buf; retval: Integer);
|
||||||
|
asm
|
||||||
|
{ -> EAX jmpb }
|
||||||
|
{ EDX retval }
|
||||||
|
{ <- EAX Result }
|
||||||
|
XCHG EDX, EAX
|
||||||
|
|
||||||
|
MOV ECX, [EDX+jmp_buf.&EIP]
|
||||||
|
// Restore task state
|
||||||
|
MOV EBX, [EDX+jmp_buf.&EBX]
|
||||||
|
MOV ESI, [EDX+jmp_buf.&ESI]
|
||||||
|
MOV EDI, [EDX+jmp_buf.&EDI]
|
||||||
|
MOV ESP, [EDX+jmp_buf.&ESP]
|
||||||
|
MOV EBP, [EDX+jmp_buf.&EBP]
|
||||||
|
MOV [ESP], ECX // Restore return address (EIP)
|
||||||
|
|
||||||
|
TEST EAX, EAX // Ensure retval is <> 0
|
||||||
|
JNZ @@1
|
||||||
|
MOV EAX, 1
|
||||||
|
@@1:
|
||||||
|
end;
|
||||||
|
{$ENDIF}
|
||||||
|
|
||||||
|
type
|
||||||
|
TJmpBuf = jmp_buf;
|
||||||
|
TErrorClientData = record
|
||||||
|
JmpBuf: TJmpBuf;
|
||||||
|
ScanlineReadReached: Boolean;
|
||||||
|
end;
|
||||||
|
PErrorClientData = ^TErrorClientData;
|
||||||
|
{$ENDIF}
|
||||||
|
|
||||||
procedure JpegError(CInfo: j_common_ptr);
|
procedure JpegError(CInfo: j_common_ptr);
|
||||||
var
|
|
||||||
Buffer: string;
|
procedure RaiseError;
|
||||||
|
var
|
||||||
|
Buffer: AnsiString;
|
||||||
|
begin
|
||||||
|
// Create the message and raise exception
|
||||||
|
CInfo.err.format_message(CInfo, Buffer);
|
||||||
|
// Warning: you can get "Invalid argument index in format" exception when
|
||||||
|
// using FPC (see http://bugs.freepascal.org/view.php?id=21229).
|
||||||
|
// Fixed in FPC 2.7.1
|
||||||
|
{$IF Defined(FPC) and (FPC_FULLVERSION <= 20701)}
|
||||||
|
raise EImagingError.CreateFmt(SJPEGError + ' %d', [CInfo.err.msg_code]);
|
||||||
|
{$ELSE}
|
||||||
|
raise EImagingError.CreateFmt(SJPEGError + ' %d: ' + string(Buffer), [CInfo.err.msg_code]);
|
||||||
|
{$IFEND}
|
||||||
|
end;
|
||||||
|
|
||||||
begin
|
begin
|
||||||
{ Create the message and raise exception }
|
{$IFDEF ErrorJmpRecovery}
|
||||||
CInfo^.err^.format_message(CInfo, buffer);
|
// Only recovers on loads and when header is successfully loaded
|
||||||
raise EImagingError.CreateFmt(SJPEGError + ' %d: ' + Buffer, [CInfo.err^.msg_code]);
|
// (error occurs when reading scanlines)
|
||||||
|
if (CInfo.client_data <> nil) and
|
||||||
|
PErrorClientData(CInfo.client_data).ScanlineReadReached then
|
||||||
|
begin
|
||||||
|
// Non-local jump to error handler in TJpegFileFormat.LoadData
|
||||||
|
longjmp(PErrorClientData(CInfo.client_data).JmpBuf, 1)
|
||||||
|
end
|
||||||
|
else
|
||||||
|
RaiseError;
|
||||||
|
{$ELSE}
|
||||||
|
RaiseError;
|
||||||
|
{$ENDIF}
|
||||||
end;
|
end;
|
||||||
|
|
||||||
procedure OutputMessage(CurInfo: j_common_ptr);
|
procedure OutputMessage(CurInfo: j_common_ptr);
|
||||||
@@ -185,8 +268,8 @@ begin
|
|||||||
|
|
||||||
if NBytes <= 0 then
|
if NBytes <= 0 then
|
||||||
begin
|
begin
|
||||||
PChar(Src.Buffer)[0] := #$FF;
|
PByteArray(Src.Buffer)[0] := $FF;
|
||||||
PChar(Src.Buffer)[1] := Char(JPEG_EOI);
|
PByteArray(Src.Buffer)[1] := JPEG_EOI;
|
||||||
NBytes := 2;
|
NBytes := 2;
|
||||||
end;
|
end;
|
||||||
Src.Pub.next_input_byte := Src.Buffer;
|
Src.Pub.next_input_byte := Src.Buffer;
|
||||||
@@ -295,14 +378,16 @@ begin
|
|||||||
Dest.Output := Handle;
|
Dest.Output := Handle;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
procedure InitDecompressor(Handle: TImagingHandle; var jc: TJpegContext);
|
procedure SetupErrorMgr(var jc: TJpegContext);
|
||||||
begin
|
begin
|
||||||
FillChar(jc, sizeof(jc), 0);
|
|
||||||
// Set standard error handlers and then override some
|
// Set standard error handlers and then override some
|
||||||
jc.common.err := jpeg_std_error(JpegErrorMgr);
|
jc.common.err := jpeg_std_error(JpegErrorMgr);
|
||||||
jc.common.err.error_exit := JpegError;
|
jc.common.err.error_exit := JpegError;
|
||||||
jc.common.err.output_message := OutputMessage;
|
jc.common.err.output_message := OutputMessage;
|
||||||
|
end;
|
||||||
|
|
||||||
|
procedure InitDecompressor(Handle: TImagingHandle; var jc: TJpegContext);
|
||||||
|
begin
|
||||||
jpeg_CreateDecompress(@jc.d, JPEG_LIB_VERSION, sizeof(jc.d));
|
jpeg_CreateDecompress(@jc.d, JPEG_LIB_VERSION, sizeof(jc.d));
|
||||||
JpegStdioSrc(jc.d, Handle);
|
JpegStdioSrc(jc.d, Handle);
|
||||||
jpeg_read_header(@jc.d, True);
|
jpeg_read_header(@jc.d, True);
|
||||||
@@ -319,12 +404,6 @@ end;
|
|||||||
procedure InitCompressor(Handle: TImagingHandle; var jc: TJpegContext;
|
procedure InitCompressor(Handle: TImagingHandle; var jc: TJpegContext;
|
||||||
Saver: TJpegFileFormat);
|
Saver: TJpegFileFormat);
|
||||||
begin
|
begin
|
||||||
FillChar(jc, sizeof(jc), 0);
|
|
||||||
// Set standard error handlers and then override some
|
|
||||||
jc.common.err := jpeg_std_error(JpegErrorMgr);
|
|
||||||
jc.common.err.error_exit := JpegError;
|
|
||||||
jc.common.err.output_message := OutputMessage;
|
|
||||||
|
|
||||||
jpeg_CreateCompress(@jc.c, JPEG_LIB_VERSION, sizeof(jc.c));
|
jpeg_CreateCompress(@jc.c, JPEG_LIB_VERSION, sizeof(jc.c));
|
||||||
JpegStdioDest(jc.c, Handle);
|
JpegStdioDest(jc.c, Handle);
|
||||||
if Saver.FGrayScale then
|
if Saver.FGrayScale then
|
||||||
@@ -339,13 +418,10 @@ end;
|
|||||||
|
|
||||||
{ TJpegFileFormat class implementation }
|
{ TJpegFileFormat class implementation }
|
||||||
|
|
||||||
constructor TJpegFileFormat.Create;
|
procedure TJpegFileFormat.Define;
|
||||||
begin
|
begin
|
||||||
inherited Create;
|
|
||||||
FName := SJpegFormatName;
|
FName := SJpegFormatName;
|
||||||
FCanLoad := True;
|
FFeatures := [ffLoad, ffSave];
|
||||||
FCanSave := True;
|
|
||||||
FIsMultiImageFormat := False;
|
|
||||||
FSupportedFormats := JpegSupportedFormats;
|
FSupportedFormats := JpegSupportedFormats;
|
||||||
|
|
||||||
FQuality := JpegDefaultQuality;
|
FQuality := JpegDefaultQuality;
|
||||||
@@ -373,6 +449,25 @@ var
|
|||||||
Col32: PColor32Rec;
|
Col32: PColor32Rec;
|
||||||
NeedsRedBlueSwap: Boolean;
|
NeedsRedBlueSwap: Boolean;
|
||||||
Pix: PColor24Rec;
|
Pix: PColor24Rec;
|
||||||
|
{$IFDEF ErrorJmpRecovery}
|
||||||
|
ErrorClient: TErrorClientData;
|
||||||
|
{$ENDIF}
|
||||||
|
|
||||||
|
procedure LoadMetaData;
|
||||||
|
var
|
||||||
|
ResUnit: TResolutionUnit;
|
||||||
|
begin
|
||||||
|
// Density unit: 0 - undef, 1 - inch, 2 - cm
|
||||||
|
if jc.d.saw_JFIF_marker and (jc.d.density_unit > 0) and
|
||||||
|
(jc.d.X_density > 0) and (jc.d.Y_density > 0) then
|
||||||
|
begin
|
||||||
|
ResUnit := ruDpi;
|
||||||
|
if jc.d.density_unit = 2 then
|
||||||
|
ResUnit := ruDpcm;
|
||||||
|
FMetadata.SetPhysicalPixelSize(ResUnit, jc.d.X_density, jc.d.Y_density);
|
||||||
|
end;
|
||||||
|
end;
|
||||||
|
|
||||||
begin
|
begin
|
||||||
// Copy IO functions to global var used in JpegLib callbacks
|
// Copy IO functions to global var used in JpegLib callbacks
|
||||||
Result := False;
|
Result := False;
|
||||||
@@ -381,7 +476,19 @@ begin
|
|||||||
|
|
||||||
with JIO, Images[0] do
|
with JIO, Images[0] do
|
||||||
try
|
try
|
||||||
|
ZeroMemory(@jc, SizeOf(jc));
|
||||||
|
SetupErrorMgr(jc);
|
||||||
|
{$IFDEF ErrorJmpRecovery}
|
||||||
|
ZeroMemory(@ErrorClient, SizeOf(ErrorClient));
|
||||||
|
jc.common.client_data := @ErrorClient;
|
||||||
|
if setjmp(ErrorClient.JmpBuf) <> 0 then
|
||||||
|
begin
|
||||||
|
Result := True;
|
||||||
|
Exit;
|
||||||
|
end;
|
||||||
|
{$ENDIF}
|
||||||
InitDecompressor(Handle, jc);
|
InitDecompressor(Handle, jc);
|
||||||
|
|
||||||
case jc.d.out_color_space of
|
case jc.d.out_color_space of
|
||||||
JCS_GRAYSCALE: Format := ifGray8;
|
JCS_GRAYSCALE: Format := ifGray8;
|
||||||
JCS_RGB: Format := ifR8G8B8;
|
JCS_RGB: Format := ifR8G8B8;
|
||||||
@@ -389,6 +496,7 @@ begin
|
|||||||
else
|
else
|
||||||
Exit;
|
Exit;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
NewImage(jc.d.image_width, jc.d.image_height, Format, Images[0]);
|
NewImage(jc.d.image_width, jc.d.image_height, Format, Images[0]);
|
||||||
jpeg_start_decompress(@jc.d);
|
jpeg_start_decompress(@jc.d);
|
||||||
GetImageFormatInfo(Format, Info);
|
GetImageFormatInfo(Format, Info);
|
||||||
@@ -404,6 +512,10 @@ begin
|
|||||||
NeedsRedBlueSwap := True;
|
NeedsRedBlueSwap := True;
|
||||||
{$ENDIF}
|
{$ENDIF}
|
||||||
|
|
||||||
|
{$IFDEF ErrorJmpRecovery}
|
||||||
|
ErrorClient.ScanlineReadReached := True;
|
||||||
|
{$ENDIF}
|
||||||
|
|
||||||
while jc.d.output_scanline < jc.d.output_height do
|
while jc.d.output_scanline < jc.d.output_height do
|
||||||
begin
|
begin
|
||||||
LinesRead := jpeg_read_scanlines(@jc.d, @Dest, LinesPerCall);
|
LinesRead := jpeg_read_scanlines(@jc.d, @Dest, LinesPerCall);
|
||||||
@@ -432,6 +544,9 @@ begin
|
|||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
// Store supported metadata
|
||||||
|
LoadMetaData;
|
||||||
|
|
||||||
jpeg_finish_output(@jc.d);
|
jpeg_finish_output(@jc.d);
|
||||||
jpeg_finish_decompress(@jc.d);
|
jpeg_finish_decompress(@jc.d);
|
||||||
Result := True;
|
Result := True;
|
||||||
@@ -453,14 +568,31 @@ var
|
|||||||
I: LongInt;
|
I: LongInt;
|
||||||
Pix: PColor24Rec;
|
Pix: PColor24Rec;
|
||||||
{$ENDIF}
|
{$ENDIF}
|
||||||
|
|
||||||
|
procedure SaveMetaData;
|
||||||
|
var
|
||||||
|
XRes, YRes: Double;
|
||||||
|
begin
|
||||||
|
if FMetadata.GetPhysicalPixelSize(ruDpcm, XRes, YRes, True) then
|
||||||
|
begin
|
||||||
|
jc.c.density_unit := 2; // Dots per cm
|
||||||
|
jc.c.X_density := Round(XRes);
|
||||||
|
jc.c.Y_density := Round(YRes)
|
||||||
|
end;
|
||||||
|
end;
|
||||||
|
|
||||||
begin
|
begin
|
||||||
Result := False;
|
Result := False;
|
||||||
// Copy IO functions to global var used in JpegLib callbacks
|
// Copy IO functions to global var used in JpegLib callbacks
|
||||||
SetJpegIO(GetIO);
|
SetJpegIO(GetIO);
|
||||||
|
|
||||||
// Makes image to save compatible with Jpeg saving capabilities
|
// Makes image to save compatible with Jpeg saving capabilities
|
||||||
if MakeCompatible(Images[Index], ImageToSave, MustBeFreed) then
|
if MakeCompatible(Images[Index], ImageToSave, MustBeFreed) then
|
||||||
with JIO, ImageToSave do
|
with JIO, ImageToSave do
|
||||||
try
|
try
|
||||||
|
ZeroMemory(@jc, SizeOf(jc));
|
||||||
|
SetupErrorMgr(jc);
|
||||||
|
|
||||||
GetImageFormatInfo(Format, Info);
|
GetImageFormatInfo(Format, Info);
|
||||||
FGrayScale := Format = ifGray8;
|
FGrayScale := Format = ifGray8;
|
||||||
InitCompressor(Handle, jc, Self);
|
InitCompressor(Handle, jc, Self);
|
||||||
@@ -484,6 +616,9 @@ begin
|
|||||||
GetMem(Line, PtrInc);
|
GetMem(Line, PtrInc);
|
||||||
{$ENDIF}
|
{$ENDIF}
|
||||||
|
|
||||||
|
// Save supported metadata
|
||||||
|
SaveMetaData;
|
||||||
|
|
||||||
jpeg_start_compress(@jc.c, True);
|
jpeg_start_compress(@jc.c, True);
|
||||||
while (jc.c.next_scanline < jc.c.image_height) do
|
while (jc.c.next_scanline < jc.c.image_height) do
|
||||||
begin
|
begin
|
||||||
@@ -558,12 +693,20 @@ initialization
|
|||||||
-- TODOS ----------------------------------------------------
|
-- TODOS ----------------------------------------------------
|
||||||
- nothing now
|
- nothing now
|
||||||
|
|
||||||
|
-- 0.77.1 ---------------------------------------------------
|
||||||
|
- Able to read corrupted JPEG files - loads partial image
|
||||||
|
and skips the corrupted parts (FPC and x86 Delphi).
|
||||||
|
- Fixed reading of physical resolution metadata, could cause
|
||||||
|
"divided by zero" later on for some files.
|
||||||
|
|
||||||
-- 0.26.5 Changes/Bug Fixes ---------------------------------
|
-- 0.26.5 Changes/Bug Fixes ---------------------------------
|
||||||
|
- Fixed loading of some JPEGs with certain APPN markers (bug in JpegLib).
|
||||||
- Fixed swapped Red-Blue order when loading Jpegs with
|
- Fixed swapped Red-Blue order when loading Jpegs with
|
||||||
jc.d.jpeg_color_space = JCS_RGB.
|
jc.d.jpeg_color_space = JCS_RGB.
|
||||||
|
- Added loading and saving of physical pixel size metadata.
|
||||||
|
|
||||||
-- 0.26.3 Changes/Bug Fixes ---------------------------------
|
-- 0.26.3 Changes/Bug Fixes ---------------------------------
|
||||||
- Changed the Jpeg error manager, messages were not properly formated.
|
- Changed the Jpeg error manager, messages were not properly formatted.
|
||||||
|
|
||||||
-- 0.26.1 Changes/Bug Fixes ---------------------------------
|
-- 0.26.1 Changes/Bug Fixes ---------------------------------
|
||||||
- Fixed wrong color space setting in InitCompressor.
|
- Fixed wrong color space setting in InitCompressor.
|
||||||
|
|||||||
+376
-250
File diff suppressed because it is too large
Load Diff
+69
-52
@@ -1,29 +1,12 @@
|
|||||||
{
|
{
|
||||||
$Id: ImagingOpenGL.pas 165 2009-08-14 12:34:40Z galfar $
|
|
||||||
Vampyre Imaging Library
|
Vampyre Imaging Library
|
||||||
by Marek Mauder
|
by Marek Mauder
|
||||||
http://imaginglib.sourceforge.net
|
https://github.com/galfar/imaginglib
|
||||||
|
https://imaginglib.sourceforge.io
|
||||||
The contents of this file are used with permission, subject to the Mozilla
|
- - - - -
|
||||||
Public License Version 1.1 (the "License"); you may not use this file except
|
This Source Code Form is subject to the terms of the Mozilla Public
|
||||||
in compliance with the License. You may obtain a copy of the License at
|
License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||||
http://www.mozilla.org/MPL/MPL-1.1.html
|
file, You can obtain one at https://mozilla.org/MPL/2.0.
|
||||||
|
|
||||||
Software distributed under the License is distributed on an "AS IS" basis,
|
|
||||||
WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License for
|
|
||||||
the specific language governing rights and limitations under the License.
|
|
||||||
|
|
||||||
Alternatively, the contents of this file may be used under the terms of the
|
|
||||||
GNU Lesser General Public License (the "LGPL License"), in which case the
|
|
||||||
provisions of the LGPL License are applicable instead of those above.
|
|
||||||
If you wish to allow use of your version of this file only under the terms
|
|
||||||
of the LGPL License and not to allow others to use your version of this file
|
|
||||||
under the MPL, indicate your decision by deleting the provisions above and
|
|
||||||
replace them with the notice and other provisions required by the LGPL
|
|
||||||
License. If you do not delete the provisions above, a recipient may use
|
|
||||||
your version of this file under either the MPL or the LGPL License.
|
|
||||||
|
|
||||||
For more information about the LGPL: http://www.gnu.org/copyleft/lesser.html
|
|
||||||
}
|
}
|
||||||
|
|
||||||
{ This unit contains functions for loading and saving OpenGL textures
|
{ This unit contains functions for loading and saving OpenGL textures
|
||||||
@@ -33,17 +16,18 @@ unit ImagingOpenGL;
|
|||||||
{$I ImagingOptions.inc}
|
{$I ImagingOptions.inc}
|
||||||
|
|
||||||
{ Define this symbol if you want to use dglOpenGL header.}
|
{ Define this symbol if you want to use dglOpenGL header.}
|
||||||
{ $DEFINE USE_DGL_HEADERS}
|
{$DEFINE OPENGL_USE_DGL_HEADERS}
|
||||||
{ $DEFINE USE_GLSCENE_HEADERS}
|
|
||||||
|
{$IFDEF OPENGL_NO_EXT_HEADERS}
|
||||||
|
{$UNDEF OPENGL_USE_DGL_HEADERS}
|
||||||
|
{$ENDIF}
|
||||||
|
|
||||||
interface
|
interface
|
||||||
|
|
||||||
uses
|
uses
|
||||||
SysUtils, Classes, ImagingTypes, Imaging, ImagingFormats,
|
SysUtils, Classes, ImagingTypes, Imaging, ImagingFormats,
|
||||||
{$IF Defined(USE_DGL_HEADERS)}
|
{$IF Defined(OPENGL_USE_DGL_HEADERS)}
|
||||||
dglOpenGL,
|
dglOpenGL,
|
||||||
{$ELSEIF Defined(USE_GLSCENE_HEADERS)}
|
|
||||||
OpenGL1x,
|
|
||||||
{$ELSE}
|
{$ELSE}
|
||||||
gl, glext,
|
gl, glext,
|
||||||
{$IFEND}
|
{$IFEND}
|
||||||
@@ -144,7 +128,7 @@ function SaveGLTextureToStream(const Ext: string; Stream: TStream; const Texture
|
|||||||
Saves all present mipmap levels.}
|
Saves all present mipmap levels.}
|
||||||
function SaveGLTextureToMemory(const Ext: string; Data: Pointer; var Size: LongInt; const Texture: GLuint): Boolean;
|
function SaveGLTextureToMemory(const Ext: string; Data: Pointer; var Size: LongInt; const Texture: GLuint): Boolean;
|
||||||
|
|
||||||
{ Converts main level of the GL texture to TImageData strucrue. OverrideFormat
|
{ Converts main level of the GL texture to TImageData structure. OverrideFormat
|
||||||
can be used to convert output image to the specified format rather
|
can be used to convert output image to the specified format rather
|
||||||
than use the format taken from GL texture, ifUnknown means no conversion.}
|
than use the format taken from GL texture, ifUnknown means no conversion.}
|
||||||
function CreateImageFromGLTexture(const Texture: GLuint;
|
function CreateImageFromGLTexture(const Texture: GLuint;
|
||||||
@@ -168,23 +152,23 @@ var
|
|||||||
pow2 texture is created and nonpow2 input image is pasted into it
|
pow2 texture is created and nonpow2 input image is pasted into it
|
||||||
keeping its original size. This could be useful for some 2D stuff
|
keeping its original size. This could be useful for some 2D stuff
|
||||||
(and its faster than rescaling of course). Note that this is applied
|
(and its faster than rescaling of course). Note that this is applied
|
||||||
to all rescaling smaller->bigger operations that might ocurr during
|
to all rescaling smaller->bigger operations that might occur during
|
||||||
image->texture process (usually only pow2/nonpow2 stuff and when you
|
image->texture process (usually only pow2/nonpow2 stuff and when you
|
||||||
set custom Width & Height in CreateGLTextureFrom(Multi)Image).}
|
set custom Width & Height in CreateGLTextureFrom(Multi)Image).}
|
||||||
PasteNonPow2ImagesIntoPow2: Boolean = False;
|
PasteNonPow2ImagesIntoPow2: Boolean = False;
|
||||||
{ Standard behaviur if GL_ARB_texture_non_power_of_two extension is not supported
|
{ Standard behavior if GL_ARB_texture_non_power_of_two extension is not supported
|
||||||
is to rescale image to power of 2 dimensions. NPOT extension is exposed only
|
is to rescale image to power of 2 dimensions. NPOT extension is exposed only
|
||||||
when HW has full support for NPOT textures but some cards
|
when HW has full support for NPOT textures but some cards
|
||||||
(ATI Radeons, some other maybe) have partial NPOT support. Namely Radeons
|
(pre-DX10 ATI Radeons, some other maybe) have partial NPOT support.
|
||||||
can use NPOT textures but not mipmapped. If you know what you are doing
|
Namely Radeons can use NPOT textures but not mipmapped. If you know what you are doing
|
||||||
you can disable NPOT support check so the image won't be rescaled to POT
|
you can disable NPOT support check so the image won't be rescaled to POT
|
||||||
by seting DisableNPOTSupportCheck to True.}
|
by setting DisableNPOTSupportCheck to True.}
|
||||||
DisableNPOTSupportCheck: Boolean = False;
|
DisableNPOTSupportCheck: Boolean = False;
|
||||||
|
|
||||||
implementation
|
implementation
|
||||||
|
|
||||||
const
|
const
|
||||||
// cube map consts
|
// Cube map constants
|
||||||
GL_TEXTURE_BINDING_CUBE_MAP = $8514;
|
GL_TEXTURE_BINDING_CUBE_MAP = $8514;
|
||||||
GL_TEXTURE_CUBE_MAP_POSITIVE_X = $8515;
|
GL_TEXTURE_CUBE_MAP_POSITIVE_X = $8515;
|
||||||
GL_TEXTURE_CUBE_MAP_NEGATIVE_X = $8516;
|
GL_TEXTURE_CUBE_MAP_NEGATIVE_X = $8516;
|
||||||
@@ -193,7 +177,7 @@ const
|
|||||||
GL_TEXTURE_CUBE_MAP_POSITIVE_Z = $8519;
|
GL_TEXTURE_CUBE_MAP_POSITIVE_Z = $8519;
|
||||||
GL_TEXTURE_CUBE_MAP_NEGATIVE_Z = $851A;
|
GL_TEXTURE_CUBE_MAP_NEGATIVE_Z = $851A;
|
||||||
|
|
||||||
// texture formats
|
// Texture formats
|
||||||
GL_COLOR_INDEX = $1900;
|
GL_COLOR_INDEX = $1900;
|
||||||
GL_STENCIL_INDEX = $1901;
|
GL_STENCIL_INDEX = $1901;
|
||||||
GL_DEPTH_COMPONENT = $1902;
|
GL_DEPTH_COMPONENT = $1902;
|
||||||
@@ -208,7 +192,7 @@ const
|
|||||||
GL_BGR_EXT = $80E0;
|
GL_BGR_EXT = $80E0;
|
||||||
GL_BGRA_EXT = $80E1;
|
GL_BGRA_EXT = $80E1;
|
||||||
|
|
||||||
// texture internal formats
|
// Texture internal formats
|
||||||
GL_ALPHA4 = $803B;
|
GL_ALPHA4 = $803B;
|
||||||
GL_ALPHA8 = $803C;
|
GL_ALPHA8 = $803C;
|
||||||
GL_ALPHA12 = $803D;
|
GL_ALPHA12 = $803D;
|
||||||
@@ -242,8 +226,9 @@ const
|
|||||||
GL_RGB10_A2 = $8059;
|
GL_RGB10_A2 = $8059;
|
||||||
GL_RGBA12 = $805A;
|
GL_RGBA12 = $805A;
|
||||||
GL_RGBA16 = $805B;
|
GL_RGBA16 = $805B;
|
||||||
|
GL_RGB565 = $8D62;
|
||||||
|
|
||||||
// floating point texture formats
|
// Floating point texture formats
|
||||||
GL_RGBA32F_ARB = $8814;
|
GL_RGBA32F_ARB = $8814;
|
||||||
GL_INTENSITY32F_ARB = $8817;
|
GL_INTENSITY32F_ARB = $8817;
|
||||||
GL_LUMINANCE32F_ARB = $8818;
|
GL_LUMINANCE32F_ARB = $8818;
|
||||||
@@ -251,22 +236,46 @@ const
|
|||||||
GL_INTENSITY16F_ARB = $881D;
|
GL_INTENSITY16F_ARB = $881D;
|
||||||
GL_LUMINANCE16F_ARB = $881E;
|
GL_LUMINANCE16F_ARB = $881E;
|
||||||
|
|
||||||
// compressed texture formats
|
// Compressed texture formats
|
||||||
|
// S3TC/DXTC
|
||||||
|
GL_COMPRESSED_RGB_S3TC_DXT1_EXT = $83F0;
|
||||||
GL_COMPRESSED_RGBA_S3TC_DXT1_EXT = $83F1;
|
GL_COMPRESSED_RGBA_S3TC_DXT1_EXT = $83F1;
|
||||||
GL_COMPRESSED_RGBA_S3TC_DXT3_EXT = $83F2;
|
GL_COMPRESSED_RGBA_S3TC_DXT3_EXT = $83F2;
|
||||||
GL_COMPRESSED_RGBA_S3TC_DXT5_EXT = $83F3;
|
GL_COMPRESSED_RGBA_S3TC_DXT5_EXT = $83F3;
|
||||||
|
// 3Dc LATC
|
||||||
GL_COMPRESSED_LUMINANCE_ALPHA_3DC_ATI = $8837;
|
GL_COMPRESSED_LUMINANCE_ALPHA_3DC_ATI = $8837;
|
||||||
GL_COMPRESSED_LUMINANCE_LATC1_EXT = $8C70;
|
GL_COMPRESSED_LUMINANCE_LATC1_EXT = $8C70;
|
||||||
GL_COMPRESSED_SIGNED_LUMINANCE_LATC1_EXT = $8C71;
|
GL_COMPRESSED_SIGNED_LUMINANCE_LATC1_EXT = $8C71;
|
||||||
GL_COMPRESSED_LUMINANCE_ALPHA_LATC2_EXT = $8C72;
|
GL_COMPRESSED_LUMINANCE_ALPHA_LATC2_EXT = $8C72;
|
||||||
GL_COMPRESSED_SIGNED_LUMINANCE_ALPHA_LATC2_EXT = $8C73;
|
GL_COMPRESSED_SIGNED_LUMINANCE_ALPHA_LATC2_EXT = $8C73;
|
||||||
|
// ETC1 GL_OES_compressed_ETC1_RGB8_texture
|
||||||
|
GL_ETC1_RGB_OES = $8D64;
|
||||||
|
// PVRTC GL_IMG_texture_compression_pvrtc
|
||||||
|
GL_COMPRESSED_RGB_PVRTC_4BPPV1_IMG = $8C00;
|
||||||
|
GL_COMPRESSED_RGB_PVRTC_2BPPV1_IMG = $8C01;
|
||||||
|
GL_COMPRESSED_RGBA_PVRTC_4BPPV1_IMG = $8C02;
|
||||||
|
GL_COMPRESSED_RGBA_PVRTC_2BPPV1_IMG = $8C03;
|
||||||
|
// AMD ATC
|
||||||
|
GL_ATC_RGBA_EXPLICIT_ALPHA_AMD = $8C93;
|
||||||
|
GL_ATC_RGBA_INTERPOLATED_ALPHA_AMD = $87EE;
|
||||||
|
// ETC2/EAC
|
||||||
|
GL_COMPRESSED_R11_EAC = $9270;
|
||||||
|
GL_COMPRESSED_SIGNED_R11_EAC = $9271;
|
||||||
|
GL_COMPRESSED_RG11_EAC = $9272;
|
||||||
|
GL_COMPRESSED_SIGNED_RG11_EAC = $9273;
|
||||||
|
GL_COMPRESSED_RGB8_ETC2 = $9274;
|
||||||
|
GL_COMPRESSED_SRGB8_ETC2 = $9275;
|
||||||
|
GL_COMPRESSED_RGB8_PUNCHTHROUGH_ALPHA1_ETC2 = $9276;
|
||||||
|
GL_COMPRESSED_SRGB8_PUNCHTHROUGH_ALPHA1_ETC2 = $9277;
|
||||||
|
GL_COMPRESSED_RGBA8_ETC2_EAC = $9278;
|
||||||
|
GL_COMPRESSED_SRGB8_ALPHA8_ETC2_EAC = $9279;
|
||||||
|
|
||||||
// various GL extension constants
|
// Various GL extension constants
|
||||||
GL_MAX_TEXTURE_UNITS = $84E2;
|
GL_MAX_TEXTURE_UNITS = $84E2;
|
||||||
GL_TEXTURE_MAX_ANISOTROPY_EXT = $84FE;
|
GL_TEXTURE_MAX_ANISOTROPY_EXT = $84FE;
|
||||||
GL_MAX_TEXTURE_MAX_ANISOTROPY_EXT = $84FF;
|
GL_MAX_TEXTURE_MAX_ANISOTROPY_EXT = $84FF;
|
||||||
|
|
||||||
// texture source data formats
|
// Texture source data formats
|
||||||
GL_UNSIGNED_BYTE_3_3_2 = $8032;
|
GL_UNSIGNED_BYTE_3_3_2 = $8032;
|
||||||
GL_UNSIGNED_SHORT_4_4_4_4 = $8033;
|
GL_UNSIGNED_SHORT_4_4_4_4 = $8033;
|
||||||
GL_UNSIGNED_SHORT_5_5_5_1 = $8034;
|
GL_UNSIGNED_SHORT_5_5_5_1 = $8034;
|
||||||
@@ -302,10 +311,10 @@ var
|
|||||||
ExtensionBuffer: string = '';
|
ExtensionBuffer: string = '';
|
||||||
|
|
||||||
{$IFDEF MSWINDOWS}
|
{$IFDEF MSWINDOWS}
|
||||||
function wglGetProcAddress(ProcName: PChar): Pointer; stdcall; external GLLibName;
|
function wglGetProcAddress(ProcName: PAnsiChar): Pointer; stdcall; external GLLibName;
|
||||||
{$ENDIF}
|
{$ENDIF}
|
||||||
{$IFDEF UNIX}
|
{$IFDEF UNIX}
|
||||||
function glXGetProcAddress(ProcName: PChar): Pointer; cdecl; external GLLibName;
|
function glXGetProcAddress(ProcName: PAnsiChar): Pointer; cdecl; external GLLibName;
|
||||||
{$ENDIF}
|
{$ENDIF}
|
||||||
|
|
||||||
function IsGLExtensionSupported(const Extension: string): Boolean;
|
function IsGLExtensionSupported(const Extension: string): Boolean;
|
||||||
@@ -327,16 +336,16 @@ end;
|
|||||||
function GetGLProcAddress(const ProcName: string): Pointer;
|
function GetGLProcAddress(const ProcName: string): Pointer;
|
||||||
begin
|
begin
|
||||||
{$IFDEF MSWINDOWS}
|
{$IFDEF MSWINDOWS}
|
||||||
Result := wglGetProcAddress(PChar(ProcName));
|
Result := wglGetProcAddress(PAnsiChar(AnsiString(ProcName)));
|
||||||
{$ENDIF}
|
{$ENDIF}
|
||||||
{$IFDEF UNIX}
|
{$IFDEF UNIX}
|
||||||
Result := glXGetProcAddress(PChar(ProcName));
|
Result := glXGetProcAddress(PAnsiChar(AnsiString(ProcName)));
|
||||||
{$ENDIF}
|
{$ENDIF}
|
||||||
end;
|
end;
|
||||||
|
|
||||||
function GetGLTextureCaps(var Caps: TGLTextureCaps): Boolean;
|
function GetGLTextureCaps(var Caps: TGLTextureCaps): Boolean;
|
||||||
begin
|
begin
|
||||||
// Check DXTC support and load extension functions if necesary
|
// Check DXTC support and load extension functions if necessary
|
||||||
Caps.DXTCompression := IsGLExtensionSupported('GL_ARB_texture_compression') and
|
Caps.DXTCompression := IsGLExtensionSupported('GL_ARB_texture_compression') and
|
||||||
IsGLExtensionSupported('GL_EXT_texture_compression_s3tc');
|
IsGLExtensionSupported('GL_EXT_texture_compression_s3tc');
|
||||||
if Caps.DXTCompression then
|
if Caps.DXTCompression then
|
||||||
@@ -408,7 +417,7 @@ begin
|
|||||||
begin
|
begin
|
||||||
GLFormat := GL_RGB;
|
GLFormat := GL_RGB;
|
||||||
GLType := GL_UNSIGNED_SHORT_5_6_5;
|
GLType := GL_UNSIGNED_SHORT_5_6_5;
|
||||||
GLInternal := GL_RGB5;
|
GLInternal := GL_RGB5; //GL_RGB565 ot working on Radeons
|
||||||
end;
|
end;
|
||||||
ifA1R5G5B5, ifX1R5G5B5:
|
ifA1R5G5B5, ifX1R5G5B5:
|
||||||
begin
|
begin
|
||||||
@@ -656,7 +665,7 @@ begin
|
|||||||
// Generate new texture, bind it and set
|
// Generate new texture, bind it and set
|
||||||
glGenTextures(1, @Result);
|
glGenTextures(1, @Result);
|
||||||
glBindTexture(GL_TEXTURE_2D, Result);
|
glBindTexture(GL_TEXTURE_2D, Result);
|
||||||
if Byte(glIsTexture(Result)) <> GL_TRUE then
|
if glIsTexture(Result) <> GL_TRUE then
|
||||||
Exit;
|
Exit;
|
||||||
|
|
||||||
for I := MainLevelIndex to MipLevels - 1 + MainLevelIndex do
|
for I := MainLevelIndex to MipLevels - 1 + MainLevelIndex do
|
||||||
@@ -843,12 +852,16 @@ begin
|
|||||||
FreeImagesInArray(Images);
|
FreeImagesInArray(Images);
|
||||||
SetLength(Images, 0);
|
SetLength(Images, 0);
|
||||||
Result := False;
|
Result := False;
|
||||||
if Byte(glIsTexture(Texture)) = GL_TRUE then
|
if glIsTexture(Texture) = GL_TRUE then
|
||||||
begin
|
begin
|
||||||
// Check if desired mipmap level count is valid
|
// Check if desired mipmap level count is valid
|
||||||
glBindTexture(GL_TEXTURE_2D, Texture);
|
glBindTexture(GL_TEXTURE_2D, Texture);
|
||||||
if MipLevels <= 0 then
|
if MipLevels <= 0 then
|
||||||
|
begin
|
||||||
|
glGetTexLevelParameteriv(GL_TEXTURE_2D, 0, GL_TEXTURE_WIDTH, @Width);
|
||||||
|
glGetTexLevelParameteriv(GL_TEXTURE_2D, 0, GL_TEXTURE_HEIGHT, @Height);
|
||||||
MipLevels := GetNumMipMapLevels(Width, Height);
|
MipLevels := GetNumMipMapLevels(Width, Height);
|
||||||
|
end;
|
||||||
SetLength(Images, MipLevels);
|
SetLength(Images, MipLevels);
|
||||||
ExistingLevels := 0;
|
ExistingLevels := 0;
|
||||||
|
|
||||||
@@ -883,9 +896,13 @@ initialization
|
|||||||
File Notes:
|
File Notes:
|
||||||
|
|
||||||
-- TODOS ----------------------------------------------------
|
-- TODOS ----------------------------------------------------
|
||||||
- use internal format of texture in CreateMultiImageFromGLTexture
|
|
||||||
not only A8R8G8B8
|
-- 0.77.1 ---------------------------------------------------
|
||||||
- support for cube and 3D maps
|
- Added some new compressed formats IDs
|
||||||
|
|
||||||
|
-- 0.26.5 Changes/Bug Fixes ---------------------------------
|
||||||
|
- Fixed GetGLProcAddress in Unicode Delphi. Compressed
|
||||||
|
textures didn't work because of this.
|
||||||
|
|
||||||
-- 0.26.1 Changes/Bug Fixes ---------------------------------
|
-- 0.26.1 Changes/Bug Fixes ---------------------------------
|
||||||
- Added support for GLScene's OpenGL header.
|
- Added support for GLScene's OpenGL header.
|
||||||
|
|||||||
+77
-50
@@ -1,5 +1,3 @@
|
|||||||
{ $Id: ImagingOptions.inc 174 2009-09-08 09:37:59Z galfar $ }
|
|
||||||
|
|
||||||
{
|
{
|
||||||
User Options
|
User Options
|
||||||
Following defines and options can be changed by user.
|
Following defines and options can be changed by user.
|
||||||
@@ -9,21 +7,24 @@
|
|||||||
|
|
||||||
{$DEFINE USE_INLINE} // Use function inlining for some functions
|
{$DEFINE USE_INLINE} // Use function inlining for some functions
|
||||||
// works in Free Pascal and Delphi 9+.
|
// works in Free Pascal and Delphi 9+.
|
||||||
{.$DEFINE USE_ASM} // Ff defined, assembler versions of some
|
{$DEFINE USE_ASM} // If defined, assembler versions of some
|
||||||
// functions will be used (only for x86).
|
// functions will be used (only for x86).
|
||||||
|
|
||||||
// Debug options: If none of these two are defined
|
// Debug options: If none of these two are defined
|
||||||
// your project settings are used.
|
// your project settings are used.
|
||||||
{ $DEFINE IMAGING_DEBUG} // If defined, debug info, range/IO/overflow
|
{.$DEFINE IMAGING_DEBUG} // If defined, debug info, range/IO/overflow
|
||||||
// checking, stack frames, assertions, and
|
// checking, stack frames, assertions, and
|
||||||
// other debugging options will be turned on.
|
// other debugging options will be turned on.
|
||||||
{$DEFINE IMAGING_RELEASE} // If defined, all debug info is off.
|
{$DEFINE IMAGING_RELEASE} // If defined, all debug info is off.
|
||||||
|
|
||||||
|
{$DEFINE OPENGL_NO_EXT_HEADERS}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
(* File format support linking options.
|
(* File format support linking options.
|
||||||
Define formats which you don't want to be registred automatically.
|
Define formats which you don't want to be registered automatically (by adding
|
||||||
Default: all formats are registered = no symbols defined.
|
Imaging.pas unit to your uses clause).
|
||||||
|
Default: most formats are registered = no symbols defined.
|
||||||
Example: If you want to disable JPEG support just uncomment //{$DEFINE DONT_LINK_JPEG} line
|
Example: If you want to disable JPEG support just uncomment //{$DEFINE DONT_LINK_JPEG} line
|
||||||
*)
|
*)
|
||||||
|
|
||||||
@@ -36,18 +37,14 @@
|
|||||||
{$DEFINE DONT_LINK_MNG} // link support for MNG images
|
{$DEFINE DONT_LINK_MNG} // link support for MNG images
|
||||||
{$DEFINE DONT_LINK_JNG} // link support for JNG images
|
{$DEFINE DONT_LINK_JNG} // link support for JNG images
|
||||||
{$DEFINE DONT_LINK_PNM} // link support for PortableMap images (PBM, PGM, PPM, PAM, PFM)
|
{$DEFINE DONT_LINK_PNM} // link support for PortableMap images (PBM, PGM, PPM, PAM, PFM)
|
||||||
|
{$DEFINE DONT_LINK_RADHDR} // link support for Radiance HDR/RGBE file format
|
||||||
|
|
||||||
{$DEFINE DONT_LINK_EXTRAS} // link support for file formats defined in
|
{$DEFINE DONT_LINK_EXTRAS} // link support for file formats defined in
|
||||||
// Extras package. Exactly which formats will be
|
// Extensions package. Exactly which formats will be
|
||||||
// registered depends on settings in
|
// registered depends on settings in
|
||||||
// ImagingExtras.pas unit.
|
// ImagingExtFileFormats.pas unit.
|
||||||
|
|
||||||
{ Component set used in ImagignComponents.pas unit. You usually don't need
|
{.$DEFINE DONT_LINK_FILE_FORMATS} // no auto link support of any file format
|
||||||
to be concerned with this - proper component library is selected automatically
|
|
||||||
according to your compiler. }
|
|
||||||
|
|
||||||
{ $DEFINE COMPONENT_SET_VCL} // use Delphi VCL
|
|
||||||
{$DEFINE COMPONENT_SET_LCL} // use Lazarus LCL (set automatically when compiling with FPC)
|
|
||||||
|
|
||||||
{
|
{
|
||||||
Auto Options
|
Auto Options
|
||||||
@@ -62,25 +59,20 @@
|
|||||||
{$BOOLEVAL OFF} // Boolean eval: off
|
{$BOOLEVAL OFF} // Boolean eval: off
|
||||||
{$EXTENDEDSYNTAX ON} // Extended syntax: on
|
{$EXTENDEDSYNTAX ON} // Extended syntax: on
|
||||||
{$LONGSTRINGS ON} // string = AnsiString: on
|
{$LONGSTRINGS ON} // string = AnsiString: on
|
||||||
{$MINENUMSIZE 4} // Min enum size: 4 B
|
{$MINENUMSIZE 1} // Min enum size: 1 B
|
||||||
{$TYPEDADDRESS OFF} // Typed pointers: off
|
{$TYPEDADDRESS OFF} // Typed pointers: off
|
||||||
{$WRITEABLECONST OFF} // Writeable constants: off
|
{$WRITEABLECONST OFF} // Writeable constants: off
|
||||||
|
|
||||||
{$IFNDEF FPC}
|
{$IFNDEF FPC}
|
||||||
{$DEFINE DCC} // if not using FPC then DCC compiler is used (Delphi/Kylix)
|
{$DEFINE DCC} // if not using FPC then DCC compiler is used (Delphi/BCB)
|
||||||
// others are not supported
|
// others are not supported
|
||||||
{$ENDIF}
|
{$ENDIF}
|
||||||
|
|
||||||
{$IFDEF DCC}
|
{$IFDEF DCC}
|
||||||
{$IFDEF LINUX}
|
{$DEFINE DELPHI}
|
||||||
{$DEFINE KYLIX} // using Kylix
|
{$IF (Defined(DCC) and (CompilerVersion >= 25.0))}
|
||||||
{$ENDIF}
|
{$LEGACYIFEND ON}
|
||||||
{$ENDIF}
|
{$IFEND}
|
||||||
|
|
||||||
{$IFDEF DCC}
|
|
||||||
{$IFNDEF KYLIX}
|
|
||||||
{$DEFINE DELPHI} // using Delphi
|
|
||||||
{$ENDIF}
|
|
||||||
{$ENDIF}
|
{$ENDIF}
|
||||||
|
|
||||||
{$IF (Defined(DCC) and (CompilerVersion >= 18.5))}
|
{$IF (Defined(DCC) and (CompilerVersion >= 18.5))}
|
||||||
@@ -123,37 +115,87 @@
|
|||||||
{$ENDIF}
|
{$ENDIF}
|
||||||
{$IFEND}
|
{$IFEND}
|
||||||
|
|
||||||
|
{$IF Defined(CPU86) and not Defined(CPUX86)}
|
||||||
|
{$DEFINE CPUX86} // Compatibility with Delphi
|
||||||
|
{$IFEND}
|
||||||
|
|
||||||
|
{$IF Defined(CPUX86_64) and not Defined(CPUX64)}
|
||||||
|
{$DEFINE CPUX64} // Compatibility with Delphi
|
||||||
|
{$IFEND}
|
||||||
|
|
||||||
|
{$IF Defined(DARWIN) and not Defined(MACOS)}
|
||||||
|
{$DEFINE MACOS} // Compatibility with Delphi
|
||||||
|
{$IFEND}
|
||||||
|
{$IF Defined(MACOS)}
|
||||||
|
{$DEFINE MACOSX}
|
||||||
|
{$IFEND}
|
||||||
|
|
||||||
|
{$IF Defined(DCC) and (CompilerVersion < 23)} // < XE2
|
||||||
|
{$DEFINE CPUX86} // Compatibility with older Delphi
|
||||||
|
{$IFEND}
|
||||||
|
|
||||||
|
{$IF Defined(WIN32) or Defined(WIN64)}
|
||||||
|
{$DEFINE MSWINDOWS} // Compatibility with Delphi
|
||||||
|
{$IFEND}
|
||||||
|
|
||||||
|
{$IF Defined(UNIX) and not Defined(POSIX)}
|
||||||
|
{$DEFINE POSIX} // Compatibility with Delphi
|
||||||
|
{$IFEND}
|
||||||
|
|
||||||
{ Compiler capabilities }
|
{ Compiler capabilities }
|
||||||
|
|
||||||
// Define if compiler supports inlining of functions and procedures
|
// Define if compiler supports inlining of functions and procedures
|
||||||
// Note that FPC inline support crashed in older versions (1.9.8)
|
{$IF (Defined(DCC) and (CompilerVersion >= 17)) or Defined(FPC)}
|
||||||
{$IF (Defined(DCC) and (CompilerVersion >= 17)) or (Defined(FPC) and Defined(CPU86))}
|
|
||||||
{$DEFINE HAS_INLINE}
|
{$DEFINE HAS_INLINE}
|
||||||
{$IFEND}
|
{$IFEND}
|
||||||
|
|
||||||
// Define if compiler supports advanced records with methods
|
// Define if compiler supports advanced records with methods
|
||||||
{$IF (Defined(DCC) and (CompilerVersion >= 18)) }
|
{$IF (Defined(DCC) and (CompilerVersion >= 18)) or
|
||||||
|
(Defined(FPC) and (FPC_FULLVERSION >= 20600))}
|
||||||
{$DEFINE HAS_ADVANCED_RECORDS}
|
{$DEFINE HAS_ADVANCED_RECORDS}
|
||||||
{$IFEND}
|
{$IFEND}
|
||||||
|
|
||||||
// Define if compiler supports operator overloading
|
// Define if compiler supports operator overloading
|
||||||
// (unfortunately Delphi and FPC operator overloaing is not compatible)
|
// (unfortunately Delphi and FPC operator overloading is not compatible).
|
||||||
{$IF (Defined(DCC) and (CompilerVersion >= 18)) or Defined(FPC)}
|
// FPC supports Delphi compatible operator overloads since 2.6.0
|
||||||
|
{$IF (Defined(DCC) and (CompilerVersion >= 18)) or
|
||||||
|
(Defined(FPC) and (FPC_FULLVERSION >= 20600))}
|
||||||
{$DEFINE HAS_OPERATOR_OVERLOADING}
|
{$DEFINE HAS_OPERATOR_OVERLOADING}
|
||||||
{$IFEND}
|
{$IFEND}
|
||||||
|
|
||||||
|
// Anonymous methods
|
||||||
|
{$IF Defined(DCC) and (CompilerVersion >= 20) }
|
||||||
|
{$DEFINE HAS_ANON_METHODS}
|
||||||
|
{$IFEND}
|
||||||
|
|
||||||
|
// Generic types (Delphi and FPC implementations incompatible).
|
||||||
|
// Update: FPC supports Delphi compatible generics since 2.6.0
|
||||||
|
{$IF (Defined(DCC) and (CompilerVersion >= 20)) or
|
||||||
|
(Defined(FPC) and (FPC_FULLVERSION >= 20600))}
|
||||||
|
{$DEFINE HAS_GENERICS}
|
||||||
|
{$IFEND}
|
||||||
|
|
||||||
|
{ Compiler pecularities }
|
||||||
|
|
||||||
|
// Delphi 64bit POSIX targets
|
||||||
|
{$IF Defined(DCC) and (SizeOf(Integer) <> SizeOf(LongInt))}
|
||||||
|
{$DEFINE LONGINT_IS_NOT_INTEGER}
|
||||||
|
{$IFEND}
|
||||||
|
|
||||||
|
// They used to force IFEND, now they warn about it
|
||||||
|
{$IF Defined(DCC) and (CompilerVersion >= 33)}
|
||||||
|
{$LEGACYIFEND ON}
|
||||||
|
{$IFEND}
|
||||||
|
|
||||||
{ Imaging options check}
|
{ Imaging options check}
|
||||||
|
|
||||||
{$IFNDEF HAS_INLINE}
|
{$IFNDEF HAS_INLINE}
|
||||||
{$UNDEF USE_INLINE}
|
{$UNDEF USE_INLINE}
|
||||||
{$ENDIF}
|
{$ENDIF}
|
||||||
|
|
||||||
{$IFDEF FPC}
|
{$IF not Defined(CPUX86)}
|
||||||
{$IFNDEF CPU86}
|
{$UNDEF USE_ASM}
|
||||||
{$UNDEF USE_ASM}
|
{$IFEND}
|
||||||
{$ENDIF}
|
|
||||||
{$ENDIF}
|
|
||||||
|
|
||||||
{$IFDEF FPC}
|
{$IFDEF FPC}
|
||||||
{$DEFINE COMPONENT_SET_LCL}
|
{$DEFINE COMPONENT_SET_LCL}
|
||||||
@@ -165,20 +207,6 @@
|
|||||||
{$DEFINE COMPONENT_SET_VCL}
|
{$DEFINE COMPONENT_SET_VCL}
|
||||||
{$ENDIF}
|
{$ENDIF}
|
||||||
|
|
||||||
{ Platform options }
|
|
||||||
|
|
||||||
{$IFDEF WIN32}
|
|
||||||
{$DEFINE MSWINDOWS}
|
|
||||||
{$ENDIF}
|
|
||||||
|
|
||||||
{$IFDEF DPMI}
|
|
||||||
{$DEFINE MSDOS}
|
|
||||||
{$ENDIF}
|
|
||||||
|
|
||||||
{$IFDEF LINUX}
|
|
||||||
{$DEFINE UNIX}
|
|
||||||
{$ENDIF}
|
|
||||||
|
|
||||||
{ More compiler options }
|
{ More compiler options }
|
||||||
|
|
||||||
{$IFDEF FPC} // Free Pascal options - some options set above (like min enum size)
|
{$IFDEF FPC} // Free Pascal options - some options set above (like min enum size)
|
||||||
@@ -188,7 +216,6 @@
|
|||||||
{$GOTO ON} // alow goto
|
{$GOTO ON} // alow goto
|
||||||
{$PACKRECORDS 8} // same as ALING 8 for Delphi
|
{$PACKRECORDS 8} // same as ALING 8 for Delphi
|
||||||
{$PACKENUM 4} // Min enum size: 4 B
|
{$PACKENUM 4} // Min enum size: 4 B
|
||||||
{$CALLING REGISTER} // default calling convention is register
|
|
||||||
{$IFDEF CPU86}
|
{$IFDEF CPU86}
|
||||||
{$ASMMODE INTEL} // intel assembler mode
|
{$ASMMODE INTEL} // intel assembler mode
|
||||||
{$ENDIF}
|
{$ENDIF}
|
||||||
|
|||||||
+54
-113
@@ -1,29 +1,12 @@
|
|||||||
{
|
{
|
||||||
$Id: ImagingPortableMaps.pas 163 2009-07-28 21:44:10Z galfar $
|
|
||||||
Vampyre Imaging Library
|
Vampyre Imaging Library
|
||||||
by Marek Mauder
|
by Marek Mauder
|
||||||
http://imaginglib.sourceforge.net
|
https://github.com/galfar/imaginglib
|
||||||
|
https://imaginglib.sourceforge.io
|
||||||
The contents of this file are used with permission, subject to the Mozilla
|
- - - - -
|
||||||
Public License Version 1.1 (the "License"); you may not use this file except
|
This Source Code Form is subject to the terms of the Mozilla Public
|
||||||
in compliance with the License. You may obtain a copy of the License at
|
License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||||
http://www.mozilla.org/MPL/MPL-1.1.html
|
file, You can obtain one at https://mozilla.org/MPL/2.0.
|
||||||
|
|
||||||
Software distributed under the License is distributed on an "AS IS" basis,
|
|
||||||
WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License for
|
|
||||||
the specific language governing rights and limitations under the License.
|
|
||||||
|
|
||||||
Alternatively, the contents of this file may be used under the terms of the
|
|
||||||
GNU Lesser General Public License (the "LGPL License"), in which case the
|
|
||||||
provisions of the LGPL License are applicable instead of those above.
|
|
||||||
If you wish to allow use of your version of this file only under the terms
|
|
||||||
of the LGPL License and not to allow others to use your version of this file
|
|
||||||
under the MPL, indicate your decision by deleting the provisions above and
|
|
||||||
replace them with the notice and other provisions required by the LGPL
|
|
||||||
License. If you do not delete the provisions above, a recipient may use
|
|
||||||
your version of this file under either the MPL or the LGPL License.
|
|
||||||
|
|
||||||
For more information about the LGPL: http://www.gnu.org/copyleft/lesser.html
|
|
||||||
}
|
}
|
||||||
|
|
||||||
{ This unit contains loader/saver for Portable Maps file format family (or PNM).
|
{ This unit contains loader/saver for Portable Maps file format family (or PNM).
|
||||||
@@ -65,12 +48,13 @@ type
|
|||||||
protected
|
protected
|
||||||
FIdNumbers: TChar2;
|
FIdNumbers: TChar2;
|
||||||
FSaveBinary: LongBool;
|
FSaveBinary: LongBool;
|
||||||
|
FUSFormat: TFormatSettings;
|
||||||
|
procedure Define; override;
|
||||||
function LoadData(Handle: TImagingHandle; var Images: TDynImageDataArray;
|
function LoadData(Handle: TImagingHandle; var Images: TDynImageDataArray;
|
||||||
OnlyFirstLevel: Boolean): Boolean; override;
|
OnlyFirstLevel: Boolean): Boolean; override;
|
||||||
function SaveDataInternal(Handle: TImagingHandle; const Images: TDynImageDataArray;
|
function SaveDataInternal(Handle: TImagingHandle; const Images: TDynImageDataArray;
|
||||||
Index: LongInt; var MapInfo: TPortableMapInfo): Boolean;
|
Index: LongInt; var MapInfo: TPortableMapInfo): Boolean;
|
||||||
public
|
public
|
||||||
constructor Create; override;
|
|
||||||
function TestFormat(Handle: TImagingHandle): Boolean; override;
|
function TestFormat(Handle: TImagingHandle): Boolean; override;
|
||||||
published
|
published
|
||||||
{ If set to True images will be saved in binary format. If it is False
|
{ If set to True images will be saved in binary format. If it is False
|
||||||
@@ -85,32 +69,30 @@ type
|
|||||||
PBM images can be loaded but not saved. Loaded images are returned in
|
PBM images can be loaded but not saved. Loaded images are returned in
|
||||||
ifGray8 format (witch pixel values scaled from 1bit to 8bit).}
|
ifGray8 format (witch pixel values scaled from 1bit to 8bit).}
|
||||||
TPBMFileFormat = class(TPortableMapFileFormat)
|
TPBMFileFormat = class(TPortableMapFileFormat)
|
||||||
public
|
protected
|
||||||
constructor Create; override;
|
procedure Define; override;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
{ Portable Gray Map is used to store grayscale 8bit or 16bit images.
|
{ Portable Gray Map is used to store grayscale 8bit or 16bit images.
|
||||||
Raster data can be saved as text or binary data.}
|
Raster data can be saved as text or binary data.}
|
||||||
TPGMFileFormat = class(TPortableMapFileFormat)
|
TPGMFileFormat = class(TPortableMapFileFormat)
|
||||||
protected
|
protected
|
||||||
|
procedure Define; override;
|
||||||
function SaveData(Handle: TImagingHandle; const Images: TDynImageDataArray;
|
function SaveData(Handle: TImagingHandle; const Images: TDynImageDataArray;
|
||||||
Index: LongInt): Boolean; override;
|
Index: LongInt): Boolean; override;
|
||||||
procedure ConvertToSupported(var Image: TImageData;
|
procedure ConvertToSupported(var Image: TImageData;
|
||||||
const Info: TImageFormatInfo); override;
|
const Info: TImageFormatInfo); override;
|
||||||
public
|
|
||||||
constructor Create; override;
|
|
||||||
end;
|
end;
|
||||||
|
|
||||||
{ Portable Pixel Map is used to store RGB images with 8bit or 16bit channels.
|
{ Portable Pixel Map is used to store RGB images with 8bit or 16bit channels.
|
||||||
Raster data can be saved as text or binary data.}
|
Raster data can be saved as text or binary data.}
|
||||||
TPPMFileFormat = class(TPortableMapFileFormat)
|
TPPMFileFormat = class(TPortableMapFileFormat)
|
||||||
protected
|
protected
|
||||||
|
procedure Define; override;
|
||||||
function SaveData(Handle: TImagingHandle; const Images: TDynImageDataArray;
|
function SaveData(Handle: TImagingHandle; const Images: TDynImageDataArray;
|
||||||
Index: LongInt): Boolean; override;
|
Index: LongInt): Boolean; override;
|
||||||
procedure ConvertToSupported(var Image: TImageData;
|
procedure ConvertToSupported(var Image: TImageData;
|
||||||
const Info: TImageFormatInfo); override;
|
const Info: TImageFormatInfo); override;
|
||||||
public
|
|
||||||
constructor Create; override;
|
|
||||||
end;
|
end;
|
||||||
|
|
||||||
{ Portable Arbitrary Map is format that can store image data formats
|
{ Portable Arbitrary Map is format that can store image data formats
|
||||||
@@ -120,12 +102,11 @@ type
|
|||||||
ifR8G8B8, ifR16G16R16, ifA8R8G8B8, and ifA16R16G16B16.}
|
ifR8G8B8, ifR16G16R16, ifA8R8G8B8, and ifA16R16G16B16.}
|
||||||
TPAMFileFormat = class(TPortableMapFileFormat)
|
TPAMFileFormat = class(TPortableMapFileFormat)
|
||||||
protected
|
protected
|
||||||
|
procedure Define; override;
|
||||||
function SaveData(Handle: TImagingHandle; const Images: TDynImageDataArray;
|
function SaveData(Handle: TImagingHandle; const Images: TDynImageDataArray;
|
||||||
Index: LongInt): Boolean; override;
|
Index: LongInt): Boolean; override;
|
||||||
procedure ConvertToSupported(var Image: TImageData;
|
procedure ConvertToSupported(var Image: TImageData;
|
||||||
const Info: TImageFormatInfo); override;
|
const Info: TImageFormatInfo); override;
|
||||||
public
|
|
||||||
constructor Create; override;
|
|
||||||
end;
|
end;
|
||||||
|
|
||||||
{ Portable Float Map is unofficial extension of PNM format family which
|
{ Portable Float Map is unofficial extension of PNM format family which
|
||||||
@@ -134,12 +115,11 @@ type
|
|||||||
or RGB images are supported by PFM format (so no alpha).}
|
or RGB images are supported by PFM format (so no alpha).}
|
||||||
TPFMFileFormat = class(TPortableMapFileFormat)
|
TPFMFileFormat = class(TPortableMapFileFormat)
|
||||||
protected
|
protected
|
||||||
|
procedure Define; override;
|
||||||
function SaveData(Handle: TImagingHandle; const Images: TDynImageDataArray;
|
function SaveData(Handle: TImagingHandle; const Images: TDynImageDataArray;
|
||||||
Index: LongInt): Boolean; override;
|
Index: LongInt): Boolean; override;
|
||||||
procedure ConvertToSupported(var Image: TImageData;
|
procedure ConvertToSupported(var Image: TImageData;
|
||||||
const Info: TImageFormatInfo); override;
|
const Info: TImageFormatInfo); override;
|
||||||
public
|
|
||||||
constructor Create; override;
|
|
||||||
end;
|
end;
|
||||||
|
|
||||||
implementation
|
implementation
|
||||||
@@ -161,7 +141,7 @@ const
|
|||||||
ifR8G8B8, ifR16G16B16, ifA8R8G8B8, ifA16R16G16B16];
|
ifR8G8B8, ifR16G16B16, ifA8R8G8B8, ifA16R16G16B16];
|
||||||
SPFMFormatName = 'Portable Float Map';
|
SPFMFormatName = 'Portable Float Map';
|
||||||
SPFMMasks = '*.pfm';
|
SPFMMasks = '*.pfm';
|
||||||
PFMSupportedFormats = [ifR32F, ifA32B32G32R32F];
|
PFMSupportedFormats = [ifR32F, ifB32G32R32F];
|
||||||
|
|
||||||
const
|
const
|
||||||
{ TAB, CR, LF, and Space are used as seperators in Portable map headers and data.}
|
{ TAB, CR, LF, and Space are used as seperators in Portable map headers and data.}
|
||||||
@@ -183,13 +163,12 @@ const
|
|||||||
|
|
||||||
{ TPortableMapFileFormat }
|
{ TPortableMapFileFormat }
|
||||||
|
|
||||||
constructor TPortableMapFileFormat.Create;
|
procedure TPortableMapFileFormat.Define;
|
||||||
begin
|
begin
|
||||||
inherited Create;
|
inherited;
|
||||||
FCanLoad := True;
|
FFeatures := [ffLoad, ffSave];
|
||||||
FCanSave := True;
|
|
||||||
FIsMultiImageFormat := False;
|
|
||||||
FSaveBinary := PortableMapDefaultBinary;
|
FSaveBinary := PortableMapDefaultBinary;
|
||||||
|
FUSFormat := GetFormatSettingsForFloats;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
function TPortableMapFileFormat.LoadData(Handle: TImagingHandle;
|
function TPortableMapFileFormat.LoadData(Handle: TImagingHandle;
|
||||||
@@ -199,7 +178,6 @@ var
|
|||||||
Dest: PByte;
|
Dest: PByte;
|
||||||
MonoData: Pointer;
|
MonoData: Pointer;
|
||||||
Info: TImageFormatInfo;
|
Info: TImageFormatInfo;
|
||||||
PixelFP: TColorFPRec;
|
|
||||||
LineBuffer: array[0..LineBufferCapacity - 1] of AnsiChar;
|
LineBuffer: array[0..LineBufferCapacity - 1] of AnsiChar;
|
||||||
LineEnd, LinePos: LongInt;
|
LineEnd, LinePos: LongInt;
|
||||||
MapInfo: TPortableMapInfo;
|
MapInfo: TPortableMapInfo;
|
||||||
@@ -263,7 +241,7 @@ var
|
|||||||
C := LineBuffer[LinePos];
|
C := LineBuffer[LinePos];
|
||||||
Inc(LinePos);
|
Inc(LinePos);
|
||||||
until not (C in WhiteSpaces) or (LineEnd = 0);
|
until not (C in WhiteSpaces) or (LineEnd = 0);
|
||||||
// Dec pos, current is the begining of the the string
|
// Dec pos, current is the beginning of the the string
|
||||||
Dec(LinePos);
|
Dec(LinePos);
|
||||||
|
|
||||||
Result := string(S);
|
Result := string(S);
|
||||||
@@ -296,7 +274,6 @@ var
|
|||||||
I: TTupleType;
|
I: TTupleType;
|
||||||
TupleTypeName: string;
|
TupleTypeName: string;
|
||||||
Scale: Single;
|
Scale: Single;
|
||||||
OldSeparator: Char;
|
|
||||||
begin
|
begin
|
||||||
Result := False;
|
Result := False;
|
||||||
with GetIO do
|
with GetIO do
|
||||||
@@ -368,10 +345,7 @@ var
|
|||||||
// Read header of PFM file
|
// Read header of PFM file
|
||||||
MapInfo.Width := ReadIntValue;
|
MapInfo.Width := ReadIntValue;
|
||||||
MapInfo.Height := ReadIntValue;
|
MapInfo.Height := ReadIntValue;
|
||||||
OldSeparator := DecimalSeparator;
|
Scale := StrToFloatDef(ReadString, 0, FUSFormat);
|
||||||
DecimalSeparator := '.';
|
|
||||||
Scale := StrToFloatDef(ReadString, 0);
|
|
||||||
DecimalSeparator := OldSeparator;
|
|
||||||
MapInfo.IsBigEndian := Scale > 0.0;
|
MapInfo.IsBigEndian := Scale > 0.0;
|
||||||
if Id[1] = 'F' then
|
if Id[1] = 'F' then
|
||||||
MapInfo.TupleType := ttRGBFP
|
MapInfo.TupleType := ttRGBFP
|
||||||
@@ -387,7 +361,7 @@ var
|
|||||||
if MapInfo.Binary and not (Id[1] in ['F', 'f']) then
|
if MapInfo.Binary and not (Id[1] in ['F', 'f']) then
|
||||||
begin
|
begin
|
||||||
// Mimic the behaviour of Photoshop and other editors/viewers:
|
// Mimic the behaviour of Photoshop and other editors/viewers:
|
||||||
// If linenreaks in file are DOS CR/LF 16bit binary values are
|
// If linereaks in file are DOS CR/LF 16bit binary values are
|
||||||
// little endian, Unix LF only linebreak indicates big endian.
|
// little endian, Unix LF only linebreak indicates big endian.
|
||||||
MapInfo.IsBigEndian := LineBreak = #10;
|
MapInfo.IsBigEndian := LineBreak = #10;
|
||||||
end;
|
end;
|
||||||
@@ -411,6 +385,7 @@ begin
|
|||||||
LineEnd := 0;
|
LineEnd := 0;
|
||||||
LinePos := 0;
|
LinePos := 0;
|
||||||
SetLength(Images, 1);
|
SetLength(Images, 1);
|
||||||
|
|
||||||
with GetIO, Images[0] do
|
with GetIO, Images[0] do
|
||||||
begin
|
begin
|
||||||
Format := ifUnknown;
|
Format := ifUnknown;
|
||||||
@@ -425,7 +400,7 @@ begin
|
|||||||
ttRGB: Format := IffFormat(MapInfo.BitCount = 8, ifR8G8B8, ifR16G16B16);
|
ttRGB: Format := IffFormat(MapInfo.BitCount = 8, ifR8G8B8, ifR16G16B16);
|
||||||
ttRGBAlpha: Format := IffFormat(MapInfo.BitCount = 8, ifA8R8G8B8, ifA16R16G16B16);
|
ttRGBAlpha: Format := IffFormat(MapInfo.BitCount = 8, ifA8R8G8B8, ifA16R16G16B16);
|
||||||
ttGrayScaleFP: Format := ifR32F;
|
ttGrayScaleFP: Format := ifR32F;
|
||||||
ttRGBFP: Format := ifA32B32G32R32F;
|
ttRGBFP: Format := ifB32G32R32F;
|
||||||
end;
|
end;
|
||||||
// Exit if no matching data format was found
|
// Exit if no matching data format was found
|
||||||
if Format = ifUnknown then Exit;
|
if Format = ifUnknown then Exit;
|
||||||
@@ -482,27 +457,9 @@ begin
|
|||||||
// FP images are in BGR order and endian swap maybe needed.
|
// FP images are in BGR order and endian swap maybe needed.
|
||||||
// Some programs store scanlines in bottom-up order but
|
// Some programs store scanlines in bottom-up order but
|
||||||
// I will stick with Photoshops behaviour here
|
// I will stick with Photoshops behaviour here
|
||||||
for I := 0 to Width * Height - 1 do
|
Read(Handle, Bits, Size);
|
||||||
begin
|
if MapInfo.IsBigEndian then
|
||||||
Read(Handle, @PixelFP, MapInfo.BitCount div 8);
|
SwapEndianUInt32(PUInt32(Dest), Size div SizeOf(UInt32));
|
||||||
if MapInfo.TupleType = ttRGBFP then
|
|
||||||
with PColorFPRec(Dest)^ do
|
|
||||||
begin
|
|
||||||
A := 1.0;
|
|
||||||
R := PixelFP.R;
|
|
||||||
G := PixelFP.G;
|
|
||||||
B := PixelFP.B;
|
|
||||||
if MapInfo.IsBigEndian then
|
|
||||||
SwapEndianLongWord(PLongWord(Dest), 3);
|
|
||||||
end
|
|
||||||
else
|
|
||||||
begin
|
|
||||||
PSingle(Dest)^ := PixelFP.B;
|
|
||||||
if MapInfo.IsBigEndian then
|
|
||||||
SwapEndianLongWord(PLongWord(Dest), 1);
|
|
||||||
end;
|
|
||||||
Inc(Dest, Info.BytesPerPixel);
|
|
||||||
end;
|
|
||||||
end;
|
end;
|
||||||
|
|
||||||
if MapInfo.TupleType in [ttBlackAndWhite, ttBlackAndWhiteAlpha] then
|
if MapInfo.TupleType in [ttBlackAndWhite, ttBlackAndWhiteAlpha] then
|
||||||
@@ -532,8 +489,8 @@ begin
|
|||||||
GetMem(MonoData, MonoSize);
|
GetMem(MonoData, MonoSize);
|
||||||
try
|
try
|
||||||
Read(Handle, MonoData, MonoSize);
|
Read(Handle, MonoData, MonoSize);
|
||||||
Convert1To8(MonoData, Bits, Width, Height, ScanLineSize);
|
Convert1To8(MonoData, Bits, Width, Height, ScanLineSize, False);
|
||||||
// 1bit mono images must be scaled to 8bit (where 0=white, 1=black)
|
// 1bit mono images must be scaled to 8bit, but inverted (where 0=white, 1=black)
|
||||||
for I := 0 to Width * Height - 1 do
|
for I := 0 to Width * Height - 1 do
|
||||||
PByteArray(Bits)[I] := 255 - PByteArray(Bits)[I] * 255;
|
PByteArray(Bits)[I] := 255 - PByteArray(Bits)[I] * 255;
|
||||||
finally
|
finally
|
||||||
@@ -565,7 +522,7 @@ begin
|
|||||||
end;
|
end;
|
||||||
|
|
||||||
function TPortableMapFileFormat.SaveDataInternal(Handle: TImagingHandle;
|
function TPortableMapFileFormat.SaveDataInternal(Handle: TImagingHandle;
|
||||||
const Images: TDynImageDataArray; Index: Integer; var MapInfo: TPortableMapInfo): Boolean;
|
const Images: TDynImageDataArray; Index: LongInt; var MapInfo: TPortableMapInfo): Boolean;
|
||||||
const
|
const
|
||||||
// Use Unix linebreak, for many viewers/editors it means that
|
// Use Unix linebreak, for many viewers/editors it means that
|
||||||
// 16bit samples are stored as big endian - so we need to swap byte order
|
// 16bit samples are stored as big endian - so we need to swap byte order
|
||||||
@@ -595,8 +552,6 @@ var
|
|||||||
end;
|
end;
|
||||||
|
|
||||||
procedure WriteHeader;
|
procedure WriteHeader;
|
||||||
var
|
|
||||||
OldSeparator: Char;
|
|
||||||
begin
|
begin
|
||||||
WriteString('P' + MapInfo.FormatId);
|
WriteString('P' + MapInfo.FormatId);
|
||||||
if not MapInfo.HasPAMHeader then
|
if not MapInfo.HasPAMHeader then
|
||||||
@@ -608,11 +563,8 @@ var
|
|||||||
ttGrayScale, ttRGB: WriteString(IntToStr(Pow2Int(MapInfo.BitCount) - 1));
|
ttGrayScale, ttRGB: WriteString(IntToStr(Pow2Int(MapInfo.BitCount) - 1));
|
||||||
ttGrayScaleFP, ttRGBFP:
|
ttGrayScaleFP, ttRGBFP:
|
||||||
begin
|
begin
|
||||||
OldSeparator := DecimalSeparator;
|
|
||||||
DecimalSeparator := '.';
|
|
||||||
// Negative value indicates that raster data is saved in little endian
|
// Negative value indicates that raster data is saved in little endian
|
||||||
WriteString(FloatToStr(-1.0));
|
WriteString(FloatToStr(-1.0, FUSFormat));
|
||||||
DecimalSeparator := OldSeparator;
|
|
||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
end
|
end
|
||||||
@@ -699,7 +651,7 @@ begin
|
|||||||
end
|
end
|
||||||
else
|
else
|
||||||
begin
|
begin
|
||||||
// 8bit RGB/ARGB images: read and blue must be swapped and
|
// 8bit RGB/ARGB images: red and blue must be swapped and
|
||||||
// 3 or 4 bytes must be written
|
// 3 or 4 bytes must be written
|
||||||
Src := Bits;
|
Src := Bits;
|
||||||
for I := 0 to Width * Height - 1 do
|
for I := 0 to Width * Height - 1 do
|
||||||
@@ -750,23 +702,7 @@ begin
|
|||||||
begin
|
begin
|
||||||
// Floating point images (no need to swap endian here - little
|
// Floating point images (no need to swap endian here - little
|
||||||
// endian is specified in file header)
|
// endian is specified in file header)
|
||||||
if MapInfo.TupleType = ttGrayScaleFP then
|
Write(Handle, Bits, Size);
|
||||||
begin
|
|
||||||
// Grayscale images can be written in one Write call
|
|
||||||
Write(Handle, Bits, Size);
|
|
||||||
end
|
|
||||||
else
|
|
||||||
begin
|
|
||||||
// Expected data format of PFM RGB file is B32G32R32F which is not
|
|
||||||
// supported by Imaging. We must write pixels one by one and
|
|
||||||
// write only RGB part of A32B32G32B32 image.
|
|
||||||
Src := Bits;
|
|
||||||
for I := 0 to Width * Height - 1 do
|
|
||||||
begin
|
|
||||||
Write(Handle, Src, SizeOf(Single) * 3);
|
|
||||||
Inc(Src, Info.BytesPerPixel);
|
|
||||||
end;
|
|
||||||
end;
|
|
||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
Result := True;
|
Result := True;
|
||||||
@@ -794,20 +730,20 @@ end;
|
|||||||
|
|
||||||
{ TPBMFileFormat }
|
{ TPBMFileFormat }
|
||||||
|
|
||||||
constructor TPBMFileFormat.Create;
|
procedure TPBMFileFormat.Define;
|
||||||
begin
|
begin
|
||||||
inherited Create;
|
inherited;
|
||||||
FName := SPBMFormatName;
|
FName := SPBMFormatName;
|
||||||
FCanSave := False;
|
FFeatures := [ffLoad];
|
||||||
AddMasks(SPBMMasks);
|
AddMasks(SPBMMasks);
|
||||||
FIdNumbers := '14';
|
FIdNumbers := '14';
|
||||||
end;
|
end;
|
||||||
|
|
||||||
{ TPGMFileFormat }
|
{ TPGMFileFormat }
|
||||||
|
|
||||||
constructor TPGMFileFormat.Create;
|
procedure TPGMFileFormat.Define;
|
||||||
begin
|
begin
|
||||||
inherited Create;
|
inherited;
|
||||||
FName := SPGMFormatName;
|
FName := SPGMFormatName;
|
||||||
FSupportedFormats := PGMSupportedFormats;
|
FSupportedFormats := PGMSupportedFormats;
|
||||||
AddMasks(SPGMMasks);
|
AddMasks(SPGMMasks);
|
||||||
@@ -816,7 +752,7 @@ begin
|
|||||||
end;
|
end;
|
||||||
|
|
||||||
function TPGMFileFormat.SaveData(Handle: TImagingHandle;
|
function TPGMFileFormat.SaveData(Handle: TImagingHandle;
|
||||||
const Images: TDynImageDataArray; Index: Integer): Boolean;
|
const Images: TDynImageDataArray; Index: LongInt): Boolean;
|
||||||
var
|
var
|
||||||
MapInfo: TPortableMapInfo;
|
MapInfo: TPortableMapInfo;
|
||||||
begin
|
begin
|
||||||
@@ -853,9 +789,9 @@ end;
|
|||||||
|
|
||||||
{ TPPMFileFormat }
|
{ TPPMFileFormat }
|
||||||
|
|
||||||
constructor TPPMFileFormat.Create;
|
procedure TPPMFileFormat.Define;
|
||||||
begin
|
begin
|
||||||
inherited Create;
|
inherited;
|
||||||
FName := SPPMFormatName;
|
FName := SPPMFormatName;
|
||||||
FSupportedFormats := PPMSupportedFormats;
|
FSupportedFormats := PPMSupportedFormats;
|
||||||
AddMasks(SPPMMasks);
|
AddMasks(SPPMMasks);
|
||||||
@@ -864,7 +800,7 @@ begin
|
|||||||
end;
|
end;
|
||||||
|
|
||||||
function TPPMFileFormat.SaveData(Handle: TImagingHandle;
|
function TPPMFileFormat.SaveData(Handle: TImagingHandle;
|
||||||
const Images: TDynImageDataArray; Index: Integer): Boolean;
|
const Images: TDynImageDataArray; Index: LongInt): Boolean;
|
||||||
var
|
var
|
||||||
MapInfo: TPortableMapInfo;
|
MapInfo: TPortableMapInfo;
|
||||||
begin
|
begin
|
||||||
@@ -901,9 +837,9 @@ end;
|
|||||||
|
|
||||||
{ TPAMFileFormat }
|
{ TPAMFileFormat }
|
||||||
|
|
||||||
constructor TPAMFileFormat.Create;
|
procedure TPAMFileFormat.Define;
|
||||||
begin
|
begin
|
||||||
inherited Create;
|
inherited;
|
||||||
FName := SPAMFormatName;
|
FName := SPAMFormatName;
|
||||||
FSupportedFormats := PAMSupportedFormats;
|
FSupportedFormats := PAMSupportedFormats;
|
||||||
AddMasks(SPAMMasks);
|
AddMasks(SPAMMasks);
|
||||||
@@ -911,7 +847,7 @@ begin
|
|||||||
end;
|
end;
|
||||||
|
|
||||||
function TPAMFileFormat.SaveData(Handle: TImagingHandle;
|
function TPAMFileFormat.SaveData(Handle: TImagingHandle;
|
||||||
const Images: TDynImageDataArray; Index: Integer): Boolean;
|
const Images: TDynImageDataArray; Index: LongInt): Boolean;
|
||||||
var
|
var
|
||||||
MapInfo: TPortableMapInfo;
|
MapInfo: TPortableMapInfo;
|
||||||
begin
|
begin
|
||||||
@@ -943,9 +879,9 @@ end;
|
|||||||
|
|
||||||
{ TPFMFileFormat }
|
{ TPFMFileFormat }
|
||||||
|
|
||||||
constructor TPFMFileFormat.Create;
|
procedure TPFMFileFormat.Define;
|
||||||
begin
|
begin
|
||||||
inherited Create;
|
inherited;
|
||||||
FName := SPFMFormatName;
|
FName := SPFMFormatName;
|
||||||
AddMasks(SPFMMasks);
|
AddMasks(SPFMMasks);
|
||||||
FIdNumbers := 'Ff';
|
FIdNumbers := 'Ff';
|
||||||
@@ -953,7 +889,7 @@ begin
|
|||||||
end;
|
end;
|
||||||
|
|
||||||
function TPFMFileFormat.SaveData(Handle: TImagingHandle;
|
function TPFMFileFormat.SaveData(Handle: TImagingHandle;
|
||||||
const Images: TDynImageDataArray; Index: Integer): Boolean;
|
const Images: TDynImageDataArray; Index: LongInt): Boolean;
|
||||||
var
|
var
|
||||||
Info: TImageFormatInfo;
|
Info: TImageFormatInfo;
|
||||||
MapInfo: TPortableMapInfo;
|
MapInfo: TPortableMapInfo;
|
||||||
@@ -979,7 +915,7 @@ procedure TPFMFileFormat.ConvertToSupported(var Image: TImageData;
|
|||||||
const Info: TImageFormatInfo);
|
const Info: TImageFormatInfo);
|
||||||
begin
|
begin
|
||||||
if (Info.ChannelCount > 1) or Info.IsIndexed then
|
if (Info.ChannelCount > 1) or Info.IsIndexed then
|
||||||
ConvertImage(Image, ifA32B32G32R32F)
|
ConvertImage(Image, ifB32G32R32F)
|
||||||
else
|
else
|
||||||
ConvertImage(Image, ifR32F);
|
ConvertImage(Image, ifR32F);
|
||||||
end;
|
end;
|
||||||
@@ -997,6 +933,11 @@ initialization
|
|||||||
-- TODOS ----------------------------------------------------
|
-- TODOS ----------------------------------------------------
|
||||||
- nothing now
|
- nothing now
|
||||||
|
|
||||||
|
-- 0.77.1 Changes/Bug Fixes -----------------------------------
|
||||||
|
- Native RGB floating point format of PFM is now supported by Imaging
|
||||||
|
so we use it now for saving instead of A32B32G32B32.
|
||||||
|
- String to float formatting changes (don't change global settings).
|
||||||
|
|
||||||
-- 0.26.3 Changes/Bug Fixes -----------------------------------
|
-- 0.26.3 Changes/Bug Fixes -----------------------------------
|
||||||
- Fixed D2009 Unicode related bug in PNM saving.
|
- Fixed D2009 Unicode related bug in PNM saving.
|
||||||
|
|
||||||
|
|||||||
@@ -0,0 +1,480 @@
|
|||||||
|
{
|
||||||
|
Vampyre Imaging Library
|
||||||
|
by Marek Mauder
|
||||||
|
https://github.com/galfar/imaginglib
|
||||||
|
https://imaginglib.sourceforge.io
|
||||||
|
- - - - -
|
||||||
|
This Source Code Form is subject to the terms of the Mozilla Public
|
||||||
|
License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||||
|
file, You can obtain one at https://mozilla.org/MPL/2.0.
|
||||||
|
}
|
||||||
|
|
||||||
|
{ This unit contains image format loader/saver for Radiance HDR/RGBE images.}
|
||||||
|
unit ImagingRadiance;
|
||||||
|
|
||||||
|
{$I ImagingOptions.inc}
|
||||||
|
|
||||||
|
interface
|
||||||
|
|
||||||
|
uses
|
||||||
|
SysUtils, Classes, Imaging, ImagingTypes, ImagingUtility;
|
||||||
|
|
||||||
|
type
|
||||||
|
{ Radiance is a suite of tools for performing lighting simulation. It's
|
||||||
|
development started in 1985 and it pioneered the concept of
|
||||||
|
high dynamic range imaging. Radiance defined an image format for storing
|
||||||
|
HDR images, now described as RGBE image format. Since it was the first
|
||||||
|
HDR image format, this format is supported by many other software packages.
|
||||||
|
|
||||||
|
Radiance image file consists of three sections: a header, resolution string,
|
||||||
|
followed by the pixel data. Each pixel is stored as 4 bytes, one byte
|
||||||
|
mantissa for each r, g, b and a shared one byte exponent.
|
||||||
|
The pixel data may be stored uncompressed or using run length encoding.
|
||||||
|
|
||||||
|
Imaging translates RGBE pixels to original float values and stores them
|
||||||
|
in ifR32G32B32F data format. It can read both compressed and uncompressed
|
||||||
|
files, and saves files as compressed.}
|
||||||
|
THdrFileFormat = class(TImageFileFormat)
|
||||||
|
protected
|
||||||
|
procedure Define; override;
|
||||||
|
function LoadData(Handle: TImagingHandle; var Images: TDynImageDataArray;
|
||||||
|
OnlyFirstLevel: Boolean): Boolean; override;
|
||||||
|
function SaveData(Handle: TImagingHandle; const Images: TDynImageDataArray;
|
||||||
|
Index: LongInt): Boolean; override;
|
||||||
|
procedure ConvertToSupported(var Image: TImageData;
|
||||||
|
const Info: TImageFormatInfo); override;
|
||||||
|
public
|
||||||
|
function TestFormat(Handle: TImagingHandle): Boolean; override;
|
||||||
|
end;
|
||||||
|
|
||||||
|
implementation
|
||||||
|
|
||||||
|
uses
|
||||||
|
Math, ImagingIO;
|
||||||
|
|
||||||
|
const
|
||||||
|
SHdrFormatName = 'Radiance HDR/RGBE';
|
||||||
|
SHdrMasks = '*.hdr';
|
||||||
|
HdrSupportedFormats: TImageFormats = [ifR32G32B32F];
|
||||||
|
|
||||||
|
type
|
||||||
|
TSignature = array[0..9] of AnsiChar;
|
||||||
|
THdrFormat = (hfRgb, hfXyz);
|
||||||
|
|
||||||
|
THdrHeader = record
|
||||||
|
Format: THdrFormat;
|
||||||
|
Width: Integer;
|
||||||
|
Height: Integer;
|
||||||
|
end;
|
||||||
|
|
||||||
|
TRgbe = packed record
|
||||||
|
R, G, B, E: Byte;
|
||||||
|
end;
|
||||||
|
TDynRgbeArray = array of TRgbe;
|
||||||
|
|
||||||
|
const
|
||||||
|
RadianceSignature: TSignature = '#?RADIANCE';
|
||||||
|
RgbeSignature: TSignature = '#?RGBE';
|
||||||
|
SFmtRgbeRle = '32-bit_rle_rgbe';
|
||||||
|
SFmtXyzeRle = '32-bit_rle_xyze';
|
||||||
|
|
||||||
|
resourcestring
|
||||||
|
SErrorBadHeader = 'Bad HDR/RGBE header format.';
|
||||||
|
SWrongScanLineWidth = 'Wrong scanline width.';
|
||||||
|
SXyzNotSupported = 'XYZ color space not supported.';
|
||||||
|
|
||||||
|
{ THdrFileFormat }
|
||||||
|
|
||||||
|
procedure THdrFileFormat.Define;
|
||||||
|
begin
|
||||||
|
inherited;
|
||||||
|
FName := SHdrFormatName;
|
||||||
|
FFeatures := [ffLoad, ffSave];
|
||||||
|
FSupportedFormats := HdrSupportedFormats;
|
||||||
|
|
||||||
|
AddMasks(SHdrMasks);
|
||||||
|
end;
|
||||||
|
|
||||||
|
function THdrFileFormat.LoadData(Handle: TImagingHandle;
|
||||||
|
var Images: TDynImageDataArray; OnlyFirstLevel: Boolean): Boolean;
|
||||||
|
var
|
||||||
|
Header: THdrHeader;
|
||||||
|
IO: TIOFunctions;
|
||||||
|
|
||||||
|
function ReadHeader: Boolean;
|
||||||
|
const
|
||||||
|
CommentIds: TAnsiCharSet = ['#', '!'];
|
||||||
|
var
|
||||||
|
Line: AnsiString;
|
||||||
|
HasResolution: Boolean;
|
||||||
|
Count, Idx: Integer;
|
||||||
|
ValStr, NativeLine: string;
|
||||||
|
ValFloat: Double;
|
||||||
|
begin
|
||||||
|
Result := False;
|
||||||
|
HasResolution := False;
|
||||||
|
Count := 0;
|
||||||
|
|
||||||
|
repeat
|
||||||
|
if not ReadLine(IO, Handle, Line) then
|
||||||
|
Exit;
|
||||||
|
|
||||||
|
Inc(Count);
|
||||||
|
if Count > 16 then // Too long header for HDR
|
||||||
|
Exit;
|
||||||
|
|
||||||
|
if Length(Line) = 0 then
|
||||||
|
Continue;
|
||||||
|
if Line[1] in CommentIds then
|
||||||
|
Continue;
|
||||||
|
|
||||||
|
NativeLine := string(Line);
|
||||||
|
|
||||||
|
if StrMaskMatch(NativeLine, 'Format=*') then
|
||||||
|
begin
|
||||||
|
// Data format parsing
|
||||||
|
ValStr := Copy(NativeLine, 8, MaxInt);
|
||||||
|
if ValStr = SFmtRgbeRle then
|
||||||
|
Header.Format := hfRgb
|
||||||
|
else if ValStr = SFmtXyzeRle then
|
||||||
|
Header.Format := hfXyz
|
||||||
|
else
|
||||||
|
Exit;
|
||||||
|
end;
|
||||||
|
|
||||||
|
if StrMaskMatch(NativeLine, 'Gamma=*') then
|
||||||
|
begin
|
||||||
|
ValStr := Copy(NativeLine, 7, MaxInt);
|
||||||
|
if TryStrToFloat(ValStr, ValFloat, GetFormatSettingsForFloats) then
|
||||||
|
FMetadata.SetMetaItem(SMetaGamma, ValFloat);
|
||||||
|
end;
|
||||||
|
|
||||||
|
if StrMaskMatch(NativeLine, 'Exposure=*') then
|
||||||
|
begin
|
||||||
|
ValStr := Copy(NativeLine, 10, MaxInt);
|
||||||
|
if TryStrToFloat(ValStr, ValFloat, GetFormatSettingsForFloats) then
|
||||||
|
FMetadata.SetMetaItem(SMetaExposure, ValFloat);
|
||||||
|
end;
|
||||||
|
|
||||||
|
if StrMaskMatch(NativeLine, '?Y * ?X *') then
|
||||||
|
begin
|
||||||
|
Idx := Pos('X', NativeLine);
|
||||||
|
ValStr := SubString(NativeLine, 4, Idx - 2);
|
||||||
|
if not TryStrToInt(ValStr, Header.Height) then
|
||||||
|
Exit;
|
||||||
|
ValStr := Copy(NativeLine, Idx + 2, MaxInt);
|
||||||
|
if not TryStrToInt(ValStr, Header.Width) then
|
||||||
|
Exit;
|
||||||
|
|
||||||
|
if (NativeLine[1] = '-') then
|
||||||
|
Header.Height := -Header.Height;
|
||||||
|
if (NativeLine[Idx - 1] = '-') then
|
||||||
|
Header.Width := -Header.Width;
|
||||||
|
|
||||||
|
HasResolution := True;
|
||||||
|
end;
|
||||||
|
|
||||||
|
until HasResolution;
|
||||||
|
Result := True;
|
||||||
|
end;
|
||||||
|
|
||||||
|
procedure DecodeRgbe(const Src: TRgbe; Dest: PColor96FPRec); {$IFDEF USE_INLINE}inline;{$ENDIF}
|
||||||
|
var
|
||||||
|
Mult: Single;
|
||||||
|
begin
|
||||||
|
if Src.E > 0 then
|
||||||
|
begin
|
||||||
|
Mult := Math.Ldexp(1, Src.E - 128);
|
||||||
|
Dest.R := Src.R / 255 * Mult;
|
||||||
|
Dest.G := Src.G / 255 * Mult;
|
||||||
|
Dest.B := Src.B / 255 * Mult;
|
||||||
|
end
|
||||||
|
else
|
||||||
|
begin
|
||||||
|
Dest.R := 0;
|
||||||
|
Dest.G := 0;
|
||||||
|
Dest.B := 0;
|
||||||
|
end;
|
||||||
|
end;
|
||||||
|
|
||||||
|
procedure ReadCompressedLine(Width, Y: Integer; var DestBuffer: TDynRgbeArray);
|
||||||
|
var
|
||||||
|
Pos: Integer;
|
||||||
|
I, X, Count: Integer;
|
||||||
|
Code, Value: Byte;
|
||||||
|
LineBuff: TDynByteArray;
|
||||||
|
Rgbe: TRgbe;
|
||||||
|
Ptr: PByte;
|
||||||
|
begin
|
||||||
|
SetLength(LineBuff, Width);
|
||||||
|
IO.Read(Handle, @Rgbe, SizeOf(Rgbe));
|
||||||
|
|
||||||
|
if ((Rgbe.B shl 8) or Rgbe.E) <> Width then
|
||||||
|
RaiseImaging(SWrongScanLineWidth);
|
||||||
|
|
||||||
|
for I := 0 to 3 do
|
||||||
|
begin
|
||||||
|
Pos := 0;
|
||||||
|
while Pos < Width do
|
||||||
|
begin
|
||||||
|
IO.Read(Handle, @Code, SizeOf(Byte));
|
||||||
|
if Code > 128 then
|
||||||
|
begin
|
||||||
|
Count := Code - 128;
|
||||||
|
IO.Read(Handle, @Value, SizeOf(Byte));
|
||||||
|
FillMemoryByte(@LineBuff[Pos], Count, Value);
|
||||||
|
end
|
||||||
|
else
|
||||||
|
begin
|
||||||
|
Count := Code;
|
||||||
|
IO.Read(Handle, @LineBuff[Pos], Count * SizeOf(Byte));
|
||||||
|
end;
|
||||||
|
Inc(Pos, Count);
|
||||||
|
end;
|
||||||
|
|
||||||
|
Ptr := @PByteArray(@DestBuffer[0])[I];
|
||||||
|
for X := 0 to Width - 1 do
|
||||||
|
begin
|
||||||
|
Ptr^ := LineBuff[X];
|
||||||
|
Inc(Ptr, 4);
|
||||||
|
end;
|
||||||
|
end;
|
||||||
|
end;
|
||||||
|
|
||||||
|
procedure ReadPixels(var Image: TImageData);
|
||||||
|
var
|
||||||
|
Y, X, SrcLineLen: Integer;
|
||||||
|
Dest: PColor96FPRec;
|
||||||
|
Compressed: Boolean;
|
||||||
|
Rgbe: TRgbe;
|
||||||
|
Buffer: TDynRgbeArray;
|
||||||
|
begin
|
||||||
|
Dest := Image.Bits;
|
||||||
|
Compressed := not ((Image.Width < 8) or (Image.Width > $7FFFF));
|
||||||
|
SrcLineLen := Image.Width * SizeOf(TRgbe);
|
||||||
|
|
||||||
|
IO.Read(Handle, @Rgbe, SizeOf(Rgbe));
|
||||||
|
IO.Seek(Handle, -SizeOf(Rgbe), smFromCurrent);
|
||||||
|
|
||||||
|
if (Rgbe.R <> 2) or (Rgbe.G <> 2) or ((Rgbe.B and 128) > 0) then
|
||||||
|
Compressed := False;
|
||||||
|
|
||||||
|
SetLength(Buffer, Image.Width);
|
||||||
|
|
||||||
|
for Y := 0 to Image.Height - 1 do
|
||||||
|
begin
|
||||||
|
if Compressed then
|
||||||
|
ReadCompressedLine(Image.Width, Y, Buffer)
|
||||||
|
else
|
||||||
|
IO.Read(Handle, @Buffer[0], SrcLineLen);
|
||||||
|
|
||||||
|
for X := 0 to Image.Width - 1 do
|
||||||
|
begin
|
||||||
|
DecodeRgbe(Buffer[X], Dest);
|
||||||
|
Inc(Dest);
|
||||||
|
end;
|
||||||
|
end;
|
||||||
|
end;
|
||||||
|
|
||||||
|
begin
|
||||||
|
IO := GetIO;
|
||||||
|
SetLength(Images, 1);
|
||||||
|
|
||||||
|
// Read header, allocate new image and, then read and convert the pixels
|
||||||
|
if not ReadHeader then
|
||||||
|
RaiseImaging(SErrorBadHeader);
|
||||||
|
if (Header.Format = hfXyz) then
|
||||||
|
RaiseImaging(SXyzNotSupported);
|
||||||
|
|
||||||
|
NewImage(Abs(Header.Width), Abs(Header.Height), ifR32G32B32F, Images[0]);
|
||||||
|
ReadPixels(Images[0]);
|
||||||
|
|
||||||
|
// Flip/mirror the image as needed (height < 0 is default top-down)
|
||||||
|
if Header.Width < 0 then
|
||||||
|
MirrorImage(Images[0]);
|
||||||
|
if Header.Height > 0 then
|
||||||
|
FlipImage(Images[0]);
|
||||||
|
|
||||||
|
Result := True;
|
||||||
|
end;
|
||||||
|
|
||||||
|
function THdrFileFormat.SaveData(Handle: TImagingHandle;
|
||||||
|
const Images: TDynImageDataArray; Index: LongInt): Boolean;
|
||||||
|
const
|
||||||
|
LineEnd = #$0A;
|
||||||
|
SPrgComment = '#Made with Vampyre Imaging Library';
|
||||||
|
SSizeFmt = '-Y %d +X %d';
|
||||||
|
var
|
||||||
|
ImageToSave: TImageData;
|
||||||
|
MustBeFreed: Boolean;
|
||||||
|
IO: TIOFunctions;
|
||||||
|
|
||||||
|
procedure SaveHeader;
|
||||||
|
begin
|
||||||
|
WriteLine(IO, Handle, RadianceSignature, LineEnd);
|
||||||
|
WriteLine(IO, Handle, SPrgComment, LineEnd);
|
||||||
|
WriteLine(IO, Handle, 'FORMAT=' + SFmtRgbeRle, LineEnd + LineEnd);
|
||||||
|
WriteLine(IO, Handle, AnsiString(Format(SSizeFmt, [ImageToSave.Height, ImageToSave.Width])), LineEnd);
|
||||||
|
end;
|
||||||
|
|
||||||
|
procedure EncodeRgbe(const Src: TColor96FPRec; var DestR, DestG, DestB, DestE: Byte); {$IFDEF USE_INLINE}inline;{$ENDIF}
|
||||||
|
var
|
||||||
|
V, M: {$IFDEF FPC}Float{$ELSE}Extended{$ENDIF};
|
||||||
|
E: Integer;
|
||||||
|
begin
|
||||||
|
V := Src.R;
|
||||||
|
if (Src.G > V) then
|
||||||
|
V := Src.G;
|
||||||
|
if (Src.B > V) then
|
||||||
|
V := Src.B;
|
||||||
|
|
||||||
|
if V < 1e-32 then
|
||||||
|
begin
|
||||||
|
DestR := 0;
|
||||||
|
DestG := 0;
|
||||||
|
DestB := 0;
|
||||||
|
DestE := 0;
|
||||||
|
end
|
||||||
|
else
|
||||||
|
begin
|
||||||
|
Frexp(V, M, E);
|
||||||
|
V := M * 256.0 / V;
|
||||||
|
DestR := ClampToByte(Round(Src.R * V));
|
||||||
|
DestG := ClampToByte(Round(Src.G * V));
|
||||||
|
DestB := ClampToByte(Round(Src.B * V));
|
||||||
|
DestE := ClampToByte(E + 128);
|
||||||
|
end;
|
||||||
|
end;
|
||||||
|
|
||||||
|
procedure WriteRleLine(const Line: array of Byte; Width: Integer);
|
||||||
|
const
|
||||||
|
MinRunLength = 4;
|
||||||
|
var
|
||||||
|
Cur, BeginRun, RunCount, OldRunCount, NonRunCount: Integer;
|
||||||
|
Buf: array[0..1] of Byte;
|
||||||
|
begin
|
||||||
|
Cur := 0;
|
||||||
|
while Cur < Width do
|
||||||
|
begin
|
||||||
|
BeginRun := Cur;
|
||||||
|
RunCount := 0;
|
||||||
|
OldRunCount := 0;
|
||||||
|
while (RunCount < MinRunLength) and (BeginRun < Width) do
|
||||||
|
begin
|
||||||
|
Inc(BeginRun, RunCount);
|
||||||
|
OldRunCount := RunCount;
|
||||||
|
RunCount := 1;
|
||||||
|
while (BeginRun + RunCount < Width) and (RunCount < 127) and (Line[BeginRun] = Line[BeginRun + RunCount]) do
|
||||||
|
Inc(RunCount);
|
||||||
|
end;
|
||||||
|
if (OldRunCount > 1) and (OldRunCount = BeginRun - Cur) then
|
||||||
|
begin
|
||||||
|
Buf[0] := 128 + OldRunCount;
|
||||||
|
Buf[1] := Line[Cur];
|
||||||
|
IO.Write(Handle, @Buf, 2);
|
||||||
|
Cur := BeginRun;
|
||||||
|
end;
|
||||||
|
while Cur < BeginRun do
|
||||||
|
begin
|
||||||
|
NonRunCount := Min(128, BeginRun - Cur);
|
||||||
|
Buf[0] := NonRunCount;
|
||||||
|
IO.Write(Handle, @Buf, 1);
|
||||||
|
IO.Write(Handle, @Line[Cur], NonRunCount);
|
||||||
|
Inc(Cur, NonRunCount);
|
||||||
|
end;
|
||||||
|
if RunCount >= MinRunLength then
|
||||||
|
begin
|
||||||
|
Buf[0] := 128 + RunCount;
|
||||||
|
Buf[1] := Line[BeginRun];
|
||||||
|
IO.Write(Handle, @Buf, 2);
|
||||||
|
Inc(Cur, RunCount);
|
||||||
|
end;
|
||||||
|
end;
|
||||||
|
end;
|
||||||
|
|
||||||
|
procedure SavePixels;
|
||||||
|
var
|
||||||
|
Y, X, I, Width: Integer;
|
||||||
|
SrcPtr: PColor96FPRecArray;
|
||||||
|
Components: array of array of Byte;
|
||||||
|
StartLine: array[0..3] of Byte;
|
||||||
|
begin
|
||||||
|
Width := ImageToSave.Width;
|
||||||
|
// Save using RLE, each component is compressed separately
|
||||||
|
SetLength(Components, 4, Width);
|
||||||
|
|
||||||
|
for Y := 0 to ImageToSave.Height - 1 do
|
||||||
|
begin
|
||||||
|
SrcPtr := @PColor96FPRecArray(ImageToSave.Bits)[ImageToSave.Width * Y];
|
||||||
|
|
||||||
|
// Identify line as using "new" RLE scheme (separate components)
|
||||||
|
StartLine[0] := 2;
|
||||||
|
StartLine[1] := 2;
|
||||||
|
StartLine[2] := Width shr 8;
|
||||||
|
StartLine[3] := Width and $FF;
|
||||||
|
IO.Write(Handle, @StartLine, SizeOf(StartLine));
|
||||||
|
|
||||||
|
for X := 0 to Width - 1 do
|
||||||
|
begin
|
||||||
|
EncodeRgbe(SrcPtr[X], Components[0, X], Components[1, X],
|
||||||
|
Components[2, X], Components[3, X]);
|
||||||
|
end;
|
||||||
|
|
||||||
|
for I := 0 to 3 do
|
||||||
|
WriteRleLine(Components[I], Width);
|
||||||
|
end;
|
||||||
|
end;
|
||||||
|
|
||||||
|
begin
|
||||||
|
Result := False;
|
||||||
|
IO := GetIO;
|
||||||
|
// Makes image to save compatible with Jpeg saving capabilities
|
||||||
|
if MakeCompatible(Images[Index], ImageToSave, MustBeFreed) then
|
||||||
|
with ImageToSave do
|
||||||
|
try
|
||||||
|
// Save header
|
||||||
|
SaveHeader;
|
||||||
|
// Save uncompressed pixels
|
||||||
|
SavePixels;
|
||||||
|
Result := True;
|
||||||
|
finally
|
||||||
|
if MustBeFreed then
|
||||||
|
FreeImage(ImageToSave);
|
||||||
|
end;
|
||||||
|
end;
|
||||||
|
|
||||||
|
procedure THdrFileFormat.ConvertToSupported(var Image: TImageData;
|
||||||
|
const Info: TImageFormatInfo);
|
||||||
|
begin
|
||||||
|
ConvertImage(Image, ifR32G32B32F);
|
||||||
|
end;
|
||||||
|
|
||||||
|
function THdrFileFormat.TestFormat(Handle: TImagingHandle): Boolean;
|
||||||
|
var
|
||||||
|
FileSig: TSignature;
|
||||||
|
ReadCount: Integer;
|
||||||
|
begin
|
||||||
|
Result := False;
|
||||||
|
if Handle <> nil then
|
||||||
|
begin
|
||||||
|
ReadCount := GetIO.Read(Handle, @FileSig, SizeOf(FileSig));
|
||||||
|
GetIO.Seek(Handle, -ReadCount, smFromCurrent);
|
||||||
|
Result := (ReadCount = SizeOf(FileSig)) and
|
||||||
|
((FileSig = RadianceSignature) or CompareMem(@FileSig, @RgbeSignature, 6));
|
||||||
|
end;
|
||||||
|
end;
|
||||||
|
|
||||||
|
initialization
|
||||||
|
RegisterImageFileFormat(THdrFileFormat);
|
||||||
|
|
||||||
|
{
|
||||||
|
File Notes:
|
||||||
|
|
||||||
|
-- 0.77.1 ---------------------------------------------------
|
||||||
|
- Added RLE compression to saving.
|
||||||
|
- Added image saving.
|
||||||
|
- Unit created with initial stuff (loading only).
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
end.
|
||||||
+27
-46
@@ -1,29 +1,12 @@
|
|||||||
{
|
{
|
||||||
$Id: ImagingTarga.pas 139 2008-09-18 02:01:42Z galfar $
|
|
||||||
Vampyre Imaging Library
|
Vampyre Imaging Library
|
||||||
by Marek Mauder
|
by Marek Mauder
|
||||||
http://imaginglib.sourceforge.net
|
https://github.com/galfar/imaginglib
|
||||||
|
https://imaginglib.sourceforge.io
|
||||||
The contents of this file are used with permission, subject to the Mozilla
|
- - - - -
|
||||||
Public License Version 1.1 (the "License"); you may not use this file except
|
This Source Code Form is subject to the terms of the Mozilla Public
|
||||||
in compliance with the License. You may obtain a copy of the License at
|
License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||||
http://www.mozilla.org/MPL/MPL-1.1.html
|
file, You can obtain one at https://mozilla.org/MPL/2.0.
|
||||||
|
|
||||||
Software distributed under the License is distributed on an "AS IS" basis,
|
|
||||||
WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License for
|
|
||||||
the specific language governing rights and limitations under the License.
|
|
||||||
|
|
||||||
Alternatively, the contents of this file may be used under the terms of the
|
|
||||||
GNU Lesser General Public License (the "LGPL License"), in which case the
|
|
||||||
provisions of the LGPL License are applicable instead of those above.
|
|
||||||
If you wish to allow use of your version of this file only under the terms
|
|
||||||
of the LGPL License and not to allow others to use your version of this file
|
|
||||||
under the MPL, indicate your decision by deleting the provisions above and
|
|
||||||
replace them with the notice and other provisions required by the LGPL
|
|
||||||
License. If you do not delete the provisions above, a recipient may use
|
|
||||||
your version of this file under either the MPL or the LGPL License.
|
|
||||||
|
|
||||||
For more information about the LGPL: http://www.gnu.org/copyleft/lesser.html
|
|
||||||
}
|
}
|
||||||
|
|
||||||
{ This unit contains image format loader/saver for Targa images.}
|
{ This unit contains image format loader/saver for Targa images.}
|
||||||
@@ -43,6 +26,7 @@ type
|
|||||||
TTargaFileFormat = class(TImageFileFormat)
|
TTargaFileFormat = class(TImageFileFormat)
|
||||||
protected
|
protected
|
||||||
FUseRLE: LongBool;
|
FUseRLE: LongBool;
|
||||||
|
procedure Define; override;
|
||||||
function LoadData(Handle: TImagingHandle; var Images: TDynImageDataArray;
|
function LoadData(Handle: TImagingHandle; var Images: TDynImageDataArray;
|
||||||
OnlyFirstLevel: Boolean): Boolean; override;
|
OnlyFirstLevel: Boolean): Boolean; override;
|
||||||
function SaveData(Handle: TImagingHandle; const Images: TDynImageDataArray;
|
function SaveData(Handle: TImagingHandle; const Images: TDynImageDataArray;
|
||||||
@@ -50,7 +34,6 @@ type
|
|||||||
procedure ConvertToSupported(var Image: TImageData;
|
procedure ConvertToSupported(var Image: TImageData;
|
||||||
const Info: TImageFormatInfo); override;
|
const Info: TImageFormatInfo); override;
|
||||||
public
|
public
|
||||||
constructor Create; override;
|
|
||||||
function TestFormat(Handle: TImagingHandle): Boolean; override;
|
function TestFormat(Handle: TImagingHandle): Boolean; override;
|
||||||
published
|
published
|
||||||
{ Controls that RLE compression is used during saving. Accessible trough
|
{ Controls that RLE compression is used during saving. Accessible trough
|
||||||
@@ -89,8 +72,8 @@ type
|
|||||||
|
|
||||||
{ Footer at the end of TGA file.}
|
{ Footer at the end of TGA file.}
|
||||||
TTargaFooter = packed record
|
TTargaFooter = packed record
|
||||||
ExtOff: LongWord; // Extension Area Offset
|
ExtOff: UInt32; // Extension Area Offset
|
||||||
DevDirOff: LongWord; // Developer Directory Offset
|
DevDirOff: UInt32; // Developer Directory Offset
|
||||||
Signature: TChar16; // TRUEVISION-XFILE
|
Signature: TChar16; // TRUEVISION-XFILE
|
||||||
Reserved: Byte; // ASCII period '.'
|
Reserved: Byte; // ASCII period '.'
|
||||||
NullChar: Byte; // 0
|
NullChar: Byte; // 0
|
||||||
@@ -99,13 +82,11 @@ type
|
|||||||
|
|
||||||
{ TTargaFileFormat class implementation }
|
{ TTargaFileFormat class implementation }
|
||||||
|
|
||||||
constructor TTargaFileFormat.Create;
|
procedure TTargaFileFormat.Define;
|
||||||
begin
|
begin
|
||||||
inherited Create;
|
inherited;
|
||||||
FName := STargaFormatName;
|
FName := STargaFormatName;
|
||||||
FCanLoad := True;
|
FFeatures := [ffLoad, ffSave];
|
||||||
FCanSave := True;
|
|
||||||
FIsMultiImageFormat := False;
|
|
||||||
FSupportedFormats := TargaSupportedFormats;
|
FSupportedFormats := TargaSupportedFormats;
|
||||||
|
|
||||||
FUseRLE := TargaDefaultRLE;
|
FUseRLE := TargaDefaultRLE;
|
||||||
@@ -120,7 +101,7 @@ var
|
|||||||
Hdr: TTargaHeader;
|
Hdr: TTargaHeader;
|
||||||
Foo: TTargaFooter;
|
Foo: TTargaFooter;
|
||||||
FooterFound, ExtFound: Boolean;
|
FooterFound, ExtFound: Boolean;
|
||||||
I, PSize, PalSize: LongWord;
|
I, PSize, PalSize: Integer;
|
||||||
Pal: Pointer;
|
Pal: Pointer;
|
||||||
FmtInfo: TImageFormatInfo;
|
FmtInfo: TImageFormatInfo;
|
||||||
WordValue: Word;
|
WordValue: Word;
|
||||||
@@ -134,7 +115,7 @@ var
|
|||||||
begin
|
begin
|
||||||
with GetIO, Images[0] do
|
with GetIO, Images[0] do
|
||||||
begin
|
begin
|
||||||
// Alocates buffer large enough to hold the worst case
|
// Allocates buffer large enough to hold the worst case
|
||||||
// RLE compressed data and reads then from input
|
// RLE compressed data and reads then from input
|
||||||
BufSize := Width * Height * FmtInfo.BytesPerPixel;
|
BufSize := Width * Height * FmtInfo.BytesPerPixel;
|
||||||
BufSize := BufSize + BufSize div 2 + 1;
|
BufSize := BufSize + BufSize div 2 + 1;
|
||||||
@@ -162,7 +143,7 @@ var
|
|||||||
1: Dest^ := Src^;
|
1: Dest^ := Src^;
|
||||||
2: PWord(Dest)^ := PWord(Src)^;
|
2: PWord(Dest)^ := PWord(Src)^;
|
||||||
3: PColor24Rec(Dest)^ := PColor24Rec(Src)^;
|
3: PColor24Rec(Dest)^ := PColor24Rec(Src)^;
|
||||||
4: PLongWord(Dest)^ := PLongWord(Src)^;
|
4: PUInt32(Dest)^ := PUInt32(Src)^;
|
||||||
end;
|
end;
|
||||||
Inc(Src, Bpp);
|
Inc(Src, Bpp);
|
||||||
Inc(Dest, Bpp);
|
Inc(Dest, Bpp);
|
||||||
@@ -180,7 +161,7 @@ var
|
|||||||
1: Dest^ := Src^;
|
1: Dest^ := Src^;
|
||||||
2: PWord(Dest)^ := PWord(Src)^;
|
2: PWord(Dest)^ := PWord(Src)^;
|
||||||
3: PColor24Rec(Dest)^ := PColor24Rec(Src)^;
|
3: PColor24Rec(Dest)^ := PColor24Rec(Src)^;
|
||||||
4: PLongWord(Dest)^ := PLongWord(Src)^;
|
4: PUInt32(Dest)^ := PUInt32(Src)^;
|
||||||
end;
|
end;
|
||||||
Inc(Dest, Bpp);
|
Inc(Dest, Bpp);
|
||||||
end;
|
end;
|
||||||
@@ -188,7 +169,7 @@ var
|
|||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
// set position in source to real end of compressed data
|
// set position in source to real end of compressed data
|
||||||
Seek(Handle, -(BufSize - LongInt(LongWord(Src) - LongWord(Buffer))),
|
Seek(Handle, -(BufSize - (PtrUInt(Src) - PtrUInt(Buffer))),
|
||||||
smFromCurrent);
|
smFromCurrent);
|
||||||
FreeMem(Buffer);
|
FreeMem(Buffer);
|
||||||
end;
|
end;
|
||||||
@@ -340,8 +321,8 @@ var
|
|||||||
|
|
||||||
function CountDiff(Data: PByte; Bpp, PixelCount: Longint): LongInt;
|
function CountDiff(Data: PByte; Bpp, PixelCount: Longint): LongInt;
|
||||||
var
|
var
|
||||||
Pixel: LongWord;
|
Pixel: UInt32;
|
||||||
NextPixel: LongWord;
|
NextPixel: UInt32;
|
||||||
N: LongInt;
|
N: LongInt;
|
||||||
begin
|
begin
|
||||||
N := 0;
|
N := 0;
|
||||||
@@ -356,7 +337,7 @@ var
|
|||||||
1: Pixel := Data^;
|
1: Pixel := Data^;
|
||||||
2: Pixel := PWord(Data)^;
|
2: Pixel := PWord(Data)^;
|
||||||
3: PColor24Rec(@Pixel)^ := PColor24Rec(Data)^;
|
3: PColor24Rec(@Pixel)^ := PColor24Rec(Data)^;
|
||||||
4: Pixel := PLongWord(Data)^;
|
4: Pixel := PUInt32(Data)^;
|
||||||
end;
|
end;
|
||||||
while PixelCount > 1 do
|
while PixelCount > 1 do
|
||||||
begin
|
begin
|
||||||
@@ -365,7 +346,7 @@ var
|
|||||||
1: NextPixel := Data^;
|
1: NextPixel := Data^;
|
||||||
2: NextPixel := PWord(Data)^;
|
2: NextPixel := PWord(Data)^;
|
||||||
3: PColor24Rec(@NextPixel)^ := PColor24Rec(Data)^;
|
3: PColor24Rec(@NextPixel)^ := PColor24Rec(Data)^;
|
||||||
4: NextPixel := PLongWord(Data)^;
|
4: NextPixel := PUInt32(Data)^;
|
||||||
end;
|
end;
|
||||||
if NextPixel = Pixel then
|
if NextPixel = Pixel then
|
||||||
Break;
|
Break;
|
||||||
@@ -381,8 +362,8 @@ var
|
|||||||
|
|
||||||
function CountSame(Data: PByte; Bpp, PixelCount: LongInt): LongInt;
|
function CountSame(Data: PByte; Bpp, PixelCount: LongInt): LongInt;
|
||||||
var
|
var
|
||||||
Pixel: LongWord;
|
Pixel: UInt32;
|
||||||
NextPixel: LongWord;
|
NextPixel: UInt32;
|
||||||
N: LongInt;
|
N: LongInt;
|
||||||
begin
|
begin
|
||||||
N := 1;
|
N := 1;
|
||||||
@@ -392,7 +373,7 @@ var
|
|||||||
1: Pixel := Data^;
|
1: Pixel := Data^;
|
||||||
2: Pixel := PWord(Data)^;
|
2: Pixel := PWord(Data)^;
|
||||||
3: PColor24Rec(@Pixel)^ := PColor24Rec(Data)^;
|
3: PColor24Rec(@Pixel)^ := PColor24Rec(Data)^;
|
||||||
4: Pixel := PLongWord(Data)^;
|
4: Pixel := PUInt32(Data)^;
|
||||||
end;
|
end;
|
||||||
PixelCount := PixelCount - 1;
|
PixelCount := PixelCount - 1;
|
||||||
while PixelCount > 0 do
|
while PixelCount > 0 do
|
||||||
@@ -402,7 +383,7 @@ var
|
|||||||
1: NextPixel := Data^;
|
1: NextPixel := Data^;
|
||||||
2: NextPixel := PWord(Data)^;
|
2: NextPixel := PWord(Data)^;
|
||||||
3: PColor24Rec(@NextPixel)^ := PColor24Rec(Data)^;
|
3: PColor24Rec(@NextPixel)^ := PColor24Rec(Data)^;
|
||||||
4: NextPixel := PLongWord(Data)^;
|
4: NextPixel := PUInt32(Data)^;
|
||||||
end;
|
end;
|
||||||
if NextPixel <> Pixel then
|
if NextPixel <> Pixel then
|
||||||
Break;
|
Break;
|
||||||
@@ -413,7 +394,7 @@ var
|
|||||||
end;
|
end;
|
||||||
|
|
||||||
procedure RleCompressLine(Data: PByte; PixelCount, Bpp: LongInt; Dest:
|
procedure RleCompressLine(Data: PByte; PixelCount, Bpp: LongInt; Dest:
|
||||||
PByte; var Written: LongInt);
|
PByte; out Written: LongInt);
|
||||||
const
|
const
|
||||||
MaxRun = 128;
|
MaxRun = 128;
|
||||||
var
|
var
|
||||||
@@ -451,7 +432,7 @@ var
|
|||||||
1: Dest^ := Data^;
|
1: Dest^ := Data^;
|
||||||
2: PWord(Dest)^ := PWord(Data)^;
|
2: PWord(Dest)^ := PWord(Data)^;
|
||||||
3: PColor24Rec(Dest)^ := PColor24Rec(Data)^;
|
3: PColor24Rec(Dest)^ := PColor24Rec(Data)^;
|
||||||
4: PLongWord(Dest)^ := PLongWord(Data)^;
|
4: PUInt32(Dest)^ := PUInt32(Data)^;
|
||||||
end;
|
end;
|
||||||
Inc(Data, Bpp);
|
Inc(Data, Bpp);
|
||||||
Inc(Dest, Bpp);
|
Inc(Dest, Bpp);
|
||||||
|
|||||||
+126
-61
@@ -1,29 +1,12 @@
|
|||||||
{
|
{
|
||||||
$Id: ImagingTypes.pas 171 2009-09-02 01:34:19Z galfar $
|
|
||||||
Vampyre Imaging Library
|
Vampyre Imaging Library
|
||||||
by Marek Mauder
|
by Marek Mauder
|
||||||
http://imaginglib.sourceforge.net
|
https://github.com/galfar/imaginglib
|
||||||
|
https://imaginglib.sourceforge.io
|
||||||
The contents of this file are used with permission, subject to the Mozilla
|
- - - - -
|
||||||
Public License Version 1.1 (the "License"); you may not use this file except
|
This Source Code Form is subject to the terms of the Mozilla Public
|
||||||
in compliance with the License. You may obtain a copy of the License at
|
License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||||
http://www.mozilla.org/MPL/MPL-1.1.html
|
file, You can obtain one at https://mozilla.org/MPL/2.0.
|
||||||
|
|
||||||
Software distributed under the License is distributed on an "AS IS" basis,
|
|
||||||
WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License for
|
|
||||||
the specific language governing rights and limitations under the License.
|
|
||||||
|
|
||||||
Alternatively, the contents of this file may be used under the terms of the
|
|
||||||
GNU Lesser General Public License (the "LGPL License"), in which case the
|
|
||||||
provisions of the LGPL License are applicable instead of those above.
|
|
||||||
If you wish to allow use of your version of this file only under the terms
|
|
||||||
of the LGPL License and not to allow others to use your version of this file
|
|
||||||
under the MPL, indicate your decision by deleting the provisions above and
|
|
||||||
replace them with the notice and other provisions required by the LGPL
|
|
||||||
License. If you do not delete the provisions above, a recipient may use
|
|
||||||
your version of this file under either the MPL or the LGPL License.
|
|
||||||
|
|
||||||
For more information about the LGPL: http://www.gnu.org/copyleft/lesser.html
|
|
||||||
}
|
}
|
||||||
|
|
||||||
{ This unit contains basic types and constants used by Imaging library.}
|
{ This unit contains basic types and constants used by Imaging library.}
|
||||||
@@ -37,9 +20,7 @@ const
|
|||||||
{ Current Major version of Imaging.}
|
{ Current Major version of Imaging.}
|
||||||
ImagingVersionMajor = 0;
|
ImagingVersionMajor = 0;
|
||||||
{ Current Minor version of Imaging.}
|
{ Current Minor version of Imaging.}
|
||||||
ImagingVersionMinor = 26;
|
ImagingVersionMinor = 82;
|
||||||
{ Current patch of Imaging.}
|
|
||||||
ImagingVersionPatch = 4;
|
|
||||||
|
|
||||||
{ Imaging Option Ids whose values can be set/get by SetOption/
|
{ Imaging Option Ids whose values can be set/get by SetOption/
|
||||||
GetOption functions.}
|
GetOption functions.}
|
||||||
@@ -88,7 +69,7 @@ const
|
|||||||
Default value is 5.}
|
Default value is 5.}
|
||||||
ImagingPNGPreFilter = 25;
|
ImagingPNGPreFilter = 25;
|
||||||
{ Sets ZLib compression level used when saving PNG images.
|
{ Sets ZLib compression level used when saving PNG images.
|
||||||
Allowed values are in range 0 (no compresstion) to 9 (best compression).
|
Allowed values are in range 0 (no compression) to 9 (best compression).
|
||||||
Default value is 5.}
|
Default value is 5.}
|
||||||
ImagingPNGCompressLevel = 26;
|
ImagingPNGCompressLevel = 26;
|
||||||
{ Boolean option that specifies whether PNG images with more frames (APNG format)
|
{ Boolean option that specifies whether PNG images with more frames (APNG format)
|
||||||
@@ -96,28 +77,32 @@ const
|
|||||||
raw frames are loaded and sent to user (if you want to animate APNG yourself).
|
raw frames are loaded and sent to user (if you want to animate APNG yourself).
|
||||||
Default value is 1.}
|
Default value is 1.}
|
||||||
ImagingPNGLoadAnimated = 27;
|
ImagingPNGLoadAnimated = 27;
|
||||||
|
{ Sets ZLib compression strategy used when saving PNG files (see deflateInit2()
|
||||||
|
in ZLib for details). Allowed values are: 0 (default), 1 (filtered),
|
||||||
|
2 (huffman only). Default value is 0.}
|
||||||
|
ImagingPNGZLibStrategy = 28;
|
||||||
|
|
||||||
{ Specifies whether MNG animation frames are saved with lossy or lossless
|
{ Specifies whether MNG animation frames are saved with lossy or lossless
|
||||||
compression. Lossless frames are saved as PNG images and lossy frames are
|
compression. Lossless frames are saved as PNG images and lossy frames are
|
||||||
saved as JNG images. Allowed values are 0 (False) and 1 (True).
|
saved as JNG images. Allowed values are 0 (False) and 1 (True).
|
||||||
Default value is 0.}
|
Default value is 0.}
|
||||||
ImagingMNGLossyCompression = 28;
|
ImagingMNGLossyCompression = 32;
|
||||||
{ Defines whether alpha channel of lossy compressed MNG frames
|
{ Defines whether alpha channel of lossy compressed MNG frames
|
||||||
(when ImagingMNGLossyCompression is 1) is lossy compressed too.
|
(when ImagingMNGLossyCompression is 1) is lossy compressed too.
|
||||||
Allowed values are 0 (False) and 1 (True). Default value is 0.}
|
Allowed values are 0 (False) and 1 (True). Default value is 0.}
|
||||||
ImagingMNGLossyAlpha = 29;
|
ImagingMNGLossyAlpha = 33;
|
||||||
{ Sets precompression filter used when saving MNG frames as PNG images.
|
{ Sets precompression filter used when saving MNG frames as PNG images.
|
||||||
For details look at ImagingPNGPreFilter.}
|
For details look at ImagingPNGPreFilter.}
|
||||||
ImagingMNGPreFilter = 30;
|
ImagingMNGPreFilter = 34;
|
||||||
{ Sets ZLib compression level used when saving MNG frames as PNG images.
|
{ Sets ZLib compression level used when saving MNG frames as PNG images.
|
||||||
For details look at ImagingPNGCompressLevel.}
|
For details look at ImagingPNGCompressLevel.}
|
||||||
ImagingMNGCompressLevel = 31;
|
ImagingMNGCompressLevel = 35;
|
||||||
{ Specifies compression quality used when saving MNG frames as JNG images.
|
{ Specifies compression quality used when saving MNG frames as JNG images.
|
||||||
For details look at ImagingJpegQuality.}
|
For details look at ImagingJpegQuality.}
|
||||||
ImagingMNGQuality = 32;
|
ImagingMNGQuality = 36;
|
||||||
{ Specifies whether images are saved in progressive format when saving MNG
|
{ Specifies whether images are saved in progressive format when saving MNG
|
||||||
frames as JNG images. For details look at ImagingJpegProgressive.}
|
frames as JNG images. For details look at ImagingJpegProgressive.}
|
||||||
ImagingMNGProgressive = 33;
|
ImagingMNGProgressive = 37;
|
||||||
|
|
||||||
{ Specifies whether alpha channels of JNG images are lossy compressed.
|
{ Specifies whether alpha channels of JNG images are lossy compressed.
|
||||||
Allowed values are 0 (False) and 1 (True). Default value is 0.}
|
Allowed values are 0 (False) and 1 (True). Default value is 0.}
|
||||||
@@ -134,14 +119,17 @@ const
|
|||||||
{ Specifies whether JNG images are saved in progressive format.
|
{ Specifies whether JNG images are saved in progressive format.
|
||||||
For details look at ImagingJpegProgressive.}
|
For details look at ImagingJpegProgressive.}
|
||||||
ImagingJNGProgressive = 44;
|
ImagingJNGProgressive = 44;
|
||||||
|
|
||||||
{ Specifies whether PGM files are stored in text or in binary format.
|
{ Specifies whether PGM files are stored in text or in binary format.
|
||||||
Allowed values are 0 (store as text - very! large files) and 1 (save binary).
|
Allowed values are 0 (store as text - very! large files) and 1 (save binary).
|
||||||
Default value is 1.}
|
Default value is 1.}
|
||||||
ImagingPGMSaveBinary = 50;
|
ImagingPGMSaveBinary = 50;
|
||||||
|
|
||||||
{ Specifies whether PPM files are stored in text or in binary format.
|
{ Specifies whether PPM files are stored in text or in binary format.
|
||||||
Allowed values are 0 (store as text - very! large files) and 1 (save binary).
|
Allowed values are 0 (store as text - very! large files) and 1 (save binary).
|
||||||
Default value is 1.}
|
Default value is 1.}
|
||||||
ImagingPPMSaveBinary = 51;
|
ImagingPPMSaveBinary = 51;
|
||||||
|
|
||||||
{ Boolean option that specifies whether GIF images with more frames
|
{ Boolean option that specifies whether GIF images with more frames
|
||||||
are animated by Imaging (according to frame disposal methods) or just
|
are animated by Imaging (according to frame disposal methods) or just
|
||||||
raw frames are loaded and sent to user (if you want to animate GIF yourself).
|
raw frames are loaded and sent to user (if you want to animate GIF yourself).
|
||||||
@@ -155,22 +143,22 @@ const
|
|||||||
format). Mask is 'anded' (bitwise AND) with every pixel's
|
format). Mask is 'anded' (bitwise AND) with every pixel's
|
||||||
channel value when creating color histogram. If $FF is used
|
channel value when creating color histogram. If $FF is used
|
||||||
all 8bits of color channels are used which can result in very
|
all 8bits of color channels are used which can result in very
|
||||||
slow proccessing of large images with many colors so you can
|
slow processing of large images with many colors so you can
|
||||||
use lower masks to speed it up (FC, F8 and F0 are good
|
use lower masks to speed it up (FC, F8 and F0 are good
|
||||||
choices). Allowed values are in range <0, $FF> and default is
|
choices). Allowed values are in range <0, $FF> and default is
|
||||||
$FE. }
|
$FE. }
|
||||||
ImagingColorReductionMask = 128;
|
ImagingColorReductionMask = 128;
|
||||||
{ This option can be used to override image data format during image
|
{ This option can be used to override image data format during image
|
||||||
loading. If set to format different from ifUnknown all loaded images
|
loading. If set to format different from ifUnknown all loaded images
|
||||||
are automaticaly converted to this format. Useful when you have
|
are automatically converted to this format. Useful when you have
|
||||||
many files in various formats but you want them all in one format for
|
many files in various formats but you want them all in one format for
|
||||||
further proccessing. Allowed values are in
|
further processing. Allowed values are in
|
||||||
range <Ord(Low(TImageFormat)), Ord(High(TImageFormat))> and
|
range <Ord(Low(TImageFormat)), Ord(High(TImageFormat))> and
|
||||||
default value is ifUnknown.}
|
default value is ifUnknown.}
|
||||||
ImagingLoadOverrideFormat = 129;
|
ImagingLoadOverrideFormat = 129;
|
||||||
{ This option can be used to override image data format during image
|
{ This option can be used to override image data format during image
|
||||||
saving. If set to format different from ifUnknown all images
|
saving. If set to format different from ifUnknown all images
|
||||||
to be saved are automaticaly internaly converted to this format.
|
to be saved are automatically internally converted to this format.
|
||||||
Note that image file formats support only a subset of Imaging data formats
|
Note that image file formats support only a subset of Imaging data formats
|
||||||
so final saved file may in different format than this override.
|
so final saved file may in different format than this override.
|
||||||
Allowed values are in range <Ord(Low(TImageFormat)), Ord(High(TImageFormat))>
|
Allowed values are in range <Ord(Low(TImageFormat)), Ord(High(TImageFormat))>
|
||||||
@@ -182,6 +170,10 @@ const
|
|||||||
<Ord(Low(ImagingFormats.TSamplingFilter)), Ord(High(ImagingFormats.TSamplingFilter))>
|
<Ord(Low(ImagingFormats.TSamplingFilter)), Ord(High(ImagingFormats.TSamplingFilter))>
|
||||||
and default value is 1 (linear filter).}
|
and default value is 1 (linear filter).}
|
||||||
ImagingMipMapFilter = 131;
|
ImagingMipMapFilter = 131;
|
||||||
|
{ Specifies threshold value used when automatically converting images to
|
||||||
|
ifBinary format. For adaptive thresholding see ImagingBinary.pas unit.
|
||||||
|
Default value is 128 and allowed range is 0..255.}
|
||||||
|
ImagingBinaryThreshold = 132;
|
||||||
|
|
||||||
{ Returned by GetOption if given Option Id is invalid.}
|
{ Returned by GetOption if given Option Id is invalid.}
|
||||||
InvalidOption = -$7FFFFFFF;
|
InvalidOption = -$7FFFFFFF;
|
||||||
@@ -195,22 +187,42 @@ const
|
|||||||
ChannelAlpha = 3;
|
ChannelAlpha = 3;
|
||||||
|
|
||||||
type
|
type
|
||||||
|
{$IFDEF DCC}
|
||||||
|
{$IF CompilerVersion <= 18.5}
|
||||||
|
PtrUInt = Cardinal;
|
||||||
|
PtrInt = Integer;
|
||||||
|
{ Some new Delphi platforms have 64bit LongInt/LongWord so rather use
|
||||||
|
Int32/UInt32 where you really want 32bits. }
|
||||||
|
Int32 = Integer;
|
||||||
|
UInt32 = Cardinal;
|
||||||
|
Int16 = SmallInt;
|
||||||
|
{$ELSE}
|
||||||
|
PtrUInt = NativeUInt;
|
||||||
|
PtrInt = NativeInt;
|
||||||
|
{$IFEND}
|
||||||
|
{ Not sure which Delphi version defined these (e.g. XE3 has UInt32 but not PUInt32). }
|
||||||
|
{$IF not Defined(PInt32) or not Defined(PUInt32)}
|
||||||
|
PInt32 = ^Int32;
|
||||||
|
PUInt32 = ^UInt32;
|
||||||
|
{$IFEND}
|
||||||
|
{$ENDIF}
|
||||||
|
|
||||||
{ Enum defining image data format. In formats with more channels,
|
{ Enum defining image data format. In formats with more channels,
|
||||||
first channel after "if" is stored in the most significant bits and channel
|
first channel after "if" is stored in the most significant bits and channel
|
||||||
before end is stored in the least significant.}
|
before end is stored in the least significant.}
|
||||||
TImageFormat = (
|
TImageFormat = (
|
||||||
ifUnknown = 0,
|
ifUnknown = 0,
|
||||||
ifDefault = 1,
|
ifDefault = 1,
|
||||||
{ Indexed formats using palette.}
|
{ Indexed formats using palette }
|
||||||
ifIndex8 = 10,
|
ifIndex8 = 10,
|
||||||
{ Grayscale/Luminance formats.}
|
{ Grayscale/Luminance formats }
|
||||||
ifGray8 = 40,
|
ifGray8 = 40,
|
||||||
ifA8Gray8 = 41,
|
ifA8Gray8 = 41,
|
||||||
ifGray16 = 42,
|
ifGray16 = 42,
|
||||||
ifGray32 = 43,
|
ifGray32 = 43,
|
||||||
ifGray64 = 44,
|
ifGray64 = 44,
|
||||||
ifA16Gray16 = 45,
|
ifA16Gray16 = 45,
|
||||||
{ ARGB formats.}
|
{ ARGB formats }
|
||||||
ifX5R1G1B1 = 80,
|
ifX5R1G1B1 = 80,
|
||||||
ifR3G3B2 = 81,
|
ifR3G3B2 = 81,
|
||||||
ifR5G6B5 = 82,
|
ifR5G6B5 = 82,
|
||||||
@@ -225,23 +237,35 @@ type
|
|||||||
ifA16R16G16B16 = 91,
|
ifA16R16G16B16 = 91,
|
||||||
ifB16G16R16 = 92,
|
ifB16G16R16 = 92,
|
||||||
ifA16B16G16R16 = 93,
|
ifA16B16G16R16 = 93,
|
||||||
{ Floating point formats.}
|
{ Floating point formats }
|
||||||
ifR32F = 170,
|
ifR32F = 160,
|
||||||
ifA32R32G32B32F = 171,
|
ifA32R32G32B32F = 161,
|
||||||
ifA32B32G32R32F = 172,
|
ifA32B32G32R32F = 162,
|
||||||
ifR16F = 173,
|
ifR16F = 163,
|
||||||
ifA16R16G16B16F = 174,
|
ifA16R16G16B16F = 164,
|
||||||
ifA16B16G16R16F = 175,
|
ifA16B16G16R16F = 165,
|
||||||
{ Special formats.}
|
ifR32G32B32F = 166,
|
||||||
ifDXT1 = 220,
|
ifB32G32R32F = 167,
|
||||||
ifDXT3 = 221,
|
{ Special formats }
|
||||||
ifDXT5 = 222,
|
ifDXT1 = 200,
|
||||||
ifBTC = 223,
|
ifDXT3 = 201,
|
||||||
ifATI1N = 224,
|
ifDXT5 = 202,
|
||||||
ifATI2N = 225);
|
ifBTC = 203,
|
||||||
|
ifATI1N = 204,
|
||||||
|
ifATI2N = 205,
|
||||||
|
ifBinary = 206,
|
||||||
|
{ Passthrough formats }
|
||||||
|
{ifETC1 = 220,
|
||||||
|
ifETC2RGB = 221,
|
||||||
|
ifETC2RGBA = 222,
|
||||||
|
ifETC2PA = 223,
|
||||||
|
ifDXBC6 = 224,
|
||||||
|
ifDXBC7 = 225}
|
||||||
|
ifLast = 255
|
||||||
|
);
|
||||||
|
|
||||||
{ Color value for 32 bit images.}
|
{ Color value for 32 bit images.}
|
||||||
TColor32 = LongWord;
|
TColor32 = UInt32;
|
||||||
PColor32 = ^TColor32;
|
PColor32 = ^TColor32;
|
||||||
|
|
||||||
{ Color value for 64 bit images.}
|
{ Color value for 64 bit images.}
|
||||||
@@ -296,12 +320,24 @@ type
|
|||||||
TColor64RecArray = array[0..MaxInt div SizeOf(TColor64Rec) - 1] of TColor64Rec;
|
TColor64RecArray = array[0..MaxInt div SizeOf(TColor64Rec) - 1] of TColor64Rec;
|
||||||
PColor64RecArray = ^TColor64RecArray;
|
PColor64RecArray = ^TColor64RecArray;
|
||||||
|
|
||||||
|
{ Color record for 96 bit floating point images, which allows access to
|
||||||
|
individual color channels.}
|
||||||
|
TColor96FPRec = packed record
|
||||||
|
case Integer of
|
||||||
|
0: (B, G, R: Single);
|
||||||
|
1: (Channels: array[0..2] of Single);
|
||||||
|
end;
|
||||||
|
PColor96FPRec = ^TColor96FPRec;
|
||||||
|
TColor96FPRecArray = array[0..MaxInt div SizeOf(TColor96FPRec) - 1] of TColor96FPRec;
|
||||||
|
PColor96FPRecArray = ^TColor96FPRecArray;
|
||||||
|
|
||||||
{ Color record for 128 bit floating point images, which allows access to
|
{ Color record for 128 bit floating point images, which allows access to
|
||||||
individual color channels.}
|
individual color channels.}
|
||||||
TColorFPRec = packed record
|
TColorFPRec = packed record
|
||||||
case LongInt of
|
case LongInt of
|
||||||
0: (B, G, R, A: Single);
|
0: (B, G, R, A: Single);
|
||||||
1: (Channels: array[0..3] of Single);
|
1: (Channels: array[0..3] of Single);
|
||||||
|
2: (Color96Rec: TColor96FPRec);
|
||||||
end;
|
end;
|
||||||
PColorFPRec = ^TColorFPRec;
|
PColorFPRec = ^TColorFPRec;
|
||||||
TColorFPRecArray = array[0..MaxInt div SizeOf(TColorFPRec) - 1] of TColorFPRec;
|
TColorFPRecArray = array[0..MaxInt div SizeOf(TColorFPRec) - 1] of TColorFPRec;
|
||||||
@@ -341,6 +377,7 @@ type
|
|||||||
Size: LongInt; // Size of image bits in Bytes
|
Size: LongInt; // Size of image bits in Bytes
|
||||||
Bits: Pointer; // Pointer to memory containing image bits
|
Bits: Pointer; // Pointer to memory containing image bits
|
||||||
Palette: PPalette32; // Image palette for indexed images
|
Palette: PPalette32; // Image palette for indexed images
|
||||||
|
Tag: Pointer; // User data
|
||||||
end;
|
end;
|
||||||
PImageData = ^TImageData;
|
PImageData = ^TImageData;
|
||||||
|
|
||||||
@@ -348,7 +385,7 @@ type
|
|||||||
image formats.}
|
image formats.}
|
||||||
TPixelFormatInfo = packed record
|
TPixelFormatInfo = packed record
|
||||||
ABitCount, RBitCount, GBitCount, BBitCount: Byte;
|
ABitCount, RBitCount, GBitCount, BBitCount: Byte;
|
||||||
ABitMask, RBitMask, GBitMask, BBitMask: LongWord;
|
ABitMask, RBitMask, GBitMask, BBitMask: UInt32;
|
||||||
AShift, RShift, GShift, BShift: Byte;
|
AShift, RShift, GShift, BShift: Byte;
|
||||||
ARecDiv, RRecDiv, GRecDiv, BRecDiv: Byte;
|
ARecDiv, RRecDiv, GRecDiv, BRecDiv: Byte;
|
||||||
end;
|
end;
|
||||||
@@ -400,6 +437,9 @@ type
|
|||||||
// format does not exist
|
// format does not exist
|
||||||
IsIndexed: Boolean; // True if image uses palette
|
IsIndexed: Boolean; // True if image uses palette
|
||||||
IsSpecial: Boolean; // True if image is in special format
|
IsSpecial: Boolean; // True if image is in special format
|
||||||
|
IsPassthrough: Boolean; // True if image is in passthrough program (Imaging
|
||||||
|
// itself doesn't know how to decode and encode it -
|
||||||
|
// complex texture compressions etc.)
|
||||||
PixelFormat: PPixelFormatInfo; // Pixel format structure
|
PixelFormat: PPixelFormatInfo; // Pixel format structure
|
||||||
GetPixelsSize: TFormatGetPixelsSizeFunc; // Returns size in bytes of
|
GetPixelsSize: TFormatGetPixelsSizeFunc; // Returns size in bytes of
|
||||||
// Width * Height pixels of image
|
// Width * Height pixels of image
|
||||||
@@ -427,7 +467,8 @@ type
|
|||||||
TResizeFilter = (
|
TResizeFilter = (
|
||||||
rfNearest = 0,
|
rfNearest = 0,
|
||||||
rfBilinear = 1,
|
rfBilinear = 1,
|
||||||
rfBicubic = 2);
|
rfBicubic = 2,
|
||||||
|
rfLanczos = 3);
|
||||||
|
|
||||||
{ Seek origin mode for IO function Seek.}
|
{ Seek origin mode for IO function Seek.}
|
||||||
TSeekMode = (
|
TSeekMode = (
|
||||||
@@ -435,16 +476,22 @@ type
|
|||||||
smFromCurrent = 1,
|
smFromCurrent = 1,
|
||||||
smFromEnd = 2);
|
smFromEnd = 2);
|
||||||
|
|
||||||
|
TOpenMode = (
|
||||||
|
omReadOnly = 0, // Opens file for reading only
|
||||||
|
omCreate = 1, // Creates new file (overwriting any existing) and opens it for writing
|
||||||
|
omReadWrite = 2 // Opens for reading and writing. Non existing file is created.
|
||||||
|
);
|
||||||
|
|
||||||
{ IO functions used for reading and writing images from/to input/output.}
|
{ IO functions used for reading and writing images from/to input/output.}
|
||||||
TOpenReadProc = function(Source: PChar): TImagingHandle; cdecl;
|
TOpenProc = function(Source: PChar; Mode: TOpenMode): TImagingHandle; cdecl;
|
||||||
TOpenWriteProc = function(Source: PChar): TImagingHandle; cdecl;
|
|
||||||
TCloseProc = procedure(Handle: TImagingHandle); cdecl;
|
TCloseProc = procedure(Handle: TImagingHandle); cdecl;
|
||||||
TEofProc = function(Handle: TImagingHandle): Boolean; cdecl;
|
TEofProc = function(Handle: TImagingHandle): Boolean; cdecl;
|
||||||
TSeekProc = function(Handle: TImagingHandle; Offset: LongInt; Mode: TSeekMode): LongInt; cdecl;
|
TSeekProc = function(Handle: TImagingHandle; Offset: Int64; Mode: TSeekMode): Int64; cdecl;
|
||||||
TTellProc = function(Handle: TImagingHandle): LongInt; cdecl;
|
TTellProc = function(Handle: TImagingHandle): Int64; cdecl;
|
||||||
TReadProc = function(Handle: TImagingHandle; Buffer: Pointer; Count: LongInt): LongInt; cdecl;
|
TReadProc = function(Handle: TImagingHandle; Buffer: Pointer; Count: LongInt): LongInt; cdecl;
|
||||||
TWriteProc = function(Handle: TImagingHandle; Buffer: Pointer; Count: LongInt): LongInt; cdecl;
|
TWriteProc = function(Handle: TImagingHandle; Buffer: Pointer; Count: LongInt): LongInt; cdecl;
|
||||||
|
|
||||||
|
|
||||||
implementation
|
implementation
|
||||||
|
|
||||||
{
|
{
|
||||||
@@ -453,6 +500,24 @@ implementation
|
|||||||
-- TODOS ----------------------------------------------------
|
-- TODOS ----------------------------------------------------
|
||||||
- add lookup tables to pixel formats for fast conversions
|
- add lookup tables to pixel formats for fast conversions
|
||||||
|
|
||||||
|
-- 0.80 -----------------------------------------------------
|
||||||
|
- Dropped "patch version".
|
||||||
|
|
||||||
|
-- 0.77.3 ---------------------------------------------------
|
||||||
|
- IO functions now have 64bit sizes and offsets.
|
||||||
|
|
||||||
|
-- 0.77.1 ---------------------------------------------------
|
||||||
|
- Added Tag to TImageData for storing user data.
|
||||||
|
- Added ImagingPNGZLibStrategy option.
|
||||||
|
- Changed IO functions. Merged open functions to one
|
||||||
|
and added third open mode R/W (for TIFF append etc.).
|
||||||
|
- Added new image data formats and related structures:
|
||||||
|
ifR32G32B32F, ifB32G32G32F.
|
||||||
|
|
||||||
|
-- 0.26.5 Changes/Bug Fixes ---------------------------------
|
||||||
|
- Added ifBinary image format and ImagingBinaryThreshold option.
|
||||||
|
- Lanczos filter added to TResizeFilter enum.
|
||||||
|
|
||||||
-- 0.24.3 Changes/Bug Fixes ---------------------------------
|
-- 0.24.3 Changes/Bug Fixes ---------------------------------
|
||||||
- Added ifATI1N and ifATI2N image data formats.
|
- Added ifATI1N and ifATI2N image data formats.
|
||||||
|
|
||||||
|
|||||||
+434
-172
@@ -1,29 +1,12 @@
|
|||||||
{
|
{
|
||||||
$Id: ImagingUtility.pas 175 2009-10-06 11:55:15Z galfar $
|
|
||||||
Vampyre Imaging Library
|
Vampyre Imaging Library
|
||||||
by Marek Mauder
|
by Marek Mauder
|
||||||
http://imaginglib.sourceforge.net
|
https://github.com/galfar/imaginglib
|
||||||
|
https://imaginglib.sourceforge.io
|
||||||
The contents of this file are used with permission, subject to the Mozilla
|
- - - - -
|
||||||
Public License Version 1.1 (the "License"); you may not use this file except
|
This Source Code Form is subject to the terms of the Mozilla Public
|
||||||
in compliance with the License. You may obtain a copy of the License at
|
License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||||
http://www.mozilla.org/MPL/MPL-1.1.html
|
file, You can obtain one at https://mozilla.org/MPL/2.0.
|
||||||
|
|
||||||
Software distributed under the License is distributed on an "AS IS" basis,
|
|
||||||
WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License for
|
|
||||||
the specific language governing rights and limitations under the License.
|
|
||||||
|
|
||||||
Alternatively, the contents of this file may be used under the terms of the
|
|
||||||
GNU Lesser General Public License (the "LGPL License"), in which case the
|
|
||||||
provisions of the LGPL License are applicable instead of those above.
|
|
||||||
If you wish to allow use of your version of this file only under the terms
|
|
||||||
of the LGPL License and not to allow others to use your version of this file
|
|
||||||
under the MPL, indicate your decision by deleting the provisions above and
|
|
||||||
replace them with the notice and other provisions required by the LGPL
|
|
||||||
License. If you do not delete the provisions above, a recipient may use
|
|
||||||
your version of this file under either the MPL or the LGPL License.
|
|
||||||
|
|
||||||
For more information about the LGPL: http://www.gnu.org/copyleft/lesser.html
|
|
||||||
}
|
}
|
||||||
|
|
||||||
{ This unit contains utility functions and types for Imaging library.}
|
{ This unit contains utility functions and types for Imaging library.}
|
||||||
@@ -41,14 +24,21 @@ const
|
|||||||
SFalse = 'False';
|
SFalse = 'False';
|
||||||
|
|
||||||
type
|
type
|
||||||
|
{$IF Defined(DELPHI)}
|
||||||
|
{$IF not Defined(UInt32)}
|
||||||
|
UInt32 = Cardinal;
|
||||||
|
{$IFEND}
|
||||||
|
{$IF not Defined(PUInt32)}
|
||||||
|
PUInt32 = ^UInt32;
|
||||||
|
{$IFEND}
|
||||||
|
{$IFEND}
|
||||||
|
|
||||||
TByteArray = array[0..MaxInt - 1] of Byte;
|
TByteArray = array[0..MaxInt - 1] of Byte;
|
||||||
PByteArray = ^TByteArray;
|
PByteArray = ^TByteArray;
|
||||||
TWordArray = array[0..MaxInt div 2 - 1] of Word;
|
TWordArray = array[0..MaxInt div 2 - 1] of Word;
|
||||||
PWordArray = ^TWordArray;
|
PWordArray = ^TWordArray;
|
||||||
TLongIntArray = array[0..MaxInt div 4 - 1] of LongInt;
|
TUInt32Array = array[0..MaxInt div 4 - 1] of UInt32;
|
||||||
PLongIntArray = ^TLongIntArray;
|
PUInt32Array = ^TUInt32Array;
|
||||||
TLongWordArray = array[0..MaxInt div 4 - 1] of LongWord;
|
|
||||||
PLongWordArray = ^TLongWordArray;
|
|
||||||
TInt64Array = array[0..MaxInt div 8 - 1] of Int64;
|
TInt64Array = array[0..MaxInt div 8 - 1] of Int64;
|
||||||
PInt64Array = ^TInt64Array;
|
PInt64Array = ^TInt64Array;
|
||||||
TSingleArray = array[0..MaxInt div 4 - 1] of Single;
|
TSingleArray = array[0..MaxInt div 4 - 1] of Single;
|
||||||
@@ -59,6 +49,7 @@ type
|
|||||||
TDynByteArray = array of Byte;
|
TDynByteArray = array of Byte;
|
||||||
TDynIntegerArray = array of Integer;
|
TDynIntegerArray = array of Integer;
|
||||||
TDynBooleanArray = array of Boolean;
|
TDynBooleanArray = array of Boolean;
|
||||||
|
TDynStringArray = array of string;
|
||||||
|
|
||||||
TWordRec = packed record
|
TWordRec = packed record
|
||||||
case Integer of
|
case Integer of
|
||||||
@@ -69,22 +60,22 @@ type
|
|||||||
TWordRecArray = array[0..MaxInt div 2 - 1] of TWordRec;
|
TWordRecArray = array[0..MaxInt div 2 - 1] of TWordRec;
|
||||||
PWordRecArray = ^TWordRecArray;
|
PWordRecArray = ^TWordRecArray;
|
||||||
|
|
||||||
TLongWordRec = packed record
|
TUInt32Rec = packed record
|
||||||
case Integer of
|
case Integer of
|
||||||
0: (LongWordValue: LongWord);
|
0: (UInt32Value: UInt32);
|
||||||
1: (Low, High: Word);
|
1: (Low, High: Word);
|
||||||
{ Array variants - Index 0 means lowest significant byte (word, ...).}
|
{ Array variants - Index 0 means lowest significant byte (word, ...).}
|
||||||
2: (Words: array[0..1] of Word);
|
2: (Words: array[0..1] of Word);
|
||||||
3: (Bytes: array[0..3] of Byte);
|
3: (Bytes: array[0..3] of Byte);
|
||||||
end;
|
end;
|
||||||
PLongWordRec = ^TLongWordRec;
|
PUInt32Rec = ^TUInt32Rec;
|
||||||
TLongWordRecArray = array[0..MaxInt div 4 - 1] of TLongWordRec;
|
TUInt32RecArray = array[0..MaxInt div 4 - 1] of TUInt32Rec;
|
||||||
PLongWordRecArray = ^TLongWordRecArray;
|
PUInt32RecArray = ^TUInt32RecArray;
|
||||||
|
|
||||||
TInt64Rec = packed record
|
TInt64Rec = packed record
|
||||||
case Integer of
|
case Integer of
|
||||||
0: (Int64Value: Int64);
|
0: (Int64Value: Int64);
|
||||||
1: (Low, High: LongWord);
|
1: (Low, High: UInt32);
|
||||||
{ Array variants - Index 0 means lowest significant byte (word, ...).}
|
{ Array variants - Index 0 means lowest significant byte (word, ...).}
|
||||||
2: (Words: array[0..3] of Word);
|
2: (Words: array[0..3] of Word);
|
||||||
3: (Bytes: array[0..7] of Byte);
|
3: (Bytes: array[0..7] of Byte);
|
||||||
@@ -94,16 +85,32 @@ type
|
|||||||
PInt64RecArray = ^TInt64RecArray;
|
PInt64RecArray = ^TInt64RecArray;
|
||||||
|
|
||||||
TFloatHelper = record
|
TFloatHelper = record
|
||||||
Data1: Int64;
|
Data: Int64;
|
||||||
Data2: Int64;
|
case Integer of
|
||||||
end;
|
0: (Data64: Int64);
|
||||||
|
1: (Data32: UInt32);
|
||||||
|
end;
|
||||||
PFloatHelper = ^TFloatHelper;
|
PFloatHelper = ^TFloatHelper;
|
||||||
|
|
||||||
|
TFloatPoint = record
|
||||||
|
X, Y: Single;
|
||||||
|
end;
|
||||||
|
|
||||||
|
TFloatRect = record
|
||||||
|
Left, Top, Right, Bottom: Single;
|
||||||
|
end;
|
||||||
|
|
||||||
TChar2 = array[0..1] of AnsiChar;
|
TChar2 = array[0..1] of AnsiChar;
|
||||||
TChar3 = array[0..2] of AnsiChar;
|
TChar3 = array[0..2] of AnsiChar;
|
||||||
TChar4 = array[0..3] of AnsiChar;
|
TChar4 = array[0..3] of AnsiChar;
|
||||||
TChar8 = array[0..7] of AnsiChar;
|
TChar8 = array[0..7] of AnsiChar;
|
||||||
TChar16 = array[0..15] of AnsiChar;
|
TChar16 = array[0..15] of AnsiChar;
|
||||||
|
TAnsiCharSet = set of AnsiChar;
|
||||||
|
|
||||||
|
ENotImplemented = class(Exception)
|
||||||
|
public
|
||||||
|
constructor Create;
|
||||||
|
end;
|
||||||
|
|
||||||
{ Options for BuildFileList function:
|
{ Options for BuildFileList function:
|
||||||
flFullNames - file names in result will have full path names
|
flFullNames - file names in result will have full path names
|
||||||
@@ -126,20 +133,26 @@ procedure FreeMem(P: Pointer); {$IFDEF USE_INLINE}inline;{$ENDIF}
|
|||||||
function GetExceptObject: Exception; {$IFDEF USE_INLINE}inline;{$ENDIF}
|
function GetExceptObject: Exception; {$IFDEF USE_INLINE}inline;{$ENDIF}
|
||||||
{ Returns time value with microsecond resolution.}
|
{ Returns time value with microsecond resolution.}
|
||||||
function GetTimeMicroseconds: Int64;
|
function GetTimeMicroseconds: Int64;
|
||||||
{ Returns time value with milisecond resolution.}
|
{ Returns time value with millisecond resolution.}
|
||||||
function GetTimeMilliseconds: Int64;
|
function GetTimeMilliseconds: Int64;
|
||||||
|
|
||||||
{ Returns file extension (without "." dot)}
|
{ Returns file extension (without "." dot)}
|
||||||
function GetFileExt(const FileName: string): string;
|
function GetFileExt(const FileName: string): string;
|
||||||
{ Returns file name of application's executable.}
|
{ Returns file name of application's executable.}
|
||||||
function GetAppExe: string;
|
function GetAppExe: string;
|
||||||
{ Returns directory where application's exceutable is located without
|
{ Returns directory where application's executable is located without
|
||||||
path delimiter at the end.}
|
path delimiter at the end.}
|
||||||
function GetAppDir: string;
|
function GetAppDir: string;
|
||||||
{ Returns True if FileName matches given Mask with optional case sensitivity.
|
{ Works like SysUtils.ExtractFileName but supports '/' and '\' dir delimiters
|
||||||
|
at the same time (whereas ExtractFileName supports on default delimiter on current platform).}
|
||||||
|
function GetFileName(const FileName: string): string;
|
||||||
|
{ Works like SysUtils.ExtractFileDir but supports '/' and '\' dir delimiters
|
||||||
|
at the same time (whereas ExtractFileDir supports on default delimiter on current platform).}
|
||||||
|
function GetFileDir(const FileName: string): string;
|
||||||
|
{ Returns True if Subject matches given Mask with optional case sensitivity.
|
||||||
Mask can contain ? and * special characters: ? matches
|
Mask can contain ? and * special characters: ? matches
|
||||||
one character, * matches zero or more characters.}
|
one character, * matches zero or more characters.}
|
||||||
function MatchFileNameMask(const FileName, Mask: string; CaseSensitive: Boolean = False): Boolean;
|
function StrMaskMatch(const Subject, Mask: string; CaseSensitive: Boolean = False): Boolean;
|
||||||
{ This function fills Files string list with names of files found
|
{ This function fills Files string list with names of files found
|
||||||
with FindFirst/FindNext functions (See details on Path/Atrr here).
|
with FindFirst/FindNext functions (See details on Path/Atrr here).
|
||||||
- BuildFileList('c:\*.*', faAnyFile, List, [flRecursive]) returns
|
- BuildFileList('c:\*.*', faAnyFile, List, [flRecursive]) returns
|
||||||
@@ -149,7 +162,9 @@ function MatchFileNameMask(const FileName, Mask: string; CaseSensitive: Boolean
|
|||||||
function BuildFileList(Path: string; Attr: LongInt; Files: TStrings;
|
function BuildFileList(Path: string; Attr: LongInt; Files: TStrings;
|
||||||
Options: TFileListOptions = []): Boolean;
|
Options: TFileListOptions = []): Boolean;
|
||||||
{ Similar to RTL's Pos function but with optional Offset where search will start.
|
{ Similar to RTL's Pos function but with optional Offset where search will start.
|
||||||
This function is in the RTL StrUtils unit but }
|
In recent FPC and Delphi XE3+ regular SysUtils.Pos has the Offset parameter as well.
|
||||||
|
This function is in the RTL StrUtils unit, it's here to depend on additional
|
||||||
|
unit for just this one function. }
|
||||||
function PosEx(const SubStr, S: string; Offset: LongInt = 1): LongInt;
|
function PosEx(const SubStr, S: string; Offset: LongInt = 1): LongInt;
|
||||||
{ Same as PosEx but without case sensitivity.}
|
{ Same as PosEx but without case sensitivity.}
|
||||||
function PosNoCase(const SubStr, S: string; Offset: LongInt = 1): LongInt; {$IFDEF USE_INLINE}inline;{$ENDIF}
|
function PosNoCase(const SubStr, S: string; Offset: LongInt = 1): LongInt; {$IFDEF USE_INLINE}inline;{$ENDIF}
|
||||||
@@ -161,10 +176,26 @@ function StrTokenEnd(var S: string; Sep: Char): string;
|
|||||||
{ Fills instance of TStrings with tokens from string S where tokens are separated by
|
{ Fills instance of TStrings with tokens from string S where tokens are separated by
|
||||||
one of Seps characters.}
|
one of Seps characters.}
|
||||||
procedure StrTokensToList(const S: string; Sep: Char; Tokens: TStrings);
|
procedure StrTokensToList(const S: string; Sep: Char; Tokens: TStrings);
|
||||||
{ Returns string representation of integer number (with digit grouping).}
|
{ Returns string representation of integer number (with digit grouping).
|
||||||
|
Uses current locale.}
|
||||||
function IntToStrFmt(const I: Int64): string; {$IFDEF USE_INLINE}inline;{$ENDIF}
|
function IntToStrFmt(const I: Int64): string; {$IFDEF USE_INLINE}inline;{$ENDIF}
|
||||||
{ Returns string representation of float number (with digit grouping).}
|
{ Returns string representation of float number (with digit grouping).
|
||||||
|
Uses current locale.}
|
||||||
function FloatToStrFmt(const F: Double; Precision: Integer = 2): string; {$IFDEF USE_INLINE}inline;{$ENDIF}
|
function FloatToStrFmt(const F: Double; Precision: Integer = 2): string; {$IFDEF USE_INLINE}inline;{$ENDIF}
|
||||||
|
{ Returns format settings for parsing floats (dot as decimal separator).
|
||||||
|
Useful when formatting/parsing floats etc.}
|
||||||
|
function GetFormatSettingsForFloats: TFormatSettings;
|
||||||
|
{ Returns True if S contains at least one of the substrings in SubStrs array. Case sensitive.}
|
||||||
|
function ContainsAnySubStr(const S: string; const SubStrs: array of string): Boolean;
|
||||||
|
{ Extracts substring starting at IdxStart ending at IdxEnd.
|
||||||
|
S[IdxEnd] is not included in the result.}
|
||||||
|
function SubString(const S: string; IdxStart, IdxEnd: Integer): string; {$IFDEF USE_INLINE}inline;{$ENDIF}
|
||||||
|
{ Similar to Trim() but removes only characters in a given set.
|
||||||
|
Part of FPC RTL here for Delphi compatibility. }
|
||||||
|
function TrimSet(const S: string; const CharSet: TSysCharSet): string;
|
||||||
|
{ Similar to TrimLeft() but removes only characters in a given set.
|
||||||
|
Part of FPC RTL here for Delphi compatibility. }
|
||||||
|
function TrimLeftSet(const S: string; const CharSet:TSysCharSet): string;
|
||||||
|
|
||||||
{ Clamps integer value to range <Min, Max>}
|
{ Clamps integer value to range <Min, Max>}
|
||||||
function ClampInt(Number: LongInt; Min, Max: LongInt): LongInt; {$IFDEF USE_INLINE}inline;{$ENDIF}
|
function ClampInt(Number: LongInt; Min, Max: LongInt): LongInt; {$IFDEF USE_INLINE}inline;{$ENDIF}
|
||||||
@@ -177,7 +208,7 @@ function ClampToWord(Value: LongInt): LongInt; {$IFDEF USE_INLINE}inline;{$ENDIF
|
|||||||
{ Returns True if Num is power of 2.}
|
{ Returns True if Num is power of 2.}
|
||||||
function IsPow2(Num: LongInt): Boolean; {$IFDEF USE_INLINE}inline;{$ENDIF}
|
function IsPow2(Num: LongInt): Boolean; {$IFDEF USE_INLINE}inline;{$ENDIF}
|
||||||
{ Returns next power of 2 greater than or equal to Num
|
{ Returns next power of 2 greater than or equal to Num
|
||||||
(if Num itself is power of 2 then it retuns Num).}
|
(if Num itself is power of 2 then it returns Num).}
|
||||||
function NextPow2(Num: LongInt): LongInt; {$IFDEF USE_INLINE}inline;{$ENDIF}
|
function NextPow2(Num: LongInt): LongInt; {$IFDEF USE_INLINE}inline;{$ENDIF}
|
||||||
{ Raises 2 to the given integer power (in range [0, 30]).}
|
{ Raises 2 to the given integer power (in range [0, 30]).}
|
||||||
function Pow2Int(Exponent: LongInt): LongInt; {$IFDEF USE_INLINE}inline;{$ENDIF}
|
function Pow2Int(Exponent: LongInt): LongInt; {$IFDEF USE_INLINE}inline;{$ENDIF}
|
||||||
@@ -187,6 +218,8 @@ function Power(const Base, Exponent: Single): Single;
|
|||||||
function Log2Int(X: LongInt): LongInt; {$IFDEF USE_INLINE}inline;{$ENDIF}
|
function Log2Int(X: LongInt): LongInt; {$IFDEF USE_INLINE}inline;{$ENDIF}
|
||||||
{ Returns log base 2 of X.}
|
{ Returns log base 2 of X.}
|
||||||
function Log2(X: Single): Single;
|
function Log2(X: Single): Single;
|
||||||
|
{ Returns log base 10 of X.}
|
||||||
|
function Log10(X: Single): Single;
|
||||||
{ Returns largest integer <= Val (for 5.9 returns 5).}
|
{ Returns largest integer <= Val (for 5.9 returns 5).}
|
||||||
function Floor(Value: Single): LongInt; {$IFDEF USE_INLINE}inline;{$ENDIF}
|
function Floor(Value: Single): LongInt; {$IFDEF USE_INLINE}inline;{$ENDIF}
|
||||||
{ Returns smallest integer >= Val (for 5.1 returns 6).}
|
{ Returns smallest integer >= Val (for 5.1 returns 6).}
|
||||||
@@ -198,46 +231,58 @@ function MinFloat(A, B: Single): Single; {$IFDEF USE_INLINE}inline;{$ENDIF}
|
|||||||
{ Returns greater of two integer numbers.}
|
{ Returns greater of two integer numbers.}
|
||||||
function Max(A, B: LongInt): LongInt; {$IFDEF USE_INLINE}inline;{$ENDIF}
|
function Max(A, B: LongInt): LongInt; {$IFDEF USE_INLINE}inline;{$ENDIF}
|
||||||
{ Returns greater of two float numbers.}
|
{ Returns greater of two float numbers.}
|
||||||
function MaxFloat(A, B: Single): Single; {$IFDEF USE_INLINE}inline;{$ENDIF}
|
function MaxFloat(A, B: Single): Single; overload; {$IFDEF USE_INLINE}inline;{$ENDIF}
|
||||||
|
{ Returns greater of two float numbers.}
|
||||||
|
function MaxFloat(const A, B: Double): Double; overload; {$IFDEF USE_INLINE}inline;{$ENDIF}
|
||||||
{ Returns result from multiplying Number by Numerator and then dividing by Denominator.
|
{ Returns result from multiplying Number by Numerator and then dividing by Denominator.
|
||||||
Denominator must be greater than 0.}
|
Denominator must be greater than 0.}
|
||||||
function MulDiv(Number, Numerator, Denominator: Word): Word; {$IFDEF USE_INLINE}inline;{$ENDIF}
|
function MulDiv(Number, Numerator, Denominator: Word): Word; {$IFDEF USE_INLINE}inline;{$ENDIF}
|
||||||
|
{ Returns true if give floats are the equal within given delta.}
|
||||||
|
function SameFloat(A, B: Single; Delta: Single = 0.001): Boolean; overload; {$IFDEF USE_INLINE}inline;{$ENDIF}
|
||||||
|
{ Returns true if give floats are the equal within given delta.}
|
||||||
|
function SameFloat(const A, B: Double; const Delta: Double = 0.000001): Boolean; overload; {$IFDEF USE_INLINE}inline;{$ENDIF}
|
||||||
|
|
||||||
{ Switches Boolean value.}
|
{ Switches Boolean value.}
|
||||||
procedure Switch(var Value: Boolean); {$IFDEF USE_INLINE}inline;{$ENDIF}
|
procedure Switch(var Value: Boolean); {$IFDEF USE_INLINE}inline;{$ENDIF}
|
||||||
{ If Condition is True then TruePart is retured, otherwise
|
{ If Condition is True then TruePart is returned, otherwise
|
||||||
FalsePart is returned.}
|
FalsePart is returned.}
|
||||||
function Iff(Condition: Boolean; TruePart, FalsePart: LongInt): LongInt; overload; {$IFDEF USE_INLINE}inline;{$ENDIF}
|
function Iff(Condition: Boolean; TruePart, FalsePart: Integer): Integer; overload; {$IFDEF USE_INLINE}inline;{$ENDIF}
|
||||||
{ If Condition is True then TruePart is retured, otherwise
|
{ If Condition is True then TruePart is returned, otherwise
|
||||||
FalsePart is returned.}
|
FalsePart is returned.}
|
||||||
function IffUnsigned(Condition: Boolean; TruePart, FalsePart: LongWord): LongWord; overload; {$IFDEF USE_INLINE}inline;{$ENDIF}
|
function IffUnsigned(Condition: Boolean; TruePart, FalsePart: Cardinal): Cardinal; overload; {$IFDEF USE_INLINE}inline;{$ENDIF}
|
||||||
{ If Condition is True then TruePart is retured, otherwise
|
{ If Condition is True then TruePart is returned, otherwise
|
||||||
FalsePart is returned.}
|
FalsePart is returned.}
|
||||||
function Iff(Condition, TruePart, FalsePart: Boolean): Boolean; overload; {$IFDEF USE_INLINE}inline;{$ENDIF}
|
function Iff(Condition, TruePart, FalsePart: Boolean): Boolean; overload; {$IFDEF USE_INLINE}inline;{$ENDIF}
|
||||||
{ If Condition is True then TruePart is retured, otherwise
|
{ If Condition is True then TruePart is returned, otherwise
|
||||||
FalsePart is returned.}
|
FalsePart is returned.}
|
||||||
function Iff(Condition: Boolean; const TruePart, FalsePart: string): string; overload; {$IFDEF USE_INLINE}inline;{$ENDIF}
|
function Iff(Condition: Boolean; const TruePart, FalsePart: string): string; overload; {$IFDEF USE_INLINE}inline;{$ENDIF}
|
||||||
{ If Condition is True then TruePart is retured, otherwise
|
{ If Condition is True then TruePart is returned, otherwise
|
||||||
FalsePart is returned.}
|
FalsePart is returned.}
|
||||||
function Iff(Condition: Boolean; TruePart, FalsePart: Char): Char; overload; {$IFDEF USE_INLINE}inline;{$ENDIF}
|
function Iff(Condition: Boolean; TruePart, FalsePart: Char): Char; overload; {$IFDEF USE_INLINE}inline;{$ENDIF}
|
||||||
{ If Condition is True then TruePart is retured, otherwise
|
{ If Condition is True then TruePart is returned, otherwise
|
||||||
FalsePart is returned.}
|
FalsePart is returned.}
|
||||||
function Iff(Condition: Boolean; TruePart, FalsePart: Pointer): Pointer; overload; {$IFDEF USE_INLINE}inline;{$ENDIF}
|
function Iff(Condition: Boolean; TruePart, FalsePart: Pointer): Pointer; overload; {$IFDEF USE_INLINE}inline;{$ENDIF}
|
||||||
{ If Condition is True then TruePart is retured, otherwise
|
{ If Condition is True then TruePart is returned, otherwise
|
||||||
FalsePart is returned.}
|
FalsePart is returned.}
|
||||||
function Iff(Condition: Boolean; const TruePart, FalsePart: Int64): Int64; overload; {$IFDEF USE_INLINE}inline;{$ENDIF}
|
function Iff(Condition: Boolean; const TruePart, FalsePart: Int64): Int64; overload; {$IFDEF USE_INLINE}inline;{$ENDIF}
|
||||||
{ If Condition is True then TruePart is retured, otherwise
|
{ If Condition is True then TruePart is returned, otherwise
|
||||||
FalsePart is returned.}
|
FalsePart is returned.}
|
||||||
function IffFloat(Condition: Boolean; TruePart, FalsePart: Single): Single; {$IFDEF USE_INLINE}inline;{$ENDIF}
|
function IffFloat(Condition: Boolean; TruePart, FalsePart: Single): Single; {$IFDEF USE_INLINE}inline;{$ENDIF}
|
||||||
|
{ Swaps two Boolean values}
|
||||||
|
procedure SwapValues(var A, B: Boolean); overload;
|
||||||
{ Swaps two Byte values}
|
{ Swaps two Byte values}
|
||||||
procedure SwapValues(var A, B: Byte); overload;
|
procedure SwapValues(var A, B: Byte); overload;
|
||||||
{ Swaps two Word values}
|
{ Swaps two Word values}
|
||||||
procedure SwapValues(var A, B: Word); overload;
|
procedure SwapValues(var A, B: Word); overload;
|
||||||
|
{ Swaps two Integer values}
|
||||||
|
procedure SwapValues(var A, B: Integer); overload;
|
||||||
|
{$IFDEF LONGINT_IS_NOT_INTEGER}
|
||||||
{ Swaps two LongInt values}
|
{ Swaps two LongInt values}
|
||||||
procedure SwapValues(var A, B: LongInt); overload;
|
procedure SwapValues(var A, B: LongInt); overload;
|
||||||
|
{$ENDIF}
|
||||||
{ Swaps two Single values}
|
{ Swaps two Single values}
|
||||||
procedure SwapValues(var A, B: Single); overload;
|
procedure SwapValues(var A, B: Single); overload;
|
||||||
{ Swaps two LongInt values if necessary to ensure that Min <= Max.}
|
{ Swaps two values if necessary to ensure that Min <= Max.}
|
||||||
procedure SwapMin(var Min, Max: LongInt); {$IFDEF USE_INLINE}inline;{$ENDIF}
|
procedure SwapMin(var Min, Max: LongInt); {$IFDEF USE_INLINE}inline;{$ENDIF}
|
||||||
{ This function returns True if running on little endian machine.}
|
{ This function returns True if running on little endian machine.}
|
||||||
function IsLittleEndian: Boolean; {$IFDEF USE_INLINE}inline;{$ENDIF}
|
function IsLittleEndian: Boolean; {$IFDEF USE_INLINE}inline;{$ENDIF}
|
||||||
@@ -245,19 +290,22 @@ function IsLittleEndian: Boolean; {$IFDEF USE_INLINE}inline;{$ENDIF}
|
|||||||
function SwapEndianWord(Value: Word): Word; overload; {$IFDEF USE_INLINE}inline;{$ENDIF}
|
function SwapEndianWord(Value: Word): Word; overload; {$IFDEF USE_INLINE}inline;{$ENDIF}
|
||||||
{ Swaps byte order of multiple Word values.}
|
{ Swaps byte order of multiple Word values.}
|
||||||
procedure SwapEndianWord(P: PWordArray; Count: LongInt); overload;
|
procedure SwapEndianWord(P: PWordArray; Count: LongInt); overload;
|
||||||
{ Swaps byte order of LongWord value.}
|
{ Swaps byte order of UInt32 value.}
|
||||||
function SwapEndianLongWord(Value: LongWord): LongWord; overload; {$IFDEF USE_INLINE}inline;{$ENDIF}
|
function SwapEndianUInt32(Value: UInt32): UInt32; overload; {$IFDEF USE_INLINE}inline;{$ENDIF}
|
||||||
{ Swaps byte order of multiple LongWord values.}
|
{ Swaps byte order of multiple UInt32 values.}
|
||||||
procedure SwapEndianLongWord(P: PLongWord; Count: LongInt); overload;
|
procedure SwapEndianUInt32(P: PUInt32; Count: LongInt); overload;
|
||||||
|
|
||||||
{ Calculates CRC32 for the given data.}
|
{ Calculates CRC32 for the given data.}
|
||||||
procedure CalcCrc32(var Crc: LongWord; Data: Pointer; Size: LongInt);
|
procedure CalcCrc32(var Crc: UInt32; Data: Pointer; Size: LongInt);
|
||||||
{ Fills given memory with given Byte value. Size is size of buffer in bytes.}
|
{ Fills given memory with given Byte value. Size is size of buffer in bytes.}
|
||||||
procedure FillMemoryByte(Data: Pointer; Size: LongInt; Value: Byte);
|
procedure FillMemoryByte(Data: Pointer; Size: LongInt; Value: Byte);
|
||||||
{ Fills given memory with given Word value. Size is size of buffer in bytes.}
|
{ Fills given memory with given Word value. Size is size of buffer in bytes.}
|
||||||
procedure FillMemoryWord(Data: Pointer; Size: LongInt; Value: Word);
|
procedure FillMemoryWord(Data: Pointer; Size: LongInt; Value: Word);
|
||||||
{ Fills given memory with given LongWord value. Size is size of buffer in bytes.}
|
{ Fills given memory with given UInt32 value. Size is size of buffer in bytes.}
|
||||||
procedure FillMemoryLongWord(Data: Pointer; Size: LongInt; Value: LongWord);
|
procedure FillMemoryUInt32(Data: Pointer; Size: LongInt; Value: UInt32);
|
||||||
|
{ Fills given memory zeroes.}
|
||||||
|
{$EXTERNALSYM ZeroMemory} // Conflicts with WinAPI ZeroMemory in C++ Builder
|
||||||
|
procedure ZeroMemory(Data: Pointer; Size: Integer); {$IFDEF USE_INLINE}inline;{$ENDIF}
|
||||||
|
|
||||||
{ Returns how many mipmap levels can be created for image of given size.}
|
{ Returns how many mipmap levels can be created for image of given size.}
|
||||||
function GetNumMipMapLevels(Width, Height: LongInt): LongInt;
|
function GetNumMipMapLevels(Width, Height: LongInt): LongInt;
|
||||||
@@ -285,10 +333,30 @@ procedure ClipStretchBounds(var SrcX, SrcY, SrcWidth, SrcHeight, DstX, DstY,
|
|||||||
{ Scales one rectangle to fit into another. Proportions are preserved so
|
{ Scales one rectangle to fit into another. Proportions are preserved so
|
||||||
it could be used for 'Stretch To Fit Window' image drawing for instance.}
|
it could be used for 'Stretch To Fit Window' image drawing for instance.}
|
||||||
function ScaleRectToRect(const SourceRect, TargetRect: TRect): TRect;
|
function ScaleRectToRect(const SourceRect, TargetRect: TRect): TRect;
|
||||||
|
{ Scales given size to fit into max size while keeping the original aspect ratio.
|
||||||
|
Useful for calculating thumbnail dimensions etc.}
|
||||||
|
function ScaleSizeToFit(const CurrentSize, MaxSize: TSize): TSize;
|
||||||
|
{ Returns width of given rect. Part of RTL in newer Delphi.}
|
||||||
|
function RectWidth(const Rect: TRect): Integer;
|
||||||
|
{ Returns height of given rect. Part of RTL in newer Delphi.}
|
||||||
|
function RectHeight(const Rect: TRect): Integer;
|
||||||
{ Returns True if R1 fits into R2.}
|
{ Returns True if R1 fits into R2.}
|
||||||
function RectInRect(const R1, R2: TRect): Boolean;
|
function RectInRect(const R1, R2: TRect): Boolean;
|
||||||
{ Returns True if R1 and R2 intersects.}
|
{ Returns True if R1 and R2 intersects.}
|
||||||
function RectIntersects(const R1, R2: TRect): Boolean;
|
function RectIntersects(const R1, R2: TRect): Boolean;
|
||||||
|
{ Ensures that rect's right>left and bottom>top. }
|
||||||
|
procedure NormalizeRect(var R: TRect);
|
||||||
|
|
||||||
|
{ Converts pixel size in micrometers to corresponding DPI.}
|
||||||
|
function PixelSizeToDpi(SizeInMicroMeters: Single): Single;
|
||||||
|
{ Converts DPI to corresponding pixel size in micrometers.}
|
||||||
|
function DpiToPixelSize(Dpi: Single): Single;
|
||||||
|
|
||||||
|
function FloatPoint(AX, AY: Single): TFloatPoint; {$IFDEF USE_INLINE}inline;{$ENDIF}
|
||||||
|
function FloatRect(ALeft, ATop, ARight, ABottom: Single): TFloatRect;
|
||||||
|
function FloatRectWidth(const R: TFloatRect): Single;
|
||||||
|
function FloatRectHeight(const R: TFloatRect): Single;
|
||||||
|
function FloatRectFromRect(const R: TRect): TFloatRect;
|
||||||
|
|
||||||
{ Formats given message for usage in Exception.Create(..). Use only
|
{ Formats given message for usage in Exception.Create(..). Use only
|
||||||
in except block - returned message contains message of last raised exception.}
|
in except block - returned message contains message of last raised exception.}
|
||||||
@@ -300,16 +368,21 @@ procedure DebugMsg(const Msg: string; const Args: array of const);
|
|||||||
implementation
|
implementation
|
||||||
|
|
||||||
uses
|
uses
|
||||||
{$IFDEF MSWINDOWS}
|
{$IF Defined(MSWINDOWS)}
|
||||||
Windows;
|
Windows;
|
||||||
{$ENDIF}
|
{$ELSEIF Defined(FPC)}
|
||||||
{$IFDEF UNIX}
|
|
||||||
{$IFDEF KYLIX}
|
|
||||||
Libc;
|
|
||||||
{$ELSE}
|
|
||||||
Dos, BaseUnix, Unix;
|
Dos, BaseUnix, Unix;
|
||||||
{$ENDIF}
|
{$ELSEIF Defined(DELPHI)}
|
||||||
{$ENDIF}
|
Posix.SysTime;
|
||||||
|
{$IFEND}
|
||||||
|
|
||||||
|
var
|
||||||
|
FloatFormatSettings: TFormatSettings;
|
||||||
|
|
||||||
|
constructor ENotImplemented.Create;
|
||||||
|
begin
|
||||||
|
inherited Create('Not implemented');
|
||||||
|
end;
|
||||||
|
|
||||||
procedure FreeAndNil(var Obj);
|
procedure FreeAndNil(var Obj);
|
||||||
var
|
var
|
||||||
@@ -337,10 +410,10 @@ begin
|
|||||||
Result := Exception(ExceptObject);
|
Result := Exception(ExceptObject);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
{$IFDEF MSWINDOWS}
|
{$IF Defined(MSWINDOWS)}
|
||||||
var
|
var
|
||||||
PerfFrequency: Int64;
|
PerfFrequency: Int64;
|
||||||
InvPerfFrequency: Single;
|
InvPerfFrequency: Extended;
|
||||||
|
|
||||||
function GetTimeMicroseconds: Int64;
|
function GetTimeMicroseconds: Int64;
|
||||||
var
|
var
|
||||||
@@ -349,56 +422,23 @@ begin
|
|||||||
QueryPerformanceCounter(Time);
|
QueryPerformanceCounter(Time);
|
||||||
Result := Round(1000000 * InvPerfFrequency * Time);
|
Result := Round(1000000 * InvPerfFrequency * Time);
|
||||||
end;
|
end;
|
||||||
{$ENDIF}
|
{$ELSEIF Defined(DELPHI)}
|
||||||
|
function GetTimeMicroseconds: Int64;
|
||||||
{$IFDEF UNIX}
|
var
|
||||||
|
Time: TimeVal;
|
||||||
|
begin
|
||||||
|
Posix.SysTime.GetTimeOfDay(Time, nil);
|
||||||
|
Result := Int64(Time.tv_sec) * 1000000 + Time.tv_usec;
|
||||||
|
end;
|
||||||
|
{$ELSEIF Defined(FPC)}
|
||||||
function GetTimeMicroseconds: Int64;
|
function GetTimeMicroseconds: Int64;
|
||||||
var
|
var
|
||||||
TimeVal: TTimeVal;
|
TimeVal: TTimeVal;
|
||||||
begin
|
begin
|
||||||
{$IFDEF KYLIX}
|
|
||||||
GetTimeOfDay(TimeVal, nil);
|
|
||||||
{$ELSE}
|
|
||||||
fpGetTimeOfDay(@TimeVal, nil);
|
fpGetTimeOfDay(@TimeVal, nil);
|
||||||
{$ENDIF}
|
|
||||||
Result := Int64(TimeVal.tv_sec) * 1000000 + TimeVal.tv_usec;
|
Result := Int64(TimeVal.tv_sec) * 1000000 + TimeVal.tv_usec;
|
||||||
end;
|
end;
|
||||||
{$ENDIF}
|
{$IFEND}
|
||||||
|
|
||||||
{$IFDEF MSDOS}
|
|
||||||
function GetTimeMicroseconds: Int64;
|
|
||||||
asm
|
|
||||||
XOR EAX, EAX
|
|
||||||
CLI
|
|
||||||
OUT $43, AL
|
|
||||||
MOV EDX, FS:[$46C]
|
|
||||||
IN AL, $40
|
|
||||||
DB $EB, 0, $EB, 0, $EB, 0
|
|
||||||
MOV AH, AL
|
|
||||||
IN AL, $40
|
|
||||||
DB $EB, 0, $EB, 0, $EB, 0
|
|
||||||
XCHG AL, AH
|
|
||||||
NEG AX
|
|
||||||
MOVZX EDI, AX
|
|
||||||
STI
|
|
||||||
MOV EBX, $10000
|
|
||||||
MOV EAX, EDX
|
|
||||||
XOR EDX, EDX
|
|
||||||
MUL EBX
|
|
||||||
ADD EAX, EDI
|
|
||||||
ADC EDX, 0
|
|
||||||
PUSH EDX
|
|
||||||
PUSH EAX
|
|
||||||
MOV ECX, $82BF1000
|
|
||||||
MOVZX EAX, WORD PTR FS:[$470]
|
|
||||||
MUL ECX
|
|
||||||
MOV ECX, EAX
|
|
||||||
POP EAX
|
|
||||||
POP EDX
|
|
||||||
ADD EAX, ECX
|
|
||||||
ADC EDX, 0
|
|
||||||
end;
|
|
||||||
{$ENDIF}
|
|
||||||
|
|
||||||
function GetTimeMilliseconds: Int64;
|
function GetTimeMilliseconds: Int64;
|
||||||
begin
|
begin
|
||||||
@@ -413,29 +453,22 @@ begin
|
|||||||
end;
|
end;
|
||||||
|
|
||||||
function GetAppExe: string;
|
function GetAppExe: string;
|
||||||
{$IFDEF MSWINDOWS}
|
{$IF Defined(MSWINDOWS)}
|
||||||
var
|
var
|
||||||
FileName: array[0..MAX_PATH] of Char;
|
FileName: array[0..MAX_PATH] of Char;
|
||||||
begin
|
begin
|
||||||
SetString(Result, FileName,
|
SetString(Result, FileName,
|
||||||
Windows.GetModuleFileName(MainInstance, FileName, SizeOf(FileName)));
|
Windows.GetModuleFileName(MainInstance, FileName, SizeOf(FileName)));
|
||||||
{$ENDIF}
|
{$ELSEIF Defined(DELPHI)} // Delphi non Win targets
|
||||||
{$IFDEF UNIX}
|
|
||||||
{$IFDEF KYLIX}
|
|
||||||
var
|
var
|
||||||
FileName: array[0..FILENAME_MAX] of Char;
|
FileName: array[0..1024] of Char;
|
||||||
begin
|
begin
|
||||||
SetString(Result, FileName,
|
SetString(Result, FileName,
|
||||||
System.GetModuleFileName(MainInstance, FileName, SizeOf(FileName)));
|
System.GetModuleFileName(MainInstance, FileName, SizeOf(FileName)));
|
||||||
{$ELSE}
|
{$ELSE}
|
||||||
begin
|
begin
|
||||||
Result := FExpand(ParamStr(0));
|
Result := ExpandFileName(ParamStr(0));
|
||||||
{$ENDIF}
|
{$IFEND}
|
||||||
{$ENDIF}
|
|
||||||
{$IFDEF MSDOS}
|
|
||||||
begin
|
|
||||||
Result := ParamStr(0);
|
|
||||||
{$ENDIF}
|
|
||||||
end;
|
end;
|
||||||
|
|
||||||
function GetAppDir: string;
|
function GetAppDir: string;
|
||||||
@@ -443,7 +476,28 @@ begin
|
|||||||
Result := ExtractFileDir(GetAppExe);
|
Result := ExtractFileDir(GetAppExe);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
function MatchFileNameMask(const FileName, Mask: string; CaseSensitive: Boolean): Boolean;
|
function GetFileName(const FileName: string): string;
|
||||||
|
var
|
||||||
|
I: Integer;
|
||||||
|
begin
|
||||||
|
I := LastDelimiter('\/' + DriveDelim, FileName);
|
||||||
|
Result := Copy(FileName, I + 1, MaxInt);
|
||||||
|
end;
|
||||||
|
|
||||||
|
function GetFileDir(const FileName: string): string;
|
||||||
|
const
|
||||||
|
Delims = '\/' + DriveDelim;
|
||||||
|
var
|
||||||
|
I: Integer;
|
||||||
|
begin
|
||||||
|
I := LastDelimiter(Delims, Filename);
|
||||||
|
if (I > 1) and
|
||||||
|
((FileName[I] = Delims[1]) or (FileName[I] = Delims[2])) and
|
||||||
|
(not IsDelimiter(Delims, FileName, I - 1)) then Dec(I);
|
||||||
|
Result := Copy(FileName, 1, I);
|
||||||
|
end;
|
||||||
|
|
||||||
|
function StrMaskMatch(const Subject, Mask: string; CaseSensitive: Boolean): Boolean;
|
||||||
var
|
var
|
||||||
MaskLen, KeyLen : LongInt;
|
MaskLen, KeyLen : LongInt;
|
||||||
|
|
||||||
@@ -486,7 +540,7 @@ var
|
|||||||
Exit;
|
Exit;
|
||||||
end;
|
end;
|
||||||
else
|
else
|
||||||
if not CharMatch(Mask[MaskPos], FileName[KeyPos]) then
|
if not CharMatch(Mask[MaskPos], Subject[KeyPos]) then
|
||||||
begin
|
begin
|
||||||
Result := False;
|
Result := False;
|
||||||
Exit;
|
Exit;
|
||||||
@@ -499,7 +553,7 @@ var
|
|||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
while (MaskPos <= MaskLen) and (Mask[MaskPos] in ['?', '*']) do
|
while (MaskPos <= MaskLen) and (AnsiChar(Mask[MaskPos]) in ['?', '*']) do
|
||||||
Inc(MaskPos);
|
Inc(MaskPos);
|
||||||
if (MaskPos <= MaskLen) or (KeyPos <= KeyLen) then
|
if (MaskPos <= MaskLen) or (KeyPos <= KeyLen) then
|
||||||
begin
|
begin
|
||||||
@@ -512,7 +566,7 @@ var
|
|||||||
|
|
||||||
begin
|
begin
|
||||||
MaskLen := Length(Mask);
|
MaskLen := Length(Mask);
|
||||||
KeyLen := Length(FileName);
|
KeyLen := Length(Subject);
|
||||||
if MaskLen = 0 then
|
if MaskLen = 0 then
|
||||||
begin
|
begin
|
||||||
Result := True;
|
Result := True;
|
||||||
@@ -707,6 +761,58 @@ begin
|
|||||||
Result := Format('%.' + IntToStr(Precision) + 'n', [F]);
|
Result := Format('%.' + IntToStr(Precision) + 'n', [F]);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
function GetFormatSettingsForFloats: TFormatSettings;
|
||||||
|
begin
|
||||||
|
Result := FloatFormatSettings;
|
||||||
|
end;
|
||||||
|
|
||||||
|
function ContainsAnySubStr(const S: string; const SubStrs: array of string): Boolean;
|
||||||
|
var
|
||||||
|
I: Integer;
|
||||||
|
begin
|
||||||
|
Result := False;
|
||||||
|
for I := 0 to High(SubStrs) do
|
||||||
|
begin
|
||||||
|
Result := Pos(SubStrs[I], S) > 0;
|
||||||
|
if Result then
|
||||||
|
Exit;
|
||||||
|
end;
|
||||||
|
end;
|
||||||
|
|
||||||
|
function SubString(const S: string; IdxStart, IdxEnd: Integer): string;
|
||||||
|
begin
|
||||||
|
Result := Copy(S, IdxStart, IdxEnd - IdxStart);
|
||||||
|
end;
|
||||||
|
|
||||||
|
function TrimSet(const S: string; const CharSet: TSysCharSet): string;
|
||||||
|
var
|
||||||
|
I, L: Integer;
|
||||||
|
begin
|
||||||
|
L := Length(S);
|
||||||
|
I := 1;
|
||||||
|
while (I <= L) and (S[I] in CharSet) do
|
||||||
|
Inc(I);
|
||||||
|
if I > L then
|
||||||
|
Result := ''
|
||||||
|
else
|
||||||
|
begin
|
||||||
|
while S[L] in CharSet do
|
||||||
|
Dec(L);
|
||||||
|
Result := Copy(S, I, L - I + 1);
|
||||||
|
end;
|
||||||
|
end;
|
||||||
|
|
||||||
|
function TrimLeftSet(const S: string; const CharSet: TSysCharSet): string;
|
||||||
|
var
|
||||||
|
I, L: Integer;
|
||||||
|
begin
|
||||||
|
L := Length(S);
|
||||||
|
I := 1;
|
||||||
|
while (I <= L) and (S[I] in CharSet) do
|
||||||
|
Inc(I);
|
||||||
|
Result := Copy(S, I, MaxInt);
|
||||||
|
end;
|
||||||
|
|
||||||
function ClampInt(Number: LongInt; Min, Max: LongInt): LongInt;
|
function ClampInt(Number: LongInt; Min, Max: LongInt): LongInt;
|
||||||
begin
|
begin
|
||||||
Result := Number;
|
Result := Number;
|
||||||
@@ -810,23 +916,48 @@ begin
|
|||||||
end;
|
end;
|
||||||
|
|
||||||
function Log2(X: Single): Single;
|
function Log2(X: Single): Single;
|
||||||
|
{$IFDEF USE_ASM}
|
||||||
|
asm
|
||||||
|
FLD1
|
||||||
|
FLD X
|
||||||
|
FYL2X
|
||||||
|
FWAIT
|
||||||
|
end;
|
||||||
|
{$ELSE}
|
||||||
const
|
const
|
||||||
Ln2: Single = 0.6931471;
|
Ln2: Single = 0.6931471;
|
||||||
begin
|
begin
|
||||||
Result := Ln(X) / Ln2;
|
Result := Ln(X) / Ln2;
|
||||||
end;
|
end;
|
||||||
|
{$ENDIF}
|
||||||
|
|
||||||
|
function Log10(X: Single): Single;
|
||||||
|
{$IFDEF USE_ASM}
|
||||||
|
asm
|
||||||
|
FLDLG2
|
||||||
|
FLD X
|
||||||
|
FYL2X
|
||||||
|
FWAIT
|
||||||
|
end;
|
||||||
|
{$ELSE}
|
||||||
|
const
|
||||||
|
Ln10: Single = 2.30258509299405;
|
||||||
|
begin
|
||||||
|
Result := Ln(X) / Ln10;
|
||||||
|
end;
|
||||||
|
{$ENDIF}
|
||||||
|
|
||||||
function Floor(Value: Single): LongInt;
|
function Floor(Value: Single): LongInt;
|
||||||
begin
|
begin
|
||||||
Result := Trunc(Value);
|
Result := Trunc(Value);
|
||||||
if Frac(Value) < 0.0 then
|
if Value < Result then
|
||||||
Dec(Result);
|
Dec(Result);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
function Ceil(Value: Single): LongInt;
|
function Ceil(Value: Single): LongInt;
|
||||||
begin
|
begin
|
||||||
Result := Trunc(Value);
|
Result := Trunc(Value);
|
||||||
if Frac(Value) > 0.0 then
|
if Value > Result then
|
||||||
Inc(Result);
|
Inc(Result);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
@@ -835,7 +966,7 @@ begin
|
|||||||
Value := not Value;
|
Value := not Value;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
function Iff(Condition: Boolean; TruePart, FalsePart: LongInt): LongInt;
|
function Iff(Condition: Boolean; TruePart, FalsePart: Integer): Integer;
|
||||||
begin
|
begin
|
||||||
if Condition then
|
if Condition then
|
||||||
Result := TruePart
|
Result := TruePart
|
||||||
@@ -843,7 +974,7 @@ begin
|
|||||||
Result := FalsePart;
|
Result := FalsePart;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
function IffUnsigned(Condition: Boolean; TruePart, FalsePart: LongWord): LongWord;
|
function IffUnsigned(Condition: Boolean; TruePart, FalsePart: Cardinal): Cardinal;
|
||||||
begin
|
begin
|
||||||
if Condition then
|
if Condition then
|
||||||
Result := TruePart
|
Result := TruePart
|
||||||
@@ -899,6 +1030,15 @@ begin
|
|||||||
Result := FalsePart;
|
Result := FalsePart;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
procedure SwapValues(var A, B: Boolean);
|
||||||
|
var
|
||||||
|
Tmp: Boolean;
|
||||||
|
begin
|
||||||
|
Tmp := A;
|
||||||
|
A := B;
|
||||||
|
B := Tmp;
|
||||||
|
end;
|
||||||
|
|
||||||
procedure SwapValues(var A, B: Byte);
|
procedure SwapValues(var A, B: Byte);
|
||||||
var
|
var
|
||||||
Tmp: Byte;
|
Tmp: Byte;
|
||||||
@@ -917,6 +1057,16 @@ begin
|
|||||||
B := Tmp;
|
B := Tmp;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
procedure SwapValues(var A, B: Integer);
|
||||||
|
var
|
||||||
|
Tmp: Integer;
|
||||||
|
begin
|
||||||
|
Tmp := A;
|
||||||
|
A := B;
|
||||||
|
B := Tmp;
|
||||||
|
end;
|
||||||
|
|
||||||
|
{$IFDEF LONGINT_IS_NOT_INTEGER}
|
||||||
procedure SwapValues(var A, B: LongInt);
|
procedure SwapValues(var A, B: LongInt);
|
||||||
var
|
var
|
||||||
Tmp: LongInt;
|
Tmp: LongInt;
|
||||||
@@ -925,6 +1075,7 @@ begin
|
|||||||
A := B;
|
A := B;
|
||||||
B := Tmp;
|
B := Tmp;
|
||||||
end;
|
end;
|
||||||
|
{$ENDIF}
|
||||||
|
|
||||||
procedure SwapValues(var A, B: Single);
|
procedure SwapValues(var A, B: Single);
|
||||||
var
|
var
|
||||||
@@ -979,6 +1130,14 @@ begin
|
|||||||
Result := B;
|
Result := B;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
function MaxFloat(const A, B: Double): Double;
|
||||||
|
begin
|
||||||
|
if A > B then
|
||||||
|
Result := A
|
||||||
|
else
|
||||||
|
Result := B;
|
||||||
|
end;
|
||||||
|
|
||||||
function MulDiv(Number, Numerator, Denominator: Word): Word;
|
function MulDiv(Number, Numerator, Denominator: Word): Word;
|
||||||
{$IF Defined(USE_ASM) and (not Defined(USE_INLINE))}
|
{$IF Defined(USE_ASM) and (not Defined(USE_INLINE))}
|
||||||
asm
|
asm
|
||||||
@@ -991,6 +1150,16 @@ begin
|
|||||||
end;
|
end;
|
||||||
{$IFEND}
|
{$IFEND}
|
||||||
|
|
||||||
|
function SameFloat(A, B: Single; Delta: Single): Boolean;
|
||||||
|
begin
|
||||||
|
Result := Abs(A - B) <= Delta;
|
||||||
|
end;
|
||||||
|
|
||||||
|
function SameFloat(const A, B: Double; const Delta: Double): Boolean;
|
||||||
|
begin
|
||||||
|
Result := Abs(A - B) <= Delta;
|
||||||
|
end;
|
||||||
|
|
||||||
function IsLittleEndian: Boolean;
|
function IsLittleEndian: Boolean;
|
||||||
var
|
var
|
||||||
W: Word;
|
W: Word;
|
||||||
@@ -1036,21 +1205,21 @@ begin
|
|||||||
end;
|
end;
|
||||||
{$ENDIF}
|
{$ENDIF}
|
||||||
|
|
||||||
function SwapEndianLongWord(Value: LongWord): LongWord;
|
function SwapEndianUInt32(Value: UInt32): UInt32;
|
||||||
{$IF Defined(USE_ASM) and (not Defined(USE_INLINE))}
|
{$IF Defined(USE_ASM) and (not Defined(USE_INLINE))}
|
||||||
asm
|
asm
|
||||||
BSWAP EAX
|
BSWAP EAX
|
||||||
end;
|
end;
|
||||||
{$ELSE}
|
{$ELSE}
|
||||||
begin
|
begin
|
||||||
TLongWordRec(Result).Bytes[0] := TLongWordRec(Value).Bytes[3];
|
TUInt32Rec(Result).Bytes[0] := TUInt32Rec(Value).Bytes[3];
|
||||||
TLongWordRec(Result).Bytes[1] := TLongWordRec(Value).Bytes[2];
|
TUInt32Rec(Result).Bytes[1] := TUInt32Rec(Value).Bytes[2];
|
||||||
TLongWordRec(Result).Bytes[2] := TLongWordRec(Value).Bytes[1];
|
TUInt32Rec(Result).Bytes[2] := TUInt32Rec(Value).Bytes[1];
|
||||||
TLongWordRec(Result).Bytes[3] := TLongWordRec(Value).Bytes[0];
|
TUInt32Rec(Result).Bytes[3] := TUInt32Rec(Value).Bytes[0];
|
||||||
end;
|
end;
|
||||||
{$IFEND}
|
{$IFEND}
|
||||||
|
|
||||||
procedure SwapEndianLongWord(P: PLongWord; Count: LongInt);
|
procedure SwapEndianUInt32(P: PUInt32; Count: LongInt);
|
||||||
{$IFDEF USE_ASM}
|
{$IFDEF USE_ASM}
|
||||||
asm
|
asm
|
||||||
@Loop:
|
@Loop:
|
||||||
@@ -1064,21 +1233,21 @@ end;
|
|||||||
{$ELSE}
|
{$ELSE}
|
||||||
var
|
var
|
||||||
I: LongInt;
|
I: LongInt;
|
||||||
Temp: LongWord;
|
Temp: UInt32;
|
||||||
begin
|
begin
|
||||||
for I := 0 to Count - 1 do
|
for I := 0 to Count - 1 do
|
||||||
begin
|
begin
|
||||||
Temp := PLongWordArray(P)[I];
|
Temp := PUInt32Array(P)[I];
|
||||||
TLongWordRec(PLongWordArray(P)[I]).Bytes[0] := TLongWordRec(Temp).Bytes[3];
|
TUInt32Rec(PUInt32Array(P)[I]).Bytes[0] := TUInt32Rec(Temp).Bytes[3];
|
||||||
TLongWordRec(PLongWordArray(P)[I]).Bytes[1] := TLongWordRec(Temp).Bytes[2];
|
TUInt32Rec(PUInt32Array(P)[I]).Bytes[1] := TUInt32Rec(Temp).Bytes[2];
|
||||||
TLongWordRec(PLongWordArray(P)[I]).Bytes[2] := TLongWordRec(Temp).Bytes[1];
|
TUInt32Rec(PUInt32Array(P)[I]).Bytes[2] := TUInt32Rec(Temp).Bytes[1];
|
||||||
TLongWordRec(PLongWordArray(P)[I]).Bytes[3] := TLongWordRec(Temp).Bytes[0];
|
TUInt32Rec(PUInt32Array(P)[I]).Bytes[3] := TUInt32Rec(Temp).Bytes[0];
|
||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
{$ENDIF}
|
{$ENDIF}
|
||||||
|
|
||||||
type
|
type
|
||||||
TCrcTable = array[Byte] of LongWord;
|
TCrcTable = array[Byte] of UInt32;
|
||||||
var
|
var
|
||||||
CrcTable: TCrcTable;
|
CrcTable: TCrcTable;
|
||||||
|
|
||||||
@@ -1087,7 +1256,7 @@ const
|
|||||||
Polynom = $EDB88320;
|
Polynom = $EDB88320;
|
||||||
var
|
var
|
||||||
I, J: LongInt;
|
I, J: LongInt;
|
||||||
C: LongWord;
|
C: UInt32;
|
||||||
begin
|
begin
|
||||||
for I := 0 to 255 do
|
for I := 0 to 255 do
|
||||||
begin
|
begin
|
||||||
@@ -1103,7 +1272,7 @@ begin
|
|||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
procedure CalcCrc32(var Crc: LongWord; Data: Pointer; Size: LongInt);
|
procedure CalcCrc32(var Crc: UInt32; Data: Pointer; Size: LongInt);
|
||||||
var
|
var
|
||||||
I: LongInt;
|
I: LongInt;
|
||||||
B: PByte;
|
B: PByte;
|
||||||
@@ -1174,11 +1343,11 @@ asm
|
|||||||
end;
|
end;
|
||||||
{$ELSE}
|
{$ELSE}
|
||||||
var
|
var
|
||||||
I, V: LongWord;
|
I, V: UInt32;
|
||||||
begin
|
begin
|
||||||
V := Value * $10000 + Value;
|
V := Value * $10000 + Value;
|
||||||
for I := 0 to Size div 4 - 1 do
|
for I := 0 to Size div 4 - 1 do
|
||||||
PLongWordArray(Data)[I] := V;
|
PUInt32Array(Data)[I] := V;
|
||||||
case Size mod 4 of
|
case Size mod 4 of
|
||||||
1: PByteArray(Data)[Size - 1] := Lo(Value);
|
1: PByteArray(Data)[Size - 1] := Lo(Value);
|
||||||
2: PWordArray(Data)[Size div 2] := Value;
|
2: PWordArray(Data)[Size div 2] := Value;
|
||||||
@@ -1191,7 +1360,7 @@ begin
|
|||||||
end;
|
end;
|
||||||
{$ENDIF}
|
{$ENDIF}
|
||||||
|
|
||||||
procedure FillMemoryLongWord(Data: Pointer; Size: LongInt; Value: LongWord);
|
procedure FillMemoryUInt32(Data: Pointer; Size: LongInt; Value: UInt32);
|
||||||
{$IFDEF USE_ASM}
|
{$IFDEF USE_ASM}
|
||||||
asm
|
asm
|
||||||
PUSH EDI
|
PUSH EDI
|
||||||
@@ -1223,19 +1392,24 @@ var
|
|||||||
I: LongInt;
|
I: LongInt;
|
||||||
begin
|
begin
|
||||||
for I := 0 to Size div 4 - 1 do
|
for I := 0 to Size div 4 - 1 do
|
||||||
PLongWordArray(Data)[I] := Value;
|
PUInt32Array(Data)[I] := Value;
|
||||||
case Size mod 4 of
|
case Size mod 4 of
|
||||||
1: PByteArray(Data)[Size - 1] := TLongWordRec(Value).Bytes[0];
|
1: PByteArray(Data)[Size - 1] := TUInt32Rec(Value).Bytes[0];
|
||||||
2: PWordArray(Data)[Size div 2] := TLongWordRec(Value).Words[0];
|
2: PWordArray(Data)[Size div 2] := TUInt32Rec(Value).Words[0];
|
||||||
3:
|
3:
|
||||||
begin
|
begin
|
||||||
PWordArray(Data)[Size div 2 - 1] := TLongWordRec(Value).Words[0];
|
PWordArray(Data)[Size div 2 - 1] := TUInt32Rec(Value).Words[0];
|
||||||
PByteArray(Data)[Size - 1] := TLongWordRec(Value).Bytes[0];
|
PByteArray(Data)[Size - 1] := TUInt32Rec(Value).Bytes[0];
|
||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
{$ENDIF}
|
{$ENDIF}
|
||||||
|
|
||||||
|
procedure ZeroMemory(Data: Pointer; Size: Integer);
|
||||||
|
begin
|
||||||
|
FillMemoryByte(Data, Size, 0);
|
||||||
|
end;
|
||||||
|
|
||||||
function GetNumMipMapLevels(Width, Height: LongInt): LongInt;
|
function GetNumMipMapLevels(Width, Height: LongInt): LongInt;
|
||||||
begin
|
begin
|
||||||
Result := 0;
|
Result := 0;
|
||||||
@@ -1407,6 +1581,27 @@ begin
|
|||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
function ScaleSizeToFit(const CurrentSize, MaxSize: Types.TSize): Types.TSize;
|
||||||
|
var
|
||||||
|
SR, TR, ScaledRect: TRect;
|
||||||
|
begin
|
||||||
|
SR := Types.Rect(0, 0, CurrentSize.CX, CurrentSize.CY);
|
||||||
|
TR := Types.Rect(0, 0, MaxSize.CX, MaxSize.CY);
|
||||||
|
ScaledRect := ScaleRectToRect(SR, TR);
|
||||||
|
Result.CX := ScaledRect.Right - ScaledRect.Left;
|
||||||
|
Result.CY := ScaledRect.Bottom - ScaledRect.Top;
|
||||||
|
end;
|
||||||
|
|
||||||
|
function RectWidth(const Rect: TRect): Integer;
|
||||||
|
begin
|
||||||
|
Result := Rect.Right - Rect.Left;
|
||||||
|
end;
|
||||||
|
|
||||||
|
function RectHeight(const Rect: TRect): Integer;
|
||||||
|
begin
|
||||||
|
Result := Rect.Bottom - Rect.Top;
|
||||||
|
end;
|
||||||
|
|
||||||
function RectInRect(const R1, R2: TRect): Boolean;
|
function RectInRect(const R1, R2: TRect): Boolean;
|
||||||
begin
|
begin
|
||||||
Result:=
|
Result:=
|
||||||
@@ -1425,6 +1620,56 @@ begin
|
|||||||
not (R1.Bottom < R2.Top);
|
not (R1.Bottom < R2.Top);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
procedure NormalizeRect(var R: TRect);
|
||||||
|
begin
|
||||||
|
if R.Right < R.Left then
|
||||||
|
SwapValues(R.Right, R.Left);
|
||||||
|
if R.Bottom < R.Top then
|
||||||
|
SwapValues(R.Bottom, R.Top);
|
||||||
|
end;
|
||||||
|
|
||||||
|
function PixelSizeToDpi(SizeInMicroMeters: Single): Single;
|
||||||
|
begin
|
||||||
|
Result := 25400 / SizeInMicroMeters;
|
||||||
|
end;
|
||||||
|
|
||||||
|
function DpiToPixelSize(Dpi: Single): Single;
|
||||||
|
begin
|
||||||
|
Result := 1e03 / (Dpi / 25.4);
|
||||||
|
end;
|
||||||
|
|
||||||
|
function FloatPoint(AX, AY: Single): TFloatPoint;
|
||||||
|
begin
|
||||||
|
Result.X := AX;
|
||||||
|
Result.Y := AY;
|
||||||
|
end;
|
||||||
|
|
||||||
|
function FloatRect(ALeft, ATop, ARight, ABottom: Single): TFloatRect;
|
||||||
|
begin
|
||||||
|
with Result do
|
||||||
|
begin
|
||||||
|
Left := ALeft;
|
||||||
|
Top := ATop;
|
||||||
|
Right := ARight;
|
||||||
|
Bottom := ABottom;
|
||||||
|
end;
|
||||||
|
end;
|
||||||
|
|
||||||
|
function FloatRectWidth(const R: TFloatRect): Single;
|
||||||
|
begin
|
||||||
|
Result := R.Right - R.Left;
|
||||||
|
end;
|
||||||
|
|
||||||
|
function FloatRectHeight(const R: TFloatRect): Single;
|
||||||
|
begin
|
||||||
|
Result := R.Bottom - R.Top;
|
||||||
|
end;
|
||||||
|
|
||||||
|
function FloatRectFromRect(const R: TRect): TFloatRect;
|
||||||
|
begin
|
||||||
|
Result := FloatRect(R.Left, R.Top, R.Right, R.Bottom);
|
||||||
|
end;
|
||||||
|
|
||||||
function FormatExceptMsg(const Msg: string; const Args: array of const): string;
|
function FormatExceptMsg(const Msg: string; const Args: array of const): string;
|
||||||
begin
|
begin
|
||||||
Result := Format(Msg + SLineBreak + 'Message: ' + GetExceptObject.Message, Args);
|
Result := Format(Msg + SLineBreak + 'Message: ' + GetExceptObject.Message, Args);
|
||||||
@@ -1455,22 +1700,38 @@ initialization
|
|||||||
QueryPerformanceFrequency(PerfFrequency);
|
QueryPerformanceFrequency(PerfFrequency);
|
||||||
InvPerfFrequency := 1.0 / PerfFrequency;
|
InvPerfFrequency := 1.0 / PerfFrequency;
|
||||||
{$ENDIF}
|
{$ENDIF}
|
||||||
{$IFDEF MSDOS}
|
|
||||||
// reset PIT
|
{$IF Defined(DELPHI)}
|
||||||
asm
|
{$IF CompilerVersion >= 23}
|
||||||
MOV EAX, $34
|
FloatFormatSettings := TFormatSettings.Create('en-US');
|
||||||
OUT $43, AL
|
{$ELSE}
|
||||||
XOR EAX, EAX
|
GetLocaleFormatSettings(1033, FloatFormatSettings);
|
||||||
OUT $40, AL
|
{$IFEND}
|
||||||
OUT $40, AL
|
{$ELSE FPC}
|
||||||
end;
|
FloatFormatSettings := DefaultFormatSettings;
|
||||||
{$ENDIF}
|
FloatFormatSettings.DecimalSeparator := '.';
|
||||||
|
FloatFormatSettings.ThousandSeparator := ',';
|
||||||
|
{$IFEND}
|
||||||
|
|
||||||
{
|
{
|
||||||
File Notes:
|
File Notes:
|
||||||
|
|
||||||
-- TODOS ----------------------------------------------------
|
-- 0.77.1 ----------------------------------------------------
|
||||||
- nothing now
|
- Added GetFileName, GetFileDir, RectWidth, RectHeight function.
|
||||||
|
- Added ScaleSizeToFit function.
|
||||||
|
- Added ZeroMemory and SwapValues for Booleans.
|
||||||
|
- Added Substring function.
|
||||||
|
- Renamed MatchFileNameMask to StrMaskMatch (it's for general use not
|
||||||
|
just filenames).
|
||||||
|
- Delphi XE2 new targets (Win64, OSX32) compatibility changes.
|
||||||
|
- Added GetFormatSettingsForFloats function.
|
||||||
|
|
||||||
|
-- 0.26.5 Changes/Bug Fixes -----------------------------------
|
||||||
|
- Added Log10 function.
|
||||||
|
- Added TFloatRect type and helper functions FloatRect, FloatRectWidth,
|
||||||
|
FloatRectHeight.
|
||||||
|
- Added string function ContainsAnySubStr.
|
||||||
|
- Added functions PixelSizeToDpi, DpiToPixelSize.
|
||||||
|
|
||||||
-- 0.26.1 Changes/Bug Fixes -----------------------------------
|
-- 0.26.1 Changes/Bug Fixes -----------------------------------
|
||||||
- Some formatting changes.
|
- Some formatting changes.
|
||||||
@@ -1521,3 +1782,4 @@ initialization
|
|||||||
}
|
}
|
||||||
end.
|
end.
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
unit imjcapimin;
|
unit imjcapimin;
|
||||||
{$N+}
|
|
||||||
{ This file contains application interface code for the compression half
|
{ This file contains application interface code for the compression half
|
||||||
of the JPEG library. These are the "minimum" API routines that may be
|
of the JPEG library. These are the "minimum" API routines that may be
|
||||||
needed in either the normal full-compression case or the transcoding-only
|
needed in either the normal full-compression case or the transcoding-only
|
||||||
@@ -157,15 +157,14 @@ begin
|
|||||||
|
|
||||||
{ For debugging purposes, we zero the whole master structure.
|
{ For debugging purposes, we zero the whole master structure.
|
||||||
But the application has already set the err pointer, and may have set
|
But the application has already set the err pointer, and may have set
|
||||||
client_data, so we have to save and restore those fields.
|
client_data, so we have to save and restore those fields. }
|
||||||
Note: if application hasn't set client_data, tools like Purify may
|
|
||||||
complain here. }
|
|
||||||
|
|
||||||
err := cinfo^.err;
|
err := cinfo^.err;
|
||||||
client_data := cinfo^.client_data; { ignore Purify complaint here }
|
client_data := cinfo^.client_data;
|
||||||
MEMZERO(cinfo, SIZEOF(jpeg_compress_struct));
|
MEMZERO(cinfo, SIZEOF(jpeg_compress_struct));
|
||||||
cinfo^.err := err;
|
cinfo^.err := err;
|
||||||
cinfo^.is_decompressor := FALSE;
|
cinfo^.is_decompressor := FALSE;
|
||||||
|
cinfo^.client_data := client_data;
|
||||||
|
|
||||||
{ Initialize a memory manager instance for this object }
|
{ Initialize a memory manager instance for this object }
|
||||||
jinit_memory_mgr(j_common_ptr(cinfo));
|
jinit_memory_mgr(j_common_ptr(cinfo));
|
||||||
@@ -279,15 +278,15 @@ begin
|
|||||||
begin
|
begin
|
||||||
if (cinfo^.progress <> NIL) then
|
if (cinfo^.progress <> NIL) then
|
||||||
begin
|
begin
|
||||||
cinfo^.progress^.pass_counter := long (iMCU_row);
|
cinfo^.progress^.pass_counter := long (iMCU_row);
|
||||||
cinfo^.progress^.pass_limit := long (cinfo^.total_iMCU_rows);
|
cinfo^.progress^.pass_limit := long (cinfo^.total_iMCU_rows);
|
||||||
cinfo^.progress^.progress_monitor (j_common_ptr(cinfo));
|
cinfo^.progress^.progress_monitor (j_common_ptr(cinfo));
|
||||||
end;
|
end;
|
||||||
{ We bypass the main controller and invoke coef controller directly;
|
{ We bypass the main controller and invoke coef controller directly;
|
||||||
all work is being done from the coefficient buffer. }
|
all work is being done from the coefficient buffer. }
|
||||||
|
|
||||||
if (not cinfo^.coef^.compress_data (cinfo, JSAMPIMAGE(NIL))) then
|
if (not cinfo^.coef^.compress_data (cinfo, JSAMPIMAGE(NIL))) then
|
||||||
ERREXIT(j_common_ptr(cinfo), JERR_CANT_SUSPEND);
|
ERREXIT(j_common_ptr(cinfo), JERR_CANT_SUSPEND);
|
||||||
end;
|
end;
|
||||||
cinfo^.master^.finish_pass (cinfo);
|
cinfo^.master^.finish_pass (cinfo);
|
||||||
end;
|
end;
|
||||||
|
|||||||
@@ -24,8 +24,7 @@ implementation
|
|||||||
|
|
||||||
{ Private subobject }
|
{ Private subobject }
|
||||||
type
|
type
|
||||||
jTInt32 = 0..Pred(MaxInt div SizeOf(INT32));
|
INT32_FIELD = array[0..MaxInt div SizeOf(INT32) - 1] of INT32;
|
||||||
INT32_FIELD = array[jTInt32] of INT32;
|
|
||||||
INT32_FIELD_PTR = ^INT32_FIELD;
|
INT32_FIELD_PTR = ^INT32_FIELD;
|
||||||
|
|
||||||
type
|
type
|
||||||
@@ -94,14 +93,14 @@ const
|
|||||||
{METHODDEF}
|
{METHODDEF}
|
||||||
procedure rgb_ycc_start (cinfo : j_compress_ptr);
|
procedure rgb_ycc_start (cinfo : j_compress_ptr);
|
||||||
const
|
const
|
||||||
FIX_0_29900 = INT32(Round (0.29900 * (1 shl SCALEBITS)) );
|
FIX_0_29900 = INT32(Round(0.29900 * (1 shl SCALEBITS)));
|
||||||
FIX_0_58700 = INT32(Round (0.58700 * (1 shl SCALEBITS)) );
|
FIX_0_58700 = INT32(Round(0.58700 * (1 shl SCALEBITS)));
|
||||||
FIX_0_11400 = INT32(Round (0.11400 * (1 shl SCALEBITS)) );
|
FIX_0_11400 = INT32(Round(0.11400 * (1 shl SCALEBITS)));
|
||||||
FIX_0_16874 = INT32(Round (0.16874 * (1 shl SCALEBITS)) );
|
FIX_0_16874 = INT32(Round(0.16874 * (1 shl SCALEBITS)));
|
||||||
FIX_0_33126 = INT32(Round (0.33126 * (1 shl SCALEBITS)) );
|
FIX_0_33126 = INT32(Round(0.33126 * (1 shl SCALEBITS)));
|
||||||
FIX_0_50000 = INT32(Round (0.50000 * (1 shl SCALEBITS)) );
|
FIX_0_50000 = INT32(Round(0.50000 * (1 shl SCALEBITS)));
|
||||||
FIX_0_41869 = INT32(Round (0.41869 * (1 shl SCALEBITS)) );
|
FIX_0_41869 = INT32(Round(0.41869 * (1 shl SCALEBITS)));
|
||||||
FIX_0_08131 = INT32(Round (0.08131 * (1 shl SCALEBITS)) );
|
FIX_0_08131 = INT32(Round(0.08131 * (1 shl SCALEBITS)));
|
||||||
var
|
var
|
||||||
cconvert : my_cconvert_ptr;
|
cconvert : my_cconvert_ptr;
|
||||||
rgb_ycc_tab : INT32_FIELD_PTR;
|
rgb_ycc_tab : INT32_FIELD_PTR;
|
||||||
@@ -232,26 +231,24 @@ begin
|
|||||||
while (num_rows > 0) do
|
while (num_rows > 0) do
|
||||||
begin
|
begin
|
||||||
Dec(num_rows);
|
Dec(num_rows);
|
||||||
inptr := input_buf^[0];
|
inptr := input_buf[0];
|
||||||
Inc(JSAMPROW_PTR(input_buf));
|
Inc(JSAMPROW_PTR(input_buf));
|
||||||
outptr := output_buf^[0]^[output_row];
|
outptr := output_buf[0][output_row];
|
||||||
Inc(output_row);
|
Inc(output_row);
|
||||||
for col := 0 to pred(num_cols) do
|
for col := 0 to num_cols - 1 do
|
||||||
begin
|
begin
|
||||||
r := GETJSAMPLE(inptr^[RGB_RED]);
|
r := GETJSAMPLE(inptr[RGB_RED]);
|
||||||
g := GETJSAMPLE(inptr^[RGB_GREEN]);
|
g := GETJSAMPLE(inptr[RGB_GREEN]);
|
||||||
b := GETJSAMPLE(inptr^[RGB_BLUE]);
|
b := GETJSAMPLE(inptr[RGB_BLUE]);
|
||||||
Inc(JSAMPLE_PTR(inptr), RGB_PIXELSIZE);
|
Inc(JSAMPLE_PTR(inptr), RGB_PIXELSIZE);
|
||||||
(* Y *)
|
(* Y *)
|
||||||
// kylix 3 compiler crashes on this
|
// kylix 3 compiler crashes on this
|
||||||
{$IF (not Defined(LINUX)) or Defined(FPC)}
|
// it also crashes Delphi OSX compiler 9 years later :(
|
||||||
outptr^[col] := JSAMPLE (
|
{$IF not (Defined(DCC) and not Defined(MSWINDOWS))}
|
||||||
((ctab^[r+R_Y_OFF] + ctab^[g+G_Y_OFF] + ctab^[b+B_Y_OFF])
|
outptr[col] := JSAMPLE(((ctab[r+R_Y_OFF] + ctab[g+G_Y_OFF] + ctab[b+B_Y_OFF]) shr SCALEBITS));
|
||||||
shr SCALEBITS) );
|
|
||||||
{$IFEND}
|
{$IFEND}
|
||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -12,7 +12,6 @@ unit imjcdctmgr;
|
|||||||
|
|
||||||
interface
|
interface
|
||||||
|
|
||||||
{$N+}
|
|
||||||
{$I imjconfig.inc}
|
{$I imjconfig.inc}
|
||||||
|
|
||||||
uses
|
uses
|
||||||
|
|||||||
@@ -121,4 +121,6 @@
|
|||||||
{!CHANGE: Added this}
|
{!CHANGE: Added this}
|
||||||
{$define Delphi_Stream}
|
{$define Delphi_Stream}
|
||||||
{$Q-}
|
{$Q-}
|
||||||
|
{$MINENUMSIZE 4}
|
||||||
|
{$ALIGN 8}
|
||||||
|
|
||||||
|
|||||||
@@ -1,7 +1,5 @@
|
|||||||
unit imjdapimin;
|
unit imjdapimin;
|
||||||
|
|
||||||
{$N+} { Nomssi: cinfo^.output_gamma }
|
|
||||||
|
|
||||||
{ This file contains application interface code for the decompression half
|
{ This file contains application interface code for the decompression half
|
||||||
of the JPEG library. These are the "minimum" API routines that may be
|
of the JPEG library. These are the "minimum" API routines that may be
|
||||||
needed in either the normal full-decompression case or the
|
needed in either the normal full-decompression case or the
|
||||||
|
|||||||
@@ -15,8 +15,6 @@ interface
|
|||||||
|
|
||||||
{$I imjconfig.inc}
|
{$I imjconfig.inc}
|
||||||
|
|
||||||
{$N+}
|
|
||||||
|
|
||||||
uses
|
uses
|
||||||
imjmorecfg,
|
imjmorecfg,
|
||||||
imjinclude,
|
imjinclude,
|
||||||
|
|||||||
@@ -1172,7 +1172,8 @@ begin
|
|||||||
end;
|
end;
|
||||||
|
|
||||||
{ Account for restart interval (no-op if not using restarts) }
|
{ Account for restart interval (no-op if not using restarts) }
|
||||||
Dec(entropy^.restarts_to_go);
|
if entropy^.restarts_to_go > 0 then
|
||||||
|
Dec(entropy^.restarts_to_go);
|
||||||
|
|
||||||
decode_mcu := TRUE;
|
decode_mcu := TRUE;
|
||||||
end;
|
end;
|
||||||
|
|||||||
@@ -601,7 +601,7 @@ begin
|
|||||||
cinfo^.min_DCT_scaled_size; { height of a row group of component }
|
cinfo^.min_DCT_scaled_size; { height of a row group of component }
|
||||||
main^.buffer[ci] := cinfo^.mem^.alloc_sarray
|
main^.buffer[ci] := cinfo^.mem^.alloc_sarray
|
||||||
(j_common_ptr(cinfo), JPOOL_IMAGE,
|
(j_common_ptr(cinfo), JPOOL_IMAGE,
|
||||||
compptr^.width_in_blocks * LongWord(compptr^.DCT_scaled_size),
|
compptr^.width_in_blocks * uInt(compptr^.DCT_scaled_size),
|
||||||
JDIMENSION (rgroup * ngroups));
|
JDIMENSION (rgroup * ngroups));
|
||||||
Inc(compptr);
|
Inc(compptr);
|
||||||
end;
|
end;
|
||||||
|
|||||||
@@ -1631,7 +1631,7 @@ function get_interesting_appn (cinfo : j_decompress_ptr) : boolean;
|
|||||||
var
|
var
|
||||||
length : INT32;
|
length : INT32;
|
||||||
b : array[0..APPN_DATA_LEN-1] of JOCTET;
|
b : array[0..APPN_DATA_LEN-1] of JOCTET;
|
||||||
i, numtoread : uint;
|
i, numtoread: uint;
|
||||||
var
|
var
|
||||||
datasrc : jpeg_source_mgr_ptr;
|
datasrc : jpeg_source_mgr_ptr;
|
||||||
next_input_byte : JOCTETptr;
|
next_input_byte : JOCTETptr;
|
||||||
@@ -1692,27 +1692,31 @@ begin
|
|||||||
numtoread := uint(length)
|
numtoread := uint(length)
|
||||||
else
|
else
|
||||||
numtoread := 0;
|
numtoread := 0;
|
||||||
for i := 0 to numtoread-1 do
|
|
||||||
begin
|
|
||||||
{ Read a byte into b[i]. If must suspend, return FALSE. }
|
|
||||||
{ make a byte available.
|
|
||||||
Note we do *not* do INPUT_SYNC before calling fill_input_buffer,
|
|
||||||
but we must reload the local copies after a successful fill. }
|
|
||||||
if (bytes_in_buffer = 0) then
|
|
||||||
begin
|
|
||||||
if (not datasrc^.fill_input_buffer(cinfo)) then
|
|
||||||
begin
|
|
||||||
get_interesting_appn := FALSE;
|
|
||||||
exit;
|
|
||||||
end;
|
|
||||||
{ Reload the local copies }
|
|
||||||
next_input_byte := datasrc^.next_input_byte;
|
|
||||||
bytes_in_buffer := datasrc^.bytes_in_buffer;
|
|
||||||
end;
|
|
||||||
Dec( bytes_in_buffer );
|
|
||||||
|
|
||||||
b[i] := GETJOCTET(next_input_byte^);
|
if numtoread > 0 then
|
||||||
Inc(next_input_byte);
|
begin
|
||||||
|
for i := 0 to numtoread-1 do
|
||||||
|
begin
|
||||||
|
{ Read a byte into b[i]. If must suspend, return FALSE. }
|
||||||
|
{ make a byte available.
|
||||||
|
Note we do *not* do INPUT_SYNC before calling fill_input_buffer,
|
||||||
|
but we must reload the local copies after a successful fill. }
|
||||||
|
if (bytes_in_buffer = 0) then
|
||||||
|
begin
|
||||||
|
if (not datasrc^.fill_input_buffer(cinfo)) then
|
||||||
|
begin
|
||||||
|
get_interesting_appn := FALSE;
|
||||||
|
exit;
|
||||||
|
end;
|
||||||
|
{ Reload the local copies }
|
||||||
|
next_input_byte := datasrc^.next_input_byte;
|
||||||
|
bytes_in_buffer := datasrc^.bytes_in_buffer;
|
||||||
|
end;
|
||||||
|
Dec( bytes_in_buffer );
|
||||||
|
|
||||||
|
b[i] := GETJOCTET(next_input_byte^);
|
||||||
|
Inc(next_input_byte);
|
||||||
|
end;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
Dec(length, numtoread);
|
Dec(length, numtoread);
|
||||||
|
|||||||
@@ -42,7 +42,7 @@ procedure ERREXIT4(cinfo : j_common_ptr; code : J_MESSAGE_CODE;
|
|||||||
p1 : int; p2 : int; p3 : int; p4 : int);
|
p1 : int; p2 : int; p3 : int; p4 : int);
|
||||||
|
|
||||||
procedure ERREXITS(cinfo : j_common_ptr;code : J_MESSAGE_CODE;
|
procedure ERREXITS(cinfo : j_common_ptr;code : J_MESSAGE_CODE;
|
||||||
str : string);
|
str : AnsiString);
|
||||||
{ Nonfatal errors (we can keep going, but the data is probably corrupt) }
|
{ Nonfatal errors (we can keep going, but the data is probably corrupt) }
|
||||||
|
|
||||||
procedure WARNMS(cinfo : j_common_ptr; code : J_MESSAGE_CODE);
|
procedure WARNMS(cinfo : j_common_ptr; code : J_MESSAGE_CODE);
|
||||||
@@ -78,7 +78,7 @@ procedure TRACEMS8(cinfo : j_common_ptr; lvl : int; code : J_MESSAGE_CODE;
|
|||||||
p5 : int; p6 : int; p7 : int; p8 : int);
|
p5 : int; p6 : int; p7 : int; p8 : int);
|
||||||
|
|
||||||
procedure TRACEMSS(cinfo : j_common_ptr; lvl : int;
|
procedure TRACEMSS(cinfo : j_common_ptr; lvl : int;
|
||||||
code : J_MESSAGE_CODE; str : string);
|
code : J_MESSAGE_CODE; str : AnsiString);
|
||||||
|
|
||||||
implementation
|
implementation
|
||||||
|
|
||||||
@@ -179,7 +179,7 @@ begin
|
|||||||
end;
|
end;
|
||||||
|
|
||||||
procedure ERREXITS(cinfo : j_common_ptr;code : J_MESSAGE_CODE;
|
procedure ERREXITS(cinfo : j_common_ptr;code : J_MESSAGE_CODE;
|
||||||
str : string);
|
str : AnsiString);
|
||||||
begin
|
begin
|
||||||
cinfo^.err^.msg_code := ord(code);
|
cinfo^.err^.msg_code := ord(code);
|
||||||
cinfo^.err^.msg_parm.s := str; { string[JMSG_STR_PARM_MAX] }
|
cinfo^.err^.msg_parm.s := str; { string[JMSG_STR_PARM_MAX] }
|
||||||
@@ -286,7 +286,7 @@ begin
|
|||||||
end;
|
end;
|
||||||
|
|
||||||
procedure TRACEMSS(cinfo : j_common_ptr; lvl : int;
|
procedure TRACEMSS(cinfo : j_common_ptr; lvl : int;
|
||||||
code : J_MESSAGE_CODE; str : string);
|
code : J_MESSAGE_CODE; str : AnsiString);
|
||||||
begin
|
begin
|
||||||
cinfo^.err^.msg_code := ord(code);
|
cinfo^.err^.msg_code := ord(code);
|
||||||
cinfo^.err^.msg_parm.s := str; { string JMSG_STR_PARM_MAX }
|
cinfo^.err^.msg_parm.s := str; { string JMSG_STR_PARM_MAX }
|
||||||
@@ -296,7 +296,7 @@ end;
|
|||||||
{METHODDEF}
|
{METHODDEF}
|
||||||
procedure output_message (cinfo : j_common_ptr);
|
procedure output_message (cinfo : j_common_ptr);
|
||||||
var
|
var
|
||||||
buffer : string; {[JMSG_LENGTH_MAX];}
|
buffer : AnsiString; {[JMSG_LENGTH_MAX];}
|
||||||
begin
|
begin
|
||||||
{ Create the message }
|
{ Create the message }
|
||||||
cinfo^.err^.format_message (cinfo, buffer);
|
cinfo^.err^.format_message (cinfo, buffer);
|
||||||
@@ -350,11 +350,11 @@ end;
|
|||||||
|
|
||||||
|
|
||||||
{METHODDEF}
|
{METHODDEF}
|
||||||
procedure format_message (cinfo : j_common_ptr; var buffer : string);
|
procedure format_message (cinfo : j_common_ptr; var buffer : AnsiString);
|
||||||
var
|
var
|
||||||
err : jpeg_error_mgr_ptr;
|
err : jpeg_error_mgr_ptr;
|
||||||
msg_code : J_MESSAGE_CODE;
|
msg_code : J_MESSAGE_CODE;
|
||||||
msgtext : string;
|
msgtext : AnsiString;
|
||||||
isstring : boolean;
|
isstring : boolean;
|
||||||
begin
|
begin
|
||||||
err := cinfo^.err;
|
err := cinfo^.err;
|
||||||
|
|||||||
@@ -1,6 +1,5 @@
|
|||||||
unit imjfdctflt;
|
unit imjfdctflt;
|
||||||
|
|
||||||
{$N+}
|
|
||||||
{ This file contains a floating-point implementation of the
|
{ This file contains a floating-point implementation of the
|
||||||
forward DCT (Discrete Cosine Transform).
|
forward DCT (Discrete Cosine Transform).
|
||||||
|
|
||||||
|
|||||||
@@ -510,7 +510,7 @@ asm
|
|||||||
mov edi, DWORD PTR [ebx+eax*4] { 4 = SizeOf(pointer) }
|
mov edi, DWORD PTR [ebx+eax*4] { 4 = SizeOf(pointer) }
|
||||||
|
|
||||||
{Inc(JSAMPLE_PTR(outptr), output_col);}
|
{Inc(JSAMPLE_PTR(outptr), output_col);}
|
||||||
add edi, LongWord(output_col)
|
add edi, uInt(output_col)
|
||||||
|
|
||||||
{ Rows of zeroes can be exploited in the same way as we did with columns.
|
{ Rows of zeroes can be exploited in the same way as we did with columns.
|
||||||
However, the column calculation has created many nonzero AC terms, so
|
However, the column calculation has created many nonzero AC terms, so
|
||||||
|
|||||||
@@ -1,6 +1,5 @@
|
|||||||
unit imjidctflt;
|
unit imjidctflt;
|
||||||
|
|
||||||
{$N+}
|
|
||||||
{ This file contains a floating-point implementation of the
|
{ This file contains a floating-point implementation of the
|
||||||
inverse DCT (Discrete Cosine Transform). In the IJG code, this routine
|
inverse DCT (Discrete Cosine Transform). In the IJG code, this routine
|
||||||
must also perform dequantization of the input coefficients.
|
must also perform dequantization of the input coefficients.
|
||||||
|
|||||||
@@ -10,40 +10,13 @@ interface
|
|||||||
|
|
||||||
{$I imjconfig.inc}
|
{$I imjconfig.inc}
|
||||||
|
|
||||||
{$IFDEF FPC} { Free Pascal Compiler }
|
type
|
||||||
type
|
int = Integer;
|
||||||
int = longint;
|
uInt = Cardinal;
|
||||||
uInt = Cardinal; { unsigned int }
|
short = SmallInt;
|
||||||
short = Integer;
|
ushort = Word;
|
||||||
ushort = Word;
|
long = LongInt;
|
||||||
long = longint;
|
|
||||||
{$ELSE}
|
|
||||||
{$IFDEF WIN32}
|
|
||||||
{ Delphi 2.0 }
|
|
||||||
type
|
|
||||||
int = Integer;
|
|
||||||
uInt = Cardinal;
|
|
||||||
short = SmallInt;
|
|
||||||
ushort = Word;
|
|
||||||
long = longint;
|
|
||||||
{$ELSE}
|
|
||||||
{$IFDEF VIRTUALPASCAL}
|
|
||||||
type
|
|
||||||
int = longint;
|
|
||||||
uInt = longint; { unsigned int }
|
|
||||||
short = system.Integer;
|
|
||||||
ushort = system.Word;
|
|
||||||
long = longint;
|
|
||||||
{$ELSE}
|
|
||||||
type
|
|
||||||
int = Integer;
|
|
||||||
uInt = Word; { unsigned int }
|
|
||||||
short = Integer;
|
|
||||||
ushort = Word;
|
|
||||||
long = longint;
|
|
||||||
{$ENDIF}
|
|
||||||
{$ENDIF}
|
|
||||||
{$ENDIF}
|
|
||||||
type
|
type
|
||||||
voidp = pointer;
|
voidp = pointer;
|
||||||
|
|
||||||
@@ -58,6 +31,7 @@ type
|
|||||||
JPEG standard, and the IJG code does not support anything else!
|
JPEG standard, and the IJG code does not support anything else!
|
||||||
We do not support run-time selection of data precision, sorry. }
|
We do not support run-time selection of data precision, sorry. }
|
||||||
|
|
||||||
|
|
||||||
{$ifdef BITS_IN_JSAMPLE_IS_8} { use 8 or 12 }
|
{$ifdef BITS_IN_JSAMPLE_IS_8} { use 8 or 12 }
|
||||||
const
|
const
|
||||||
BITS_IN_JSAMPLE = 8;
|
BITS_IN_JSAMPLE = 8;
|
||||||
@@ -67,8 +41,6 @@ const
|
|||||||
{$endif}
|
{$endif}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
{ Maximum number of components (color channels) allowed in JPEG image.
|
{ Maximum number of components (color channels) allowed in JPEG image.
|
||||||
To meet the letter of the JPEG spec, set this to 255. However, darn
|
To meet the letter of the JPEG spec, set this to 255. However, darn
|
||||||
few applications need more than 4 channels (maybe 5 for CMYK + alpha
|
few applications need more than 4 channels (maybe 5 for CMYK + alpha
|
||||||
@@ -159,7 +131,7 @@ type
|
|||||||
{ UINT8 must hold at least the values 0..255. }
|
{ UINT8 must hold at least the values 0..255. }
|
||||||
|
|
||||||
type
|
type
|
||||||
UINT8 = byte;
|
UINT8 = Byte;
|
||||||
|
|
||||||
{ UINT16 must hold at least the values 0..65535. }
|
{ UINT16 must hold at least the values 0..65535. }
|
||||||
|
|
||||||
@@ -167,11 +139,11 @@ type
|
|||||||
|
|
||||||
{ INT16 must hold at least the values -32768..32767. }
|
{ INT16 must hold at least the values -32768..32767. }
|
||||||
|
|
||||||
INT16 = int;
|
INT16 = SmallInt;
|
||||||
|
|
||||||
{ INT32 must hold at least signed 32-bit values. }
|
{ INT32 must hold at least signed 32-bit values. }
|
||||||
|
|
||||||
INT32 = longint;
|
INT32 = LongInt;
|
||||||
type
|
type
|
||||||
INT32PTR = ^INT32;
|
INT32PTR = ^INT32;
|
||||||
|
|
||||||
|
|||||||
@@ -722,7 +722,7 @@ type
|
|||||||
{ Routine that actually outputs a trace or error message }
|
{ Routine that actually outputs a trace or error message }
|
||||||
output_message : procedure (cinfo : j_common_ptr);
|
output_message : procedure (cinfo : j_common_ptr);
|
||||||
{ Format a message string for the most recent JPEG error or message }
|
{ Format a message string for the most recent JPEG error or message }
|
||||||
format_message : procedure (cinfo : j_common_ptr; var buffer : string);
|
format_message : procedure (cinfo : j_common_ptr; var buffer : AnsiString);
|
||||||
|
|
||||||
{ Reset error state variables at start of a new image }
|
{ Reset error state variables at start of a new image }
|
||||||
reset_error_mgr : procedure (cinfo : j_common_ptr);
|
reset_error_mgr : procedure (cinfo : j_common_ptr);
|
||||||
|
|||||||
+32
-27
@@ -45,43 +45,43 @@ unit dzlib;
|
|||||||
|
|
||||||
interface
|
interface
|
||||||
|
|
||||||
|
{$DEFINE IMPASZLIB}
|
||||||
|
{ $DEFINE ZLIBPAS}
|
||||||
|
{ $DEFINE FPCPASZLIB}
|
||||||
{ $DEFINE ZLIBEX}
|
{ $DEFINE ZLIBEX}
|
||||||
{ $DEFINE DELPHIZLIB}
|
{ $DEFINE DELPHIZLIB}
|
||||||
{ $DEFINE ZLIBPAS}
|
|
||||||
{$DEFINE IMPASZLIB}
|
|
||||||
{ $DEFINE FPCPASZLIB}
|
|
||||||
|
|
||||||
{ Automatically use FPC's PasZLib when compiling with Lazarus.}
|
{ Automatically use FPC's PasZLib when compiling with FPC.}
|
||||||
|
|
||||||
{$IFDEF LCL}
|
{$IFDEF FPC}
|
||||||
{$UNDEF IMPASZLIB}
|
{$UNDEF IMPASZLIB}
|
||||||
{$DEFINE FPCPASZLIB}
|
{$DEFINE FPCPASZLIB}
|
||||||
{$ENDIF}
|
{$ENDIF}
|
||||||
|
|
||||||
uses
|
uses
|
||||||
{$IF Defined(ZLIBEX)}
|
{$IF Defined(IMPASZLIB)}
|
||||||
{ Use ZlibEx unit.}
|
{ Use paszlib modified by me for Delphi and FPC }
|
||||||
ZLibEx,
|
|
||||||
{$ELSEIF Defined(DELPHIZLIB)}
|
|
||||||
{ Use ZLib unit shipped with Delphi.}
|
|
||||||
ZLib,
|
|
||||||
{$ELSEIF Defined(ZLIBPAS)}
|
|
||||||
{ Pascal interface to ZLib shipped with ZLib C source.}
|
|
||||||
zlibpas,
|
|
||||||
{$ELSEIF Defined(IMPASZLIB)}
|
|
||||||
{ Use paszlib modified by me for Delphi and FPC.}
|
|
||||||
imzdeflate, imzinflate, impaszlib,
|
imzdeflate, imzinflate, impaszlib,
|
||||||
{$ELSEIF Defined(FPCPASZLIB)}
|
{$ELSEIF Defined(FPCPASZLIB)}
|
||||||
{ Use FPC's paszlib.}
|
{ Use FPC's paszlib }
|
||||||
zbase, paszlib,
|
zbase, paszlib,
|
||||||
|
{$ELSEIF Defined(ZLIBPAS)}
|
||||||
|
{ Pascal interface to ZLib shipped with ZLib C source }
|
||||||
|
zlibpas,
|
||||||
|
{$ELSEIF Defined(ZLIBEX)}
|
||||||
|
{ Use ZlibEx unit }
|
||||||
|
ZLibEx,
|
||||||
|
{$ELSEIF Defined(DELPHIZLIB)}
|
||||||
|
{ Use ZLib unit shipped with Delphi }
|
||||||
|
ZLib,
|
||||||
{$IFEND}
|
{$IFEND}
|
||||||
SysUtils, Classes;
|
ImagingTypes, SysUtils, Classes;
|
||||||
|
|
||||||
{$IF Defined(IMPASZLIB) or Defined(FPCPASZLIB) or Defined(ZLIBPAS)}
|
{$IF Defined(IMPASZLIB) or Defined(FPCPASZLIB) or Defined(ZLIBPAS)}
|
||||||
type
|
type
|
||||||
TZStreamRec = z_stream;
|
TZStreamRec = z_stream;
|
||||||
{$IFEND}
|
{$IFEND}
|
||||||
{$IFDEF ZLIBEX}
|
|
||||||
const
|
const
|
||||||
Z_NO_FLUSH = 0;
|
Z_NO_FLUSH = 0;
|
||||||
Z_PARTIAL_FLUSH = 1;
|
Z_PARTIAL_FLUSH = 1;
|
||||||
@@ -114,7 +114,6 @@ const
|
|||||||
Z_UNKNOWN = 2;
|
Z_UNKNOWN = 2;
|
||||||
|
|
||||||
Z_DEFLATED = 8;
|
Z_DEFLATED = 8;
|
||||||
{$ENDIF}
|
|
||||||
|
|
||||||
type
|
type
|
||||||
{ Abstract ancestor class }
|
{ Abstract ancestor class }
|
||||||
@@ -207,8 +206,9 @@ type
|
|||||||
Out: OutBuf = ptr to newly allocated buffer containing decompressed data
|
Out: OutBuf = ptr to newly allocated buffer containing decompressed data
|
||||||
OutBytes = number of bytes in OutBuf }
|
OutBytes = number of bytes in OutBuf }
|
||||||
procedure CompressBuf(const InBuf: Pointer; InBytes: Integer;
|
procedure CompressBuf(const InBuf: Pointer; InBytes: Integer;
|
||||||
var OutBuf: Pointer; var OutBytes: Integer;
|
var OutBuf: Pointer; var OutBytes: Integer;
|
||||||
CompressLevel: Integer = Z_DEFAULT_COMPRESSION);
|
CompressLevel: Integer = Z_DEFAULT_COMPRESSION;
|
||||||
|
CompressStrategy: Integer = Z_DEFAULT_STRATEGY);
|
||||||
|
|
||||||
{ DecompressBuf decompresses data, buffer to buffer, in one call.
|
{ DecompressBuf decompresses data, buffer to buffer, in one call.
|
||||||
In: InBuf = ptr to compressed data
|
In: InBuf = ptr to compressed data
|
||||||
@@ -265,8 +265,8 @@ begin
|
|||||||
end;
|
end;
|
||||||
|
|
||||||
procedure CompressBuf(const InBuf: Pointer; InBytes: Integer;
|
procedure CompressBuf(const InBuf: Pointer; InBytes: Integer;
|
||||||
var OutBuf: Pointer; var OutBytes: Integer;
|
var OutBuf: Pointer; var OutBytes: Integer;
|
||||||
CompressLevel: Integer);
|
CompressLevel, CompressStrategy: Integer);
|
||||||
var
|
var
|
||||||
strm: TZStreamRec;
|
strm: TZStreamRec;
|
||||||
P: Pointer;
|
P: Pointer;
|
||||||
@@ -283,14 +283,17 @@ begin
|
|||||||
strm.avail_in := InBytes;
|
strm.avail_in := InBytes;
|
||||||
strm.next_out := OutBuf;
|
strm.next_out := OutBuf;
|
||||||
strm.avail_out := OutBytes;
|
strm.avail_out := OutBytes;
|
||||||
CCheck(deflateInit_(strm, CompressLevel, zlib_version, sizeof(strm)));
|
|
||||||
|
CCheck(deflateInit2(strm, CompressLevel, Z_DEFLATED, MAX_WBITS,
|
||||||
|
DEF_MEM_LEVEL, CompressStrategy));
|
||||||
|
|
||||||
try
|
try
|
||||||
while CCheck(deflate(strm, Z_FINISH)) <> Z_STREAM_END do
|
while CCheck(deflate(strm, Z_FINISH)) <> Z_STREAM_END do
|
||||||
begin
|
begin
|
||||||
P := OutBuf;
|
P := OutBuf;
|
||||||
Inc(OutBytes, 256);
|
Inc(OutBytes, 256);
|
||||||
ReallocMem(OutBuf, OutBytes);
|
ReallocMem(OutBuf, OutBytes);
|
||||||
strm.next_out := Pointer(Integer(OutBuf) + (Integer(strm.next_out) - Integer(P)));
|
strm.next_out := Pointer(PtrUInt(OutBuf) + (PtrUInt(strm.next_out) - PtrUInt(P)));
|
||||||
strm.avail_out := 256;
|
strm.avail_out := 256;
|
||||||
end;
|
end;
|
||||||
finally
|
finally
|
||||||
@@ -334,7 +337,7 @@ begin
|
|||||||
P := OutBuf;
|
P := OutBuf;
|
||||||
Inc(OutBytes, BufInc);
|
Inc(OutBytes, BufInc);
|
||||||
ReallocMem(OutBuf, OutBytes);
|
ReallocMem(OutBuf, OutBytes);
|
||||||
strm.next_out := Pointer(Integer(OutBuf) + (Integer(strm.next_out) - Integer(P)));
|
strm.next_out := Pointer(PtrUInt(OutBuf) + (PtrUInt(strm.next_out) - PtrUInt(P)));
|
||||||
strm.avail_out := BufInc;
|
strm.avail_out := BufInc;
|
||||||
end;
|
end;
|
||||||
finally
|
finally
|
||||||
@@ -404,6 +407,7 @@ end;
|
|||||||
|
|
||||||
function TCompressionStream.Read(var Buffer; Count: Longint): Longint;
|
function TCompressionStream.Read(var Buffer; Count: Longint): Longint;
|
||||||
begin
|
begin
|
||||||
|
Result := 0;
|
||||||
raise ECompressionError.Create('Invalid stream operation');
|
raise ECompressionError.Create('Invalid stream operation');
|
||||||
end;
|
end;
|
||||||
|
|
||||||
@@ -485,6 +489,7 @@ end;
|
|||||||
|
|
||||||
function TDecompressionStream.Write(const Buffer; Count: Longint): Longint;
|
function TDecompressionStream.Write(const Buffer; Count: Longint): Longint;
|
||||||
begin
|
begin
|
||||||
|
Result := 0;
|
||||||
raise EDecompressionError.Create('Invalid stream operation');
|
raise EDecompressionError.Create('Invalid stream operation');
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
|||||||
@@ -32,10 +32,14 @@ type
|
|||||||
puIntf = ^uIntf;
|
puIntf = ^uIntf;
|
||||||
puLong = ^uLongf;
|
puLong = ^uLongf;
|
||||||
|
|
||||||
ptr2int = uInt;
|
{$IF Defined(FPC)}
|
||||||
{ a pointer to integer casting is used to do pointer arithmetic.
|
ptr2int = PtrUInt;
|
||||||
ptr2int must be an integer type and sizeof(ptr2int) must be less
|
{$ELSEIF CompilerVersion >= 20}
|
||||||
than sizeof(pointer) - Nomssi }
|
ptr2int = NativeUInt;
|
||||||
|
{$ELSE}
|
||||||
|
ptr2int = Cardinal;
|
||||||
|
{$IFEND}
|
||||||
|
{ a pointer to integer casting is used to do pointer arithmetic. }
|
||||||
|
|
||||||
type
|
type
|
||||||
zByteArray = array[0..(MaxInt div SizeOf(Bytef))-1] of Bytef;
|
zByteArray = array[0..(MaxInt div SizeOf(Bytef))-1] of Bytef;
|
||||||
|
|||||||
@@ -93,6 +93,8 @@ end;
|
|||||||
|
|
||||||
function TAnimDataProvider.GetData(AID, AOffset: Integer): TAnimData;
|
function TAnimDataProvider.GetData(AID, AOffset: Integer): TAnimData;
|
||||||
begin
|
begin
|
||||||
|
if (AID < 0) or (AID >= Length(FAnimData)) then
|
||||||
|
raise Exception.CreateFmt('Invalid animdata ID %d', [AID]);
|
||||||
Result := FAnimData[AID];
|
Result := FAnimData[AID];
|
||||||
end;
|
end;
|
||||||
|
|
||||||
@@ -114,6 +116,8 @@ end;
|
|||||||
|
|
||||||
procedure TAnimDataProvider.SetData(AID, AOffset: Integer; ABlock: TMulBlock);
|
procedure TAnimDataProvider.SetData(AID, AOffset: Integer; ABlock: TMulBlock);
|
||||||
begin
|
begin
|
||||||
|
if (AID < 0) or (AID >= Length(FAnimData)) then
|
||||||
|
raise Exception.CreateFmt('Invalid animdata ID %d', [AID]);
|
||||||
FreeAndNil(FAnimData[AID]);
|
FreeAndNil(FAnimData[AID]);
|
||||||
FAnimData[AID] := TAnimData(ABlock.Clone);
|
FAnimData[AID] := TAnimData(ABlock.Clone);
|
||||||
|
|
||||||
@@ -126,6 +130,8 @@ end;
|
|||||||
|
|
||||||
function TAnimDataProvider.GetBlock(AID: Integer): TAnimData;
|
function TAnimDataProvider.GetBlock(AID: Integer): TAnimData;
|
||||||
begin
|
begin
|
||||||
|
if (AID < 0) or (AID >= Length(FAnimData)) then
|
||||||
|
raise Exception.CreateFmt('Invalid animdata ID %d', [AID]);
|
||||||
Result := FAnimData[AID].Clone;
|
Result := FAnimData[AID].Clone;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
|||||||
@@ -91,7 +91,10 @@ var
|
|||||||
begin
|
begin
|
||||||
FIndex.Position := CalculateIndexOffset(AID);
|
FIndex.Position := CalculateIndexOffset(AID);
|
||||||
genericIndex := TGenericIndex.Create(FIndex);
|
genericIndex := TGenericIndex.Create(FIndex);
|
||||||
Result := TArt.Create(FData, genericIndex, atLandFlat);
|
if (genericIndex.Lookup > -1) and (genericIndex.Size > 0) then
|
||||||
|
Result := TArt.Create(FData, genericIndex, atLandFlat)
|
||||||
|
else
|
||||||
|
Result := TArt.Create(nil, nil, atLandFlat);
|
||||||
genericIndex.Free;
|
genericIndex.Free;
|
||||||
Result.OnChanged := @OnChanged;
|
Result.OnChanged := @OnChanged;
|
||||||
Result.OnFinished := @OnFinished;
|
Result.OnFinished := @OnFinished;
|
||||||
|
|||||||
@@ -45,7 +45,7 @@ implementation
|
|||||||
|
|
||||||
function TGumpProvider.GetData(AID: Integer; AIndex: TGenericIndex): TMulBlock;
|
function TGumpProvider.GetData(AID: Integer; AIndex: TGenericIndex): TMulBlock;
|
||||||
begin
|
begin
|
||||||
if AIndex.Lookup <> LongInt($FFFFFFFF) then
|
if (AIndex.Lookup > -1) and (AIndex.Size > 0) then
|
||||||
Result := TGump.Create(FData, TGumpIndex(AIndex))
|
Result := TGump.Create(FData, TGumpIndex(AIndex))
|
||||||
else
|
else
|
||||||
Result := TGump.Create(0, 0);
|
Result := TGump.Create(0, 0);
|
||||||
|
|||||||
@@ -92,6 +92,8 @@ function THueProvider.GetData(AID, AOffset: Integer): TMulBlock;
|
|||||||
var
|
var
|
||||||
group, entry: Integer;
|
group, entry: Integer;
|
||||||
begin
|
begin
|
||||||
|
if (AID < 0) or (AID >= FHueGroups.Count * 8) then
|
||||||
|
raise Exception.CreateFmt('Invalid hue ID %d', [AID]);
|
||||||
group := (AID div 8) mod FHueGroups.Count;
|
group := (AID div 8) mod FHueGroups.Count;
|
||||||
entry := AID mod 8;
|
entry := AID mod 8;
|
||||||
Result := TMulBlock(THueGroup(FHueGroups.Items[group]).HueEntries[entry].Clone);
|
Result := TMulBlock(THueGroup(FHueGroups.Items[group]).HueEntries[entry].Clone);
|
||||||
@@ -104,6 +106,8 @@ function THueProvider.GetHue(AIndex: Integer): THue;
|
|||||||
var
|
var
|
||||||
group, entry: Integer;
|
group, entry: Integer;
|
||||||
begin
|
begin
|
||||||
|
if (AIndex < 0) or (AIndex >= FHueGroups.Count * 8) then
|
||||||
|
raise Exception.CreateFmt('Invalid hue ID %d', [AIndex]);
|
||||||
group := (AIndex div 8) mod FHueGroups.Count;
|
group := (AIndex div 8) mod FHueGroups.Count;
|
||||||
entry := AIndex mod 8;
|
entry := AIndex mod 8;
|
||||||
Result := THue(THueGroup(FHueGroups.Items[group]).HueEntries[entry]);
|
Result := THue(THueGroup(FHueGroups.Items[group]).HueEntries[entry]);
|
||||||
|
|||||||
@@ -72,6 +72,7 @@ begin
|
|||||||
RegisterGumpProvider(nil);
|
RegisterGumpProvider(nil);
|
||||||
RegisterTexmapProvider(nil);
|
RegisterTexmapProvider(nil);
|
||||||
RegisterTileDataProvider(nil);
|
RegisterTileDataProvider(nil);
|
||||||
|
RegisterAnimDataProvider(nil);
|
||||||
RegisterHueProvider(nil);
|
RegisterHueProvider(nil);
|
||||||
RegisterRadarProvider(nil);
|
RegisterRadarProvider(nil);
|
||||||
inherited Destroy;
|
inherited Destroy;
|
||||||
|
|||||||
@@ -21,7 +21,7 @@
|
|||||||
* CDDL HEADER END
|
* CDDL HEADER END
|
||||||
*
|
*
|
||||||
*
|
*
|
||||||
* Portions Copyright 2009 Andreas Schneider
|
* Portions Copyright 2012 Andreas Schneider
|
||||||
*)
|
*)
|
||||||
unit UTileDataProvider;
|
unit UTileDataProvider;
|
||||||
|
|
||||||
@@ -46,6 +46,7 @@ type
|
|||||||
FLandTiles: TLandTileDataArray;
|
FLandTiles: TLandTileDataArray;
|
||||||
FStaticTiles: TStaticTileDataArray;
|
FStaticTiles: TStaticTileDataArray;
|
||||||
FStaticCount: Cardinal;
|
FStaticCount: Cardinal;
|
||||||
|
FVersion: TTileDataVersion;
|
||||||
procedure InitArray;
|
procedure InitArray;
|
||||||
function CalculateOffset(AID: Integer): Integer; override;
|
function CalculateOffset(AID: Integer): Integer; override;
|
||||||
function GetData(AID, AOffset: Integer): TMulBlock; override;
|
function GetData(AID, AOffset: Integer): TMulBlock; override;
|
||||||
@@ -68,7 +69,7 @@ uses
|
|||||||
|
|
||||||
function TTiledataProvider.CalculateOffset(AID: Integer): Integer;
|
function TTiledataProvider.CalculateOffset(AID: Integer): Integer;
|
||||||
begin
|
begin
|
||||||
Result := GetTileDataOffset(AID);
|
Result := GetTileDataOffset(AID, FVersion);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
constructor TTiledataProvider.Create(AData: TStream; AReadOnly: Boolean = False);
|
constructor TTiledataProvider.Create(AData: TStream; AReadOnly: Boolean = False);
|
||||||
@@ -114,17 +115,31 @@ end;
|
|||||||
procedure TTiledataProvider.InitArray;
|
procedure TTiledataProvider.InitArray;
|
||||||
var
|
var
|
||||||
i: Integer;
|
i: Integer;
|
||||||
|
staticGroupSize: Integer;
|
||||||
begin
|
begin
|
||||||
|
//Guess the version by looking at the filesize.
|
||||||
|
if FData.Size >= 3188736 then
|
||||||
|
FVersion := tdvHighSeas
|
||||||
|
else
|
||||||
|
FVersion := tdvLegacy;
|
||||||
|
if FVersion >= tdvHighSeas then
|
||||||
|
staticGroupSize := StaticTileGroupSizeHS
|
||||||
|
else
|
||||||
|
staticGroupSize := StaticTileGroupSize;
|
||||||
|
|
||||||
FData.Position := 0;
|
FData.Position := 0;
|
||||||
Logger.Send([lcInfo], 'Loading $4000 LandTiledata Entries');
|
Logger.Send([lcInfo], 'Loading $4000 LandTiledata Entries');
|
||||||
for i := $0 to $3FFF do
|
for i := $0 to $3FFF do
|
||||||
begin
|
begin
|
||||||
if i mod 32 = 0 then
|
//In High Seas, the first header comes AFTER the unknown tile (for whatever
|
||||||
|
//reason). Therefore special handling is required.
|
||||||
|
if ((FVersion = tdvLegacy) and (i mod 32 = 0)) or
|
||||||
|
((FVersion >= tdvHighSeas) and ((i = 1) or ((i > 1) and (i mod 32 = 0)))) then
|
||||||
FData.Seek(4, soFromCurrent);
|
FData.Seek(4, soFromCurrent);
|
||||||
FLandTiles[i] := TLandTileData.Create(FData);
|
FLandTiles[i] := TLandTileData.Create(FData, FVersion);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
FStaticCount := ((FData.Size - FData.Position) div StaticTileGroupSize) * 32;
|
FStaticCount := ((FData.Size - FData.Position) div staticGroupSize) * 32;
|
||||||
Logger.Send([lcInfo], 'Loading $%x StaticTiledata Entries', [FStaticCount]);
|
Logger.Send([lcInfo], 'Loading $%x StaticTiledata Entries', [FStaticCount]);
|
||||||
SetLength(FStaticTiles, FStaticCount);
|
SetLength(FStaticTiles, FStaticCount);
|
||||||
|
|
||||||
@@ -132,7 +147,7 @@ begin
|
|||||||
begin
|
begin
|
||||||
if i mod 32 = 0 then
|
if i mod 32 = 0 then
|
||||||
FData.Seek(4, soFromCurrent);
|
FData.Seek(4, soFromCurrent);
|
||||||
FStaticTiles[i] := TStaticTileData.Create(FData);
|
FStaticTiles[i] := TStaticTileData.Create(FData, FVersion);
|
||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
@@ -161,6 +176,8 @@ end;
|
|||||||
|
|
||||||
function TTiledataProvider.GetTileData(AID: Integer): TTiledata;
|
function TTiledataProvider.GetTileData(AID: Integer): TTiledata;
|
||||||
begin
|
begin
|
||||||
|
if (AID < 0) or (AID >= $4000 + Integer(FStaticCount)) then
|
||||||
|
raise Exception.CreateFmt('Invalid tiledata ID %d', [AID]);
|
||||||
if AID < $4000 then
|
if AID < $4000 then
|
||||||
Result := FLandTiles[AID]
|
Result := FLandTiles[AID]
|
||||||
else
|
else
|
||||||
|
|||||||
@@ -1,46 +0,0 @@
|
|||||||
CentrED (c) 2009 Andreas Schneider
|
|
||||||
==================================
|
|
||||||
|
|
||||||
License
|
|
||||||
=======
|
|
||||||
CentrED is released under the CDDL - the Common Development and
|
|
||||||
Distribution License by Sun Microsystems. A copy of that license
|
|
||||||
should be included with this source, but you can also read it
|
|
||||||
at http://www.opensource.org/licenses/cddl1.php.
|
|
||||||
|
|
||||||
Compiling
|
|
||||||
=========
|
|
||||||
To build CentrED you need at least FreePascal 2.2.2 and a
|
|
||||||
recent Lazarus (at least 0.9.26).
|
|
||||||
You also have to have the following packages installed:
|
|
||||||
- VirtualTrees from http://code.google.com/p/luipack/wiki/VirtualTreeview
|
|
||||||
- LazOpenGLContext (included with Lazarus)
|
|
||||||
- lNet by Almindor: http://wiki.lazarus.freepascal.org/lNet
|
|
||||||
|
|
||||||
The client project can be found in Client/CentrED.lpi and the
|
|
||||||
server projectin Server/cedserver.lpi, both to be opened by
|
|
||||||
Lazarus or compiled via lazbuild.
|
|
||||||
Currently supported targets are i386-linux-gtk and
|
|
||||||
i386-win32-win32. Other targets might work too, but I haven't
|
|
||||||
tested or approved them. Don't forget to create the necessary
|
|
||||||
target directories in obj/ first, before trying other targets.
|
|
||||||
|
|
||||||
Structure
|
|
||||||
=========
|
|
||||||
./ contains generic source files used by the client and server
|
|
||||||
bin/ contains the linked binaries
|
|
||||||
Client/ contains the source of the CentrED client
|
|
||||||
Imaging/ contains the Vampyre Imaging Library with CentrED specific options
|
|
||||||
MulProvider/ contains my MulProvider library with some wrapper classes around the mul objects
|
|
||||||
obj/ contains the compiled objects
|
|
||||||
Server/ contains the Source of the CentrED server
|
|
||||||
Setup/ contains the InnoSetup project file(s)
|
|
||||||
UOLib/ contains my UO library for access to many mul files
|
|
||||||
|
|
||||||
Thanks
|
|
||||||
======
|
|
||||||
Almindor for lNet and his support on how to use it efficently.
|
|
||||||
Marek Mauder for the great Vampyre Imaging Library and also his support and extensions.
|
|
||||||
Luiz Américo Pereira Câmara for his nice port of VirtualTrees.
|
|
||||||
And last but not least the whole FPC and Lazarus team for developing, maintaining
|
|
||||||
and supporting such great development tools, which make life a lot easier.
|
|
||||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user