2
0

Pascal.xml 19 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520
  1. <?xml version="1.0" encoding="utf-8"?>
  2. <?xml-stylesheet type="text/xsl" href="../Xsl/doc2html.xsl"?>
  3. <doc>
  4. <title>Object Pascal Demos</title>
  5. <chapter>
  6. <title>Object Pascal Demos</title>
  7. <par>These Object Pascal demos currently exist:</par>
  8. <blist>
  9. <li><link url="#benchmark">Benchmark</link></li>
  10. <li><link url="#ibrowser">VCL Image Browser</link></li>
  11. <li><link url="#lclimager">LCL Imager</link></li>
  12. <li><link url="#vampconvert">VampConvert</link></li>
  13. <li><link url="#opengldemo">OpenGL Demo</link></li>
  14. <li><link url="#d3ddemo">Direct3D 9 Demo</link></li>
  15. <li><link url="#sdldemo">SDL Demo</link></li>
  16. </blist>
  17. <note>
  18. If you have paths to compilers properly set you can build basic demos at
  19. once by calling build scripts named <icode>BuildDemos*.bat</icode>
  20. for Windows and DOS and <icode>BuildDemos*.sh</icode> for Linux.
  21. They are located in Scripts directory and compiled demos will be
  22. placed in Demos/Bin directory.
  23. Demos of Imaging extensions (like <keyword>OpenGL</keyword> support)
  24. which require 3rd party units (like <keyword>OpenGL</keyword> headers)
  25. can be compiled using <icode>BuildExtDemos*.bat</icode> and
  26. <icode>BuildExtDemos*.sh</icode> scripts. Remember that you must
  27. first set paths to required headers in these scripts for them to
  28. work.
  29. </note>
  30. <note>
  31. Some demos from older Imaging releases were removed. DXTTool has been
  32. replaced by VampConvert. HighLevel was there to show how to use
  33. high level interface (class based) which is now used by
  34. nearly all demos so HighLevel is no longer necessary.
  35. </note>
  36. <!-- BENCHMARK DEMO ****************************** -->
  37. <lcap><anchor name="benchmark">Benchmark</anchor></lcap>
  38. <par>
  39. Simple program which measures time taken by the main Imaging functions
  40. (loading, manipulation, saving) in microsecond resolution.
  41. You can use it to compare the speeds of executables created by the supported
  42. compilers
  43. (you can find results for my machine in BenchmarkResults directory).
  44. </par>
  45. <table>
  46. <title>Demo Information</title>
  47. <row>
  48. <td><b>Name</b></td>
  49. <td>Benchmark</td>
  50. </row>
  51. <row>
  52. <td><b>Language</b></td>
  53. <td>Object Pascal</td>
  54. </row>
  55. <row>
  56. <td><b>Source Path</b></td>
  57. <td>(Imaging Root)\Demos\ObjectPascal\Benchmark</td>
  58. </row>
  59. <row>
  60. <td><b>Exe Path</b></td>
  61. <td>(Imaging Root)\Demos\Bin\Bench[.exe]</td>
  62. </row>
  63. <row>
  64. <td><b>Platforms (tested)</b></td>
  65. <td><b>W</b>indows, <b>L</b>inux, Free<b>B</b>SD</td>
  66. </row>
  67. <row>
  68. <td><b>Compilers (tested)</b></td>
  69. <td>Delphi 7/2007/2009/2010 <b>W</b>
  70. Free Pascal 2.2.4 <b>WLBD</b></td>
  71. </row>
  72. <row>
  73. <td><b>Demo shows usage of</b></td>
  74. <td>low level</td>
  75. </row>
  76. </table>
  77. <par>Benchmark first loads images (one for each supported and registered
  78. file format)
  79. and then calls various image manipulation functions on them.
  80. Finally, images are saved and log file (with time consumption of
  81. each action) is written. You can change behaviour of program by
  82. commenting/uncommenting two defines:</par>
  83. <olist>
  84. <li><b>LOG_TO_FILE</b> If defined log is written to file (ResultsPas.log
  85. in the directory where executable is located), otherwise it is
  86. written to console. </li>
  87. <li><b>SAVE_IMAGES_TO_FILES</b> If not defined, modified
  88. images are saved only to memory and taken time is measured.
  89. If defined, these images are saved to files
  90. after measurement.</li>
  91. </olist>
  92. <par>Also note these things before running this demo:</par>
  93. <olist>
  94. <li>During the test large amounts of memory can be allocated by
  95. the program (e.g. conversion from 3000x3000x64 bit image to 128 bit requires
  96. over 200 MB of memory).</li>
  97. <li>Program's executable must be located in Demos,
  98. Demos\SomeDir or Demos\SomeDir1\SomeDir2 to be able to find used data
  99. files.</li>
  100. </olist>
  101. <!-- VCL IMAGE BROWSER DEMO *************************** -->
  102. <lcap><anchor name="ibrowser">VCL Image Browser</anchor></lcap>
  103. <par>
  104. This simple viewer application shows usage of high level class interface
  105. to Imaging library and also drawing images onto standard <b>VCL</b> <icode>TCanvas</icode>.
  106. TImagingCanvas class is also used here.
  107. </par>
  108. <table>
  109. <title>Demo Information</title>
  110. <row>
  111. <td><b>Name</b></td>
  112. <td>VCL Image Browser</td>
  113. </row>
  114. <row>
  115. <td><b>Language</b></td>
  116. <td>Object Pascal</td>
  117. </row>
  118. <row>
  119. <td><b>Source Path</b></td>
  120. <td>(Imaging Root)\Demos\ObjectPascal\VCLImageBrowser</td>
  121. </row>
  122. <row>
  123. <td><b>Exe Path</b></td>
  124. <td>(Imaging Root)\Demos\Bin\ImgBrowser.exe</td>
  125. </row>
  126. <row>
  127. <td><b>Platforms (tested)</b></td>
  128. <td><b>W</b>in32</td>
  129. </row>
  130. <row>
  131. <td><b>Compilers (tested)</b></td>
  132. <td>Delphi 7/2007/2009/2010 <b>W</b></td>
  133. </row>
  134. <row>
  135. <td><b>Demo shows usage of</b></td>
  136. <td>high level/component sets/canvas</td>
  137. </row>
  138. </table>
  139. <par>
  140. In the left part of the window is shell tree view component. Here you can
  141. select files located in your computer. If the selected file is in one of the
  142. supported formats it is displayed in the viewer
  143. area and some information about the file is displayed in the info area.
  144. If image file contains subimages you can view them too. Select active subimage
  145. by clicking on buttons with arrows (Previous/Next or First/Last). There is also Save Image Copy
  146. button that allows you to save copy (that is used for display, in A8R8G8B8)
  147. of currently selected image to file.
  148. </par>
  149. <par>
  150. When supported file is selected in shell tree view it is loaded to
  151. <ref>TMultiImage</ref> and converted to <icode>ifA8R8G8B8</icode>
  152. data format.
  153. Active subimage is then drawn
  154. (with alpha blending if there is a alpha channel present -
  155. methods of <ref>TImagingCanvas</ref> are used) on background
  156. image (filled with back color).
  157. Final blended image is then drawn into
  158. <icode>TPainBox</icode> component's
  159. client area using <ref>DisplayImage</ref> procedure (direct bit copy, no need to
  160. convert Imaging's data to <icode>TGraphic</icode>).
  161. Image is rescaled to fit the whole display area and
  162. there is optional bicubic filtering (nearest neighbor is used when disabled).
  163. </par>
  164. <image url="imgbrowser.jpg"/>
  165. <!-- LCL IMAGER DEMO *************************** -->
  166. <lcap><anchor name="lclimager">LCL Imager</anchor></lcap>
  167. <par>
  168. Simple image manipulator program which shows usage of Imaging
  169. <keyword>LCL</keyword> classes (<ref>TImagingGraphic</ref> and
  170. its descendants) to display images on the form.
  171. It also uses high level image classes and low level functions.
  172. </par>
  173. <table>
  174. <title>Demo Information</title>
  175. <row>
  176. <td><b>Name</b></td>
  177. <td>LCL Imager</td>
  178. </row>
  179. <row>
  180. <td><b>Language</b></td>
  181. <td>Object Pascal</td>
  182. </row>
  183. <row>
  184. <td><b>Source Path</b></td>
  185. <td>(Imaging Root)\Demos\ObjectPascal\LCLImager</td>
  186. </row>
  187. <row>
  188. <td><b>Exe Path</b></td>
  189. <td>(Imaging Root)\Demos\Bin\LCLImager.exe</td>
  190. </row>
  191. <row>
  192. <td><b>Platforms (tested)</b></td>
  193. <td><b>W</b>indows, <b>L</b>inux, Free<b>B</b>SD</td>
  194. </row>
  195. <row>
  196. <td><b>Compilers (tested)</b></td>
  197. <td>Lazarus 0.9.28 <b>WLB</b> interfaces: Win32/64, GTK/GTK2, Qt, Carbon</td>
  198. </row>
  199. <row>
  200. <td><b>Demo shows usage of</b></td>
  201. <td>high level/component sets/canvas</td>
  202. </row>
  203. </table>
  204. <par>
  205. Demo uses <ref>TMultiImage</ref> class to store images
  206. (loaded from one file so its usually only one for most formats with
  207. exceptions like MNG and DDS)
  208. which can be modified by user. After each modification image
  209. is assigned to <ref>TImagingBitmap</ref> class which provides visualization
  210. on the app form (using standard <icode>TImage</icode> component).
  211. Demo also uses new <ref>TImagingCanvas</ref> class to do some effects.
  212. </par>
  213. <par>
  214. In <keyword>File</keyword> menu you can open new image and save the
  215. current one. Items in <keyword>View</keyword> menu provide
  216. information about the current image and controls how it is displayed.
  217. You can also select next and previous subimage if loaded file
  218. contains more than one image.
  219. <keyword>Format</keyword> menu allows you to convert image
  220. to different image data formats supported by Imaging. <keyword>Manipulate</keyword>
  221. menu allows you to enlarge/shrink/flip/mirror/swap channels/reduce colors
  222. of the current image.
  223. <keyword>Linear Filters</keyword> menu allows you to apply various linear filters
  224. to the image like bluring, sharpening,
  225. or edge detection.
  226. <keyword>Nonlinear Filters</keyword> menu allows you to apply nonlinear filters
  227. like median or maximum.
  228. Using operations in <keyword>Point Transforms</keyword> menu you can
  229. adjust image contrast, brightness, or gamma.
  230. Filters and point transforms are provided by <ref>TImagingCanvas</ref>.
  231. <keyword>Binary Morphology</keyword> menu provides image segmentation
  232. functions using basic morphology operators (unit <ref>ImagingBinary</ref>).
  233. <keyword>Colors</keyword> menu allows user to
  234. set the value of specific color/alpha channel of all image pixels.
  235. There is also option to show histogram of current image (R, G, B, and Gray
  236. values displayed).
  237. </par>
  238. <image url="lclimager.jpg"/>
  239. <!-- VAMPCONVERT DEMO **************************** -->
  240. <lcap><anchor name="vampconvert">VampConvert</anchor></lcap>
  241. <par>Image Converter is command line tool for converting images between
  242. file and data formats. It also provides some basic manipulation functions
  243. like resizing, rotating, or color reduction.
  244. </par>
  245. <table>
  246. <title>Demo Information</title>
  247. <row>
  248. <td><b>Name</b></td>
  249. <td>VampConvert</td>
  250. </row>
  251. <row>
  252. <td><b>Language</b></td>
  253. <td>Object Pascal</td>
  254. </row>
  255. <row>
  256. <td><b>Source Path</b></td>
  257. <td>(Imaging Root)\Demos\ObjectPascal\VampConvert</td>
  258. </row>
  259. <row>
  260. <td><b>Exe Path</b></td>
  261. <td>(Imaging Root)\Demos\Bin\VampConvert[.exe]</td>
  262. </row>
  263. <row>
  264. <td><b>Platforms (tested)</b></td>
  265. <td><b>W</b>indows, <b>L</b>inux, Free<b>B</b>SD</td>
  266. </row>
  267. <row>
  268. <td><b>Compilers (tested)</b></td>
  269. <td>Delphi 7/2007/2009/2010 <b>W</b>,
  270. Free Pascal 2.2.4 <b>WLBD</b></td>
  271. </row>
  272. <row>
  273. <td><b>Demo shows usage of</b></td>
  274. <td>low level</td>
  275. </row>
  276. </table>
  277. <par>
  278. Here is usage information with possible command switches and parameters
  279. (as printed by demo if invalid input is given):
  280. </par>
  281. <code>
  282. Vampyre Image Converter (library version 0.26.0)
  283. by Marek Mauder
  284. Error: Input file not specified
  285. Usage:
  286. VampConvert [-op=arg] [..] -infile=file.ext [..] [-outfile=file.ext] [-op=arg]
  287. Options:
  288. -infile | -i: specify input image file path
  289. -outfile | -o: specify output image file path
  290. argument: file path or "*.ext" where input file name will be used
  291. but with "ext" extension
  292. Operations:
  293. Note: they are processed in the same order as they appear on command line
  294. -format: changes data format of input images
  295. argument: name of data format supported by Imaging like A8R8G8B8
  296. -resize: changes size of input images
  297. argument: string in format AxBxC (%dx%dx%s) where A is desired
  298. width, B is desired height, and C is resampling filter used.
  299. If A or B is 0 then original dimension will be preserved.
  300. C is optional and can have one of following values:
  301. nearest(default), bilinear, bicubic.
  302. -flip: flips input images upside down
  303. -mirror: mirrors input images left to right
  304. -colorcount: reduces number of colors in image
  305. argument: number of desired colors (2-4096)
  306. -genmipmaps: generates mipmaps for main image
  307. argument: number of desired mip levels. 0 or no arg means
  308. create all possible levels
  309. -rotate: rotates input images counterclockwise
  310. argument: angle in degrees, multiple of 90
  311. Supported file formats (INPUT):
  312. bmp jpg png mng jng gif dds tga pbm pgm ppm pam pfm jp2 psd pcx xpm bsi cif img
  313. dagtexture
  314. Supported file formats (OUTPUT):
  315. bmp jpg png mng jng gif dds tga pgm ppm pam pfm jp2 psd cif img
  316. Supported data formats: Index8 Gray8 A8Gray8 Gray16 Gray32 Gray64 A16Gray16 X5
  317. R1G1B1 R3G3B2 R5G6B5 A1R5G5B5 A4R4G4B4 X1R5G5B5 X4R4G4B4 R8G8B8 A8R8G8B8 X8R8G8B
  318. 8 R16G16B16 A16R16G16B16 B16G16R16 A16B16G16R16 R32F A32R32G32B32F A32B32G32R32F
  319. R16F A16R16G16B16F A16B16G16R16F DXT1 DXT3 DXT5 BTC ATI1N ATI2N
  320. </code>
  321. <note>
  322. Operations (change format, resize, rotate) are processed in the same order
  323. as they appear on the command line.
  324. </note>
  325. <!-- OPENGL DEMO *************************** -->
  326. <lcap><anchor name="opengldemo">OpenGL Demo</anchor></lcap>
  327. <par>
  328. Demo that shows how to create <keyword>OpenGL</keyword> textures from files
  329. and Imaging's images and vice versa.
  330. <note>This demo requires <keyword>OpenGL</keyword> drivers and
  331. <keyword>SDL</keyword> installed to run and requires
  332. <keyword>Object Pascal</keyword> headers to compile.
  333. </note>
  334. </par>
  335. <table>
  336. <title>Demo Information</title>
  337. <row>
  338. <td><b>Name</b></td>
  339. <td>OpenGL Demo</td>
  340. </row>
  341. <row>
  342. <td><b>Language</b></td>
  343. <td>Object Pascal</td>
  344. </row>
  345. <row>
  346. <td><b>Source Path</b></td>
  347. <td>(Imaging Root)\Demos\ObjectPascal\OpenGLDemo</td>
  348. </row>
  349. <row>
  350. <td><b>Exe Path</b></td>
  351. <td>(Imaging Root)\Demos\Bin\OpenGLDemo[.exe]</td>
  352. </row>
  353. <row>
  354. <td><b>Platforms (tested)</b></td>
  355. <td><b>W</b>in32, <b>L</b>inux</td>
  356. </row>
  357. <row>
  358. <td><b>Compilers (tested)</b></td>
  359. <td>Delphi 7/2007/2009/2010 <b>W</b>FPC 2.2.4 <b>WL</b></td>
  360. </row>
  361. <row>
  362. <td><b>Demo shows usage of</b></td>
  363. <td>low level/OpenGL extension</td>
  364. </row>
  365. </table>
  366. <par>
  367. This sample uses <keyword>SDL</keyword> to create
  368. window and process messages. Background and sprite textures are loaded from
  369. files and rendered. Sprite is mapped on the spinning cube in the
  370. center of the window.
  371. You can change sprite's texture format by pressing <keyboard>SPACE</keyboard> key
  372. (it cycles trough all <ref>TImageFormat</ref> values).
  373. Screehshot
  374. can be saved to file by pressing <keyboard>S</keyboard> key and sprite texture
  375. can be saved by pressing <keyboard>D</keyboard> key.
  376. </par>
  377. <image url="opengldemo.jpg"/>
  378. <!-- D3D DEMO *************************** -->
  379. <lcap><anchor name="d3ddemo">Direct3D 9 Demo</anchor></lcap>
  380. <par>
  381. Demo that shows how to create <keyword>Direct3D 9</keyword> textures
  382. from files and Imaging's images and vice versa.
  383. <note>This demo requires <keyword>Direct3D 9.0</keyword> and
  384. <keyword>SDL</keyword> installed to run and requires
  385. <keyword>Object Pascal</keyword> headers to compile.
  386. </note>
  387. </par>
  388. <table>
  389. <title>Demo Information</title>
  390. <row>
  391. <td><b>Name</b></td>
  392. <td>D3D Demo</td>
  393. </row>
  394. <row>
  395. <td><b>Language</b></td>
  396. <td>Object Pascal</td>
  397. </row>
  398. <row>
  399. <td><b>Source Path</b></td>
  400. <td>(Imaging Root)\Demos\ObjectPascal\D3DDemo</td>
  401. </row>
  402. <row>
  403. <td><b>Exe Path</b></td>
  404. <td>(Imaging Root)\Demos\Bin\D3DDemo.exe</td>
  405. </row>
  406. <row>
  407. <td><b>Platforms (tested)</b></td>
  408. <td><b>W</b>in32</td>
  409. </row>
  410. <row>
  411. <td><b>Compilers (tested)</b></td>
  412. <td>Delphi 7/2007/2009/2010 <b>W</b>, FPC 2.0.4 <b>W</b></td>
  413. </row>
  414. <row>
  415. <td><b>Demo shows usage of</b></td>
  416. <td>low level/D3D9 extension</td>
  417. </row>
  418. </table>
  419. <par>
  420. This sample uses <keyword>SDL</keyword> to create
  421. window and process messages. Background and sprite textures are loaded from
  422. files and rendered. Sprite is rendered in each corner of the window
  423. using various texture stage and blending settings.
  424. You can change sprite's texture format by pressing <keyboard>SPACE</keyboard> key
  425. (it cycles trough all <ref>TImageFormat</ref> values). Screehshot can be
  426. saved to file by pressing <keyboard>S</keyboard> key and sprite texture
  427. can be saved by pressing <keyboard>D</keyboard> key.
  428. </par>
  429. <image url="d3ddemo.jpg"/>
  430. <!-- SDL DEMO *************************** -->
  431. <lcap><anchor name="sdldemo">SDL Demo</anchor></lcap>
  432. <par>
  433. Demo that shows how to create <keyword>SDL</keyword> surfaces from Imaging's
  434. images and vice versa.
  435. <note>This demo requires <keyword>SDL</keyword> installed to run and requires
  436. <keyword>Object Pascal</keyword> headers to compile.
  437. </note>
  438. </par>
  439. <table>
  440. <title>Demo Information</title>
  441. <row>
  442. <td><b>Name</b></td>
  443. <td>SDL Demo</td>
  444. </row>
  445. <row>
  446. <td><b>Language</b></td>
  447. <td>Object Pascal</td>
  448. </row>
  449. <row>
  450. <td><b>Source Path</b></td>
  451. <td>(Imaging Root)\Demos\ObjectPascal\SDLDemo</td>
  452. </row>
  453. <row>
  454. <td><b>Exe Path</b></td>
  455. <td>(Imaging Root)\Demos\Bin\SDLDemo[.exe]</td>
  456. </row>
  457. <row>
  458. <td><b>Platforms (tested)</b></td>
  459. <td><b>W</b>in32, <b>L</b>inux</td>
  460. </row>
  461. <row>
  462. <td><b>Compilers (tested)</b></td>
  463. <td>Delphi 7/2007/2009/2010 <b>W</b>, FPC 2.2.4 <b>WL</b></td>
  464. </row>
  465. <row>
  466. <td><b>Demo shows usage of</b></td>
  467. <td>low level/SDL extension</td>
  468. </row>
  469. </table>
  470. <par>
  471. <keyword>SDL</keyword> window is opened and background
  472. and sprite surfaces are loaded and blitted to window. You can change
  473. sprite's data format by pressing <keyboard>SPACE</keyboard> key (it cycles trough all
  474. <ref>TImageFormat</ref> values) and toggle alpha blending (working only
  475. when sprite's current format has alpha channel) and color keying.
  476. Sprite can be moved across the screen using arrow keys.
  477. Screenshots can also be taken. Status of the sprite
  478. and list of active keys are shown in the console window (but <keyword>SDL</keyword>
  479. window must have focus for the key input to be recognized).
  480. </par>
  481. <image url="sdldemo.jpg"/>
  482. </chapter>
  483. </doc>