DevIL.NET 1.1 !
I’ve released DevIL.NET 1.1.
It’s a small update for a small library
Included in this version :
- Fixed a bad bug when loading non true color images (above all GIFs)
- Implemented a new LoadBitmapAndScale which allows for the bitmap to be scaled directly in DevIL.NET
- Started to implement some error handling…
- note: From version 1.1, DevIL.NET may require ILU.dll to be installed in addition to DevIL.DLL. Since having an additional DLL is always a burden, ILU.dll is loaded dinamically and it’s not required unless the scale/resize feature is used
Also the Visual C++ project is available for download now.
update:I’ve found a small bug in the LoadAndScale function (the filter setting is set after the scaling which is kinda stupid… Will be fixed later today
update 2:Bug fixed! ![]()
Code Snippet I : Wrapper for CLR string to native string marshalling
A frequent (too much frequent) need in Managed C++ is going from System::String objects to char* or wchar_t* strings. The boring side of the marshalling is that the memory allocated with the StringToHGlobalxxx functions should be freed with a matching call to FreeHGlobal.
The solution is simple : using the power of C++ destructors we can create a temporary object for the entire time we need the string. Whenever the object goes out of scope, the string is automagically freed.
You can find the code (released to public domain) here.
Please note that assignments (and copy-constructor) are disabled (they are in an empty private method) to preserve the destruction safety (the free is thus execute once and only once).
As an example you can do :
void mystrcpy(char* dest, const System::String __gc* source)
{
strcpy(dest, StringAutoMarshal(source));
}
with no need to manage the marshalling manually.
Another free book on the shelf
You can get a free copy of “.NET in Samples” ebook here.
The samples are all in C#, but I think the book can be useful for anyone using any .NET language.
Image Library for .NET
I’ve written a small wrap around the DevIL image library .
It allows any .NET program (VB.NET, C#, etc) to open and save files in all formats supported by the DevIL library (most notably it can open PSD, PSP, TGA and DDS - yes it can directly open Photoshop files ;)). Also it opens them as System.Drawing.Bitmap objects, so that it works optimally with existing code.
Also it is very simple to use.
UPDATE :
Minor bugfix, and uploaded samples of C# and VB.NET code
