EgtExecutor 1.8g1 :
- aggiunta gestione immagini (inizialmente solo recupero dimensioni in pixel).
This commit is contained in:
@@ -0,0 +1,53 @@
|
||||
//----------------------------------------------------------------------------
|
||||
// EgalTech 2017-2017
|
||||
//----------------------------------------------------------------------------
|
||||
// File : LUA_Image.cpp Data : 05.07.17 Versione : 1.8g1
|
||||
// Contenuto : Funzioni sulle immagini per LUA.
|
||||
//
|
||||
//
|
||||
//
|
||||
// Modifiche : 05.07.17 DS Creazione modulo.
|
||||
//
|
||||
//
|
||||
//----------------------------------------------------------------------------
|
||||
|
||||
//--------------------------- Include ----------------------------------------
|
||||
#include "stdafx.h"
|
||||
#include "LUA.h"
|
||||
#include "/EgtDev/Include/EXeExecutor.h"
|
||||
#include "/EgtDev/Include/EGkLuaAux.h"
|
||||
#include "/EgtDev/Include/EgnStringUtils.h"
|
||||
|
||||
using namespace std ;
|
||||
|
||||
//-------------------------------------------------------------------------------
|
||||
static int
|
||||
LuaGetImagePixels( lua_State* L)
|
||||
{
|
||||
// 1 parametro : sFile
|
||||
string sFile ;
|
||||
LuaCheckParam( L, 1, sFile)
|
||||
LuaClearStack( L) ;
|
||||
// recupero la dimensione in pixels dell'immagine
|
||||
int nPixelX, nPixelY ;
|
||||
bool bOk = ExeGetImagePixels( sFile, nPixelX, nPixelY) ;
|
||||
// restituisco il risultato
|
||||
if ( bOk) {
|
||||
LuaSetParam( L, nPixelX) ;
|
||||
LuaSetParam( L, nPixelY) ;
|
||||
return 2 ;
|
||||
}
|
||||
else {
|
||||
LuaSetParam( L) ;
|
||||
return 1 ;
|
||||
}
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------------------
|
||||
bool
|
||||
LuaInstallImage( LuaMgr& luaMgr)
|
||||
{
|
||||
bool bOk = ( &luaMgr != nullptr) ;
|
||||
bOk = bOk && luaMgr.RegisterFunction( "EgtGetImagePixels", LuaGetImagePixels) ;
|
||||
return bOk ;
|
||||
}
|
||||
Reference in New Issue
Block a user