add: gamma settings in crereader

This commit is contained in:
Qingping Hou
2012-04-06 19:30:10 +08:00
parent a5a5c477ac
commit 9650a4a057
2 changed files with 41 additions and 0 deletions

18
cre.cpp
View File

@@ -57,9 +57,25 @@ static int openDocument(lua_State *L) {
doc->text_view->LoadDocument(file_name);
doc->text_view->Render();
printf("gamma: %d\n", fontMan->GetGammaIndex());
return 1;
}
static int getGammaIndex(lua_State *L) {
lua_pushinteger(L, fontMan->GetGammaIndex());
return 1;
}
static int setGammaIndex(lua_State *L) {
int index = luaL_checkint(L, 1);
fontMan->SetGammaIndex(index);
return 0;
}
static int closeDocument(lua_State *L) {
CreDocument *doc = (CreDocument*) luaL_checkudata(L, 1, "credocument");
delete doc->text_view;
@@ -284,6 +300,8 @@ static int drawCurrentPage(lua_State *L) {
static const struct luaL_Reg cre_func[] = {
{"openDocument", openDocument},
{"getFontFaces", getFontFaces},
{"getGammaIndex", getGammaIndex},
{"setGammaIndex", setGammaIndex},
{NULL, NULL}
};