Hi,

I noticed that the second method of wxImage::GetAlpha() is missing. AFAICS wxLua
only has the first one. So I've quickly adapted this for wxLua. Here's the code 
in
case you want to merge this with the official branch:

This goes to bindings/wxwidgets/wxcore_image.i:

    // %override [Lua string] wxImage::GetAlpha() const;
    // C++ Func: unsigned char* GetAlpha() const;
    %override_name wxLua_wxImage_GetAlphaData unsigned char* GetAlpha() const;
       

And this goes to bindings/wxwidgets/wxcore_override.hpp:

%override wxLua_wxImage_GetAlphaData
//     unsigned char* GetAlpha() const
static int LUACALL wxLua_wxImage_GetAlphaData(lua_State *L)
{
    // get this
    wxImage * self = (wxImage *)wxluaT_getuserdatatype(L, 1, wxluatype_wxImage);
    // call GetAlpha
    char* returns = (char*)self->GetAlpha();
    
    if(returns) {
        // push the result pointer
        lua_pushlstring(L, returns, self->GetWidth()*self->GetHeight());
    } else {
        wxluaT_pushuserdatatype(L, NULL, wxluatype_NULL, true, true);
    }
        
    return 1;
}
%end

I'm not sure if the wxluatype_NULL return is consistent with wxLua's standard. 
What is the function expected to return if wxImage::GetAlpha() returns NULL?
Currently it returns wx.NULL but of course it could also be made to return NIL,
an empty string, or even nothing here.... not sure how wxLua is supposed to
behave in this case.

-- 
Best regards,
 Andreas Falkenhahn                          mailto:andr...@falkenhahn.com


------------------------------------------------------------------------------
Get 100% visibility into Java/.NET code with AppDynamics Lite!
It's a free troubleshooting tool designed for production.
Get down to code-level detail for bottlenecks, with <2% overhead. 
Download for free and get started troubleshooting in minutes. 
http://pubads.g.doubleclick.net/gampad/clk?id=48897031&iu=/4140/ostg.clktrk
_______________________________________________
wxlua-users mailing list
wxlua-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/wxlua-users

Reply via email to