romantic_boy
New member
- Joined
- Jul 6, 2005
- Messages
- 1
I need to convert the picture on the panel to bytes.
I did that but it works only for the backgroungimage of a panel.
in my program I use 3ds max to draw on the panel
I need to convert the picture on the panel to bytes
this is the function I use to get the bytes of the backgroungimage of the panel
private void fun()
{
pna1.BackgroundImage.Save("m"); //m is the name of the file
bm = new Bitmap("m");
//the size of the panel is 240*160
byte [,] matrix= new byte [240,160];
byte red=0, green=0, blue=0;
byte [] test=new byte [1];
for (int y=0; y < 160; y++)
{
for (int x =0; x < 240; x++)
{
Color u=bm.GetPixel (x ,y);
//I need only one byte represent each pixel
blue = (byte)(u.B/64*64);
green = (byte)(u.G/32*8);
red =(byte)(u.R/32);
matrix[x,y]=(byte)(red + green + blue);
}
}
}
I did that but it works only for the backgroungimage of a panel.
in my program I use 3ds max to draw on the panel
I need to convert the picture on the panel to bytes
this is the function I use to get the bytes of the backgroungimage of the panel
private void fun()
{
pna1.BackgroundImage.Save("m"); //m is the name of the file
bm = new Bitmap("m");
//the size of the panel is 240*160
byte [,] matrix= new byte [240,160];
byte red=0, green=0, blue=0;
byte [] test=new byte [1];
for (int y=0; y < 160; y++)
{
for (int x =0; x < 240; x++)
{
Color u=bm.GetPixel (x ,y);
//I need only one byte represent each pixel
blue = (byte)(u.B/64*64);
green = (byte)(u.G/32*8);
red =(byte)(u.R/32);
matrix[x,y]=(byte)(red + green + blue);
}
}
}