Equivalent of BufferedImage from Java to C#
I am trying to convert a Java program to C# and I don't know the equivalent of BufferedImage from Java to C#...
Code from Java:
public static String ActiveContour(int x11, int x22, int y11, int y22, BufferedImage bufIm, int contor)
{
double [][] img=new double[bufIm.getHeight()][bufIm.getWidth()];
double [][] imgf=new double[bufIm.getHeight()][bufIm.getWidth()];
w=bufIm.getWidth();
h=bufIm.getHeight();
for(int i=0;i<h;i++)
for(int j=0;j<w;j++)
{
img[i][j]=bufIm.getRGB(j, i);
c = new Color((int)img[i][j]);
img[i][j]= 0.28开发者_Python百科98*c.getRed() + 0.5870*c.getGreen() + 0.1140*c.getBlue();
}
Am I missing a statement?
using System...;
because in Java I have
import java.awt.image.BufferedImage;
System.Drawing.Bitmap
is the closest I can think of.
What does this function do? Why bother with translating the code bit by bit when most probably there is another way achieving the same result using C# classes? In C# using System.Drawing.Bitmap is common practice but there are other ways depending on what the code is meant to be doing.
精彩评论