예제 #1
0
파일: ui_lua.cpp 프로젝트: rikus--/Epiar
/** \brief Change the Image in a Picture Widget
 *
 */
int UI_Lua::setPicture(lua_State *L){
	int n = lua_gettop(L);  // Number of arguments
	if (n == 2){
		Picture* pic = (Picture*)checkWidget(L,1);
		luaL_argcheck(L, pic->GetMask() & WIDGET_PICTURE, 1, "`Picture' expected.");
		string picname = luaL_checkstring (L, 2);
		pic->Set( picname );
	
	} else {
		luaL_error(L, "Got %d arguments expected 2 (self, picname)", n);
	}
	return 0;
}
예제 #2
0
파일: ui_lua.cpp 프로젝트: rikus--/Epiar
/** \brief Rotate a Picture Widget
 *
 */
int UI_Lua::rotatePicture(lua_State *L){
	int n = lua_gettop(L);  // Number of arguments
	if (n != 2)
		return luaL_error(L, "Got %d arguments expected 2 (self, angle )", n);

	Picture* pic = (Picture*)checkWidget(L,1);
	luaL_argcheck(L, pic->GetMask() & WIDGET_PICTURE, 1, "`Picture' expected.");

	double angle = luaL_checknumber (L, 2);

	pic->Rotate(angle);

	return 1;
}
예제 #3
0
파일: ui_lua.cpp 프로젝트: rikus--/Epiar
/** \brief Change the Background of a Picture Widget
 *
 */
int UI_Lua::setBackground(lua_State *L){
	int n = lua_gettop(L);  // Number of arguments
	if ((n == 4) || (n == 5)){
		Picture* pic = (Picture*)checkWidget(L,1);
		luaL_argcheck(L, pic->GetMask() & WIDGET_PICTURE, 1, "`Picture' expected.");

		float r = luaL_checknumber (L, 2);
		float g = luaL_checknumber (L, 3);
		float b = luaL_checknumber (L, 4);
		float a = pic->GetAlpha();
		if( n == 5 ) {
			a = luaL_checknumber (L, 5);
		}

		pic->SetColor( r, g, b, a );
	
	} else {
		luaL_error(L, "Got %d arguments expected 2 (self, picname)", n);
	}
	return 0;
}