Asp.net top post solution (source code)

Source: Internet
Author: User
Most of the websites are php. Since no one has done it, I will share it...

Process .. flash takes a photo and submits it to the specified processing program.
Data: width, height, px + xxx
Parse rows and columns to fill in each dot matrix data.

// Save the width and height submitted by flash and verify the value
Int width = 0;
Int height = 0;

If (! Int. TryParse (Request. Form ["width"], out width )&&
! Int. TryParse (Request. Form ["height"], out height ))
{
Throw new ApplicationException ("the photo format is incorrect! ");
}

// Define bitmap, width, height, and format
Bitmap bmp = new Bitmap (width, height, System. Drawing. Imaging. PixelFormat. Format24bppRgb );

// The width * length * 3 is because each point requires three colors of rgb.
Int iBytes = width * height * 3;
Byte [] PixelValues = new byte [iBytes];
// Current location
Int iPoint = 0;

For (int I = 0; I {
String [] ss = Request. Form ["px" + I]. Split (','); // parse row Data Group
For (int j = 0; j <width; j ++)
{
String values = ss [j];
While (values. Length <6)
{
Values = "0" + values; // fill in the missing bits
}
String s1, s2, s3; // obtain RGB
S1 = values. Substring (0, 2 );
S2 = values. Substring (2, 2 );
S3 = values. Substring (4, 2 );
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 ));
// Set the dot Chen color
Bmp. SetPixel (j, I, Color. FromArgb (PixelValues [iPoint], PixelValues [iPoint + 1], PixelValues [iPoint + 2]);

IPoint + = 3;
}
}

// Note that the directory must have at least the User and User modification permissions.
String path = @ "d: \ test \" + DateTime. Now. ToFileTime () + ". jpg ";
Bmp. Save (path, ImageFormat. Jpeg );

// OK. This is the main process.

The compressed package contains the source code and the flash source code.

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

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.