C # parse the SUM grating file image (RAS file)

Source: Internet
Author: User

Usage,

 

ImageRas _ Ras = new ImageRas (@ "D: empest. ras ");
PictureBox1.Image = _ Ras. Image;

 

_ Ras. SaveRas (@ "d: empOK. ras ");

 

I only implemented the 24-bit color and 8-bit color structure, which is too simple. Only the file header and data area are supported. The 8-bit color table has some special features.

 

First, the red table, the green table, and the blue table are usually RGB and RGB. In this case, the RRRR... GGG... B ....

 

I don't know what to think.

 

There is little time to do these things when there are too many projects. The next target is the IFF file.

 

All code

 

 

View plaincopy to clipboardprint?
  1. UsingSystem;
  2.  UsingSystem. Collections. Generic;
  3.  UsingSystem. Text;
  4.  UsingSystem. Runtime. InteropServices;
  5.  UsingSystem. Drawing. Imaging;
  6.  UsingSystem. Drawing;
  7.  UsingSystem. IO;
  8.  NamespaceZgke. MyImage. ImageFile
  9. {
  10. /// <Summary>
  11. /// SUN Raster image RAS
  12. // Zgke@sina.com
  13. /// Qq: 116149
  14. /// </Summary>
  15. Public ClassImageRas
  16. {
  17. PublicImageRas (StringP_ImageFile)
  18. {
  19. If(System. IO. File. Exists (p_ImageFile ))
  20. {
  21. LoadImage (System. IO. File. ReadAllBytes (p_ImageFile ));
  22. }
  23. }
  24. PublicImageRas ()
  25. {
  26. }
  27. # Region private
  28. /// <Summary>
  29. /// File Header 956AA659
  30. /// </Summary>
  31. Private UintM_Mageic = 0x956AA659;
  32. /// <Summary>
  33. /// Width
  34. /// </Summary>
  35. Private UintM_Width = 0;
  36. /// <Summary>
  37. /// High
  38. /// </Summary>
  39. Private UintM_Height = 0;
  40. & N

Related Article

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.