发新话题
打印

c#.NET-自己编写的摄像头控制类

正好需要

TOP

顶我顶呀顶呀

我顶先:),我逛顶我逛顶啊

TOP

asdfasdf

TOP

aaaaaa

TOP

sdf

sdfsdfsdf

TOP

W

EWEE

TOP

thanks

xuyao

TOP

版主啊!可不可以给我份摄像头控制类的源码啊

本人找这代码N久了啊今天终于看到了!我准备做一个视频聊天室程序

TOP

我的E-mail:xudongloveme@163.com

TOP

好啊,政要学习哪

TOP

ddf

ddfdfsdff

TOP

我要侃·····

TOP

eerewdfwdw

TOP

private   bool   CreateImage(string   Path)     
  {   
   
  int   w   =   0;   
  int   h   =   0;   
   
  try     
  {   
  w   =   int.Parse(   Request.Form["W"]   );   
  h   =   int.Parse(   Request.Form["H"]   );   
  }   
  catch(Exception   ee)     
  {   
  return   false;   
  }   
   
  Bitmap   newmap   =   new   Bitmap(w,h);   
  int   rows   =   0;   
  int   cols   =   0;   
   
  Graphics   gp   =   Graphics.FromImage(newmap);   
  gp.Clear(Color.White);   
  ImageCodecInfo   myImageCodecInfo;   
  System.Drawing.Imaging.Encoder   myEncoder;   
  EncoderParameter   myEncoderParameter;   
  EncoderParameters   myEncoderParameters;   
  myImageCodecInfo   =   ImageCodecInfo.GetImageEncoders()[1];   
  myEncoder   =   System.Drawing.Imaging.Encoder.Quality;   
  myEncoderParameters   =   new   EncoderParameters(1);   
  myEncoderParameter   =   new   EncoderParameter(myEncoder,   95L);   
  myEncoderParameters.Param[0]   =   myEncoderParameter;   
   
  gp.CompositingQuality   =   CompositingQuality.HighQuality;     
  gp.SmoothingMode   =   SmoothingMode.HighQuality;     
  gp.InterpolationMode   =   InterpolationMode.HighQualityBicubic;     
  gp.TextRenderingHint   =   TextRenderingHint.ClearTypeGridFit;   
  for   (rows   =   0;   rows   <   newmap.Height;   rows++)   //循环图片高度   
  {   
  string   px   =   Request["PX"   +   rows   ]   ;   
  string[]   c_row   =   px.Split(',');   
  for   (cols   =   0;   cols   <   newmap.Width;   cols++)   //循环图片宽度   
  {   
   
  string   values   =   c_row[cols];   
  if   (   values   !=   ""   &&   values!=null   )     
  {   
  string   hex   =   values;   
  while   (   hex.Length   <   6   )   { //防止颜色丢失   
  hex   =   "0"   +   hex;     
  }     
   
  int   r   =   int.Parse(hex.Substring(0,2),System.Globalization.NumberStyles.HexNumber);   
  int   g   =   int.Parse(hex.Substring(2,2),System.Globalization.NumberStyles.HexNumber);   
  int   b   =   int.Parse(hex.Substring(4,2),System.Globalization.NumberStyles.HexNumber);   
   
  newmap.SetPixel(   cols,rows,Color.FromArgb(r,g,b)   );   
   
  }   
  }   
  }   
   
  gp.DrawImage(newmap,   0,   0,   w,h);   
   
  //保存路径,修改这里   
  newmap.Save(   Path,myImageCodecInfo,   myEncoderParameters   );   
  myEncoderParameters.Dispose();   
  gp.Dispose();   
  newmap.Dispose();   
   
  return   true;   
  }   我喜欢

TOP

^_^

^_^

TOP

3q

感谢分享

TOP

发新话题