Re: [Patch] export image drawing routines to Lua

2009-04-16 Thread Uli Schlachter
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 Julien Danjou wrote: At 1239844131 time_t, Gregor Best wrote: +static int +luaA_image_draw_rectangle(lua_State *L) +{ +size_t len; +xcolor_t color; +image_t *image = luaL_checkudata(L, 1, image); +int x = luaL_checkint(L, 2);

Re: [Patch] export image drawing routines to Lua

2009-04-16 Thread Uli Schlachter
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 Julien Danjou wrote: At 1239871750 time_t, Uli Schlachter wrote: How bad would it be to add color objects to lua? They do xcolor_init_unchecked() when they are created and the xcolor_init_reply() can be delayed until they are actually used (or

Re: [Patch] export image drawing routines to Lua

2009-04-16 Thread Julien Danjou
At 1239871750 time_t, Uli Schlachter wrote: How bad would it be to add color objects to lua? They do xcolor_init_unchecked() when they are created and the xcolor_init_reply() can be delayed until they are actually used (or garbage collected). That way colors could be reused and we wouldn't

Re: [Patch] export image drawing routines to Lua

2009-04-16 Thread Julien Danjou
At 1239877236 time_t, Uli Schlachter wrote: Then... Simply limit the number of colors in the cache and kick out the oldest one if there is too few space available. The results wouldnt be much worse than what we have currently if a user uses many colors, but it would be much better if there

[Patch] export image drawing routines to Lua

2009-04-15 Thread Gregor Best
Hi people, the attached two patches export routines for drawing into image objects to Lua, so one can do things like this: img = image(nil, 20, 20) -- create an empty 20x20 image img:draw_rectangle(0,0,20,20,true,#FF) -- fill the image with white img:draw_circle(2,2,8,8,false,#00)