I'm using IKVM Libraries in my C# project. I can define a BufferedImage using these libraries, Also I can use a Bitmap as BufferedImage source, but there is a problem;
java.awt.image.BufferedImage fileZ =new java.awt.image.BufferedImage(new Bitmap(file));
Here is the Error:
An exception of type 'System.TypeInitializationException' occurred in IKVM.OpenJDK.SwingAWT.dll but was not handled in user code
Additional information: The type initializer for 'java.awt.image.ColorModel' threw an exception.
file is a string refers to a bitmap file. and I have added these references to my project:
IKVM.OpenJDK.Core
IKVM.OpenJDK.SwingAWT
IKVM.OpenJDK.Util
IKVM.Runtime
How can I solve this issue?
Your question does not have sufficient information to answer. However, this post is related to related to your task. Of particular interest is this line:
BufferedImage img = new BufferedImage(10, 10, BufferedImage.TYPE_INT_RGB);
The last parameter specifies image type.
Also other constructors in the BufferedImage class deals with color models. Check them out.