ruby-iup 0.0.1
Sign up to get free protection for your applications and to get access to all the features.
- data/Rakefile +97 -0
- data/doc/README +10 -0
- data/doc/build_install.txt +77 -0
- data/examples/README +16 -0
- data/examples/ctrl/cbox.rb +221 -0
- data/examples/ctrl/checkboard.rb +33 -0
- data/examples/ctrl/degrade.rb +73 -0
- data/examples/ctrl/example1.rb +53 -0
- data/examples/ctrl/example2.rb +39 -0
- data/examples/ctrl/iupcolorbar.rb +95 -0
- data/examples/ctrl/iupcolorbrowser.rb +45 -0
- data/examples/ctrl/iupdial.rb +117 -0
- data/examples/ctrl/iupgauge.rb +242 -0
- data/examples/ctrl/iupgetcolor.rb +8 -0
- data/examples/ctrl/iupgetparam.rb +62 -0
- data/examples/ctrl/iupglcanvas.rb +172 -0
- data/examples/ctrl/iupmask.rb +15 -0
- data/examples/ctrl/iupmatrix.rb +39 -0
- data/examples/ctrl/iupplot2.rb +603 -0
- data/examples/ctrl/iuptabs.rb +22 -0
- data/examples/ctrl/iuptree.rb +190 -0
- data/examples/ctrl/iupval.rb +71 -0
- data/examples/ctrl/numbering.rb +46 -0
- data/examples/ctrl/sample.rb +166 -0
- data/examples/dlg/iupalarm.rb +14 -0
- data/examples/dlg/iupfiledlg.rb +19 -0
- data/examples/dlg/iupgetfile.rb +19 -0
- data/examples/dlg/iuplistdialog.rb +26 -0
- data/examples/dlg/iupmessage.rb +5 -0
- data/examples/dlg/iupscanf.rb +17 -0
- data/examples/elem/iupbutton.rb +197 -0
- data/examples/elem/iupcanvas.rb +27 -0
- data/examples/elem/iupcanvas2.rb +113 -0
- data/examples/elem/iupcanvas3.rb +62 -0
- data/examples/elem/iupdialog.rb +71 -0
- data/examples/elem/iupdialog2.rb +25 -0
- data/examples/elem/iupfill.rb +51 -0
- data/examples/elem/iupframe.rb +25 -0
- data/examples/elem/iuphbox.rb +68 -0
- data/examples/elem/iupimage.rb +113 -0
- data/examples/elem/iupitem.rb +60 -0
- data/examples/elem/iuplabel.rb +57 -0
- data/examples/elem/iuplist.rb +41 -0
- data/examples/elem/iuplist2.rb +125 -0
- data/examples/elem/iupmenu.rb +32 -0
- data/examples/elem/iupmultiline.rb +24 -0
- data/examples/elem/iupmultiline2.rb +156 -0
- data/examples/elem/iupradio.rb +32 -0
- data/examples/elem/iupseparator.rb +81 -0
- data/examples/elem/iupsubmenu.rb +85 -0
- data/examples/elem/iuptext.rb +61 -0
- data/examples/elem/iuptimer.rb +36 -0
- data/examples/elem/iuptoggle.rb +110 -0
- data/examples/elem/iupvbox.rb +87 -0
- data/examples/elem/iupzbox.rb +60 -0
- data/examples/elem/mdisample.rb +376 -0
- data/examples/elem/progressbar.rb +294 -0
- data/examples/elem/scrollbar.rb +66 -0
- data/examples/elem/tray.rb +90 -0
- data/examples/func/iupgetattribute.rb +32 -0
- data/examples/func/iupidle.rb +48 -0
- data/ext/extconf.rb +27 -0
- data/ext/iup-linux/include/cd.h +494 -0
- data/ext/iup-linux/include/cd_canvas.hpp +358 -0
- data/ext/iup-linux/include/cd_old.h +158 -0
- data/ext/iup-linux/include/cd_private.h +362 -0
- data/ext/iup-linux/include/cdcgm.h +34 -0
- data/ext/iup-linux/include/cdclipbd.h +22 -0
- data/ext/iup-linux/include/cddbuf.h +23 -0
- data/ext/iup-linux/include/cddebug.h +24 -0
- data/ext/iup-linux/include/cddgn.h +23 -0
- data/ext/iup-linux/include/cddxf.h +22 -0
- data/ext/iup-linux/include/cdemf.h +22 -0
- data/ext/iup-linux/include/cdgdiplus.h +29 -0
- data/ext/iup-linux/include/cdimage.h +23 -0
- data/ext/iup-linux/include/cdirgb.h +30 -0
- data/ext/iup-linux/include/cdiup.h +22 -0
- data/ext/iup-linux/include/cdlua.h +39 -0
- data/ext/iup-linux/include/cdlua3_private.h +120 -0
- data/ext/iup-linux/include/cdlua5_private.h +141 -0
- data/ext/iup-linux/include/cdluaim.h +24 -0
- data/ext/iup-linux/include/cdluaiup.h +27 -0
- data/ext/iup-linux/include/cdluapdf.h +27 -0
- data/ext/iup-linux/include/cdmf.h +24 -0
- data/ext/iup-linux/include/cdmf_private.h +32 -0
- data/ext/iup-linux/include/cdnative.h +26 -0
- data/ext/iup-linux/include/cdpdf.h +38 -0
- data/ext/iup-linux/include/cdpicture.h +22 -0
- data/ext/iup-linux/include/cdprint.h +23 -0
- data/ext/iup-linux/include/cdps.h +37 -0
- data/ext/iup-linux/include/cdwmf.h +22 -0
- data/ext/iup-linux/include/im.h +282 -0
- data/ext/iup-linux/include/im_attrib.h +116 -0
- data/ext/iup-linux/include/im_attrib_flat.h +39 -0
- data/ext/iup-linux/include/im_binfile.h +214 -0
- data/ext/iup-linux/include/im_capture.h +365 -0
- data/ext/iup-linux/include/im_color.h +465 -0
- data/ext/iup-linux/include/im_colorhsi.h +61 -0
- data/ext/iup-linux/include/im_complex.h +160 -0
- data/ext/iup-linux/include/im_convert.h +127 -0
- data/ext/iup-linux/include/im_counter.h +69 -0
- data/ext/iup-linux/include/im_dib.h +195 -0
- data/ext/iup-linux/include/im_file.h +111 -0
- data/ext/iup-linux/include/im_format.h +79 -0
- data/ext/iup-linux/include/im_format_all.h +576 -0
- data/ext/iup-linux/include/im_format_avi.h +87 -0
- data/ext/iup-linux/include/im_format_ecw.h +93 -0
- data/ext/iup-linux/include/im_format_jp2.h +78 -0
- data/ext/iup-linux/include/im_format_raw.h +64 -0
- data/ext/iup-linux/include/im_format_wmv.h +100 -0
- data/ext/iup-linux/include/im_image.h +403 -0
- data/ext/iup-linux/include/im_kernel.h +315 -0
- data/ext/iup-linux/include/im_lib.h +191 -0
- data/ext/iup-linux/include/im_math.h +368 -0
- data/ext/iup-linux/include/im_math_op.h +219 -0
- data/ext/iup-linux/include/im_palette.h +172 -0
- data/ext/iup-linux/include/im_plus.h +73 -0
- data/ext/iup-linux/include/im_process.h +35 -0
- data/ext/iup-linux/include/im_process_ana.h +221 -0
- data/ext/iup-linux/include/im_process_glo.h +170 -0
- data/ext/iup-linux/include/im_process_loc.h +577 -0
- data/ext/iup-linux/include/im_process_pon.h +712 -0
- data/ext/iup-linux/include/im_raw.h +34 -0
- data/ext/iup-linux/include/im_util.h +277 -0
- data/ext/iup-linux/include/imlua.h +83 -0
- data/ext/iup-linux/include/iup.h +255 -0
- data/ext/iup-linux/include/iup_pplot.h +40 -0
- data/ext/iup-linux/include/iupcb.h +25 -0
- data/ext/iup-linux/include/iupcbox.h +23 -0
- data/ext/iup-linux/include/iupcbs.h +42 -0
- data/ext/iup-linux/include/iupcells.h +130 -0
- data/ext/iup-linux/include/iupcolorbar.h +126 -0
- data/ext/iup-linux/include/iupcompat.h +62 -0
- data/ext/iup-linux/include/iupcontrols.h +40 -0
- data/ext/iup-linux/include/iupcpi.h +76 -0
- data/ext/iup-linux/include/iupdef.h +520 -0
- data/ext/iup-linux/include/iupdial.h +64 -0
- data/ext/iup-linux/include/iupgauge.h +57 -0
- data/ext/iup-linux/include/iupgc.h +20 -0
- data/ext/iup-linux/include/iupgetparam.h +27 -0
- data/ext/iup-linux/include/iupgl.h +101 -0
- data/ext/iup-linux/include/iupim.h +21 -0
- data/ext/iup-linux/include/iupkey.h +290 -0
- data/ext/iup-linux/include/iuplua.h +41 -0
- data/ext/iup-linux/include/iuplua_pplot.h +26 -0
- data/ext/iup-linux/include/iupluacontrols.h +27 -0
- data/ext/iup-linux/include/iupluagl.h +26 -0
- data/ext/iup-linux/include/iupluaim.h +26 -0
- data/ext/iup-linux/include/iupluaole.h +26 -0
- data/ext/iup-linux/include/iupmask.h +52 -0
- data/ext/iup-linux/include/iupmatrix.h +69 -0
- data/ext/iup-linux/include/iupole.h +24 -0
- data/ext/iup-linux/include/iupsbox.h +20 -0
- data/ext/iup-linux/include/iupspeech.h +23 -0
- data/ext/iup-linux/include/iupspin.h +21 -0
- data/ext/iup-linux/include/iuptabs.h +79 -0
- data/ext/iup-linux/include/iuptree.h +93 -0
- data/ext/iup-linux/include/iupval.h +46 -0
- data/ext/iup-linux/include/lauxlib.h +174 -0
- data/ext/iup-linux/include/lua.h +388 -0
- data/ext/iup-linux/include/lua.hpp +9 -0
- data/ext/iup-linux/include/luaconf.h +763 -0
- data/ext/iup-linux/include/lualib.h +53 -0
- data/ext/iup-linux/include/old_im.h +59 -0
- data/ext/iup-linux/include/wd.h +78 -0
- data/ext/iup-linux/include/wd_old.h +85 -0
- data/ext/iup-linux/libcd.so +0 -0
- data/ext/iup-linux/libcdcontextplus.so +0 -0
- data/ext/iup-linux/libcdluacontextplus51.so +0 -0
- data/ext/iup-linux/libcdpdf.so +0 -0
- data/ext/iup-linux/libfreetype.so +0 -0
- data/ext/iup-linux/libim.so +0 -0
- data/ext/iup-linux/libim_fftw.so +0 -0
- data/ext/iup-linux/libim_jp2.so +0 -0
- data/ext/iup-linux/libim_process.so +0 -0
- data/ext/iup-linux/libiup.so +0 -0
- data/ext/iup-linux/libiup_pplot.so +0 -0
- data/ext/iup-linux/libiupcd.so +0 -0
- data/ext/iup-linux/libiupcontrols.so +0 -0
- data/ext/iup-linux/libiupgl.so +0 -0
- data/ext/iup-linux/libiupim.so +0 -0
- data/ext/iup-linux/libiupimglib.so +0 -0
- data/ext/iup-linux/libpdflib.so +0 -0
- data/ext/iup-win32/cd.dll +0 -0
- data/ext/iup-win32/cd.lib +0 -0
- data/ext/iup-win32/cdcontextplus.dll +0 -0
- data/ext/iup-win32/cdcontextplus.lib +0 -0
- data/ext/iup-win32/cdlua51.lib +0 -0
- data/ext/iup-win32/cdluacontextplus51.lib +0 -0
- data/ext/iup-win32/cdluaim51.lib +0 -0
- data/ext/iup-win32/cdluapdf51.lib +0 -0
- data/ext/iup-win32/cdpdf.dll +0 -0
- data/ext/iup-win32/cdpdf.lib +0 -0
- data/ext/iup-win32/freetype6.dll +0 -0
- data/ext/iup-win32/freetype6.lib +0 -0
- data/ext/iup-win32/im.dll +0 -0
- data/ext/iup-win32/im_avi.dll +0 -0
- data/ext/iup-win32/im_capture.dll +0 -0
- data/ext/iup-win32/im_ecw.dll +0 -0
- data/ext/iup-win32/im_fftw.dll +0 -0
- data/ext/iup-win32/im_jp2.dll +0 -0
- data/ext/iup-win32/im_process.dll +0 -0
- data/ext/iup-win32/im_wmv.dll +0 -0
- data/ext/iup-win32/include/cd.h +494 -0
- data/ext/iup-win32/include/cd_canvas.hpp +358 -0
- data/ext/iup-win32/include/cd_old.h +158 -0
- data/ext/iup-win32/include/cd_private.h +362 -0
- data/ext/iup-win32/include/cdcgm.h +34 -0
- data/ext/iup-win32/include/cdclipbd.h +22 -0
- data/ext/iup-win32/include/cddbuf.h +23 -0
- data/ext/iup-win32/include/cddebug.h +24 -0
- data/ext/iup-win32/include/cddgn.h +23 -0
- data/ext/iup-win32/include/cddxf.h +22 -0
- data/ext/iup-win32/include/cdemf.h +22 -0
- data/ext/iup-win32/include/cdgdiplus.h +29 -0
- data/ext/iup-win32/include/cdimage.h +23 -0
- data/ext/iup-win32/include/cdirgb.h +30 -0
- data/ext/iup-win32/include/cdiup.h +22 -0
- data/ext/iup-win32/include/cdlua.h +39 -0
- data/ext/iup-win32/include/cdlua3_private.h +120 -0
- data/ext/iup-win32/include/cdlua5_private.h +141 -0
- data/ext/iup-win32/include/cdluaim.h +24 -0
- data/ext/iup-win32/include/cdluaiup.h +27 -0
- data/ext/iup-win32/include/cdluapdf.h +27 -0
- data/ext/iup-win32/include/cdmf.h +24 -0
- data/ext/iup-win32/include/cdmf_private.h +32 -0
- data/ext/iup-win32/include/cdnative.h +26 -0
- data/ext/iup-win32/include/cdpdf.h +38 -0
- data/ext/iup-win32/include/cdpicture.h +22 -0
- data/ext/iup-win32/include/cdprint.h +23 -0
- data/ext/iup-win32/include/cdps.h +37 -0
- data/ext/iup-win32/include/cdwmf.h +22 -0
- data/ext/iup-win32/include/iup.h +255 -0
- data/ext/iup-win32/include/iup_pplot.h +40 -0
- data/ext/iup-win32/include/iupcb.h +25 -0
- data/ext/iup-win32/include/iupcbox.h +23 -0
- data/ext/iup-win32/include/iupcbs.h +42 -0
- data/ext/iup-win32/include/iupcells.h +130 -0
- data/ext/iup-win32/include/iupcolorbar.h +126 -0
- data/ext/iup-win32/include/iupcompat.h +62 -0
- data/ext/iup-win32/include/iupcontrols.h +40 -0
- data/ext/iup-win32/include/iupcpi.h +76 -0
- data/ext/iup-win32/include/iupdef.h +520 -0
- data/ext/iup-win32/include/iupdial.h +64 -0
- data/ext/iup-win32/include/iupgauge.h +57 -0
- data/ext/iup-win32/include/iupgc.h +20 -0
- data/ext/iup-win32/include/iupgetparam.h +27 -0
- data/ext/iup-win32/include/iupgl.h +101 -0
- data/ext/iup-win32/include/iupim.h +21 -0
- data/ext/iup-win32/include/iupkey.h +290 -0
- data/ext/iup-win32/include/iuplua.h +41 -0
- data/ext/iup-win32/include/iuplua_pplot.h +26 -0
- data/ext/iup-win32/include/iupluacontrols.h +27 -0
- data/ext/iup-win32/include/iupluagl.h +26 -0
- data/ext/iup-win32/include/iupluaim.h +26 -0
- data/ext/iup-win32/include/iupluaole.h +26 -0
- data/ext/iup-win32/include/iupmask.h +52 -0
- data/ext/iup-win32/include/iupmatrix.h +69 -0
- data/ext/iup-win32/include/iupole.h +24 -0
- data/ext/iup-win32/include/iupsbox.h +20 -0
- data/ext/iup-win32/include/iupspeech.h +23 -0
- data/ext/iup-win32/include/iupspin.h +21 -0
- data/ext/iup-win32/include/iuptabs.h +79 -0
- data/ext/iup-win32/include/iuptree.h +93 -0
- data/ext/iup-win32/include/iupval.h +46 -0
- data/ext/iup-win32/include/wd.h +78 -0
- data/ext/iup-win32/include/wd_old.h +85 -0
- data/ext/iup-win32/iup.dll +0 -0
- data/ext/iup-win32/iup.lib +0 -0
- data/ext/iup-win32/iup_pplot.dll +0 -0
- data/ext/iup-win32/iup_pplot.lib +0 -0
- data/ext/iup-win32/iupcd.dll +0 -0
- data/ext/iup-win32/iupcd.lib +0 -0
- data/ext/iup-win32/iupcontrols.dll +0 -0
- data/ext/iup-win32/iupcontrols.lib +0 -0
- data/ext/iup-win32/iupgl.dll +0 -0
- data/ext/iup-win32/iupgl.lib +0 -0
- data/ext/iup-win32/iupim.dll +0 -0
- data/ext/iup-win32/iupim.lib +0 -0
- data/ext/iup-win32/iupimglib.dll +0 -0
- data/ext/iup-win32/iupimglib.lib +0 -0
- data/ext/iup-win32/iuplua51.lib +0 -0
- data/ext/iup-win32/iuplua_pplot51.lib +0 -0
- data/ext/iup-win32/iupluacd51.lib +0 -0
- data/ext/iup-win32/iupluacontrols51.lib +0 -0
- data/ext/iup-win32/iupluagl51.lib +0 -0
- data/ext/iup-win32/iupluaim51.lib +0 -0
- data/ext/iup-win32/iupluaimglib51.lib +0 -0
- data/ext/iup-win32/iupluaole51.lib +0 -0
- data/ext/iup-win32/iupole.dll +0 -0
- data/ext/iup-win32/iupole.lib +0 -0
- data/ext/iup-win32/iupstub.lib +0 -0
- data/ext/iup-win32/pdflib.dll +0 -0
- data/ext/iup-win32/pdflib.lib +0 -0
- data/ext/iup.c +1261 -0
- data/ext/mkrf_conf.rb +72 -0
- data/ext/rb_cd.h +1525 -0
- data/ext/rb_iup.h +2446 -0
- data/ext/rb_iup_pplot.h +129 -0
- data/ext/rb_iupcb.h +13 -0
- data/ext/rb_iupcbox.h +40 -0
- data/ext/rb_iupcells.h +15 -0
- data/ext/rb_iupcolorbar.h +17 -0
- data/ext/rb_iupcompat.h +237 -0
- data/ext/rb_iupcontrols.h +28 -0
- data/ext/rb_iupdef.h +3 -0
- data/ext/rb_iupdial.h +24 -0
- data/ext/rb_iupgauge.h +15 -0
- data/ext/rb_iupgc.h +18 -0
- data/ext/rb_iupgetparam.h +72 -0
- data/ext/rb_iupgl.h +58 -0
- data/ext/rb_iupim.h +25 -0
- data/ext/rb_iupmask.h +189 -0
- data/ext/rb_iupmatrix.h +80 -0
- data/ext/rb_iupole.h +24 -0
- data/ext/rb_iupsbox.h +23 -0
- data/ext/rb_iupspeech.h +25 -0
- data/ext/rb_iupspin.h +29 -0
- data/ext/rb_iuptabs.h +29 -0
- data/ext/rb_iuptree.h +94 -0
- data/ext/rb_iupval.h +24 -0
- data/lib/README +1 -0
- metadata +391 -0
@@ -0,0 +1,116 @@
|
|
1
|
+
/** \file
|
2
|
+
* \brief Attributes Table.
|
3
|
+
*
|
4
|
+
* See Copyright Notice in im_lib.h
|
5
|
+
*/
|
6
|
+
|
7
|
+
#ifndef __IM_ATTRIB_H_
|
8
|
+
#define __IM_ATTRIB_H_
|
9
|
+
|
10
|
+
#include "im_attrib_flat.h"
|
11
|
+
|
12
|
+
/** \brief Attributes Table.
|
13
|
+
*
|
14
|
+
* \par
|
15
|
+
* All the attributes have a name, a type, a count and the data.\n
|
16
|
+
* Names are usually strings with less that 30 chars.
|
17
|
+
* \par
|
18
|
+
* Attributes are stored in a hash table for fast access. \n
|
19
|
+
* We use the hash function described in "The Pratice of Programming" of Kernighan & Pike.
|
20
|
+
* \ingroup util */
|
21
|
+
class imAttribTable
|
22
|
+
{
|
23
|
+
imAttribTablePrivate* ptable;
|
24
|
+
public:
|
25
|
+
|
26
|
+
/** Creates an empty table.
|
27
|
+
* If size is zero the default size of 101 is used. Size must be a prime number.
|
28
|
+
* Other common values are 67, 599 and 1499.*/
|
29
|
+
imAttribTable(int hash_size)
|
30
|
+
{ ptable = imAttribTableCreate(hash_size); }
|
31
|
+
|
32
|
+
/** Destroys the table and all the attributes. */
|
33
|
+
~imAttribTable()
|
34
|
+
{ imAttribTableDestroy(ptable); ptable = 0; }
|
35
|
+
|
36
|
+
/** Returns the number of elements in the table. */
|
37
|
+
int Count() const
|
38
|
+
{ return imAttribTableCount(ptable); }
|
39
|
+
|
40
|
+
/** Removes all the attributes in the table */
|
41
|
+
void RemoveAll()
|
42
|
+
{ imAttribTableRemoveAll(ptable); }
|
43
|
+
|
44
|
+
/** Copies the contents of the given table into this table. */
|
45
|
+
void CopyFrom(const imAttribTable& table)
|
46
|
+
{ imAttribTableCopyFrom(ptable, table.ptable); }
|
47
|
+
|
48
|
+
/** Inserts an attribute into the table. \n
|
49
|
+
* Data is duplicated if not NULL, else data is initialized with zeros.
|
50
|
+
* See also \ref imDataType. */
|
51
|
+
void Set(const char* name, int data_type, int count, const void* data)
|
52
|
+
{ imAttribTableSet(ptable, name, data_type, count, data); }
|
53
|
+
|
54
|
+
/** Removes an attribute from the table given its name. */
|
55
|
+
void UnSet(const char *name)
|
56
|
+
{ imAttribTableUnSet(ptable, name); }
|
57
|
+
|
58
|
+
/** Finds an attribute in the table.
|
59
|
+
* Returns the attribute if found, NULL otherwise.
|
60
|
+
* See also \ref imDataType. */
|
61
|
+
const void* Get(const char *name, int *data_type = 0, int *count = 0) const
|
62
|
+
{ return imAttribTableGet(ptable, name, data_type, count); }
|
63
|
+
|
64
|
+
/** For each attribute calls the user callback. If the callback returns 0 the function returns. */
|
65
|
+
void ForEach(void* user_data, imAttribTableCallback attrib_func) const
|
66
|
+
{ imAttribTableForEach(ptable, user_data, attrib_func); }
|
67
|
+
};
|
68
|
+
|
69
|
+
/** \brief Attributes Table.
|
70
|
+
*
|
71
|
+
* \par
|
72
|
+
* Same as \ref imAttribTable, but uses an array of fixed size.
|
73
|
+
* \ingroup util */
|
74
|
+
class imAttribArray
|
75
|
+
{
|
76
|
+
imAttribTablePrivate* ptable;
|
77
|
+
public:
|
78
|
+
|
79
|
+
/** Creates an empty array. */
|
80
|
+
imAttribArray(int count)
|
81
|
+
{ ptable = imAttribArrayCreate(count); }
|
82
|
+
|
83
|
+
/** Destroys the array and all the attributes. */
|
84
|
+
~imAttribArray()
|
85
|
+
{ imAttribTableDestroy(ptable); ptable = 0; }
|
86
|
+
|
87
|
+
/** Returns the number of elements in the array. */
|
88
|
+
int Count() const
|
89
|
+
{ return imAttribTableCount(ptable); }
|
90
|
+
|
91
|
+
/** Removes all the attributes in the array */
|
92
|
+
void RemoveAll()
|
93
|
+
{ imAttribTableRemoveAll(ptable); }
|
94
|
+
|
95
|
+
/** Copies the contents of the given table into this table. */
|
96
|
+
void CopyFrom(const imAttribArray& table)
|
97
|
+
{ imAttribArrayCopyFrom(ptable, table.ptable); }
|
98
|
+
|
99
|
+
/** Inserts an attribute into the array. \n
|
100
|
+
* Data is duplicated if not NULL, else data is initialized with zeros.
|
101
|
+
* See also \ref imDataType. */
|
102
|
+
void Set(int index, const char* name, int data_type, int count, const void* data)
|
103
|
+
{ imAttribArraySet(ptable, index, name, data_type, count, data); }
|
104
|
+
|
105
|
+
/** Finds an attribute in the array.
|
106
|
+
* Returns the attribute if found, NULL otherwise.
|
107
|
+
* See also \ref imDataType. */
|
108
|
+
const void* Get(int index, char *name = 0, int *data_type = 0, int *count = 0) const
|
109
|
+
{ return imAttribArrayGet(ptable, index, name, data_type, count); }
|
110
|
+
|
111
|
+
/** For each attribute calls the user callback. If the callback returns 0 the function returns. */
|
112
|
+
void ForEach(void* user_data, imAttribTableCallback attrib_func) const
|
113
|
+
{ imAttribTableForEach(ptable, user_data, attrib_func); }
|
114
|
+
};
|
115
|
+
|
116
|
+
#endif
|
@@ -0,0 +1,39 @@
|
|
1
|
+
/** \file
|
2
|
+
* \brief Attributes Table Flat API.
|
3
|
+
* This will simplify the DLL export, and can be used for C aplications.
|
4
|
+
*
|
5
|
+
* See Copyright Notice in im_lib.h
|
6
|
+
*/
|
7
|
+
|
8
|
+
#ifndef __IM_ATTRIB_FLAT_H_
|
9
|
+
#define __IM_ATTRIB_FLAT_H_
|
10
|
+
|
11
|
+
#if defined(__cplusplus)
|
12
|
+
extern "C" {
|
13
|
+
#endif
|
14
|
+
|
15
|
+
struct imAttribTablePrivate;
|
16
|
+
|
17
|
+
/** Definition of the callback used in ForEach function. */
|
18
|
+
typedef int (*imAttribTableCallback)(void* user_data, int index, const char* name, int data_type, int count, const void* data);
|
19
|
+
|
20
|
+
imAttribTablePrivate* imAttribTableCreate(int hash_size);
|
21
|
+
void imAttribTableDestroy(imAttribTablePrivate* ptable);
|
22
|
+
int imAttribTableCount(imAttribTablePrivate* ptable);
|
23
|
+
void imAttribTableRemoveAll(imAttribTablePrivate* ptable);
|
24
|
+
const void* imAttribTableGet(const imAttribTablePrivate* ptable, const char *name, int *data_type, int *count);
|
25
|
+
void imAttribTableSet(imAttribTablePrivate* ptable, const char* name, int data_type, int count, const void* data);
|
26
|
+
void imAttribTableUnSet(imAttribTablePrivate* ptable, const char *name);
|
27
|
+
void imAttribTableCopyFrom(imAttribTablePrivate* ptable_dst, const imAttribTablePrivate* ptable_src);
|
28
|
+
void imAttribTableForEach(const imAttribTablePrivate* ptable, void* user_data, imAttribTableCallback attrib_func);
|
29
|
+
|
30
|
+
imAttribTablePrivate* imAttribArrayCreate(int hash_size);
|
31
|
+
const void* imAttribArrayGet(const imAttribTablePrivate* ptable, int index, char *name, int *data_type, int *count);
|
32
|
+
void imAttribArraySet(imAttribTablePrivate* ptable, int index, const char* name, int data_type, int count, const void* data);
|
33
|
+
void imAttribArrayCopyFrom(imAttribTablePrivate* ptable_dst, const imAttribTablePrivate* ptable_src);
|
34
|
+
|
35
|
+
#if defined(__cplusplus)
|
36
|
+
}
|
37
|
+
#endif
|
38
|
+
|
39
|
+
#endif
|
@@ -0,0 +1,214 @@
|
|
1
|
+
/** \file
|
2
|
+
* \brief Binary File Access.
|
3
|
+
*
|
4
|
+
* See Copyright Notice in im_lib.h
|
5
|
+
*/
|
6
|
+
|
7
|
+
#include "im_util.h"
|
8
|
+
|
9
|
+
#ifndef __IM_BINFILE_H
|
10
|
+
#define __IM_BINFILE_H
|
11
|
+
|
12
|
+
#if defined(__cplusplus)
|
13
|
+
extern "C" {
|
14
|
+
#endif
|
15
|
+
|
16
|
+
|
17
|
+
/** \defgroup binfile Binary File Access
|
18
|
+
*
|
19
|
+
* \par
|
20
|
+
* These functions are very usefull for reading/writing binary files
|
21
|
+
* that have headers or data that have to be converted depending on
|
22
|
+
* the current CPU byte order. It can invert 2, 4 or 8 bytes numbers to/from little/big-endian orders.
|
23
|
+
* \par
|
24
|
+
* It will process the data only if the file format is diferent from the current CPU.
|
25
|
+
* \par
|
26
|
+
* Can read from disk or memory. In case of a memory buffer, the file name must be the \ref imBinMemoryFileName structure.
|
27
|
+
* \par
|
28
|
+
* See \ref im_binfile.h
|
29
|
+
* \ingroup util */
|
30
|
+
|
31
|
+
typedef struct _imBinFile imBinFile;
|
32
|
+
|
33
|
+
/** Opens an existant binary file for reading.
|
34
|
+
* The default file byte order is the CPU byte order.
|
35
|
+
* Returns NULL if failed.
|
36
|
+
* \ingroup binfile */
|
37
|
+
imBinFile* imBinFileOpen(const char* pFileName);
|
38
|
+
|
39
|
+
/** Creates a new binary file for writing.
|
40
|
+
* The default file byte order is the CPU byte order.
|
41
|
+
* Returns NULL if failed.
|
42
|
+
* \ingroup binfile */
|
43
|
+
imBinFile* imBinFileNew(const char* pFileName);
|
44
|
+
|
45
|
+
/** Closes the file.
|
46
|
+
* \ingroup binfile */
|
47
|
+
void imBinFileClose(imBinFile* bfile);
|
48
|
+
|
49
|
+
/** Indicates that was an error on the last operation.
|
50
|
+
* \ingroup binfile */
|
51
|
+
int imBinFileError(imBinFile* bfile);
|
52
|
+
|
53
|
+
/** Returns the file size in bytes.
|
54
|
+
* \ingroup binfile */
|
55
|
+
unsigned long imBinFileSize(imBinFile* bfile);
|
56
|
+
|
57
|
+
/** Changes the file byte order. Returns the old one.
|
58
|
+
* \ingroup binfile */
|
59
|
+
int imBinFileByteOrder(imBinFile* bfile, int pByteOrder);
|
60
|
+
|
61
|
+
/** Reads an array of count values with byte sizes: 1, 2, 4, or 8. And invert the byte order if necessary after read.
|
62
|
+
* \ingroup binfile */
|
63
|
+
unsigned long imBinFileRead(imBinFile* bfile, void* pValues, unsigned long pCount, int pSizeOf);
|
64
|
+
|
65
|
+
/** Writes an array of values with sizes: 1, 2, 4, or 8. And invert the byte order if necessary before write.\n
|
66
|
+
* <b>ATENTION</b>: The function will not make a temporary copy of the values to invert the byte order.\n
|
67
|
+
* So after the call the values will be invalid, if the file byte order is diferent from the CPU byte order.
|
68
|
+
* \ingroup binfile */
|
69
|
+
unsigned long imBinFileWrite(imBinFile* bfile, void* pValues, unsigned long pCount, int pSizeOf);
|
70
|
+
|
71
|
+
/** Writes a string without the NULL terminator. The function uses sprintf to compose the string. \n
|
72
|
+
* The internal buffer is fixed at 4096 bytes.
|
73
|
+
* \ingroup binfile */
|
74
|
+
unsigned long imBinFilePrintf(imBinFile* bfile, char *format, ...);
|
75
|
+
|
76
|
+
/** Moves the file pointer from the begining of the file.\n
|
77
|
+
* When writing to a file seeking can go beyond the end of the file.
|
78
|
+
* \ingroup binfile */
|
79
|
+
void imBinFileSeekTo(imBinFile* bfile, unsigned long pOffset);
|
80
|
+
|
81
|
+
/** Moves the file pointer from current position.\n
|
82
|
+
* If the offset is a negative value the pointer moves backwards.
|
83
|
+
* \ingroup binfile */
|
84
|
+
void imBinFileSeekOffset(imBinFile* bfile, long pOffset);
|
85
|
+
|
86
|
+
/** Moves the file pointer from the end of the file.\n
|
87
|
+
* The offset is usually a negative value.
|
88
|
+
* \ingroup binfile */
|
89
|
+
void imBinFileSeekFrom(imBinFile* bfile, long pOffset);
|
90
|
+
|
91
|
+
/** Returns the current offset position.
|
92
|
+
* \ingroup binfile */
|
93
|
+
unsigned long imBinFileTell(imBinFile* bfile);
|
94
|
+
|
95
|
+
/** Indicates that the file pointer is at the end of the file.
|
96
|
+
* \ingroup binfile */
|
97
|
+
int imBinFileEndOfFile(imBinFile* bfile);
|
98
|
+
|
99
|
+
/** Predefined I/O Modules.
|
100
|
+
* \ingroup binfile */
|
101
|
+
enum imBinFileModule
|
102
|
+
{
|
103
|
+
IM_RAWFILE, /**< System dependent file I/O Rotines. */
|
104
|
+
IM_STREAM, /**< Standard Ansi C Stream I/O Rotines. */
|
105
|
+
IM_MEMFILE, /**< Uses a memory buffer (see \ref imBinMemoryFileName). */
|
106
|
+
IM_SUBFILE, /**< It is a sub file. FileName is a imBinFile* pointer from any other module. */
|
107
|
+
IM_FILEHANDLE,/**< System dependent file I/O Rotines, but FileName is a system file handle ("int" in UNIX and "HANDLE" in Windows). */
|
108
|
+
IM_IOCUSTOM0 /**< Other registered modules starts from here. */
|
109
|
+
};
|
110
|
+
|
111
|
+
/** Sets the current I/O module.
|
112
|
+
* \returns the previous function set, or -1 if failed.
|
113
|
+
* See also \ref imBinFileModule.
|
114
|
+
* \ingroup binfile */
|
115
|
+
int imBinFileSetCurrentModule(int pModule);
|
116
|
+
|
117
|
+
/** \brief Memory File I/O Filename
|
118
|
+
*
|
119
|
+
* \par
|
120
|
+
* Fake file name for the memory I/O module.
|
121
|
+
* \ingroup binfile */
|
122
|
+
typedef struct _imBinMemoryFileName
|
123
|
+
{
|
124
|
+
unsigned char *buffer; /**< The memory buffer. If you are reading the buffer must exists.
|
125
|
+
* If you are writing the buffer can be internally allocated to the given size. The buffer is never free.
|
126
|
+
* The buffer is allocated using "malloc", and reallocated using "realloc". Use "free" to release it.
|
127
|
+
* To avoid RTL conflicts use the function imBinMemoryRelease. */
|
128
|
+
int size; /**< Size of the buffer. */
|
129
|
+
float reallocate; /**< Reallocate factor for the memory buffer when writing (size += reallocate*size).
|
130
|
+
* Set reallocate to 0 to disable reallocation, in this case buffer must not be NULL. */
|
131
|
+
}imBinMemoryFileName;
|
132
|
+
|
133
|
+
/** Release the internal memory allocated when writing a Memory File (see \ref imBinMemoryFileName).
|
134
|
+
* \ingroup binfile */
|
135
|
+
void imBinMemoryRelease(unsigned char *buffer);
|
136
|
+
|
137
|
+
|
138
|
+
#if defined(__cplusplus)
|
139
|
+
}
|
140
|
+
#endif
|
141
|
+
|
142
|
+
|
143
|
+
#if defined(__cplusplus)
|
144
|
+
|
145
|
+
/** Base class to help the creation of new modules.\n
|
146
|
+
* It handles the read/write operations with byte order correction if necessary.
|
147
|
+
* \ingroup binfile */
|
148
|
+
class imBinFileBase
|
149
|
+
{
|
150
|
+
friend class imBinSubFile;
|
151
|
+
|
152
|
+
protected:
|
153
|
+
int IsNew,
|
154
|
+
FileByteOrder,
|
155
|
+
DoByteOrder; // to speed up byte order checking
|
156
|
+
|
157
|
+
// These will actually read/write the data
|
158
|
+
virtual unsigned long ReadBuf(void* pValues, unsigned long pSize) = 0;
|
159
|
+
virtual unsigned long WriteBuf(void* pValues, unsigned long pSize) = 0;
|
160
|
+
|
161
|
+
public:
|
162
|
+
|
163
|
+
int InitByteOrder(int ByteOrder)
|
164
|
+
{
|
165
|
+
int old_byte_order = this->FileByteOrder;
|
166
|
+
this->FileByteOrder = ByteOrder;
|
167
|
+
|
168
|
+
if (ByteOrder != imBinCPUByteOrder())
|
169
|
+
this->DoByteOrder = 1;
|
170
|
+
else
|
171
|
+
this->DoByteOrder = 0;
|
172
|
+
return old_byte_order;
|
173
|
+
}
|
174
|
+
|
175
|
+
// These will take care of byte swap if needed.
|
176
|
+
|
177
|
+
unsigned long Read(void* pValues, unsigned long pCount, int pSizeOf)
|
178
|
+
{
|
179
|
+
unsigned long rSize = ReadBuf(pValues, pCount * pSizeOf);
|
180
|
+
if (pSizeOf != 1 && DoByteOrder) imBinSwapBytes(pValues, pCount, pSizeOf);
|
181
|
+
return rSize/pSizeOf;
|
182
|
+
}
|
183
|
+
|
184
|
+
unsigned long Write(void* pValues, unsigned long pCount, int pSizeOf)
|
185
|
+
{
|
186
|
+
if (pSizeOf != 1 && DoByteOrder) imBinSwapBytes(pValues, pCount, pSizeOf);
|
187
|
+
return WriteBuf(pValues, pCount * pSizeOf)/pSizeOf;
|
188
|
+
}
|
189
|
+
|
190
|
+
virtual void Open(const char* pFileName) = 0;
|
191
|
+
virtual void New(const char* pFileName) = 0;
|
192
|
+
virtual void Close() = 0;
|
193
|
+
virtual unsigned long FileSize() = 0;
|
194
|
+
virtual int HasError() const = 0;
|
195
|
+
virtual void SeekTo(unsigned long pOffset) = 0;
|
196
|
+
virtual void SeekOffset(long pOffset) = 0;
|
197
|
+
virtual void SeekFrom(long pOffset) = 0;
|
198
|
+
virtual unsigned long Tell() const = 0;
|
199
|
+
virtual int EndOfFile() const = 0;
|
200
|
+
};
|
201
|
+
|
202
|
+
/** File I/O module creation callback.
|
203
|
+
* \ingroup binfile */
|
204
|
+
typedef imBinFileBase* (*imBinFileNewFunc)();
|
205
|
+
|
206
|
+
/** Register a user I/O module.\n
|
207
|
+
* Returns the new function set id.\n
|
208
|
+
* Accepts up to 10 modules.
|
209
|
+
* \ingroup binfile */
|
210
|
+
int imBinFileRegisterModule(imBinFileNewFunc pNewFunc);
|
211
|
+
|
212
|
+
#endif
|
213
|
+
|
214
|
+
#endif
|
@@ -0,0 +1,365 @@
|
|
1
|
+
/** \file
|
2
|
+
* \brief Video Capture
|
3
|
+
*
|
4
|
+
* See Copyright Notice in im.h
|
5
|
+
*/
|
6
|
+
|
7
|
+
#ifndef __IM_CAPTURE_H
|
8
|
+
#define __IM_CAPTURE_H
|
9
|
+
|
10
|
+
#if defined(__cplusplus)
|
11
|
+
extern "C" {
|
12
|
+
#endif
|
13
|
+
|
14
|
+
/* declarations to create an export library for Watcom. */
|
15
|
+
#if ! defined (IM_DECL)
|
16
|
+
#if defined (__WATCOMC__)
|
17
|
+
#define IM_DECL __cdecl
|
18
|
+
#elif defined(__WATCOM_CPLUSPLUS__)
|
19
|
+
#define IM_DECL __cdecl
|
20
|
+
#else
|
21
|
+
#define IM_DECL
|
22
|
+
#endif
|
23
|
+
#endif
|
24
|
+
|
25
|
+
/** \defgroup capture Image Capture
|
26
|
+
* \par
|
27
|
+
* Functions to capture images from live video devices.
|
28
|
+
* \par
|
29
|
+
* See \ref im_capture.h
|
30
|
+
*/
|
31
|
+
|
32
|
+
typedef struct _imVideoCapture imVideoCapture;
|
33
|
+
|
34
|
+
/** Returns the number of available devices.
|
35
|
+
*
|
36
|
+
* \verbatim im.VideoCaptureDeviceCount() -> count: number [in Lua 5] \endverbatim
|
37
|
+
* \ingroup capture */
|
38
|
+
int IM_DECL imVideoCaptureDeviceCount(void);
|
39
|
+
|
40
|
+
/** Returns the device description. Returns NULL only if it is an invalid device.
|
41
|
+
*
|
42
|
+
* \verbatim im.VideoCaptureDeviceDesc(device: number) -> desc: string [in Lua 5] \endverbatim
|
43
|
+
* \ingroup capture */
|
44
|
+
const char* IM_DECL imVideoCaptureDeviceDesc(int device);
|
45
|
+
|
46
|
+
/** Returns the extendend device description. May return NULL.
|
47
|
+
*
|
48
|
+
* \verbatim im.VideoCaptureDeviceExDesc(device: number) -> desc: string [in Lua 5] \endverbatim
|
49
|
+
* \ingroup capture */
|
50
|
+
const char* imVideoCaptureDeviceExDesc(int device);
|
51
|
+
|
52
|
+
/** Returns the device path configuration. This is a unique string.
|
53
|
+
*
|
54
|
+
* \verbatim im.VideoCaptureDevicePath(device: number) -> desc: string [in Lua 5] \endverbatim
|
55
|
+
* \ingroup capture */
|
56
|
+
const char* imVideoCaptureDevicePath(int device);
|
57
|
+
|
58
|
+
/** Returns the vendor information. May return NULL.
|
59
|
+
*
|
60
|
+
* \verbatim im.VideoCaptureDeviceVendorInfo(device: number) -> desc: string [in Lua 5] \endverbatim
|
61
|
+
* \ingroup capture */
|
62
|
+
const char* imVideoCaptureDeviceVendorInfo(int device);
|
63
|
+
|
64
|
+
/** Reload the device list. The devices can be dynamically removed or added to the system.
|
65
|
+
* Returns the number of available devices.
|
66
|
+
*
|
67
|
+
* \verbatim im.imVideoCaptureReloadDevices() -> count: number [in Lua 5] \endverbatim
|
68
|
+
* \ingroup capture */
|
69
|
+
int IM_DECL imVideoCaptureReloadDevices(void);
|
70
|
+
|
71
|
+
/** Creates a new imVideoCapture object. \n
|
72
|
+
* Returns NULL if there is no capture device available. \n
|
73
|
+
* In Windows returns NULL if DirectX version is older than 8. \n
|
74
|
+
* In Lua the IM videocapture metatable name is "imVideoCapture".
|
75
|
+
* When converted to a string will return "imVideoCapture(%p)" where %p is replaced by the userdata address.
|
76
|
+
* If the videocapture is already destroyed by im.VideoCaptureDestroy, then it will return also the suffix "-destroyed".
|
77
|
+
*
|
78
|
+
* \verbatim im.VideoCaptureCreate() -> vc: imVideoCapture [in Lua 5] \endverbatim
|
79
|
+
* \ingroup capture */
|
80
|
+
imVideoCapture* IM_DECL imVideoCaptureCreate(void);
|
81
|
+
|
82
|
+
/** Destroys a imVideoCapture object. \n
|
83
|
+
* In Lua if this function is not called, the videocapture is destroyed by the garbage collector.
|
84
|
+
*
|
85
|
+
* \verbatim im.VideoCaptureDestroy(vc: imVideoCapture) [in Lua 5] \endverbatim
|
86
|
+
* \verbatim vc:Destroy() [in Lua 5] \endverbatim
|
87
|
+
* \ingroup capture */
|
88
|
+
void IM_DECL imVideoCaptureDestroy(imVideoCapture* vc);
|
89
|
+
|
90
|
+
/** Connects to a capture device.
|
91
|
+
* More than one imVideoCapture object can be created
|
92
|
+
* but they must be connected to different devices. \n
|
93
|
+
* If the object is conected it will disconnect first. \n
|
94
|
+
* Use -1 to return the current connected device,
|
95
|
+
* in this case returns -1 if not connected. \n
|
96
|
+
* Returns zero if failed.
|
97
|
+
*
|
98
|
+
* \verbatim vc:Connect([device: number]) -> ret: number [in Lua 5] \endverbatim
|
99
|
+
* \ingroup capture */
|
100
|
+
int IM_DECL imVideoCaptureConnect(imVideoCapture* vc, int device);
|
101
|
+
|
102
|
+
/** Disconnect from a capture device.
|
103
|
+
*
|
104
|
+
* \verbatim vc:Disconnect() [in Lua 5] \endverbatim
|
105
|
+
* \ingroup capture */
|
106
|
+
void IM_DECL imVideoCaptureDisconnect(imVideoCapture* vc);
|
107
|
+
|
108
|
+
/** Returns the number of available configuration dialogs.
|
109
|
+
*
|
110
|
+
* \verbatim vc:DialogCount() -> count: number [in Lua 5] \endverbatim
|
111
|
+
* \ingroup capture */
|
112
|
+
int IM_DECL imVideoCaptureDialogCount(imVideoCapture* vc);
|
113
|
+
|
114
|
+
/** Displays a configuration modal dialog of the connected device. \n
|
115
|
+
* In Windows, the capturing will be stopped in some cases. \n
|
116
|
+
* In Windows parent is a HWND of a parent window, it can be NULL. \n
|
117
|
+
* dialog can be from 0 to \ref imVideoCaptureDialogCount. \n
|
118
|
+
* Returns zero if failed.
|
119
|
+
*
|
120
|
+
* \verbatim vc:ShowDialog(dialog: number, parent: userdata) -> error: number [in Lua 5] \endverbatim
|
121
|
+
* \ingroup capture */
|
122
|
+
int IM_DECL imVideoCaptureShowDialog(imVideoCapture* vc, int dialog, void* parent);
|
123
|
+
|
124
|
+
/** Allows to control the input and output of devices that have multiple input and outputs.
|
125
|
+
* cross controls in which stage the input/output will be set. Usually use 1, but some capture boards
|
126
|
+
* has a second stage. In Direct X it controls the crossbars.
|
127
|
+
*
|
128
|
+
* \verbatim vc:SetInOut(input, output, cross: number) -> error: number [in Lua 5] \endverbatim
|
129
|
+
* \ingroup capture */
|
130
|
+
int imVideoCaptureSetInOut(imVideoCapture* vc, int input, int output, int cross);
|
131
|
+
|
132
|
+
/** Returns the description of a configuration dialog.
|
133
|
+
* dialog can be from 0 to \ref imVideoCaptureDialogCount. \n
|
134
|
+
*
|
135
|
+
* \verbatim vc:DialogDesc(dialog: number) -> desc: string [in Lua 5] \endverbatim
|
136
|
+
* \ingroup capture */
|
137
|
+
const char* IM_DECL imVideoCaptureDialogDesc(imVideoCapture* vc, int dialog);
|
138
|
+
|
139
|
+
/** Returns the number of available video formats. \n
|
140
|
+
* Returns zero if failed.
|
141
|
+
*
|
142
|
+
* \verbatim vc:FormatCount() -> error: number [in Lua 5] \endverbatim
|
143
|
+
* \ingroup capture */
|
144
|
+
int IM_DECL imVideoCaptureFormatCount(imVideoCapture* vc);
|
145
|
+
|
146
|
+
/** Returns information about the video format. \n
|
147
|
+
* format can be from 0 to \ref imVideoCaptureFormatCount. \n
|
148
|
+
* desc should be of size 10. \n
|
149
|
+
* The image size is usually the maximum size for that format.
|
150
|
+
* Other sizes can be available using \ref imVideoCaptureSetImageSize. \n
|
151
|
+
* Returns zero if failed.
|
152
|
+
*
|
153
|
+
* \verbatim vc:GetFormat(format: number) -> error: number, width: number, height: number, desc: string [in Lua 5] \endverbatim
|
154
|
+
* \ingroup capture */
|
155
|
+
int IM_DECL imVideoCaptureGetFormat(imVideoCapture* vc, int format, int *width, int *height, char* desc);
|
156
|
+
|
157
|
+
/** Changes the video format of the connected device. \n
|
158
|
+
* Should NOT work for DV devices. Use \ref imVideoCaptureSetImageSize only. \n
|
159
|
+
* Use -1 to return the current format, in this case returns -1 if failed. \n
|
160
|
+
* When the format is changed in the dialog, for some formats
|
161
|
+
* the returned format is the preferred format, not the current format. \n
|
162
|
+
* This will not affect color_mode of the capture image. \n
|
163
|
+
* Returns zero if failed.
|
164
|
+
*
|
165
|
+
* \verbatim vc:SetFormat(format: number) -> error: number [in Lua 5] \endverbatim
|
166
|
+
* \ingroup capture */
|
167
|
+
int IM_DECL imVideoCaptureSetFormat(imVideoCapture* vc, int format);
|
168
|
+
|
169
|
+
/** Returns the current image size of the connected device. \n
|
170
|
+
* width and height returns 0 if not connected.
|
171
|
+
*
|
172
|
+
* \verbatim vc:GetImageSize() -> width: number, height: number [in Lua 5] \endverbatim
|
173
|
+
* \ingroup capture */
|
174
|
+
void IM_DECL imVideoCaptureGetImageSize(imVideoCapture* vc, int *width, int *height);
|
175
|
+
|
176
|
+
/** Changes the image size of the connected device. \n
|
177
|
+
* Similar to \ref imVideoCaptureSetFormat, but changes only the size. \n
|
178
|
+
* Valid sizes can be obtained with \ref imVideoCaptureGetFormat. \n
|
179
|
+
* Returns zero if failed.
|
180
|
+
*
|
181
|
+
* \verbatim vc:SetImageSize(width: number, height: number) -> error: number [in Lua 5] \endverbatim
|
182
|
+
* \ingroup capture */
|
183
|
+
int IM_DECL imVideoCaptureSetImageSize(imVideoCapture* vc, int width, int height);
|
184
|
+
|
185
|
+
/** Returns a new captured frame. Use -1 for infinite timeout. \n
|
186
|
+
* Color space can be IM_RGB or IM_GRAY, and mode can be packed (IM_PACKED) or not. \n
|
187
|
+
* Data type is always IM_BYTE. \n
|
188
|
+
* It can not have an alpha channel and orientation is always bottom up. \n
|
189
|
+
* Returns zero if failed or timeout expired, the buffer is not changed.
|
190
|
+
*
|
191
|
+
* \verbatim vc:Frame(image: imImage, timeout: number) -> error: number [in Lua 5] \endverbatim
|
192
|
+
* \ingroup capture */
|
193
|
+
int IM_DECL imVideoCaptureFrame(imVideoCapture* vc, unsigned char* data, int color_mode, int timeout);
|
194
|
+
|
195
|
+
/** Start capturing, returns the new captured frame and stop capturing. \n
|
196
|
+
* This is more usefull if you are switching between devices. \n
|
197
|
+
* Data format is the same as imVideoCaptureFrame. \n
|
198
|
+
* Returns zero if failed.
|
199
|
+
*
|
200
|
+
* \verbatim vc:OneFrame(image: imImage) -> error: number [in Lua 5] \endverbatim
|
201
|
+
* \ingroup capture */
|
202
|
+
int IM_DECL imVideoCaptureOneFrame(imVideoCapture* vc, unsigned char* data, int color_mode);
|
203
|
+
|
204
|
+
/** Start capturing. \n
|
205
|
+
* Use -1 to return the current state. \n
|
206
|
+
* Returns zero if failed.
|
207
|
+
*
|
208
|
+
* \verbatim vc:Live(live: number) -> error: number [in Lua 5] \endverbatim
|
209
|
+
* \ingroup capture */
|
210
|
+
int IM_DECL imVideoCaptureLive(imVideoCapture* vc, int live);
|
211
|
+
|
212
|
+
/** Resets a camera or video attribute to the default value or
|
213
|
+
* to the automatic setting. \n
|
214
|
+
* Not all attributes support automatic modes. \n
|
215
|
+
* Returns zero if failed.
|
216
|
+
*
|
217
|
+
* \verbatim vc:ResetAttribute(attrib: string, fauto: number) -> error: number [in Lua 5] \endverbatim
|
218
|
+
* \ingroup capture */
|
219
|
+
int IM_DECL imVideoCaptureResetAttribute(imVideoCapture* vc, const char* attrib, int fauto);
|
220
|
+
|
221
|
+
/** Returns a camera or video attribute in percentage of the valid range value. \n
|
222
|
+
* Returns zero if failed or attribute not supported.
|
223
|
+
*
|
224
|
+
* \verbatim vc:GetAttribute(attrib: string) -> error: number, percent: number [in Lua 5] \endverbatim
|
225
|
+
* \ingroup capture */
|
226
|
+
int IM_DECL imVideoCaptureGetAttribute(imVideoCapture* vc, const char* attrib, float *percent);
|
227
|
+
|
228
|
+
/** Changes a camera or video attribute in percentage of the valid range value. \n
|
229
|
+
* Returns zero if failed or attribute not supported.
|
230
|
+
*
|
231
|
+
* \verbatim vc:SetAttribute(attrib: string, percent: number) -> error: number [in Lua 5] \endverbatim
|
232
|
+
* \ingroup capture */
|
233
|
+
int IM_DECL imVideoCaptureSetAttribute(imVideoCapture* vc, const char* attrib, float percent);
|
234
|
+
|
235
|
+
/** Returns a list of the description of the valid attributes for the device class. \n
|
236
|
+
* But each device may still not support some of the returned attributes. \n
|
237
|
+
* Use the return value of \ref imVideoCaptureGetAttribute to check if the attribute is supported.
|
238
|
+
*
|
239
|
+
* \verbatim vc:GetAttributeList() -> attrib_list: table of strings [in Lua 5] \endverbatim
|
240
|
+
* \ingroup capture */
|
241
|
+
const char** IM_DECL imVideoCaptureGetAttributeList(imVideoCapture* vc, int *num_attrib);
|
242
|
+
|
243
|
+
|
244
|
+
/** \defgroup winattrib Windows Attributes Names
|
245
|
+
* Not all attributes are supported by each device.
|
246
|
+
* Use the return value of \ref imVideoCaptureGetAttribute to check if the attribute is supported.
|
247
|
+
\verbatim
|
248
|
+
VideoBrightness - Specifies the brightness, also called the black level.
|
249
|
+
VideoContrast - Specifies the contrast, expressed as gain factor.
|
250
|
+
VideoHue - Specifies the hue angle.
|
251
|
+
VideoSaturation - Specifies the saturation.
|
252
|
+
VideoSharpness - Specifies the sharpness.
|
253
|
+
VideoGamma - Specifies the gamma.
|
254
|
+
VideoColorEnable - Specifies the color enable setting. (0/100)
|
255
|
+
VideoWhiteBalance - Specifies the white balance, as a color temperature in degrees Kelvin.
|
256
|
+
VideoBacklightCompensation - Specifies the backlight compensation setting. (0/100)
|
257
|
+
VideoGain - Specifies the gain adjustment.
|
258
|
+
CameraPanAngle - Specifies the camera's pan angle. To 100 rotate right, To 0 rotate left (view from above).
|
259
|
+
CameraTiltAngle - Specifies the camera's tilt angle. To 100 rotate up, To 0 rotate down.
|
260
|
+
CameraRollAngle - Specifies the camera's roll angle. To 100 rotate right, To 0 rotate left.
|
261
|
+
CameraLensZoom - Specifies the camera's zoom setting.
|
262
|
+
CameraExposure - Specifies the exposure setting.
|
263
|
+
CameraIris - Specifies the camera's iris setting.
|
264
|
+
CameraFocus - Specifies the camera's focus setting, as the distance to the optimally focused target.
|
265
|
+
FlipHorizontal - Specifies the video will be flipped in the horizontal direction.
|
266
|
+
FlipVertical - Specifies the video will be flipped in the vertical direction.
|
267
|
+
AnalogFormat - Specifies the video format standard NTSC, PAL, etc. Valid values:
|
268
|
+
NTSC_M = 0
|
269
|
+
NTSC_M_J = 1
|
270
|
+
NTSC_433 = 2
|
271
|
+
PAL_B = 3
|
272
|
+
PAL_D = 4
|
273
|
+
PAL_H = 5
|
274
|
+
PAL_I = 6
|
275
|
+
PAL_M = 7
|
276
|
+
PAL_N = 8
|
277
|
+
PAL_60 = 9
|
278
|
+
SECAM_B = 10
|
279
|
+
SECAM_D = 11
|
280
|
+
SECAM_G = 12
|
281
|
+
SECAM_H = 13
|
282
|
+
SECAM_K = 14
|
283
|
+
SECAM_K1 = 15
|
284
|
+
SECAM_L = 16
|
285
|
+
SECAM_L1 = 17
|
286
|
+
PAL_N_COMBO = 18
|
287
|
+
\endverbatim
|
288
|
+
* \ingroup capture */
|
289
|
+
|
290
|
+
|
291
|
+
#if defined(__cplusplus)
|
292
|
+
}
|
293
|
+
|
294
|
+
/** A C++ Wrapper for the imVideoCapture structure functions.
|
295
|
+
* \ingroup capture */
|
296
|
+
class imCapture
|
297
|
+
{
|
298
|
+
public:
|
299
|
+
imCapture()
|
300
|
+
{ vc = imVideoCaptureCreate(); }
|
301
|
+
|
302
|
+
~imCapture()
|
303
|
+
{ if (vc) imVideoCaptureDestroy(vc); }
|
304
|
+
|
305
|
+
int Failed()
|
306
|
+
{ if (!vc) return 0; else return 1; }
|
307
|
+
|
308
|
+
int Connect(int device)
|
309
|
+
{ return imVideoCaptureConnect(vc, device); }
|
310
|
+
|
311
|
+
void Disconnect()
|
312
|
+
{ imVideoCaptureDisconnect(vc); }
|
313
|
+
|
314
|
+
int DialogCount()
|
315
|
+
{ return imVideoCaptureDialogCount(vc); }
|
316
|
+
|
317
|
+
int ShowDialog(int dialog, void* parent)
|
318
|
+
{ return imVideoCaptureShowDialog(vc, dialog, parent); }
|
319
|
+
|
320
|
+
const char* DialogDescription(int dialog)
|
321
|
+
{ return imVideoCaptureDialogDesc(vc, dialog); }
|
322
|
+
|
323
|
+
int FormatCount()
|
324
|
+
{ return imVideoCaptureFormatCount(vc); }
|
325
|
+
|
326
|
+
int GetFormat(int format, int *width, int *height, char* desc)
|
327
|
+
{ return imVideoCaptureGetFormat(vc, format, width, height, desc); }
|
328
|
+
|
329
|
+
int SetFormat(int format)
|
330
|
+
{ return imVideoCaptureSetFormat(vc, format); }
|
331
|
+
|
332
|
+
void GetImageSize(int *width, int *height)
|
333
|
+
{ imVideoCaptureGetImageSize(vc, width, height); }
|
334
|
+
|
335
|
+
int SetImageSize(int width, int height)
|
336
|
+
{ return imVideoCaptureSetImageSize(vc, width, height); }
|
337
|
+
|
338
|
+
int GetFrame(unsigned char* data, int color_mode, int timeout)
|
339
|
+
{ return imVideoCaptureFrame(vc, data, color_mode, timeout); }
|
340
|
+
|
341
|
+
int GetOneFrame(unsigned char* data, int color_mode)
|
342
|
+
{ return imVideoCaptureOneFrame(vc, data, color_mode); }
|
343
|
+
|
344
|
+
int Live(int live)
|
345
|
+
{ return imVideoCaptureLive(vc, live); }
|
346
|
+
|
347
|
+
int ResetAttribute(const char* attrib, int fauto)
|
348
|
+
{ return imVideoCaptureResetAttribute(vc, attrib, fauto); }
|
349
|
+
|
350
|
+
int GetAttribute(const char* attrib, float *percent)
|
351
|
+
{ return imVideoCaptureGetAttribute(vc, attrib, percent); }
|
352
|
+
|
353
|
+
int SetAttribute(const char* attrib, float percent)
|
354
|
+
{ return imVideoCaptureSetAttribute(vc, attrib, percent); }
|
355
|
+
|
356
|
+
const char** GetAttributeList(int *num_attrib)
|
357
|
+
{ return imVideoCaptureGetAttributeList(vc, num_attrib); }
|
358
|
+
|
359
|
+
protected:
|
360
|
+
imVideoCapture* vc;
|
361
|
+
};
|
362
|
+
|
363
|
+
#endif
|
364
|
+
|
365
|
+
#endif
|