Equivalent of BufferedImage from Java to C#
12,232
Solution 1
System.Drawing.Bitmap
is the closest I can think of.
Solution 2
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.
Author by
Bosco
Updated on June 23, 2022Comments
-
Bosco almost 2 years
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.2898*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;
-
Marc Gravell over 13 years@Bosco do you have a reference to
System.Drawing.dll
? (note you shouldn't use this from a web app)