Totemsoft.SDK.Framework4.Graphics.Image.Serialized 命名空间
提供图像的序列化处理支持
说明 Introduction
将位图 System.Drawing.Bitmap 结构数据序列化处理类,该类可以在 Bitmap 结构与字节数组间的通用转换。
成员 Members
- Totemsoft.SDK.Framework4.Graphics.Image.Serialized 命名空间
- Totemsoft.SDK.Framework4.Graphics.Image.Serialized.SerializeImage
- Totemsoft.SDK.Framework4.Graphics.Image.Serialized.Exceptions 命名空间
- Totemsoft.SDK.Framework4.Graphics.Image.Serialized.Exceptions.ImageOverFlowException
版本信息 Version Information
Created date: 2017年04月17日
Last modify date: 2017年05月09日
Programmer: Eddie Chan
Version: 1.01.03
版权信息 Copyright Information
Copyright © 2017 Totemsoft Inc. All rights reserved.
Totemsoft is a trademark of Imago organization.
SerializeImage 类
方法 Methods
名称 | 说明 |
---|---|
FromBitmap (Bitmap) Byte() | 将通用位图格式数据转换为一维字节数组。 |
FromBitmap (Bitmap, Rectangle) Byte() | 将通用位图格式的指定区域数据转换为一维字节数组。 |
FromBytes(Byte(), Size) Bitmap | 将一维字节数组数据转换为通用位图格式。 |
异常 Exceptions
名称 | 说明 |
---|---|
ImageOverFlowException | 缓冲出超出限制时触发。 |
ImagePixelFormatException | 图像不是32位 (ARGB) 格式时触发。 |
ImagePixelFormatException 位于 Totemsoft.SDK.Framework4.Graphics.Image.Exceptions 命名空间。
示例 Examples
Visual C Sharp Code
using System.Drawing;
using System.Drawing.Imaging;
using Totemsoft.SDK.Framework4.Graphics.Serialized;
public class TestSerializeImageClass
{
public void CloneBitmap()
{
Bitmap objBitmap = Bitmap.FromFile("D:\\TestSerialized.png");
Size objSize = objBitmap.Size;
try
{
byte[] objBytes = SerializeImage.FromBitmap(objBitmap);
Bitmap objNewBitmap = SerializeImage.FromBytes(objBytes, objSize);
objNewBitmap.Save("D:\\SerializedClone.png", ImageFormat.Png);
}
catch
{
//TODO: Any exception code.
}
}
}
Visual Basic Code
Imports System.Drawing
Imports System.Drawing.Imaging
Imports Totemsoft.SDK.Framework4.Graphics.Image.Serialized
Public Class TestSerializeImageClass
Public Sub CloneBitmap()
Dim objBitmap As Bitmap = Bitmap.FromFile("D:\TestSerialized.png")
Dim objSize As Size = objBitmap.Size
Try
Dim objBytes As Byte() = SerializeImage.FromBitmap(objBitmap)
Dim objNewBitmap As Bitmap = SerializeImage.FromBytes(objBytes, objSize)
objNewBitmap.Save("D:\SerializedClone.png", ImageFormat.Png)
Catch
' TODO: Any exception code.
End Try
End Sub
End Class
Copyright © 2017 Totemsoft Inc. All rights reserved.