Help with C Sharp

eww245

Member
Licensed User
I have written a Library to expose the IImagingFactory interface.

This works very well to load an image from a file, but I would rather use an imagelist.

Does a basic4ppc imagelist act as an embedded resource that could be loaded in the below example?

The MemoryStream would be loaded into a byte array and out to an IImage interface.

B4X:
MemoryStream strm = (MemoryStream)Assembly.GetExecutingAssembly().GetManifestResourceStream("Alpha.image.png");
 

agraham

Expert
Licensed User
Longtime User
That will only work for an optimised compiled application. I think the resource names are prefixed with "b4p", you will have to check with GetManifestResourceNames().

Isn't IImagingFactory a barely documented CE only COM interface? Bringing that into a .NET library looks deeply complicated to me :sign0188: I found this comment on the web about IImageFactory and IImage.
"The interfaces you are using have almost a one-to-one mapping with the System.Drawing.Image and System.Drawing.Bitmap classes. You might be ahead by using those classes instead of hacking COM."
 

eww245

Member
Licensed User
That will only work for an optimised compiled application. I think the resource names are prefixed with "b4p", you will have to check with GetManifestResourceNames().

Isn't IImagingFactory a barely documented CE only COM interface? Bringing that into a .NET library looks deeply complicated to me :sign0188: I found this comment on the web about IImageFactory and IImage.


There is not much documentation, what I found were examples in C and some C#
It is the only way i've gotten true transparency with b4p.

It looks like the resources are b4p.image.png but I am not very familiar with Reflection to get that info.
I've tried with GetManifestResourceNames().GetType().GetField("b4p").GetValue(image)
and many other combinations but always get null reference.

I think all that's needed is an image converted to byte[] then pass that with it's length.
Either through dzImage, the binary library or in this library.
Do you think any of these will work?

Both IImageFactory and IImage are from imaging.h in WM5 SDK

After the image is created it's drawn with IImage.Draw to a rectangle then to the form.

Here's the method i'm trying to use.

Any help is much appreciated.

B4X:
CreateImageFromBuffer([MarshalAs(UnmanagedType.LPArray)] byte[] buffer, uint size, BufferDisposalFlag disposalFlag, out IImage image);
 
Top