麻豆小视频在线观看_中文黄色一级片_久久久成人精品_成片免费观看视频大全_午夜精品久久久久久久99热浪潮_成人一区二区三区四区

首頁 > 編程 > C# > 正文

C# 解析 RAS文件 SUM 光柵文件圖象的代碼

2024-09-07 17:05:26
字體:
來源:轉載
供稿:網友
使用方法:
代碼如下:
ImageRas _Ras = new ImageRas(@"D:/temp/test.ras");
pictureBox1.Image = _Ras.Image;
_Ras.SaveRas(@"d:/temp/OK.ras");

我只實現了24位色和8位色 這個結構也太簡單了。只有文件頭和數據區 。就是8位色的色彩表有些特殊
先是紅色表 綠色表 藍色表 平時都是 RGB、RGB 這樣放 這東西居然RRRR.....GGG......B....
不知道怎么想的。
項目多了很少有時間做這些東西了。下個目標是IFF文件
全部代碼
代碼如下:
using System;
using System.Collections.Generic;
using System.Text;
using System.Runtime.InteropServices;
using System.Drawing.Imaging;
using System.Drawing;
using System.IO;
namespace Zgke.MyImage.ImageFile
{
/// <summary>
/// SUN光柵圖形 RAS
/// [email protected]
/// qq:116149
/// </summary>
public class ImageRas
{
public ImageRas(string p_ImageFile)
{
if (System.IO.File.Exists(p_ImageFile))
{
LoadImage(System.IO.File.ReadAllBytes(p_ImageFile));
}
}
public ImageRas()
{
}
#region 私有
/// <summary>
/// 文件頭 956AA659
/// </summary>
private uint m_Mageic = 0x956AA659;
/// <summary>
/// 寬
/// </summary>
private uint m_Width = 0;
/// <summary>
/// 高
/// </summary>
private uint m_Height = 0;
/// <summary>
/// 顏色深
/// </summary>
private uint m_Depth = 0;
/// <summary>
/// 圖形區域數據大小
/// </summary>
private uint m_Length = 0;
/// <summary>
/// 數據類型
/// </summary>
private uint m_Type = 0;
/// <summary>
/// 色彩圖形類型
/// </summary>
private uint m_MapType = 0;
/// <summary>
/// 色彩長度
/// </summary>
private uint m_MapLength = 0;
/// <summary>
/// 顏色表
/// </summary>
private Color[] m_ColorList = new Color[256];
/// <summary>
/// 圖形
/// </summary>
private Bitmap m_Image;
#endregion
/// <summary>
/// 獲取圖形
/// </summary>
public Bitmap Image
{
get
{
return m_Image;
}
set
{
if (value != null)
{
m_Image = value;
m_Width = (uint)value.Width;
m_Height = (uint)value.Height;
switch (value.PixelFormat)
{
case PixelFormat.Format8bppIndexed:
break;
case PixelFormat.Format32bppArgb:
break;
default:
m_Depth = 24;
break;
}
}
}
}
/// <summary>
/// 獲取數據
/// </summary>
/// <param name="p_ImageBytes"></param>
private void LoadImage(byte[] p_ImageBytes)
{
if (BitConverter.ToUInt32(p_ImageBytes, 0) != m_Mageic) throw new Exception("文件頭不正確!");
m_Width = BytesToUint(p_ImageBytes, 4);
m_Height = BytesToUint(p_ImageBytes, 8);
m_Depth = BytesToUint(p_ImageBytes, 12);
發表評論 共有條評論
用戶名: 密碼:
驗證碼: 匿名發表
主站蜘蛛池模板: 天天看天天摸天天操 | 激情欧美在线 | 蜜桃av网| 亚洲欧美成aⅴ人在线观看 免费看欧美黑人毛片 | 7777久久香蕉成人影院 | 777午夜精品视频在线播放 | 一级做a爱性色毛片免费1 | 久久久在线免费观看 | 天天看天天摸天天操 | 成年性羞羞视频免费观看无限 | 久久久久久亚洲综合影院红桃 | 涩涩伊人 | 欧美一级成人 | 免费一级毛片在线播放不收费 | 精品国产一区二区久久 | 国产午夜网 | 成人免费av在线播放 | 免费欧美精品 | 久久精品亚洲一区二区三区观看模式 | 亚洲免费观看视频 | 久久毛片 | 欧美性生活区 | 国产精品自拍av | 欧美城网站地址 | 欧美一级二级毛片视频 | 99成人在线 | 久久久在线 | 一级电影在线免费观看 | 爱操影院| 亚洲午夜在线观看 | 国产精品一区二区手机在线观看 | 视频一区国产 | 日本网站在线播放 | 黄色片网站免费观看 | 欧美日韩高清不卡 | 免费一级特黄做受大片 | 99国产精品自拍 | 日韩剧情片| av色哟哟 | 中文字幕在线网 | 欧美性生交xxxxx免费观看 |