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?
- UsingSystem;
- UsingSystem. Collections. Generic;
- UsingSystem. Text;
- UsingSystem. Runtime. InteropServices;
- UsingSystem. Drawing. Imaging;
- UsingSystem. Drawing;
- UsingSystem. IO;
- NamespaceZgke. MyImage. ImageFile
- {
- /// <Summary>
- /// SUN Raster image RAS
- // Zgke@sina.com
- /// Qq: 116149
- /// </Summary>
- Public ClassImageRas
- {
- PublicImageRas (StringP_ImageFile)
- {
- If(System. IO. File. Exists (p_ImageFile ))
- {
- LoadImage (System. IO. File. ReadAllBytes (p_ImageFile ));
- }
- }
- PublicImageRas ()
- {
- }
- # Region private
- /// <Summary>
- /// File Header 956AA659
- /// </Summary>
- Private UintM_Mageic = 0x956AA659;
- /// <Summary>
- /// Width
- /// </Summary>
- Private UintM_Width = 0;
- /// <Summary>
- /// High
- /// </Summary>
- Private UintM_Height = 0;
- & N