wxIScan
wxiscanluascript.h
Go to the documentation of this file.
00001 /***************************************************************
00002  * Name:      wxiscanluascript.h
00003  * Purpose:   Provides access to a lot of wxIScan functions
00004  *            to the Lua language.
00005  * Author:    Daniel Nell (daniel.nell@nellresearch.de)
00006  * Created:   2012-02-03
00007  * Copyright: Daniel Nell (www.nellresearch.de)
00008  * License:   GPL
00009  **************************************************************/
00010 
00011 #ifndef WXISCANLUASCRIPT_H
00012 #define WXISCANLUASCRIPT_H
00013 
00014 // Private header files.
00015 #if __WXLUASCRIPT__
00016 #   include "wxluascript.h"
00017 #endif // __WXLUASCRIPT__
00018 
00019 
00020 //////////////////////////////////////////////////////////
00021 // Predefined classes
00022 //
00023 #if __WXLUASCRIPT__
00024 struct lua_State;
00025 #endif // __WXLUASCRIPT__
00026 
00027 
00028 #if __WXLUASCRIPT__
00029 /////////////////////////////////////////////////////////////////////////////
00030 //  Class wxIScanLuaScript
00031 //
00032 /// \brief An extended class to handle Lua scripting.
00033 ///
00034 /// wxIScanLuaScript is a friend class to the frame window class
00035 /// wxIScanFrame an is intended to control the frame window
00036 /// remotely.
00037 class wxIScanLuaScript : public wxLuaScript
00038 {
00039   public:
00040     /// \brief Standard constructor.
00041     ///
00042     /// \param strScript            The Lua source code of the script to execute.
00043     ///                             Default is the empty string.
00044     /// \param poParent             a pointer to the parent event handler (mostly
00045     ///                             a window), may be NULL
00046     /// \param strDomain            ...
00047     ///                             Default is the empty string.
00048     /// \param pbParentState        a pointer to a boolean to get the error state,
00049     ///                             may be NULL
00050     wxIScanLuaScript( const wxString& strScript= wxEmptyString, wxEvtHandler *poParent= NULL,
00051                       const wxString& strDomain= wxEmptyString, bool *pbParentState= NULL );
00052 
00053   private:
00054     // Addtional Lua functions.
00055     /// \brief Do OCR on the loaded/scanned image and return the text (to Lua).
00056     ///
00057     /// \param L      a pointer to the Lua context.
00058     static int OCR( lua_State* L );
00059 
00060     /// \brief Open an image file in Lua using a given name.
00061     ///
00062     /// \param L      a pointer to the Lua context.
00063     static int OpenImage( lua_State* L );
00064 
00065     /// \brief Save an image file in Lua using a given name.
00066     ///
00067     /// \param L      a pointer to the Lua context.
00068     static int SaveImage( lua_State* L );
00069 
00070     /// \brief Copy a given text to the clipboard in Lua.
00071     ///
00072     /// \param L      a pointer to the Lua context.
00073     static int CopyText2Clipboard( lua_State* L );
00074 
00075     /// \brief Replace the program's image by its monochrome version.
00076     ///
00077     /// \param L      a pointer to the Lua context.
00078     static int Image2Mono( lua_State* L );
00079 
00080     /// \brief Replace the program's image by its greyscale version.
00081     ///
00082     /// \param L      a pointer to the Lua context.
00083     static int Image2Grey( lua_State* L );
00084 
00085     /// \brief Replace the program's image by its cropped version.
00086     ///
00087     /// \param L      a pointer to the Lua context.
00088     static int CropImage( lua_State* L );
00089 
00090     /// \brief Replace the program's image by a new version that is colour enhenced.
00091     ///
00092     /// \param L      a pointer to the Lua context.
00093     static int EnhenceColours( lua_State* L );
00094 
00095     /// \brief Replace white colour by yellow.
00096     ///
00097     /// \param L      a pointer to the Lua context.
00098     static int EnhenceOpticalContrast( lua_State* L );
00099 
00100     /// \brief (Fine) Rotate an image by a given angle.
00101     ///
00102     /// \param L      a pointer to the Lua context.
00103     static int RotateImage( lua_State* L );
00104 
00105     /// \brief Rotate an image by a given angle by 90 degrees.
00106     ///
00107     /// \param L      a pointer to the Lua context.
00108     static int RotateImage90( lua_State* L );
00109 
00110     /// \brief Resize an image to the given size.
00111     ///
00112     /// \param L      a pointer to the Lua context.
00113     static int ResizeImage( lua_State* L );
00114 
00115     /// \brief Fork an external process.
00116     ///
00117     /// \param L      a pointer to the Lua context.
00118     static int Execute( lua_State* L );
00119 
00120     /// \brief Set the filename of the image to "unknown.XXX".
00121     ///
00122     /// \param L      a pointer to the Lua context.
00123     static int ResetFileName( lua_State* L );
00124 };
00125 #endif // __WXLUASCRIPT__
00126 
00127 #endif // WXISCANHOCR2PDF_H