sovr610 / luainterface

Automatically exported from code.google.com/p/luainterface
1 stars 0 forks source link

The Bitmap overload Bitmap(Int32,Inte32) returns a .Net exception #57

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
1. Using the Lua command line interpreter type require("CLRForm")
2. type: b = Bitman(100,100) -- any integer values can be tried.
3.

What is the expected output? What do you see instead?
print(b) should return System.Drawing.Bitmap. Instead I get A .Net exception 
has occured in user-code

What version of the product are you using? On what operating system?
LuaInterface_2.0.3.7z

Please provide any additional information below.
All other overloads of the System.Drawing.Bitmap seem to be working properly. 
In particular, I have had no problems with Bitmap(System.String).

Original issue reported on code.google.com by anaris...@gmail.com on 12 Feb 2013 at 9:06

GoogleCodeExporter commented 9 years ago
I am sorry. From what I entered above it would seem that the .Net exception 
occurs when I enter print(b). That is not what I meant. The net exception 
occurs when I enter b = Bitmap(100,100)

Original comment by anaris...@gmail.com on 12 Feb 2013 at 9:17

GoogleCodeExporter commented 9 years ago
I've gotten around the problem by using the following overload:

bitmap = Bitmap( int32, Int32, graphics_context )

The graphics_context (the graphics object for the target control) is used by 
the constructor to extract the resolution for the bitmap. When the failing 
overload is used the constructor uses a default resolution.
I suspect that when Luainterface constructs the proxy for this call, it passes 
garbage as a 3rd parameter to the constructor rather than just the two Int32 
parameters.

Original comment by anaris...@gmail.com on 3 Mar 2013 at 4:11