惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

Martin Fowler
Martin Fowler
D
DataBreaches.Net
Cyber Security Advisories - MS-ISAC
Cyber Security Advisories - MS-ISAC
The GitHub Blog
The GitHub Blog
Blog — PlanetScale
Blog — PlanetScale
Microsoft Security Blog
Microsoft Security Blog
A
About on SuperTechFans
Vercel News
Vercel News
L
LangChain Blog
B
Blog RSS Feed
Y
Y Combinator Blog
IT之家
IT之家
H
Hackread – Cybersecurity News, Data Breaches, AI and More
GbyAI
GbyAI
V
V2EX
博客园 - 三生石上(FineUI控件)
钛媒体:引领未来商业与生活新知
钛媒体:引领未来商业与生活新知
阮一峰的网络日志
阮一峰的网络日志
有赞技术团队
有赞技术团队
D
Docker
V
Visual Studio Blog
aimingoo的专栏
aimingoo的专栏
Last Week in AI
Last Week in AI
月光博客
月光博客

博客园 - 潇笑

抽筋的Delphi 可重用的定时任务实现 正则表达式性能问题 图片剪切板(文件上传)的实现 - 潇笑 - 博客园 asp.net下web控件点评 正则测试器&代码书签,更新.. (已更新!)正则测试器&代码书签,增强版 4.20更新 I-Favourite3.0提供下载 I-Favourite 截图,介绍.. I-Favourite2.0 Build (多用户多语言多种数据支持博客系统)正式版发布 角色权限,RBAC 发个小工具..正则表达示测试器 - 潇笑 - 博客园 QQ机器人,博客助手开通... MSN机器人 博客助手 for I-Favourite I-Favourite数据层,开源 I-Favourite2.0RC1 发布 I-favourite v2.0 Beta2 for sql server发布 同时支持多语言,多种数据库的多用博客提供下载 i-favourite 1.5 i-favourite 1.2正式版发布。。
asp.net中拍大头帖解决方案 (源码) - 潇笑 - 博客园
潇笑 · 2007-08-08 · via 博客园 - 潇笑

网上大多是php的,既然没人做,那我做一个分享了 。。。

流程..  flash 拍下照片后提交到指定的处理程序。
数据: width,height,  px+xxx
解析行列,填充每一个点阵数据。

//保存flash 提交过来的宽高值.并验定
        int width = 0;
        
int height = 0;

        
if (!int.TryParse(Request.Form["width"], out width) &&
         
!int.TryParse(Request.Form["height"], out  height))
        

            
throw new ApplicationException("照片格式不正确!");
        }


//定义bitmap ,宽,高,和格式
         Bitmap bmp = new Bitmap(width, height,System.Drawing.Imaging.PixelFormat.Format24bppRgb);

//宽*长 *3是因为每一点都需要rgb三种色值填充
         int iBytes = width * height * 3;
         
byte[] PixelValues = new byte[iBytes];
//当前位置
         int iPoint = 0;

 
for (int i = 0; i < height; i++)//填充每一行的色值
         {
             
string[] ss=Request.Form["px"+i].Split(','); //解析行数据分组
             for (int j = 0; j < width; j++)
             
{
                 
string values = ss[j];
                 
while (values.Length < 6)
                 
{
                     values 
= "0" + values; //位不足填充
                 }

                 
string s1, s2, s3;//获取RGB
                 s1 = values.Substring(02);
                 s2 
= values.Substring(22);
                 s3 
= values.Substring(42);
                 PixelValues[iPoint] 
= Convert.ToByte(Convert.ToInt32(s1,16));
                 PixelValues[iPoint
+1= Convert.ToByte(Convert.ToInt32(s2, 16));
                 PixelValues[iPoint
+2= Convert.ToByte(Convert.ToInt32(s3, 16));
                 
//设置点陈color
                  bmp.SetPixel(j, i, Color.FromArgb(PixelValues[iPoint], PixelValues[iPoint + 1], PixelValues[iPoint + 2]));
                 
                 iPoint 
+= 3;
             }

         }


 
//注意,目录一下要有权限,至少要有User和户修改权限
         string path=@"d:\test\"+DateTime.Now.ToFileTime()+".jpg";
         bmp.Save(path, ImageFormat.Jpeg);

//OK,这就是主要的处理流程

 压缩包中附说明源码,和flash源码

http://www.bfor.cn/download/MakePic.rar